Skip to content

Commit

Permalink
p521: arithmetic feature (#953)
Browse files Browse the repository at this point in the history
Now that #946, #950, and #951 have landed it seems prudent to add a real
`arithmetic` feature.

This adds a feature similar to the other crates in this repo which
exposes the following types which provide a curve arithmetic
implementation:

- `AffinePoint`
- `ProjectivePoint`
- `Scalar`

The `wip-arithmetic-do-not-use` feature is now removed as well. While
technically SemVer breaking, it wasn't supposed to be used in the first
place!

Closes #947
  • Loading branch information
tarcieri authored Nov 3, 2023
1 parent 45540cf commit 3a19153
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions p521/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ hex-literal = "0.4"
primeorder = { version = "0.13.3", features = ["dev"], path = "../primeorder" }

[features]
default = ["pem", "std"]
default = ["arithmetic", "pem", "std"]
alloc = ["elliptic-curve/alloc"]
std = ["alloc", "elliptic-curve/std"]

arithmetic = ["dep:primeorder"]
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"]

[package.metadata.docs.rs]
Expand Down
5 changes: 4 additions & 1 deletion p521/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
unused_qualifications
)]

#[cfg(feature = "wip-arithmetic-do-not-use")]
#[cfg(feature = "arithmetic")]
pub mod arithmetic;

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

#[cfg(feature = "arithmetic")]
pub use arithmetic::{scalar::Scalar, AffinePoint, ProjectivePoint};

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

#[cfg(feature = "pkcs8")]
Expand Down
2 changes: 1 addition & 1 deletion p521/tests/projective.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Projective arithmetic tests.

#![cfg(all(feature = "wip-arithmetic-do-not-use", feature = "test-vectors"))]
#![cfg(all(feature = "arithmetic", feature = "test-vectors"))]

use elliptic_curve::{
group::ff::PrimeField,
Expand Down

0 comments on commit 3a19153

Please sign in to comment.