fix --no-default-features; also make sure everything compilers with every feature combination

This commit is contained in:
Conrado Gouvea 2024-03-14 12:09:41 -03:00
parent 6e5aff8342
commit 64b5e33816
7 changed files with 21 additions and 11 deletions

View File

@ -17,14 +17,15 @@ use rand_core::{CryptoRng, RngCore};
use zeroize::{DefaultIsZeroes, Zeroize};
use crate::{
serialization::{Deserialize, Serialize},
Ciphersuite, Element, Error, Field, Group, Header, Identifier, Scalar, SigningKey,
VerifyingKey,
Ciphersuite, Element, Error, Field, Group, Header, Identifier, Scalar, SigningKey, VerifyingKey,
};
#[cfg(feature = "serde")]
use crate::serialization::{ElementSerialization, ScalarSerialization};
#[cfg(feature = "serialization")]
use crate::serialization::{Deserialize, Serialize};
use super::compute_lagrange_coefficient;
pub mod dkg;

View File

@ -50,6 +50,7 @@ pub mod round1 {
use derive_getters::Getters;
use zeroize::Zeroize;
#[cfg(feature = "serialization")]
use crate::serialization::{Deserialize, Serialize};
use super::*;
@ -167,6 +168,7 @@ pub mod round2 {
use derive_getters::Getters;
use zeroize::Zeroize;
#[cfg(feature = "serialization")]
use crate::serialization::{Deserialize, Serialize};
use super::*;

View File

@ -153,7 +153,7 @@ struct Header<C: Ciphersuite> {
serde(deserialize_with = "crate::serialization::ciphersuite_deserialize::<_, C>")
)]
ciphersuite: (),
#[serde(skip)]
#[cfg_attr(feature = "serde", serde(skip))]
phantom: PhantomData<C>,
}

View File

@ -12,15 +12,14 @@ use hex::FromHex;
use rand_core::{CryptoRng, RngCore};
use zeroize::Zeroize;
use crate as frost;
use crate::{
serialization::{Deserialize, Serialize},
Ciphersuite, Element, Error, Field, Group, Header, Scalar,
};
use crate::{Ciphersuite, Element, Error, Field, Group, Header, Scalar};
#[cfg(feature = "serde")]
use crate::serialization::{ElementSerialization, ScalarSerialization};
#[cfg(feature = "serialization")]
use crate::serialization::{Deserialize, Serialize};
use super::{keys::SigningShare, Identifier};
/// A scalar that is a signing nonce.
@ -353,11 +352,12 @@ where
/// Computes the [signature commitment share] from these round one signing commitments.
///
/// [signature commitment share]: https://www.ietf.org/archive/id/draft-irtf-cfrg-frost-14.html#name-signature-share-verificatio
#[cfg(any(feature = "cheater-detection", feature = "internals"))]
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
pub(super) fn to_group_commitment_share(
self,
binding_factor: &frost::BindingFactor<C>,
binding_factor: &crate::BindingFactor<C>,
) -> GroupCommitmentShare<C> {
GroupCommitmentShare::<C>(self.hiding.0 + (self.binding.0 * binding_factor.0))
}

View File

@ -81,6 +81,7 @@ where
/// This is the final step of [`verify_signature_share`] from the spec.
///
/// [`verify_signature_share`]: https://www.ietf.org/archive/id/draft-irtf-cfrg-frost-14.html#name-signature-share-verificatio
#[cfg(any(feature = "cheater-detection", feature = "internals"))]
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
pub(crate) fn verify(

View File

@ -1,6 +1,10 @@
//! Serialization support.
use crate::{Ciphersuite, Error, Field, Group};
#[cfg(feature = "serde")]
use crate::{Ciphersuite, Field, Group};
#[cfg(feature = "serialization")]
use crate::Error;
#[cfg(feature = "serde")]
#[cfg_attr(feature = "internals", visibility::make(pub))]
@ -89,6 +93,7 @@ where
// The short 4-byte ID. Derived as the CRC-32 of the UTF-8
// encoded ID in big endian format.
#[cfg(feature = "serde")]
const fn short_id<C>() -> [u8; 4]
where
C: Ciphersuite,

View File

@ -326,6 +326,7 @@ fn check_aggregate_errors<C: Ciphersuite + PartialEq>(
);
}
#[cfg(feature = "cheater-detection")]
fn check_aggregate_corrupted_share<C: Ciphersuite + PartialEq>(
signing_package: frost::SigningPackage<C>,
mut signature_shares: BTreeMap<frost::Identifier<C>, frost::round2::SignatureShare<C>>,