diff options
author | stratospher <44024636+stratospher@users.noreply.github.com> | 2021-12-17 23:04:04 +0530 |
---|---|---|
committer | stratospher <44024636+stratospher@users.noreply.github.com> | 2021-12-17 23:04:04 +0530 |
commit | 8f79831ab57b8fce48bb7b01fce86fac338755a5 (patch) | |
tree | b118691c1649d1e22d422d720770a8e4b26e665a /src | |
parent | 4ad59042b359f473d5888ecee0c9288dcf98f1c9 (diff) |
Refactor the chacha20 differential fuzz test
Diffstat (limited to 'src')
-rw-r--r-- | src/test/fuzz/crypto_diff_fuzz_chacha20.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/test/fuzz/crypto_diff_fuzz_chacha20.cpp b/src/test/fuzz/crypto_diff_fuzz_chacha20.cpp index 96681a121a..fcc96c6418 100644 --- a/src/test/fuzz/crypto_diff_fuzz_chacha20.cpp +++ b/src/test/fuzz/crypto_diff_fuzz_chacha20.cpp @@ -314,9 +314,7 @@ FUZZ_TARGET(crypto_diff_fuzz_chacha20) chacha20.Keystream(output.data(), output.size()); std::vector<uint8_t> djb_output(integralInRange); ECRYPT_keystream_bytes(&ctx, djb_output.data(), djb_output.size()); - if (output.data() != NULL && djb_output.data() != NULL) { - assert(memcmp(output.data(), djb_output.data(), integralInRange) == 0); - } + assert(output == djb_output); }, [&] { uint32_t integralInRange = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096); @@ -325,6 +323,7 @@ FUZZ_TARGET(crypto_diff_fuzz_chacha20) chacha20.Crypt(input.data(), output.data(), input.size()); std::vector<uint8_t> djb_output(integralInRange); ECRYPT_encrypt_bytes(&ctx, input.data(), djb_output.data(), input.size()); + assert(output == djb_output); }); } } |