From a8a5ec9e3e78513590d811f32b7ce19f084d1d31 Mon Sep 17 00:00:00 2001 From: Conrado Gouvea Date: Tue, 29 Oct 2024 20:04:17 -0300 Subject: [PATCH] update frost-rerandomized with new Randomizer generation --- Cargo.lock | 14 ++++++-------- Cargo.toml | 6 ++++-- src/frost/redjubjub.rs | 22 ++++++++++++++++++++++ src/frost/redpallas.rs | 25 +++++++++++++++++++++++-- 4 files changed, 55 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 92a3dbc..453af53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -322,9 +322,9 @@ checksum = "f400d0750c0c069e8493f2256cb4da6f604b6d2eeb69a0ca8863acde352f8400" [[package]] name = "derive-getters" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6433aac097572ea8ccc60b3f2e756c661c9aeed9225cdd4d0cb119cb7ff6ba" +checksum = "74ef43543e701c01ad77d3a5922755c6a1d71b22d942cb8042be4994b380caff" dependencies = [ "proc-macro2", "quote", @@ -391,9 +391,8 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "frost-core" -version = "2.0.0-rc.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1383227a6606aacf5df9a17ff57824c6971a0ab225b69b911bec0ba7bbb869" +version = "2.0.0" +source = "git+https://github.com/ZcashFoundation/frost.git?rev=ab8e2ef2f986480f079393729fb631ad44151aea#ab8e2ef2f986480f079393729fb631ad44151aea" dependencies = [ "byteorder", "const-crc32-nostd", @@ -417,9 +416,8 @@ dependencies = [ [[package]] name = "frost-rerandomized" -version = "2.0.0-rc.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb14a6054f9ce5aa4912c60c11392d42c43acec8295ee1df1f67a9d0b7a73ee" +version = "2.0.0" +source = "git+https://github.com/ZcashFoundation/frost.git?rev=ab8e2ef2f986480f079393729fb631ad44151aea#ab8e2ef2f986480f079393729fb631ad44151aea" dependencies = [ "derive-getters", "document-features", diff --git a/Cargo.toml b/Cargo.toml index 694b688..788f19b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,8 @@ pasta_curves = { version = "0.5", default-features = false } rand_core = { version = "0.6", default-features = false } serde = { version = "1", optional = true, features = ["derive"] } thiserror = { version = "1.0", optional = true } -frost-rerandomized = { version = "2.0.0-rc.0", optional = true, default-features = false, features = ["serialization", "cheater-detection"] } +# frost-rerandomized = { version = "2.0.0", optional = true, default-features = false, features = ["serialization", "cheater-detection"] } +frost-rerandomized = { git = "https://github.com/ZcashFoundation/frost.git", rev = "ab8e2ef2f986480f079393729fb631ad44151aea", optional = true, default-features = false, features = ["serialization", "cheater-detection"] } [dependencies.zeroize] version = "1" @@ -50,7 +51,8 @@ rand_chacha = "0.3" serde_json = "1.0" num-bigint = "0.4.6" num-traits = "0.2.19" -frost-rerandomized = { version = "2.0.0-rc.0", features = ["test-impl"] } +# frost-rerandomized = { version = "2.0.0", features = ["test-impl"] } +frost-rerandomized = { git = "https://github.com/ZcashFoundation/frost.git", rev = "ab8e2ef2f986480f079393729fb631ad44151aea", features = ["test-impl"] } # `alloc` is only used in test code [dev-dependencies.pasta_curves] diff --git a/src/frost/redjubjub.rs b/src/frost/redjubjub.rs index 2a20459..0cc9473 100644 --- a/src/frost/redjubjub.rs +++ b/src/frost/redjubjub.rs @@ -343,14 +343,36 @@ pub mod round2 { /// /// Assumes the participant has already determined which nonce corresponds with /// the commitment that was assigned by the coordinator in the SigningPackage. + #[deprecated( + note = "switch to sign_with_randomizer_seed(), passing a seed generated with RandomizedParams::new_from_commitments()" + )] pub fn sign( signing_package: &SigningPackage, signer_nonces: &round1::SigningNonces, key_package: &keys::KeyPackage, randomizer: Randomizer, ) -> Result { + #[allow(deprecated)] frost_rerandomized::sign(signing_package, signer_nonces, key_package, randomizer) } + + /// Re-randomized FROST signing using the given `randomizer_seed`, which should + /// be sent from the Coordinator using a confidential channel. + /// + /// See [`frost::round2::sign`] for documentation on the other parameters. + pub fn sign_with_randomizer_seed( + signing_package: &SigningPackage, + signer_nonces: &round1::SigningNonces, + key_package: &keys::KeyPackage, + randomizer_seed: &[u8], + ) -> Result { + frost_rerandomized::sign_with_randomizer_seed( + signing_package, + signer_nonces, + key_package, + randomizer_seed, + ) + } } /// A Schnorr signature on FROST(Jubjub, BLAKE2b-512). diff --git a/src/frost/redpallas.rs b/src/frost/redpallas.rs index c788d16..b4b02f4 100644 --- a/src/frost/redpallas.rs +++ b/src/frost/redpallas.rs @@ -326,8 +326,7 @@ pub mod keys { /// Convert the given type to make sure the group public key has an even /// Y coordinate. `is_even` can be specified if evenness was already - /// determined beforehand. Returns a boolean indicating if the original - /// type had an even Y, and a (possibly converted) value with even Y. + /// determined beforehand. fn into_even_y(self, is_even: Option) -> Self; } @@ -502,14 +501,36 @@ pub mod round2 { /// /// Assumes the participant has already determined which nonce corresponds with /// the commitment that was assigned by the coordinator in the SigningPackage. + #[deprecated( + note = "switch to sign_with_randomizer_seed(), passing a seed generated with RandomizedParams::new_from_commitments()" + )] pub fn sign( signing_package: &SigningPackage, signer_nonces: &round1::SigningNonces, key_package: &keys::KeyPackage, randomizer: Randomizer, ) -> Result { + #[allow(deprecated)] frost_rerandomized::sign(signing_package, signer_nonces, key_package, randomizer) } + + /// Re-randomized FROST signing using the given `randomizer_seed`, which should + /// be sent from the Coordinator using a confidential channel. + /// + /// See [`frost::round2::sign`] for documentation on the other parameters. + pub fn sign_with_randomizer_seed( + signing_package: &SigningPackage, + signer_nonces: &round1::SigningNonces, + key_package: &keys::KeyPackage, + randomizer_seed: &[u8], + ) -> Result { + frost_rerandomized::sign_with_randomizer_seed( + signing_package, + signer_nonces, + key_package, + randomizer_seed, + ) + } } /// A Schnorr signature on FROST(Pallas, BLAKE2b-512).