-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stdlib): Add secp256r1 builtin function (#1858)
* feat: ecdsa secp256r1 * fix: remove verbose logging * chore(cargo): update deps * fix: remove commented code * check * chore(deps): update flake and acvm * chore(bb-backend): update acvm bb * chore(bb-backend): bump backend to 0.7.0 * update cargo.lock * use exact wasm-bindgen version --------- Co-authored-by: kevaundray <kevtheappdev@gmail.com> Co-authored-by: TomAFrench <tom@tomfren.ch>
- Loading branch information
1 parent
1747176
commit f3800c5
Showing
13 changed files
with
340 additions
and
291 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "ECDSA secp256r1 verification" | ||
authors = [""] | ||
compiler_version = "0.1" | ||
|
||
[dependencies] |
19 changes: 19 additions & 0 deletions
19
crates/nargo_cli/tests/test_data/ecdsa_secp256r1/Prover.toml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
hashed_message = [ | ||
84, 112, 91, 163, 186, 175, 219, 223, 186, 140, 95, 154, 112, 247, 168, 155, 238, 152, | ||
217, 6, 181, 62, 49, 7, 77, 167, 186, 236, 220, 13, 169, 173, | ||
] | ||
pub_key_x = [ | ||
85, 15, 71, 16, 3, 243, 223, 151, 195, 223, 80, 106, 199, 151, 246, 114, 31, 177, 161, | ||
251, 123, 143, 111, 131, 210, 36, 73, 138, 101, 200, 142, 36, | ||
] | ||
pub_key_y = [ | ||
19, 96, 147, 215, 1, 46, 80, 154, 115, 113, 92, 189, 11, 0, 163, 204, 15, 244, 181, | ||
192, 27, 63, 250, 25, 106, 177, 251, 50, 112, 54, 184, 230, | ||
] | ||
signature = [ | ||
44, 112, 168, 208, 132, 182, 43, 252, 92, 224, 54, 65, 202, 249, 247, 42, | ||
212, 218, 140, 129, 191, 230, 236, 148, 135, 187, 94, 27, 239, 98, 161, 50, | ||
24, 173, 158, 226, 158, 175, 53, 31, 220, 80, 241, 82, 12, 66, 94, 155, | ||
144, 138, 7, 39, 139, 67, 176, 236, 123, 135, 39, 120, 193, 78, 7, 132 | ||
] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use dep::std; | ||
|
||
fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { | ||
let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); | ||
assert(valid_signature); | ||
} |
6 changes: 6 additions & 0 deletions
6
crates/nargo_cli/tests/test_data_ssa_refactor/ecdsa_secp256r1/Nargo.toml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "ECDSA secp256r1 verification" | ||
authors = [""] | ||
compiler_version = "0.1" | ||
|
||
[dependencies] |
20 changes: 20 additions & 0 deletions
20
crates/nargo_cli/tests/test_data_ssa_refactor/ecdsa_secp256r1/Prover.toml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
hashed_message = [ | ||
84, 112, 91, 163, 186, 175, 219, 223, 186, 140, 95, 154, 112, 247, 168, 155, 238, 152, | ||
217, 6, 181, 62, 49, 7, 77, 167, 186, 236, 220, 13, 169, 173, | ||
] | ||
pub_key_x = [ | ||
85, 15, 71, 16, 3, 243, 223, 151, 195, 223, 80, 106, 199, 151, 246, 114, 31, 177, 161, | ||
251, 123, 143, 111, 131, 210, 36, 73, 138, 101, 200, 142, 36, | ||
] | ||
pub_key_y = [ | ||
19, 96, 147, 215, 1, 46, 80, 154, 115, 113, 92, 189, 11, 0, 163, 204, 15, 244, 181, | ||
192, 27, 63, 250, 25, 106, 177, 251, 50, 112, 54, 184, 230, | ||
] | ||
signature = [ | ||
44, 112, 168, 208, 132, 182, 43, 252, 92, 224, 54, 65, 202, 249, 247, 42, | ||
212, 218, 140, 129, 191, 230, 236, 148, 135, 187, 94, 27, 239, 98, 161, 50, | ||
24, 173, 158, 226, 158, 175, 53, 31, 220, 80, 241, 82, 12, 66, 94, 155, | ||
144, 138, 7, 39, 139, 67, 176, 236, 123, 135, 39, 120, 193, 78, 7, 132 | ||
] | ||
|
||
|
7 changes: 7 additions & 0 deletions
7
crates/nargo_cli/tests/test_data_ssa_refactor/ecdsa_secp256r1/src/main.nr
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use dep::std; | ||
|
||
|
||
fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { | ||
let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); | ||
assert(valid_signature); | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#[foreign(ecdsa_secp256r1)] | ||
fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message_hash: [u8]) -> bool {} |
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