diff --git a/p256/src/arithmetic/hash2curve.rs b/p256/src/arithmetic/hash2curve.rs index dab2848b..e9cca7e2 100644 --- a/p256/src/arithmetic/hash2curve.rs +++ b/p256/src/arithmetic/hash2curve.rs @@ -93,7 +93,9 @@ impl FromOkm for Scalar { #[cfg(test)] mod tests { - use crate::{arithmetic::field::MODULUS, FieldElement, NistP256, Scalar, U256}; + #[cfg(feature = "expose-field")] + use crate::FieldElement; + use crate::{arithmetic::field::MODULUS, NistP256, Scalar, U256}; use elliptic_curve::{ bigint::{ArrayEncoding, CheckedSub, NonZero, U384}, consts::U48, @@ -105,8 +107,10 @@ mod tests { }; use hex_literal::hex; use proptest::{num::u64::ANY, prelude::ProptestConfig, proptest}; + #[cfg(feature = "sha256")] use sha2::Sha256; + #[cfg(feature = "expose-field")] #[test] fn params() { let params = ::PARAMS; @@ -122,6 +126,7 @@ mod tests { assert_eq!(params.c2, c2); } + #[cfg(feature = "expose-field")] #[allow(dead_code)] // TODO(tarcieri): fix commented out code #[test] fn hash_to_curve() { @@ -241,6 +246,7 @@ mod tests { } } + #[cfg(feature = "sha256")] /// Taken from . #[test] fn hash_to_scalar_voprf() { diff --git a/p256/tests/ecdsa.rs b/p256/tests/ecdsa.rs index dfc80ae5..82f3ee4f 100644 --- a/p256/tests/ecdsa.rs +++ b/p256/tests/ecdsa.rs @@ -1,6 +1,6 @@ //! ECDSA tests. -#![cfg(feature = "arithmetic")] +#![cfg(all(feature = "arithmetic", feature = "ecdsa"))] use elliptic_curve::ops::Reduce; use p256::{