Place Schnorr signature aggregation behind a feature flag

This commit is contained in:
Luke Parker
2025-08-19 21:45:59 -04:00
parent d407e35cee
commit 75964cf6da
5 changed files with 10 additions and 7 deletions

2
Cargo.lock generated
View File

@@ -7845,7 +7845,7 @@ dependencies = [
[[package]] [[package]]
name = "schnorr-signatures" name = "schnorr-signatures"
version = "0.5.1" version = "0.5.2"
dependencies = [ dependencies = [
"ciphersuite", "ciphersuite",
"dalek-ff-group", "dalek-ff-group",

View File

@@ -26,7 +26,7 @@ blake2 = { version = "0.10", default-features = false, features = ["std"] }
transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std", "recommended"] } transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std", "recommended"] }
ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] } ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] }
schnorr = { package = "schnorr-signatures", path = "../crypto/schnorr", default-features = false, features = ["std"] } schnorr = { package = "schnorr-signatures", path = "../crypto/schnorr", default-features = false, features = ["std", "aggregate"] }
dkg-musig = { path = "../crypto/dkg/musig", default-features = false, features = ["std"] } dkg-musig = { path = "../crypto/dkg/musig", default-features = false, features = ["std"] }
frost = { package = "modular-frost", path = "../crypto/frost" } frost = { package = "modular-frost", path = "../crypto/frost" }
frost-schnorrkel = { path = "../crypto/schnorrkel" } frost-schnorrkel = { path = "../crypto/schnorrkel" }

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "schnorr-signatures" name = "schnorr-signatures"
version = "0.5.1" version = "0.5.2"
description = "Minimal Schnorr signatures crate hosting common code" description = "Minimal Schnorr signatures crate hosting common code"
license = "MIT" license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/schnorr" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/schnorr"
@@ -39,5 +39,6 @@ dalek-ff-group = { path = "../dalek-ff-group" }
ciphersuite = { path = "../ciphersuite", features = ["ed25519"] } ciphersuite = { path = "../ciphersuite", features = ["ed25519"] }
[features] [features]
aggregate = []
std = ["std-shims/std", "rand_core/std", "zeroize/std", "transcript/std", "ciphersuite/std", "multiexp/std"] std = ["std-shims/std", "rand_core/std", "zeroize/std", "transcript/std", "ciphersuite/std", "multiexp/std"]
default = ["std"] default = ["std"]

View File

@@ -25,6 +25,7 @@ use ciphersuite::{
use multiexp::{multiexp_vartime, BatchVerifier}; use multiexp::{multiexp_vartime, BatchVerifier};
/// Half-aggregation from <https://eprint.iacr.org/2021/350>. /// Half-aggregation from <https://eprint.iacr.org/2021/350>.
#[cfg(feature = "aggregate")]
pub mod aggregate; pub mod aggregate;
#[cfg(test)] #[cfg(test)]

View File

@@ -9,10 +9,9 @@ use ciphersuite::{
}; };
use multiexp::BatchVerifier; use multiexp::BatchVerifier;
use crate::{ use crate::SchnorrSignature;
SchnorrSignature, #[cfg(feature = "aggregate")]
aggregate::{SchnorrAggregator, SchnorrAggregate}, use crate::aggregate::{SchnorrAggregator, SchnorrAggregate};
};
mod rfc8032; mod rfc8032;
@@ -77,6 +76,7 @@ pub(crate) fn batch_verify<C: Ciphersuite>() {
} }
} }
#[cfg(feature = "aggregate")]
pub(crate) fn aggregate<C: Ciphersuite>() { pub(crate) fn aggregate<C: Ciphersuite>() {
const DST: &[u8] = b"Schnorr Aggregator Test"; const DST: &[u8] = b"Schnorr Aggregator Test";
@@ -117,5 +117,6 @@ fn test() {
sign::<Ed25519>(); sign::<Ed25519>();
verify::<Ed25519>(); verify::<Ed25519>();
batch_verify::<Ed25519>(); batch_verify::<Ed25519>();
#[cfg(feature = "aggregate")]
aggregate::<Ed25519>(); aggregate::<Ed25519>();
} }