From e9be37db4b9fdf30cbdf0a364dbcf85058cc500f Mon Sep 17 00:00:00 2001 From: ccli8 Date: Mon, 12 Feb 2018 14:04:56 +0800 Subject: [PATCH] Refine crypto_zeroize/crypto_zeroize32 --- targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.c | 4 ++-- targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.c b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.c index 8f2aed1509..87af3a9271 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.c +++ b/targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.c @@ -104,7 +104,7 @@ void crypto_uninit(void) /* Implementation that should never be optimized out by the compiler */ void crypto_zeroize(void *v, size_t n) { - volatile unsigned char *p = (unsigned char*) v; + volatile unsigned char *p = (volatile unsigned char*) v; while (n--) { *p++ = 0; } @@ -113,7 +113,7 @@ void crypto_zeroize(void *v, size_t n) /* Implementation that should never be optimized out by the compiler */ void crypto_zeroize32(uint32_t *v, size_t n) { - volatile uint32_t *p = (uint32_t*) v; + volatile uint32_t *p = (volatile uint32_t*) v; while (n--) { *p++ = 0; } diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.c b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.c index 72581362d7..c9cdc1098e 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.c @@ -100,7 +100,7 @@ void crypto_uninit(void) /* Implementation that should never be optimized out by the compiler */ void crypto_zeroize(void *v, size_t n) { - volatile unsigned char *p = (unsigned char*) v; + volatile unsigned char *p = (volatile unsigned char*) v; while (n--) { *p++ = 0; }