-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make verify_batch
deterministic
#256
Make verify_batch
deterministic
#256
Conversation
Just refactored
|
@@ -170,55 +170,19 @@ transactions. | |||
The scalar component of a signature is not the only source of signature | |||
malleability, however. Both the public key used for signature verification and | |||
the group element component of the signature are malleable, as they may contain | |||
a small torsion component as a consquence of the curve25519 group not being of | |||
a small torsion component as a consequence of the curve25519 group not being of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do all README changes in #241 pretty pls - Merged all this there :)
Ready for review @tarcieri. I'm also gonna wait on at least one more set of eyes on the new |
@@ -160,7 +160,7 @@ impl InternalSignature { | |||
/// | |||
/// However, by the time this was standardised, most libraries in use were | |||
/// only checking the most significant three bits. (See also the | |||
/// documentation for `PublicKey.verify_strict`.) | |||
/// documentation for [`crate::VerifyingKey::verify_strict`].) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, guess this was missed in #242. Looks like there's another instance of it on L46
Just ran benchmarks. Looks like performance is unaffected. Documenting some design changes here:
|
Batch verif code was reviewed by @james-miller-93 Notes from James:
My conclusion: Since we will never support another basepoint, and success-on-empty is intended, no actions need to be taken. cc @tarcieri Thanks James! |
Previously we had
batch
andbatch_deterministic
features, which would do a different thing under the hood depending on what you picked. This PR removes all nondeterminism from batch verification, and simply uses Merlin for everything. This is for a few reasons:I only have two arguments against this PR:
verify_batch
to succeed on a bad signature. I think this is unlikely, given the transcript hash is done in 3 lines and consumes literally every input to the function in the process. Unfortunately, this claim requires some deep code checking. For example, the signatures that are hashed are actually the result ofInternalSignature::into
. Is this accidentally two-to-one? The answer is no but it requires you to check how scalars and points are deserialized. I don't think there's a problem here, but I can make the code more obviously correct by hashing in the un-converted input values. Update: I did thisR
andA
values that pass our validation criteria). However, even a nondeterministic batch function will succeed on these batches with 1/8 probability (technically, (1/8)^n for n such items in a batch). How much do we care if the alternative has such a high likelihood of false positive as well? I think this if anything, this is a good argument to use the batched equation, which multiplies by the cofactor and accepts all of these 100% of the time.