Merge pull request #1737 from bthebaudeau/cc2538-fix-missing-result-av

cc2538: aes: Fix possibly missing result available status
This commit is contained in:
Antonio Lignan 2016-06-25 00:14:29 +02:00 committed by GitHub
commit 6a2d802b9a
2 changed files with 7 additions and 8 deletions

View File

@ -195,7 +195,7 @@ parse(void)
packetbuf_set_datalen(packetbuf_datalen() - MIC_LEN); packetbuf_set_datalen(packetbuf_datalen() - MIC_LEN);
if(!aead(result, 0)) { if(!aead(result, 0)) {
PRINTF("noncoresec: received unauthentic frame %"PRIu32"\n", PRINTF("noncoresec: received unauthentic frame %lu\n",
anti_replay_get_counter()); anti_replay_get_counter());
return FRAMER_FAILED; return FRAMER_FAILED;
} }
@ -228,7 +228,7 @@ parse(void)
anti_replay_init_info(info); anti_replay_init_info(info);
} else { } else {
if(anti_replay_was_replayed(info)) { if(anti_replay_was_replayed(info)) {
PRINTF("noncoresec: received replayed frame %"PRIu32"\n", PRINTF("noncoresec: received replayed frame %lu\n",
anti_replay_get_counter()); anti_replay_get_counter());
return FRAMER_FAILED; return FRAMER_FAILED;
} }

View File

@ -226,12 +226,14 @@ aes_auth_crypt_start(uint32_t ctrl, uint8_t key_area, const void *iv,
REG(AES_CTRL_ALG_SEL) = 0x00000000; REG(AES_CTRL_ALG_SEL) = 0x00000000;
return CRYPTO_DMA_BUS_ERROR; return CRYPTO_DMA_BUS_ERROR;
} }
/* Clear interrupt status */
REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE;
} }
} }
/* Clear interrupt status */ /* Enable result available bit in interrupt enable */
REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE | REG(AES_CTRL_INT_EN) = AES_CTRL_INT_EN_RESULT_AV;
AES_CTRL_INT_CLR_RESULT_AV;
if(process != NULL) { if(process != NULL) {
crypto_register_process_notification(process); crypto_register_process_notification(process);
@ -239,9 +241,6 @@ aes_auth_crypt_start(uint32_t ctrl, uint8_t key_area, const void *iv,
nvic_interrupt_enable(NVIC_INT_AES); nvic_interrupt_enable(NVIC_INT_AES);
} }
/* Enable result available bit in interrupt enable */
REG(AES_CTRL_INT_EN) = AES_CTRL_INT_EN_RESULT_AV;
if(data_len != 0) { if(data_len != 0) {
/* Configure DMAC /* Configure DMAC
* Enable DMA channel 0 */ * Enable DMA channel 0 */