Skip to content

Commit 2b8c150

Browse files
committed
reexport rerandomized API in ciphersuite crates
1 parent 3ed40ad commit 2b8c150

File tree

10 files changed

+422
-6
lines changed

10 files changed

+422
-6
lines changed

frost-core/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Entries are listed in reverse chronological order.
3535
### Additional changes
3636

3737
* Added DKG refresh functions to the crate-specific `refresh` modules.
38+
* Re-exported the `frost-rerandomized` crate in the ciphersuite functions, e.g.
39+
you can call `frost_ristretto255::rerandomized::sign_with_randomizer_seed()`.
3840

3941
## 2.2.0
4042

frost-ed25519/src/rerandomized.rs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//! FROST implementation supporting re-randomizable keys.
2+
3+
use alloc::collections::btree_map::BTreeMap;
4+
5+
/// Re-randomized FROST signing using the given `randomizer_seed`, which should
6+
/// be sent from the Coordinator using a confidential channel.
7+
///
8+
/// See [`crate::round2::sign`] for documentation on the other parameters.
9+
pub fn sign_with_randomizer_seed(
10+
signing_package: &crate::SigningPackage,
11+
signer_nonces: &crate::round1::SigningNonces,
12+
key_package: &crate::keys::KeyPackage,
13+
randomizer_seed: &[u8],
14+
) -> Result<crate::round2::SignatureShare, crate::Error> {
15+
frost_rerandomized::sign_with_randomizer_seed::<crate::Ed25519Sha512>(
16+
signing_package,
17+
signer_nonces,
18+
key_package,
19+
randomizer_seed,
20+
)
21+
}
22+
23+
/// Re-randomized FROST signature share aggregation with the given
24+
/// [`RandomizedParams`].
25+
///
26+
/// See [`frost::aggregate`] for documentation on the other parameters.
27+
pub fn aggregate(
28+
signing_package: &crate::SigningPackage,
29+
signature_shares: &BTreeMap<crate::Identifier, crate::round2::SignatureShare>,
30+
pubkeys: &crate::keys::PublicKeyPackage,
31+
randomized_params: &RandomizedParams,
32+
) -> Result<crate::Signature, crate::Error> {
33+
frost_rerandomized::aggregate::<crate::Ed25519Sha512>(
34+
signing_package,
35+
signature_shares,
36+
pubkeys,
37+
randomized_params,
38+
)
39+
}
40+
41+
/// Re-randomized FROST signature share aggregation with the given
42+
/// [`RandomizedParams`] using the given cheater detection strategy.
43+
///
44+
/// See [`frost::aggregate_custom`] for documentation on the other parameters.
45+
pub fn aggregate_custom(
46+
signing_package: &crate::SigningPackage,
47+
signature_shares: &BTreeMap<crate::Identifier, crate::round2::SignatureShare>,
48+
pubkeys: &crate::keys::PublicKeyPackage,
49+
cheater_detection: crate::CheaterDetection,
50+
randomized_params: &RandomizedParams,
51+
) -> Result<crate::Signature, crate::Error> {
52+
frost_rerandomized::aggregate_custom::<crate::Ed25519Sha512>(
53+
signing_package,
54+
signature_shares,
55+
pubkeys,
56+
cheater_detection,
57+
randomized_params,
58+
)
59+
}
60+
61+
/// A randomizer. A random scalar which is used to randomize the key.
62+
pub type Randomizer = frost_rerandomized::Randomizer<crate::Ed25519Sha512>;
63+
64+
/// Randomized parameters for a signing instance of randomized FROST.
65+
pub type RandomizedParams = frost_rerandomized::RandomizedParams<crate::Ed25519Sha512>;

