From e725f6b250a7e488e94ac8a5bc2d33bc9f2be001 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 28 Mar 2025 17:41:22 -0400 Subject: [PATCH] On apple, don't explicit_bzero --- src/stdlib/rng.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stdlib/rng.c b/src/stdlib/rng.c index 5e98ba0..ffc2808 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)); }