-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Extract the secret key from a keypair #845
Conversation
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.
Concept ACK
Usually we test the functions more exhaustively - see for example the keypair_pub
tests. We should have tests where the non-ctx arguments are NULL and check that the seckey
is zeroed.
6199885
to
095f5ea
Compare
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.
ACK 095f5ea
Concept ACK I think this function should be added to the constant-time tests. edit: And a nit on the naming: The other function is just |
hmm I'm also not sure if it's better to stay "consistent" with the half name or write the "full name", I'll change this if anyone prefers a specific side |
@jonasnick Was there a specific reason you choose the half name? (I know it's kind of annoying to have these debates but I think it's better to have them early than never.) |
Yes, the name's in the module are generally too long already and |
Concept ACK. Adding to constant-time tests would be good. |
095f5ea
to
bc0c009
Compare
bc0c009
to
c85113b
Compare
c85113b
to
33cb3c2
Compare
@sipa @jonasnick Fixed |
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.
ACK 33cb3c2
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.
ACK 33cb3c2 code inspection, tests pass
Summary: ``` With schnorrsig if you need to tweak the secret key (for BIP32) you must use the keypair API to get compatible secret/public keys which you do by calling secp256k1_keypair_xonly_tweak_add(), but after that there's no currently a way to extract the secret key back for storage. so I added a secp256k1_keypair_seckey function to extract the key ``` Backport of [[bitcoin-core/secp256k1#845 | secp256k1#845]] Test Plan: ninja check-secp256k1 Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D9381
Summary: ``` With schnorrsig if you need to tweak the secret key (for BIP32) you must use the keypair API to get compatible secret/public keys which you do by calling secp256k1_keypair_xonly_tweak_add(), but after that there's no currently a way to extract the secret key back for storage. so I added a secp256k1_keypair_seckey function to extract the key ``` Backport of [[bitcoin-core/secp256k1#845 | secp256k1#845]] Test Plan: ninja check-secp256k1 Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D9381
With schnorrsig if you need to tweak the secret key (for BIP32) you must use the keypair API to get compatible secret/public keys which you do by calling
secp256k1_keypair_xonly_tweak_add()
, but after that there's no currently a way to extract the secret key back for storage.so I added a
secp256k1_keypair_seckey
function to extract the key