frost-ed448/src/rerandomized.rs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//! FROST implementation supporting re-randomizable keys.
2+
3+
use alloc::collections::btree_map::BTreeMap;
4+
5+
/// Re-randomized FROST signing using the given `randomizer_seed`, which should
6+
/// be sent from the Coordinator using a confidential channel.
7+
///
8+
/// See [`crate::round2::sign`] for documentation on the other parameters.
9+
pub fn sign_with_randomizer_seed(
10+
signing_package: &crate::SigningPackage,
11+
signer_nonces: &crate::round1::SigningNonces,
12+
key_package: &crate::keys::KeyPackage,
13+
randomizer_seed: &[u8],
14+
) -> Result<crate::round2::SignatureShare, crate::Error> {
15+
frost_rerandomized::sign_with_randomizer_seed::<crate::Ed448Shake256>(
16+
signing_package,
17+
signer_nonces,
18+
key_package,
19+
randomizer_seed,
20+
)
21+
}
22+
23+
/// Re-randomized FROST signature share aggregation with the given
24+
/// [`RandomizedParams`].
25+
///
26+
/// See [`frost::aggregate`] for documentation on the other parameters.
27+
pub fn aggregate(
28+
signing_package: &crate::SigningPackage,
29+
signature_shares: &BTreeMap<crate::Identifier, crate::round2::SignatureShare>,
30+
pubkeys: &crate::keys::PublicKeyPackage,
31+
randomized_params: &RandomizedParams,
32+
) -> Result<crate::Signature, crate::Error> {
33+
frost_rerandomized::aggregate::<crate::Ed448Shake256>(
34+
signing_package,
35+
signature_shares,
36+
pubkeys,
37+
randomized_params,
38+
)
39+
}
40+
41+
/// Re-randomized FROST signature share aggregation with the given
42+
/// [`RandomizedParams`] using the given cheater detection strategy.
43+
///
44+
/// See [`frost::aggregate_custom`] for documentation on the other parameters.
45+
pub fn aggregate_custom(
46+
signing_package: &crate::SigningPackage,
47+
signature_shares: &BTreeMap<crate::Identifier, crate::round2::SignatureShare>,
48+
pubkeys: &crate::keys::PublicKeyPackage,
49+
cheater_detection: crate::CheaterDetection,
50+
randomized_params: &RandomizedParams,
51+
) -> Result<crate::Signature, crate::Error> {
52+
frost_rerandomized::aggregate_custom::<crate::Ed448Shake256>(
53+
signing_package,
54+
signature_shares,
55+
pubkeys,
56+
cheater_detection,
57+
randomized_params,
58+
)
59+
}
60+
61+
/// A randomizer. A random scalar which is used to randomize the key.
62+
pub type Randomizer = frost_rerandomized::Randomizer<crate::Ed448Shake256>;
63+
64+
/// Randomized parameters for a signing instance of randomized FROST.
65+
pub type RandomizedParams = frost_rerandomized::RandomizedParams<crate::Ed448Shake256>;

