Skip to content

Commit

Permalink
all: fix issues related to features (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
conradoplg authored Jan 15, 2025
1 parent 80d53f2 commit a879360
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion frost-core/src/round1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ where
/// Computes the [commitment share] from these round one signing commitments.
///
/// [commitment share]: https://datatracker.ietf.org/doc/html/rfc9591#name-signature-share-aggregation
#[cfg(any(feature = "internals", feature = "cheater-detection"))]
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
pub(super) fn to_group_commitment_share(
Expand Down Expand Up @@ -367,6 +366,7 @@ pub struct GroupCommitmentShare<C: Ciphersuite>(pub(super) Element<C>);
impl<C: Ciphersuite> GroupCommitmentShare<C> {
/// Create from an element.
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[allow(unused)]
pub(crate) fn from_element(element: Element<C>) -> Self {
Self(element)
}
Expand Down
1 change: 0 additions & 1 deletion frost-core/src/round2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ where
/// This is the final step of [`verify_signature_share`] from the spec.
///
/// [`verify_signature_share`]: https://datatracker.ietf.org/doc/html/rfc9591#name-signature-share-aggregation
#[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(
Expand Down
8 changes: 4 additions & 4 deletions frost-core/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ where

/// Converts default-encoded bytes as
/// [`Ciphersuite::SignatureSerialization`] into a `Signature<C>`.
#[cfg(feature = "internals")]
pub fn default_deserialize(bytes: &[u8]) -> Result<Self, Error<C>> {
#[cfg_attr(feature = "internals", visibility::make(pub))]
pub(crate) fn default_deserialize(bytes: &[u8]) -> Result<Self, Error<C>> {
// To compute the expected length of the encoded point, encode the generator
// and get its length. Note that we can't use the identity because it can be encoded
// shorter in some cases (e.g. P-256, which uses SEC1 encoding).
Expand Down Expand Up @@ -75,8 +75,8 @@ where
}

/// Converts this signature to its default byte serialization.
#[cfg(feature = "internals")]
pub fn default_serialize(&self) -> Result<Vec<u8>, Error<C>> {
#[cfg_attr(feature = "internals", visibility::make(pub))]
pub(crate) fn default_serialize(&self) -> Result<Vec<u8>, Error<C>> {
let mut bytes = Vec::<u8>::new();

bytes.extend(<C::Group>::serialize(&self.R)?.as_ref());
Expand Down
8 changes: 6 additions & 2 deletions frost-core/src/signing_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ where

/// Create a signature `msg` using this `SigningKey` using the default
/// signing.
#[cfg(feature = "internals")]
pub fn default_sign<R: RngCore + CryptoRng>(&self, mut rng: R, message: &[u8]) -> Signature<C> {
#[cfg_attr(feature = "internals", visibility::make(pub))]
pub(crate) fn default_sign<R: RngCore + CryptoRng>(
&self,
mut rng: R,
message: &[u8],
) -> Signature<C> {
let public = VerifyingKey::<C>::from(*self);

let (k, R) = <C>::generate_nonce(&mut rng);
Expand Down
5 changes: 2 additions & 3 deletions frost-core/src/tests/ciphersuite_generic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! Ciphersuite-generic test functions.
#![allow(clippy::type_complexity)]

use alloc::collections::BTreeMap;
use alloc::{borrow::ToOwned, collections::BTreeMap, vec::Vec};
use rand_core::{CryptoRng, RngCore};

use crate as frost;
use crate::keys::SigningShare;
Expand All @@ -10,8 +11,6 @@ use crate::{
keys::PublicKeyPackage, Error, Field, Group, Identifier, Signature, SigningKey, SigningPackage,
VerifyingKey,
};
use alloc::vec::Vec;
use rand_core::{CryptoRng, RngCore};

use crate::Ciphersuite;

Expand Down
8 changes: 4 additions & 4 deletions frost-core/src/tests/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ use crate::keys::generate_with_dealer;
use crate::keys::refresh::{
compute_refreshing_shares, refresh_dkg_part2, refresh_dkg_part_1, refresh_share,
};
#[cfg(feature = "serialization")]
use crate::keys::{PublicKeyPackage, SecretShare};
use crate::{self as frost};
use crate::{
keys::{KeyPackage, PublicKeyPackage, SecretShare},
Ciphersuite, Error, Identifier, Signature, VerifyingKey,
};
use crate::{keys::KeyPackage, Ciphersuite, Error, Identifier, Signature, VerifyingKey};

use crate::tests::ciphersuite_generic::check_part3_different_participants;

Expand Down Expand Up @@ -175,6 +174,7 @@ pub fn check_refresh_shares_with_dealer_fails_with_invalid_public_key_package<
}

/// Check serialisation
#[cfg(feature = "serialization")]
pub fn check_refresh_shares_with_dealer_serialisation<C: Ciphersuite, R: RngCore + CryptoRng>(
mut rng: R,
) {
Expand Down

0 comments on commit a879360

Please sign in to comment.