Skip to content

Commit

Permalink
p521: projective arithmetic tests (#950)
Browse files Browse the repository at this point in the history
Uses `impl_projective_arithmetic_tests!` to test projective arithmetic
against a set of test vectors.

Includes test vectors from:

http://point-at-infinity.org/ecc/nisttv
  • Loading branch information
tarcieri authored Nov 2, 2023
1 parent a9e16d0 commit f9916b2
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions p521/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ elliptic-curve = { version = "0.13", default-features = false, features = ["hazm
sha2 = { version = "0.10", optional = true, default-features = false }

# optional dependencies
hex-literal = { version = "0.4", optional = true }
primeorder = { version = "0.13.1", optional = true, path = "../primeorder" }

[dev-dependencies]
hex-literal = "0.4"

[features]
default = ["pem", "std"]
alloc = ["elliptic-curve/alloc"]
Expand All @@ -30,6 +34,7 @@ std = ["alloc", "elliptic-curve/std"]
jwk = ["elliptic-curve/jwk"]
pem = ["elliptic-curve/pem", "pkcs8"]
pkcs8 = ["elliptic-curve/pkcs8"]
test-vectors = ["dep:hex-literal"]
wip-arithmetic-do-not-use = ["dep:primeorder"]
voprf = ["elliptic-curve/voprf", "dep:sha2"]

Expand Down
3 changes: 3 additions & 0 deletions p521/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#[cfg(feature = "wip-arithmetic-do-not-use")]
pub mod arithmetic;

#[cfg(any(feature = "test-vectors", test))]
pub mod test_vectors;

pub use elliptic_curve::{self, bigint::U576};

#[cfg(feature = "pkcs8")]
Expand Down
3 changes: 3 additions & 0 deletions p521/src/test_vectors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! secp521r1 test vectors.
pub mod group;
Loading

0 comments on commit f9916b2

Please sign in to comment.