frost-p256/src/rerandomized.rs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//! FROST implementation supporting re-randomizable keys.
2+
3+
use alloc::collections::btree_map::BTreeMap;
4+
5+
/// Re-randomized FROST signing using the given `randomizer_seed`, which should
6+
/// be sent from the Coordinator using a confidential channel.
7+
///
8+
/// See [`crate::round2::sign`] for documentation on the other parameters.
9+
pub fn sign_with_randomizer_seed(
10+
signing_package: &crate::SigningPackage,
11+
signer_nonces: &crate::round1::SigningNonces,
12+
key_package: &crate::keys::KeyPackage,
13+
randomizer_seed: &[u8],
14+
) -> Result<crate::round2::SignatureShare, crate::Error> {
15+
frost_rerandomized::sign_with_randomizer_seed::<crate::P256Sha256>(
16+
signing_package,
17+
signer_nonces,
18+
key_package,
19+
randomizer_seed,
20+
)
21+
}
22+
23+
/// Re-randomized FROST signature share aggregation with the given
24+
/// [`RandomizedParams`].
25+
///
26+
/// See [`frost::aggregate`] for documentation on the other parameters.
27+
pub fn aggregate(
28+
signing_package: &crate::SigningPackage,
29+
signature_shares: &BTreeMap<crate::Identifier, crate::round2::SignatureShare>,
30+
pubkeys: &crate::keys::PublicKeyPackage,
31+
randomized_params: &RandomizedParams,
32+
) -> Result<crate::Signature, crate::Error> {
33+
frost_rerandomized::aggregate::<crate::P256Sha256>(
34+
signing_package,
35+
signature_shares,
36+
pubkeys,
37+
randomized_params,
38+
)
39+
}
40+
41+
/// Re-randomized FROST signature share aggregation with the given
42+
/// [`RandomizedParams`] using the given cheater detection strategy.
43+
///
44+
/// See [`frost::aggregate_custom`] for documentation on the other parameters.
45+
pub fn aggregate_custom(
46+
signing_package: &crate::SigningPackage,
47+
signature_shares: &BTreeMap<crate::Identifier, crate::round2::SignatureShare>,
48+
pubkeys: &crate::keys::PublicKeyPackage,
49+
cheater_detection: crate::CheaterDetection,
50+
randomized_params: &RandomizedParams,
51+
) -> Result<crate::Signature, crate::Error> {
52+
frost_rerandomized::aggregate_custom::<crate::P256Sha256>(
53+
signing_package,
54+
signature_shares,
55+
pubkeys,
56+
cheater_detection,
57+
randomized_params,
58+
)
59+
}
60+
61+
/// A randomizer. A random scalar which is used to randomize the key.
62+
pub type Randomizer = frost_rerandomized::Randomizer<crate::P256Sha256>;
63+
64+
/// Randomized parameters for a signing instance of randomized FROST.
65+
pub type RandomizedParams = frost_rerandomized::RandomizedParams<crate::P256Sha256>;

frost-rerandomized/src/lib.rs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ use frost_core::SigningPackage;
3030
use frost_core::{
3131
self as frost,
3232
keys::{KeyPackage, PublicKeyPackage, SigningShare, VerifyingShare},
33-
round1::encode_group_commitments,
34-
round1::SigningCommitments,
33+
round1::{encode_group_commitments, SigningCommitments},
3534
serialization::SerializableScalar,
36-
Ciphersuite, Error, Field, Group, Identifier, Scalar, VerifyingKey,
35+
CheaterDetection, Ciphersuite, Error, Field, Group, Identifier, Scalar, VerifyingKey,
3736
};
3837

3938
#[cfg(feature = "serde")]
@@ -161,9 +160,8 @@ pub fn sign_with_randomizer_seed<C: RandomizedCiphersuite>(
161160
frost::round2::sign(signing_package, signer_nonces, &randomized_key_package)
162161
}
163162

164-
/// Re-randomized FROST signature share aggregation with the given [`RandomizedParams`],
165-
/// which can be computed from the previously generated randomizer using
166-
/// [`RandomizedParams::from_randomizer`].
163+
/// Re-randomized FROST signature share aggregation with the given
164+
/// [`RandomizedParams`].
167165
///
168166
/// See [`frost::aggregate`] for documentation on the other parameters.
169167
pub fn aggregate<C>(
@@ -183,6 +181,29 @@ where
183181
)
184182
}
185183

184+
/// Re-randomized FROST signature share aggregation with the given
185+
/// [`RandomizedParams`] using the given cheater detection strategy.
186+
///
187+
/// See [`frost::aggregate_custom`] for documentation on the other parameters.
188+
pub fn aggregate_custom<C>(
189+
signing_package: &frost::SigningPackage<C>,
190+
signature_shares: &BTreeMap<frost::Identifier<C>, frost::round2::SignatureShare<C>>,
191+
pubkeys: &frost::keys::PublicKeyPackage<C>,
192+
cheater_detection: CheaterDetection,
193+
randomized_params: &RandomizedParams<C>,
194+
) -> Result<frost_core::Signature<C>, Error<C>>
195+
where
196+
C: Ciphersuite,
197+
{
198+
let randomized_public_key_package = pubkeys.randomize(randomized_params)?;
199+
frost::aggregate_custom(
200+
signing_package,
201+
signature_shares,
202+
&randomized_public_key_package,
203+
cheater_detection,
204+
)
205+
}
206+
186207
/// A randomizer. A random scalar which is used to randomize the key.
187208
#[derive(Copy, Clone, PartialEq, Eq)]
188209
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]

