aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/rng.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/rng.c')
-rw-r--r--src/stdlib/rng.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stdlib/rng.c b/src/stdlib/rng.c
index 5e98ba00..ffc28084 100644
--- a/src/stdlib/rng.c
+++ b/src/stdlib/rng.c
@@ -72,7 +72,11 @@ static void rekey(RNG_t rng)
// Immediately reinitialize for backtracking resistance
chacha_keysetup(&rng->chacha, rng->random_bytes, KEYSZ/8);
chacha_ivsetup(&rng->chacha, rng->random_bytes + KEYSZ);
+#ifdef __APPLE__
+ bzero(rng->random_bytes, KEYSZ + IVSZ);
+#else
explicit_bzero(rng->random_bytes, KEYSZ + IVSZ);
+#endif
rng->unused_bytes = sizeof(rng->random_bytes) - KEYSZ - IVSZ;
assert(rng->unused_bytes <= sizeof(rng->random_bytes));
}