diff --git a/.github/workflows/elliptic-curve.yml b/.github/workflows/elliptic-curve.yml index 68a40e9ab..c9eee6497 100644 --- a/.github/workflows/elliptic-curve.yml +++ b/.github/workflows/elliptic-curve.yml @@ -52,10 +52,9 @@ jobs: - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features sec1 - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features serde - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features voprf + - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features alloc,arithmetic,pkcs8 - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features alloc,serde - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features arithmetic,serde - - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features pkcs8,sec1 - - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features pem,pkcs8,sec1 - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features alloc,digest,ecdh,hazmat,hash2curve,jwk,pem,pkcs8,sec1,serde,voprf # TODO: use the reusable workflow after this crate is re-added to the diff --git a/elliptic-curve/Cargo.toml b/elliptic-curve/Cargo.toml index 6f3d0cf12..46e4cc216 100644 --- a/elliptic-curve/Cargo.toml +++ b/elliptic-curve/Cargo.toml @@ -47,13 +47,15 @@ default = ["arithmetic"] alloc = ["base16ct/alloc", "der/alloc", "ff?/alloc", "group?/alloc", "sec1?/alloc", "zeroize/alloc"] std = ["alloc", "rand_core/std", "sec1?/std"] -arithmetic = ["ff", "group"] +arithmetic = ["group"] bits = ["arithmetic", "ff/bits"] dev = ["arithmetic", "hex-literal", "pem", "pkcs8"] hash2curve = ["arithmetic", "digest"] ecdh = ["arithmetic", "digest", "hkdf"] +group = ["dep:group", "ff"] hazmat = [] jwk = ["alloc", "base64ct/alloc", "serde", "serde_json", "zeroize/alloc"] +pkcs8 = ["dep:pkcs8", "sec1"] pem = ["alloc", "arithmetic", "der/pem", "pem-rfc7468/alloc", "pkcs8", "sec1/pem"] serde = ["alloc", "pkcs8", "sec1/serde", "serdect"] voprf = ["digest"] diff --git a/elliptic-curve/src/dev.rs b/elliptic-curve/src/dev.rs index 999ccc3dc..d316d33d1 100644 --- a/elliptic-curve/src/dev.rs +++ b/elliptic-curve/src/dev.rs @@ -24,7 +24,7 @@ use hex_literal::hex; use pkcs8::AssociatedOid; #[cfg(feature = "bits")] -use crate::group::ff::PrimeFieldBits; +use ff::PrimeFieldBits; #[cfg(feature = "jwk")] use crate::JwkParameters; diff --git a/elliptic-curve/src/scalar/core.rs b/elliptic-curve/src/scalar/core.rs index de12685b1..94fd8bfab 100644 --- a/elliptic-curve/src/scalar/core.rs +++ b/elliptic-curve/src/scalar/core.rs @@ -22,7 +22,7 @@ use zeroize::DefaultIsZeroes; #[cfg(feature = "arithmetic")] use { super::{Scalar, ScalarArithmetic}, - group::ff::PrimeField, + ff::PrimeField, }; #[cfg(feature = "serde")] diff --git a/elliptic-curve/src/secret_key/pkcs8.rs b/elliptic-curve/src/secret_key/pkcs8.rs index ad769ca6e..934cd7d62 100644 --- a/elliptic-curve/src/secret_key/pkcs8.rs +++ b/elliptic-curve/src/secret_key/pkcs8.rs @@ -10,8 +10,7 @@ use der::Decode; use sec1::EcPrivateKey; // Imports for the `EncodePrivateKey` impl -// TODO(tarcieri): use weak activation of `pkcs8/alloc` for gating `EncodePrivateKey` impl -#[cfg(all(feature = "arithmetic", feature = "pem"))] +#[cfg(all(feature = "alloc", feature = "arithmetic"))] use { crate::{ sec1::{FromEncodedPoint, ToEncodedPoint}, @@ -51,10 +50,7 @@ where { } -// TODO(tarcieri): use weak activation of `pkcs8/alloc` for this when possible -// It doesn't strictly depend on `pkcs8/pem` but we can't easily activate `pkcs8/alloc` -// without adding a separate crate feature just for this functionality. -#[cfg(all(feature = "arithmetic", feature = "pem"))] +#[cfg(all(feature = "alloc", feature = "arithmetic"))] impl EncodePrivateKey for SecretKey where C: Curve + AssociatedOid + ProjectiveArithmetic,