-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add ECDSA signatures over NIST-P256 to aptos-crypto
#9594
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hariria
reviewed
Aug 10, 2023
alinush
changed the title
Add ECDSA Signature Scheme Over NIST-P256
Add ECDSA signatures over NIST-P256 to Aug 10, 2023
aptos-crypto
* Update semgrep.yaml to also run daily * update semgrep rule * fix workflows * Update .github/workflows/semgrep.yaml Co-authored-by: Balaji Arun <[email protected]> --------- Co-authored-by: Balaji Arun <[email protected]>
alinush
reviewed
Sep 22, 2023
alinush
reviewed
Sep 22, 2023
alinush
reviewed
Oct 18, 2023
alinush
reviewed
Oct 18, 2023
alinush
reviewed
Oct 18, 2023
alinush
reviewed
Oct 18, 2023
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
❌ Forge suite
|
✅ Forge suite
|
alinush
reviewed
Oct 18, 2023
let bignum = BigUint::from_bytes_be(&bytes[..]); | ||
let order = BigUint::from_bytes_be(&ORDER); | ||
let remainder = bignum.mod_floor(&order); | ||
P256PrivateKey::from_bytes_unchecked(&remainder.to_bytes_be()).unwrap() |
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.
Also, documenting for posterity, I traced down the deserialization code to this line, which does indeed use BE.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for ECDSA signatures over NIST-P256, inside of the
aptos-crypto
crate. This is necessary for adding transaction authenticators that interact with popular implementations of the WebAuthn standard. The API for this signature scheme is identical to that of the already-implemented EdDSA over Ed25519 signature scheme. Signatures are guaranteed to be output in canonical form, and signatures not in this form are rejected by verification, to prevent malleability attacks.Test Plan
Unit tests are included in
crates/aptos-crypto/unit_tests/p256_test.rs
. They can be run withcargo test
incrates/aptos-crypto
.