llsec: Added AEAD mode to CCM*

This commit is contained in:
Konrad Krentz 2015-07-15 06:11:42 -07:00 committed by kkrentz
parent c656a4d1c5
commit 0a6b1cb646
7 changed files with 116 additions and 108 deletions

View file

@ -146,9 +146,32 @@ set_key(const uint8_t *key)
AES_128.set_key(key);
}
/*---------------------------------------------------------------------------*/
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)
{
if(!forward) {
/* decrypt */
ctr(nonce, m, m_len);
}
mic(nonce,
m, m_len,
a, a_len,
result,
mic_len);
if(forward) {
/* encrypt */
ctr(nonce, m, m_len);
}
}
/*---------------------------------------------------------------------------*/
const struct ccm_star_driver ccm_star_driver = {
mic,
ctr,
set_key
set_key,
aead
};
/*---------------------------------------------------------------------------*/