Split out parsing & validation of test VerificationKey from checking of the signature (#2228)

Now that we always generate an extra proper VerificationKey for each
Tweak::ChangePubkey case, this /should/ never fail: it also helps split out the
actual verification of the signature from the parsing and validation of the key
itself.
This commit is contained in:
Deirdre Connolly 2021-06-01 01:59:34 -04:00 committed by GitHub
parent ebe1c9f88e
commit 4e8efd0cec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -12,3 +12,6 @@ cc 68e194dd66b253f8e9ce1719d48859faee091b599b0eaa28f5565a0cb8dda0d7 # shrinks to
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc e31ba1ed4703731bee9d445f19eef0b9b3a4b83cf996bfe8f7c31ef199c7a7f5 # shrinks to tweaks = [ChangePubkey, ChangePubkey, ChangePubkey, ChangePubkey], rng_seed = [47, 76, 188, 189, 167, 109, 189, 126, 164, 51, 0, 11, 240, 53, 145, 194, 104, 117, 4, 96, 28, 48, 122, 25, 230, 14, 102, 21, 172, 162, 206, 139]
cc e4b0768f257afe1caf51520a4b145966ef17e734056a5de6fe03c8bd70d46a96 # shrinks to tweaks = [ChangePubkey, ChangePubkey, ChangePubkey, ChangePubkey], rng_seed = [176, 120, 84, 2, 89, 31, 155, 163, 124, 202, 49, 170, 157, 29, 1, 222, 252, 153, 37, 168, 22, 39, 188, 49, 32, 3, 37, 140, 37, 49, 122, 216]
cc 3343d535df2fd11dd8aaf647fd23a447ccfd3edc78997c119d3a33b703192908 # shrinks to tweaks = [ChangePubkey, ChangePubkey, ChangePubkey, ChangePubkey], rng_seed = [76, 239, 61, 73, 170, 200, 44, 2, 142, 88, 103, 213, 46, 44, 16, 122, 147, 213, 128, 119, 26, 104, 235, 218, 54, 50, 230, 45, 29, 191, 84, 87]
cc 5e6016829c630c3bff1805dc39110275755741d473f7b90e4d1f2ae4d2896c08 # shrinks to tweaks = [ChangePubkey, ChangePubkey, ChangePubkey, ChangePubkey], rng_seed = [77, 71, 192, 111, 106, 185, 167, 104, 120, 245, 108, 6, 39, 147, 183, 164, 187, 117, 31, 227, 54, 34, 197, 118, 54, 10, 171, 122, 62, 47, 75, 47]

View File

@ -67,11 +67,12 @@ impl<T: SigType> SignatureCase<T> {
VerificationKeyBytes::<T>::from(bytes)
};
// Check that the verification key is a valid RedPallas verification key.
let pub_key = VerificationKey::try_from(pk_bytes)
.expect("The test verification key to be well-formed.");
// Check that signature validation has the expected result.
self.is_valid
== VerificationKey::try_from(pk_bytes)
.and_then(|pk| pk.verify(&self.msg, &sig))
.is_ok()
self.is_valid == pub_key.verify(&self.msg, &sig).is_ok()
}
fn apply_tweak(&mut self, tweak: &Tweak) {