frost-ristretto255/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ use frost_core as frost;
2222
#[cfg(test)]
2323
mod tests;
2424

25+
pub mod rerandomized;
26+
2527
// Re-exports in our public API
2628
#[cfg(feature = "serde")]
2729
pub use frost_core::serde;
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//! FROST implementation supporting re-randomizable keys.
2+
3+
use alloc::collections::btree_map::BTreeMap;
4+
5+
/// Re-randomized FROST signing using the given `randomizer_seed`, which should
6+
/// be sent from the Coordinator using a confidential channel.
7+
///
8+
/// See [`crate::round2::sign`] for documentation on the other parameters.
9+
pub fn sign_with_randomizer_seed(
10+
signing_package: &crate::SigningPackage,
11+
signer_nonces: &crate::round1::SigningNonces,
12+
key_package: &crate::keys::KeyPackage,
13+
randomizer_seed: &[u8],
14+
) -> Result<crate::round2::SignatureShare, crate::Error> {
15+
frost_rerandomized::sign_with_randomizer_seed::<crate::Ristretto255Sha512>(
16+
signing_package,
17+
signer_nonces,
18+
key_package,
19+
randomizer_seed,
20+
)
21+
}
22+
23+
/// Re-randomized FROST signature share aggregation with the given
24+
/// [`RandomizedParams`].
25+
///
26+
/// See [`frost_core::aggregate`] for documentation on the other parameters.
27+
pub fn aggregate(
28+
signing_package: &crate::SigningPackage,
29+
signature_shares: &BTreeMap<crate::Identifier, crate::round2::SignatureShare>,
30+
pubkeys: &crate::keys::PublicKeyPackage,
31+
randomized_params: &RandomizedParams,
32+
) -> Result<crate::Signature, crate::Error> {
33+
frost_rerandomized::aggregate::<crate::Ristretto255Sha512>(
34+
signing_package,
35+
signature_shares,
36+
pubkeys,
37+
randomized_params,
38+
)
39+
}
40+
41+
/// Re-randomized FROST signature share aggregation with the given
42+
/// [`RandomizedParams`] using the given cheater detection strategy.
43+
///
44+
/// See [`frost_core::aggregate_custom`] for documentation on the other parameters.
45+
pub fn aggregate_custom(
46+
signing_package: &crate::SigningPackage,
47+
signature_shares: &BTreeMap<crate::Identifier, crate::round2::SignatureShare>,
48+
pubkeys: &crate::keys::PublicKeyPackage,
49+
cheater_detection: crate::CheaterDetection,
50+
randomized_params: &RandomizedParams,
51+
) -> Result<crate::Signature, crate::Error> {
52+
frost_rerandomized::aggregate_custom::<crate::Ristretto255Sha512>(
53+
signing_package,
54+
signature_shares,
55+
pubkeys,
56+
cheater_detection,
57+
randomized_params,
58+
)
59+
}
60+
61+
/// A randomizer. A random scalar which is used to randomize the key.
62+
pub type Randomizer = frost_rerandomized::Randomizer<crate::Ristretto255Sha512>;
63+
64+
/// Randomized parameters for a signing instance of randomized FROST.
65+
pub type RandomizedParams = frost_rerandomized::RandomizedParams<crate::Ristretto255Sha512>;

0 commit comments

Comments
 (0)