aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-28 17:41:22 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-28 17:41:22 -0400
commite725f6b250a7e488e94ac8a5bc2d33bc9f2be001 (patch)
treeb815709f30428c6d49912822793725599d58ec90 /src
parenta64e20d456de4bdb4e057d41491c3184a6cf9b74 (diff)
On apple, don't explicit_bzero
Diffstat (limited to 'src')
-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));
}