-
Notifications
You must be signed in to change notification settings - Fork 3
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
taproot signatures should be serialized as 64 bytes #5
taproot signatures should be serialized as 64 bytes #5
Conversation
@@ -76,7 +76,7 @@ where | |||
// h * ( z * B - c * A - R) == 0 | |||
// | |||
// where h is the cofactor | |||
let R = C::effective_nonce_element(signature.R); | |||
let R = signature.R; |
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.
Before this PR, a Signature
's R
point could be either even or odd parity. When verifying, we were coercing R
to be even, so that BIP340 verification logic would work.
After this PR, the Signature
's R
point is always even parity (unless someone manually constructs one with an odd-parity outside the scope of this library). We no longer need to do this coercion during verification.
BIP340 signatures are usually represented with x-only (even parity) nonce points. As a step towards normalizing this for the frost-secp256k1-tr crate, we should ensure all Signature struct instances always use the effective nonce point, including the DKG proof-of-knowledge.
BIP340 signatures are supposed to be serialized as a 64-byte array: 32 bytes for the x-only nonce point 'R', and 32 bytes for the signature component 's'. This commit customizes the frost-secp256k1-tr crate so that signatures are serialized with x-only nonces, omitting the leading parity byte.
33bb2cf
to
5dc7dd8
Compare
|
|
Tests seems to be passed. I'm tankful for @conduition. |
My pleasure :D |
I'm sorry for my slow reaction. |
I'm lost control by the last time... |
wrong worlds -- I'm sorry... Your coding practices is impressive... i'm periodical off.. |
updates ZcashFoundation#584 to serialize taproot signatures as 64 bytes, in compliance with BIP340.
BIP340 signatures are supposed to be serialized as a 64-byte array: 32 bytes for the x-only nonce point$R$ , and 32 bytes for the signature component $s$ . This PR customizes the
frost-secp256k1-tr
crate so that signatures are serialized with x-only nonces, omitting the leading parity byte. Instead of embedding global serialization logic in the methods ofSignature
, we now endowCiphersuite
with two optional methods to serialize and deserialize aSignature
, and then replace those methods in thefrost-secp256k1-tr
crate.To maintain reusability of the
Signature
type, i had to modify the DKG proof-of-knowledge so that we always hash the participant's effective verifying key, which in taproot is always the even-parity point. This allows the PoK to also be serialized as a 64-byte BIP340 signature. For all other ciphersuites, this change has no effect.