llsec: Added AEAD mode to CCM*
This commit is contained in:
parent
c656a4d1c5
commit
0a6b1cb646
7 changed files with 116 additions and 108 deletions
|
@ -101,9 +101,11 @@ test_sec_lvl_2()
|
|||
0x84 , 0x1A , 0xB5 , 0x53 };
|
||||
frame802154_frame_counter_t counter;
|
||||
uint8_t mic[LLSEC802154_MIC_LENGTH];
|
||||
uint8_t nonce[13];
|
||||
|
||||
printf("Testing verification ... ");
|
||||
|
||||
linkaddr_copy(&linkaddr_node_addr, &source_address);
|
||||
packetbuf_clear();
|
||||
packetbuf_set_datalen(26);
|
||||
memcpy(packetbuf_hdrptr(), data, 26);
|
||||
|
@ -114,9 +116,14 @@ test_sec_lvl_2()
|
|||
packetbuf_hdrreduce(18);
|
||||
|
||||
CCM_STAR.set_key(key);
|
||||
ccm_star_packetbuf_mic(&source_address, mic, LLSEC802154_MIC_LENGTH);
|
||||
ccm_star_packetbuf_set_nonce(nonce, 1);
|
||||
CCM_STAR.aead(nonce,
|
||||
NULL, 0,
|
||||
packetbuf_hdrptr(), packetbuf_totlen(),
|
||||
((uint8_t *) packetbuf_dataptr()) + packetbuf_datalen(), LLSEC802154_MIC_LENGTH,
|
||||
1);
|
||||
|
||||
if(memcmp(mic, oracle, LLSEC802154_MIC_LENGTH) == 0) {
|
||||
if(memcmp(((uint8_t *) packetbuf_dataptr()) + packetbuf_datalen(), oracle, LLSEC802154_MIC_LENGTH) == 0) {
|
||||
printf("Success\n");
|
||||
} else {
|
||||
printf("Failure\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue