Skip to content

Commit 05d3f8e

Browse files
committed
Merge bitcoin/bitcoin#28951: fuzz: BIP324: damage ciphertext/aad in full byte range
e67634e fuzz: BIP324: damage ciphertext/aad in full byte range (Sebastian Falbesoner) Pull request description: This PR is a tiny improvement for the `bip324_cipher_roundtrip` fuzz target: 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`). Noticed while reviewing #28263 which uses similar constructs. ACKs for top commit: stratospher: ACK e67634e. dergoegge: utACK e67634e Tree-SHA512: 1bab4df28708e079874feee939beef45eff235215375c339decc696f4c9aef04e4b417322b045491c8aec6e88ec8ec2db564e27ef1b0be352b6ff4ed38bad49a
2 parents d80318d + e67634e commit 05d3f8e

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)