mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-08-29 13:29:09 +00:00
Port JN516x ccm-star implementation to new ccm_star_driver interface
This commit is contained in:
parent
9500be8916
commit
bfeff0488d
@ -45,54 +45,6 @@
|
|||||||
static tsReg128 current_key;
|
static tsReg128 current_key;
|
||||||
static int current_key_is_new = 1;
|
static int current_key_is_new = 1;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static void
|
|
||||||
mic(const uint8_t *m, uint8_t m_len,
|
|
||||||
const uint8_t *nonce,
|
|
||||||
const uint8_t *a, uint8_t a_len,
|
|
||||||
uint8_t *result,
|
|
||||||
uint8_t mic_len)
|
|
||||||
{
|
|
||||||
tsReg128 nonce_aligned;
|
|
||||||
memcpy(&nonce_aligned, nonce, sizeof(nonce_aligned));
|
|
||||||
bACI_CCMstar(
|
|
||||||
¤t_key,
|
|
||||||
current_key_is_new,
|
|
||||||
XCV_REG_AES_SET_MODE_CCM,
|
|
||||||
mic_len,
|
|
||||||
a_len,
|
|
||||||
m_len,
|
|
||||||
&nonce_aligned,
|
|
||||||
(uint8_t *)a,
|
|
||||||
(uint8_t *)m,
|
|
||||||
NULL,
|
|
||||||
result,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
current_key_is_new = 0;
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static void
|
|
||||||
ctr(uint8_t *m, uint8_t m_len, const uint8_t *nonce)
|
|
||||||
{
|
|
||||||
tsReg128 nonce_aligned;
|
|
||||||
memcpy(&nonce_aligned, nonce, sizeof(nonce_aligned));
|
|
||||||
bACI_CCMstar(
|
|
||||||
¤t_key,
|
|
||||||
current_key_is_new,
|
|
||||||
XCV_REG_AES_SET_MODE_CCM,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
m_len,
|
|
||||||
&nonce_aligned,
|
|
||||||
NULL,
|
|
||||||
m,
|
|
||||||
m,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
current_key_is_new = 0;
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
aead(const uint8_t *nonce,
|
aead(const uint8_t *nonce,
|
||||||
@ -161,8 +113,7 @@ set_key(const uint8_t *key)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
const struct ccm_star_driver ccm_star_driver_jn516x = {
|
const struct ccm_star_driver ccm_star_driver_jn516x = {
|
||||||
mic,
|
set_key,
|
||||||
ctr,
|
aead
|
||||||
set_key
|
|
||||||
};
|
};
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
Loading…
Reference in New Issue
Block a user