forked from ejoerns/contiki-inga
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit '6ca95ebc0c63fde42745ededbca09beddd41d8fa' into HEAD
- Loading branch information
Showing
12 changed files
with
39 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ | |
* Konrad Krentz <[email protected]> | ||
*/ | ||
|
||
#include "net/llsec/ccm.h" | ||
#include "net/llsec/ccm-star.h" | ||
#include "net/llsec/llsec802154.h" | ||
#include "net/packetbuf.h" | ||
#include "lib/aes-128.h" | ||
|
@@ -80,7 +80,7 @@ ctr_step(const uint8_t *extended_source_address, | |
uint8_t a[AES_128_BLOCK_SIZE]; | ||
uint8_t i; | ||
|
||
set_nonce(a, CCM_ENCRYPTION_FLAGS, extended_source_address, counter); | ||
set_nonce(a, CCM_STAR_ENCRYPTION_FLAGS, extended_source_address, counter); | ||
AES_128.encrypt(a); | ||
|
||
for(i = 0; (pos + i < m_len) && (i < AES_128_BLOCK_SIZE); i++) { | ||
|
@@ -112,13 +112,13 @@ mic(const uint8_t *extended_source_address, | |
m_len = 0; | ||
} | ||
set_nonce(x, | ||
CCM_AUTH_FLAGS(a_len, mic_len), | ||
CCM_STAR_AUTH_FLAGS(a_len, mic_len), | ||
extended_source_address, | ||
m_len); | ||
#else /* LLSEC802154_USES_ENCRYPTION */ | ||
a_len = packetbuf_totlen(); | ||
set_nonce(x, | ||
CCM_AUTH_FLAGS(a_len, mic_len), | ||
CCM_STAR_AUTH_FLAGS(a_len, mic_len), | ||
extended_source_address, | ||
0); | ||
#endif /* LLSEC802154_USES_ENCRYPTION */ | ||
|
@@ -181,7 +181,7 @@ ctr(const uint8_t *extended_source_address) | |
} | ||
} | ||
/*---------------------------------------------------------------------------*/ | ||
const struct ccm_driver ccm_driver = { | ||
const struct ccm_star_driver ccm_star_driver = { | ||
mic, | ||
ctr | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,26 +42,26 @@ | |
* Konrad Krentz <[email protected]> | ||
*/ | ||
|
||
#ifndef CCM_H_ | ||
#define CCM_H_ | ||
#ifndef CCM_STAR_H_ | ||
#define CCM_STAR_H_ | ||
|
||
#include "contiki.h" | ||
#include "net/mac/frame802154.h" | ||
|
||
/* see RFC 3610 */ | ||
#define CCM_AUTH_FLAGS(Adata, M) ((Adata ? (1 << 6) : 0) | (((M - 2) >> 1) << 3) | 1) | ||
#define CCM_ENCRYPTION_FLAGS 1 | ||
#define CCM_STAR_AUTH_FLAGS(Adata, M) ((Adata ? (1 << 6) : 0) | (((M - 2) >> 1) << 3) | 1) | ||
#define CCM_STAR_ENCRYPTION_FLAGS 1 | ||
|
||
#ifdef CCM_CONF | ||
#define CCM CCM_CONF | ||
#else /* CCM_CONF */ | ||
#define CCM ccm_driver | ||
#endif /* CCM_CONF */ | ||
#ifdef CCM_STAR_CONF | ||
#define CCM_STAR CCM_STAR_CONF | ||
#else /* CCM_STAR_CONF */ | ||
#define CCM_STAR ccm_star_driver | ||
#endif /* CCM_STAR_CONF */ | ||
|
||
/** | ||
* Structure of CCM drivers. | ||
* Structure of CCM* drivers. | ||
*/ | ||
struct ccm_driver { | ||
struct ccm_star_driver { | ||
|
||
/** | ||
* \brief Generates a MIC over the frame in the packetbuf. | ||
|
@@ -78,8 +78,8 @@ struct ccm_driver { | |
void (* ctr)(const uint8_t *extended_source_address); | ||
}; | ||
|
||
extern const struct ccm_driver CCM; | ||
extern const struct ccm_star_driver CCM_STAR; | ||
|
||
#endif /* CCM_H_ */ | ||
#endif /* CCM_STAR_H_ */ | ||
|
||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.