forked from RustCrypto/elliptic-curves
-
Notifications
You must be signed in to change notification settings - Fork 5
p256 acceleration #10
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5db6c1f
zkvm config to allow tests to run in zkvm
austinabell 195c183
initial template of code for acc
austinabell 98e8ea5
impl
austinabell 84ef330
uncomment dep config
austinabell 6d87f20
accelerate point inv for proj -> affine
austinabell 73a06f5
accelerate scalar inverse
austinabell d095d83
switch to unchecked (already checked)
austinabell 64c9011
impl acceleration for decompress before sqrt
austinabell 9856151
accelerate sqrt
austinabell fb939a8
move ec add to accelerated
austinabell d7454af
accelerate the to_mont multiply
austinabell d30ec8a
accelerate to_affine conversion
austinabell ef27d4b
add zero checks to inverse operations through zkvm
austinabell a5cce8f
impl remaining ec impls
austinabell 480bedf
update impl of scalar to words to be more careful about alignment
austinabell 3fc6064
update patch config to minimize git diff
austinabell 2bbfc5d
rename risc0 module to minimize discoverability
austinabell d220d53
reduce duplicate logic
austinabell 17cf000
switch ops to do prime check even for intermediate ops to be safe
austinabell db7cd24
handle identity in affine conversion, panic on invalid mont conversio…
austinabell 09f54cb
simplify invert and FE conversions with checked mul
austinabell 70c5519
Test and prep for 1.2.1
tzerrell 0a739b1
Cut over to 1.2.1 release
tzerrell cdbf06d
Update lock file with version update
tzerrell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| use risc0_bigint2::ec::{Curve, WeierstrassCurve, EC_256_WIDTH_WORDS}; | ||
|
|
||
| /// The secp256r1 curve's prime field characteristic | ||
| pub(crate) const SECP256R1_PRIME: [u32; EC_256_WIDTH_WORDS] = [ | ||
| 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0xFFFFFFFF, | ||
| ]; | ||
|
|
||
| /// The secp256r1 curve's order | ||
| pub(crate) const SECP256R1_ORDER: [u32; EC_256_WIDTH_WORDS] = [ | ||
| 0xFC632551, 0xF3B9CAC2, 0xA7179E84, 0xBCE6FAAD, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, | ||
| ]; | ||
|
|
||
| pub(crate) const SECP256R1_EQUATION_A_LE: [u32; EC_256_WIDTH_WORDS] = [ | ||
| 0xFFFFFFFC, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0xFFFFFFFF, | ||
| ]; | ||
|
|
||
| pub(crate) const SECP256R1_EQUATION_B_LE: [u32; EC_256_WIDTH_WORDS] = [ | ||
| 0x27D2604B, 0x3BCE3C3E, 0xCC53B0F6, 0x651D06B0, 0x769886BC, 0xB3EBBD55, 0xAA3A93E7, 0x5AC635D8, | ||
| ]; | ||
|
|
||
| const SECP256R1_CURVE: &WeierstrassCurve<EC_256_WIDTH_WORDS> = | ||
| &WeierstrassCurve::<EC_256_WIDTH_WORDS>::new( | ||
| SECP256R1_PRIME, | ||
| // Curve parameter a = -3 (represented mod p) | ||
| SECP256R1_EQUATION_A_LE, | ||
| SECP256R1_EQUATION_B_LE, | ||
| ); | ||
|
|
||
| impl Curve<EC_256_WIDTH_WORDS> for crate::NistP256 { | ||
| const CURVE: &'static WeierstrassCurve<EC_256_WIDTH_WORDS> = SECP256R1_CURVE; | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.