Skip to content

Commit

Permalink
add voprf to p521
Browse files Browse the repository at this point in the history
  • Loading branch information
crwn1337 committed Aug 31, 2023
1 parent d8e44b0 commit 2c5347d
Show file tree
Hide file tree
Showing 3 changed files with 12 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.

2 changes: 2 additions & 0 deletions p521/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ rust-version = "1.65"

[dependencies]
elliptic-curve = { version = "0.13", default-features = false, features = ["hazmat", "sec1"] }
sha2 = { version = "0.10", optional = true, default-features = false }

# optional dependencies
primeorder = { version = "0.13.1", optional = true, path = "../primeorder" }
Expand All @@ -30,6 +31,7 @@ jwk = ["elliptic-curve/jwk"]
pem = ["elliptic-curve/pem", "pkcs8"]
pkcs8 = ["elliptic-curve/pkcs8"]
wip-arithmetic-do-not-use = ["dep:primeorder"]
voprf = ["elliptic-curve/voprf", "sha2"]

[package.metadata.docs.rs]
all-features = true
Expand Down
9 changes: 9 additions & 0 deletions p521/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,12 @@ impl FieldBytesEncoding<NistP521> for U576 {}

/// NIST P-521 secret key.
pub type SecretKey = elliptic_curve::SecretKey<NistP521>;

#[cfg(feature = "voprf")]
impl elliptic_curve::VoprfParameters for NistP521 {
/// See <https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-19.html#section-4.5-1>.
const ID: &'static str = "P521-SHA512";

/// See <https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-08.html#section-4.5-1.2>.
type Hash = sha2::Sha512;
}

0 comments on commit 2c5347d

Please sign in to comment.