From a6151cf4c40b19022b503104916aad1b88aaf2f3 Mon Sep 17 00:00:00 2001 From: cyliangtw Date: Tue, 21 Mar 2017 11:14:58 +0800 Subject: [PATCH] Enable HW AES --- targets/TARGET_NUVOTON/TARGET_NUC472/trng_api.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/trng_api.c b/targets/TARGET_NUVOTON/TARGET_NUC472/trng_api.c index 29566c3ab3..3734536023 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/trng_api.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/trng_api.c @@ -31,12 +31,16 @@ * Get Random number generator. */ static volatile int g_PRNG_done; +volatile int g_AES_done; void CRYPTO_IRQHandler() { if (PRNG_GET_INT_FLAG()) { g_PRNG_done = 1; PRNG_CLR_INT_FLAG(); + } else if (AES_GET_INT_FLAG()) { + g_AES_done = 1; + AES_CLR_INT_FLAG(); } } @@ -86,7 +90,7 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l memcpy(output, &tmpBuff, length); *output_length = length; } else { - for (size_t i = 0; i < (length/32); i++) { + for (int i = 0; i < (length/32); i++) { trng_get(output); *output_length += 32; output += 32;