[NUC472/M487] Refine crypto_zeroize/crypto_zeroize32

pull/5812/head
ccli8 2018-02-12 14:04:56 +08:00
parent 25253529ae
commit cfdc72d75e
2 changed files with 3 additions and 3 deletions

View File

@ -104,7 +104,7 @@ void crypto_uninit(void)
/* Implementation that should never be optimized out by the compiler */ /* Implementation that should never be optimized out by the compiler */
void crypto_zeroize(void *v, size_t n) 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--) { while (n--) {
*p++ = 0; *p++ = 0;
} }
@ -113,7 +113,7 @@ void crypto_zeroize(void *v, size_t n)
/* Implementation that should never be optimized out by the compiler */ /* Implementation that should never be optimized out by the compiler */
void crypto_zeroize32(uint32_t *v, size_t n) 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--) { while (n--) {
*p++ = 0; *p++ = 0;
} }

View File

@ -100,7 +100,7 @@ void crypto_uninit(void)
/* Implementation that should never be optimized out by the compiler */ /* Implementation that should never be optimized out by the compiler */
void crypto_zeroize(void *v, size_t n) 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--) { while (n--) {
*p++ = 0; *p++ = 0;
} }