From 49f2c5e7ea4937560d126239cb48b230c1702276 Mon Sep 17 00:00:00 2001 From: Christian Reitter Date: Thu, 17 Feb 2022 11:54:38 +0100 Subject: [PATCH] feat(crypto): clear internal BIP32 & BIP39 caches --- crypto/fuzzer/fuzzer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crypto/fuzzer/fuzzer.c b/crypto/fuzzer/fuzzer.c index c1edd0e069..af8a2ae6eb 100644 --- a/crypto/fuzzer/fuzzer.c +++ b/crypto/fuzzer/fuzzer.c @@ -84,6 +84,15 @@ void fuzzer_reset_state(void) { // reset the PRNGs to make individual fuzzer runs deterministic srand(0); random_reseed(0); + + // clear internal caches + // note: this is not strictly required for all fuzzer targets +#if USE_BIP32_CACHE + bip32_cache_clear(); +#endif +#if USE_BIP39_CACHE + bip39_cache_clear(); +#endif } void crash(void) {