From 2c5347d385b62d7d1ec7de1a6b9ee70a23f048be Mon Sep 17 00:00:00 2001 From: crwn1337 <38888474+crwn1337@users.noreply.github.com> Date: Thu, 31 Aug 2023 18:18:57 +0300 Subject: [PATCH] add voprf to p521 --- Cargo.lock | 1 + p521/Cargo.toml | 2 ++ p521/src/lib.rs | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index b2ddf688..d2ec03bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -790,6 +790,7 @@ version = "0.13.0" dependencies = [ "elliptic-curve", "primeorder", + "sha2", ] [[package]] diff --git a/p521/Cargo.toml b/p521/Cargo.toml index f80160e8..8786301c 100644 --- a/p521/Cargo.toml +++ b/p521/Cargo.toml @@ -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" } @@ -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 diff --git a/p521/src/lib.rs b/p521/src/lib.rs index dc9859b2..fb127ca7 100644 --- a/p521/src/lib.rs +++ b/p521/src/lib.rs @@ -78,3 +78,12 @@ impl FieldBytesEncoding for U576 {} /// NIST P-521 secret key. pub type SecretKey = elliptic_curve::SecretKey; + +#[cfg(feature = "voprf")] +impl elliptic_curve::VoprfParameters for NistP521 { + /// See . + const ID: &'static str = "P521-SHA512"; + + /// See . + type Hash = sha2::Sha512; +}