Try to prevent ChangePubkey tweaks from becoming a no-op.

Since we expect the signature to fail if ChangePubkey is applied, we need to
make sure it actually changes the signature test case.
This commit is contained in:
Henry de Valence 2019-12-09 12:15:11 -08:00
parent a15b4721be
commit d8ad15059d
1 changed files with 2 additions and 0 deletions

View File

@ -79,8 +79,10 @@ impl<T: SigType> SignatureCase<T> {
Tweak::ChangePubkey => {
// Changing the public key makes the signature invalid.
let mut bytes: [u8; 32] = self.pk_bytes.clone().into();
let j = (bytes[2] & 31) as usize;
bytes[2] ^= 0x23;
bytes[2] |= 0x99;
bytes[j] ^= bytes[2];
self.pk_bytes = bytes.into();
self.is_valid = false;
}