46 #define MODULE_NAME "cc2538-ccm-star" 48 #define CCM_STAR_LEN_LEN (CCM_NONCE_LEN_LEN - CCM_STAR_NONCE_LENGTH) 52 #define PRINTF(...) printf(__VA_ARGS__) 68 restore_crypto(uint8_t enabled)
78 cc2538_aes_128_driver.
set_key(key);
82 aead(
const uint8_t *nonce, uint8_t *m, uint8_t m_len,
const uint8_t *a,
83 uint8_t a_len, uint8_t *result, uint8_t mic_len,
int forward)
86 uint8_t crypto_enabled, ret;
88 crypto_enabled = enable_crypto();
92 nonce, a, a_len, m, m_len, m, mic_len, NULL);
93 if(ret != CRYPTO_SUCCESS) {
94 PRINTF(
"%s: ccm_auth_encrypt_start() error %u\n", MODULE_NAME, ret);
95 restore_crypto(crypto_enabled);
101 if(ret != CRYPTO_SUCCESS) {
102 PRINTF(
"%s: ccm_auth_encrypt_get_result() error %u\n", MODULE_NAME, ret);
105 cdata_len = m_len + mic_len;
107 nonce, a, a_len, m, cdata_len, m, mic_len,
109 if(ret != CRYPTO_SUCCESS) {
110 PRINTF(
"%s: ccm_auth_decrypt_start() error %u\n", MODULE_NAME, ret);
111 restore_crypto(crypto_enabled);
117 if(ret != CRYPTO_SUCCESS) {
118 PRINTF(
"%s: ccm_auth_decrypt_get_result() error %u\n", MODULE_NAME, ret);
122 restore_crypto(crypto_enabled);
Structure of CCM* drivers.
#define ccm_auth_decrypt_check_status
Checks the status of the CCM authentication checking and decryption operation.
uint8_t ccm_auth_encrypt_get_result(void *mic, uint8_t mic_len)
Gets the result of the CCM authentication and encryption operation.
Header file of the AES-128 driver for the CC2538 SoC.
uint8_t ccm_auth_decrypt_get_result(const void *cdata, uint16_t cdata_len, void *mic, uint8_t mic_len)
Gets the result of the CCM authentication checking and decryption operation.
#define ccm_auth_encrypt_check_status
Checks the status of the CCM authentication and encryption operation.
void crypto_enable(void)
Enables the AES/SHA cryptoprocessor.
uint8_t ccm_auth_decrypt_start(uint8_t len_len, uint8_t key_area, const void *nonce, const void *adata, uint16_t adata_len, const void *cdata, uint16_t cdata_len, void *pdata, uint8_t mic_len, struct process *process)
Starts a CCM authentication checking and decryption operation.
Header file of the AES-CCM* driver for the CC2538 SoC.
#define CRYPTO_IS_ENABLED()
Indicates whether the AES/SHA cryptoprocessor is enabled.
void crypto_disable(void)
Disables the AES/SHA cryptoprocessor.
void(* aead)(const uint8_t *nonce, uint8_t *m, uint8_t m_len, const uint8_t *a, uint8_t a_len, uint8_t *result, uint8_t mic_len, int forward)
Combines authentication and encryption.
uint8_t ccm_auth_encrypt_start(uint8_t len_len, uint8_t key_area, const void *nonce, const void *adata, uint16_t adata_len, const void *pdata, uint16_t pdata_len, void *cdata, uint8_t mic_len, struct process *process)
Starts a CCM authentication and encryption operation.
void(* set_key)(const uint8_t *key)
Sets the key in use.
Header file for the cc2538 AES-CCM driver.
void(* set_key)(const uint8_t *key)
Sets the current key.