Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compilation errors if only the feature hash2curve is enabled #996

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion p256/src/arithmetic/hash2curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = <FieldElement as OsswuMap>::PARAMS;
Expand All @@ -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() {
Expand Down Expand Up @@ -241,6 +246,7 @@ mod tests {
}
}

#[cfg(feature = "sha256")]
/// Taken from <https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-voprf#appendix-A.3>.
#[test]
fn hash_to_scalar_voprf() {
Expand Down
2 changes: 1 addition & 1 deletion p256/tests/ecdsa.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! ECDSA tests.

#![cfg(feature = "arithmetic")]
#![cfg(all(feature = "arithmetic", feature = "ecdsa"))]

use elliptic_curve::ops::Reduce;
use p256::{
Expand Down