aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/bip324.cpp
diff options
context:
space:
mode:
authorstratospher <44024636+stratospher@users.noreply.github.com>2023-08-13 11:55:46 +0530
committerstratospher <44024636+stratospher@users.noreply.github.com>2023-08-14 09:03:21 +0530
commitd22d5d925c000bf25ad2410ca66c4c21eea75004 (patch)
tree5e4e9e2f0f5e808dcb5175271b8797e9aa8dce94 /src/test/fuzz/bip324.cpp
parentb2ec0326fd76e64a6d0d7e4745506b29f60d0be5 (diff)
crypto: BIP324 ciphersuite follow-up
follow-up to #28008. * move `dummy_tag` variable in FSChaCha20Poly1305 crypto_tests outside of the loop to be reused every time * use easy to read `cipher.last()` in `AEADChaCha20Poly1305::Decrypt()` * comment for initiator in `BIP324Cipher::Initialize()` * systematically damage ciphertext with bit positions in bip324_tests * use 4095 max bytes for aad in bip324 fuzz test
Diffstat (limited to 'src/test/fuzz/bip324.cpp')
-rw-r--r--src/test/fuzz/bip324.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/fuzz/bip324.cpp b/src/test/fuzz/bip324.cpp
index 359de6c66a..8282261c52 100644
--- a/src/test/fuzz/bip324.cpp
+++ b/src/test/fuzz/bip324.cpp
@@ -75,13 +75,13 @@ FUZZ_TARGET(bip324_cipher_roundtrip, .init=Initialize)
// - Bit 0: whether the ignore bit is set in message
// - Bit 1: whether the responder (0) or initiator (1) sends
// - Bit 2: whether this ciphertext will be corrupted (making it the last sent one)
- // - Bit 3-4: controls the maximum aad length (max 511 bytes)
+ // - Bit 3-4: controls the maximum aad length (max 4095 bytes)
// - Bit 5-7: controls the maximum content length (max 16383 bytes, for performance reasons)
unsigned mode = provider.ConsumeIntegral<uint8_t>();
bool ignore = mode & 1;
bool from_init = mode & 2;
bool damage = mode & 4;
- unsigned aad_length_bits = 3 * ((mode >> 3) & 3);
+ unsigned aad_length_bits = 4 * ((mode >> 3) & 3);
unsigned aad_length = provider.ConsumeIntegralInRange<unsigned>(0, (1 << aad_length_bits) - 1);
unsigned length_bits = 2 * ((mode >> 5) & 7);
unsigned length = provider.ConsumeIntegralInRange<unsigned>(0, (1 << length_bits) - 1);