diff --git a/src/prngs/chacha20.c b/src/prngs/chacha20.c index faaf629..b528dd2 100644 --- a/src/prngs/chacha20.c +++ b/src/prngs/chacha20.c @@ -71,7 +71,7 @@ int chacha20_prng_add_entropy(const unsigned char *in, unsigned long inlen, prng /* iv 8 bytes */ if ((err = chacha_ivctr64(&prng->chacha.s, buf + 32, 8, 0)) != CRYPT_OK) goto LBL_UNLOCK; /* clear KEY + IV */ - XMEMSET(buf, 0, sizeof(buf)); + zeromem(buf, sizeof(buf)); } else { /* chacha20_prng_ready() was not called yet, add entropy to ent buffer */ diff --git a/src/prngs/rc4.c b/src/prngs/rc4.c index e7d3afc..ac88fd5 100644 --- a/src/prngs/rc4.c +++ b/src/prngs/rc4.c @@ -72,6 +72,7 @@ int rc4_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *pr if ((err = rc4_stream_setup(&prng->rc4.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; /* drop first 3072 bytes - https://en.wikipedia.org/wiki/RC4#Fluhrer.2C_Mantin_and_Shamir_attack */ for (i = 0; i < 12; i++) rc4_stream_keystream(&prng->rc4.s, buf, sizeof(buf)); + zeromem(buf, sizeof(buf)); } else { /* rc4_ready() was not called yet, add entropy to the buffer */ diff --git a/src/prngs/sober128.c b/src/prngs/sober128.c index 56f873c..64d083b 100644 --- a/src/prngs/sober128.c +++ b/src/prngs/sober128.c @@ -73,7 +73,7 @@ int sober128_add_entropy(const unsigned char *in, unsigned long inlen, prng_stat /* iv 8 bytes */ if ((err = sober128_stream_setiv(&prng->sober128.s, buf + 32, 8)) != CRYPT_OK) goto LBL_UNLOCK; /* clear KEY + IV */ - XMEMSET(buf, 0, sizeof(buf)); + zeromem(buf, sizeof(buf)); } else { /* sober128_ready() was not called yet, add entropy to ent buffer */