Skip to content

Commit 98a2ddc

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#23806: fuzz: follow up for #22704
8f79831 Refactor the chacha20 differential fuzz test (stratospher) Pull request description: This PR addresses [comments from #22704](https://github.com/bitcoin/bitcoin/pull/22704/files#discussion_r771510963) to make the following changes in `src/test/fuzz/crypto_diff_fuzz_chacha20.cpp`: - replace `memcmp()` with == - add a missing assert statement to compare the encrypted bytes Top commit has no ACKs. Tree-SHA512: 02338460fb3a89e732558bf00f3aebf8f04daba194e03ae0e3339bb2ff6ba35d06841452585b739047a29f8ec64f36b1b4ce2dfa39a08f6ad44a6a937e7b3acb
2 parents c06cda3 + 8f79831 commit 98a2ddc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/test/fuzz/crypto_diff_fuzz_chacha20.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,7 @@ FUZZ_TARGET(crypto_diff_fuzz_chacha20)
314314
chacha20.Keystream(output.data(), output.size());
315315
std::vector<uint8_t> djb_output(integralInRange);
316316
ECRYPT_keystream_bytes(&ctx, djb_output.data(), djb_output.size());
317-
if (output.data() != NULL && djb_output.data() != NULL) {
318-
assert(memcmp(output.data(), djb_output.data(), integralInRange) == 0);
319-
}
317+
assert(output == djb_output);
320318
},
321319
[&] {
322320
uint32_t integralInRange = fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096);
@@ -325,6 +323,7 @@ FUZZ_TARGET(crypto_diff_fuzz_chacha20)
325323
chacha20.Crypt(input.data(), output.data(), input.size());
326324
std::vector<uint8_t> djb_output(integralInRange);
327325
ECRYPT_encrypt_bytes(&ctx, input.data(), djb_output.data(), input.size());
326+
assert(output == djb_output);
328327
});
329328
}
330329
}

0 commit comments

Comments
 (0)