Skip to content

Commit e67634e

Browse files
committed
fuzz: BIP324: damage ciphertext/aad in full byte range
Currently the damaging of input data for decryption (either ciphertext or aad) only ever happens in the lower nibble within the byte at the damage position, as the bit position for the `damage_val` byte was calculated with `damage_bit & 3` (corresponding to `% 4`) rather than `damage_bit & 7` (corresponding to the expected `% 8`).
1 parent 794f971 commit e67634e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test/fuzz/bip324.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ FUZZ_TARGET(bip324_cipher_roundtrip, .init=Initialize)
9898
unsigned damage_bit = provider.ConsumeIntegralInRange<unsigned>(0,
9999
(ciphertext.size() + aad.size()) * 8U - 1U);
100100
unsigned damage_pos = damage_bit >> 3;
101-
std::byte damage_val{(uint8_t)(1U << (damage_bit & 3))};
101+
std::byte damage_val{(uint8_t)(1U << (damage_bit & 7))};
102102
if (damage_pos >= ciphertext.size()) {
103103
aad[damage_pos - ciphertext.size()] ^= damage_val;
104104
} else {

0 commit comments

Comments
 (0)