Skip to content

Commit

Permalink
round_two signing that produces signature share after cooridnator ass…
Browse files Browse the repository at this point in the history
…embles commitments from participants (#4558)
  • Loading branch information
jowparks authored Jan 18, 2024
1 parent dbbab1b commit 44422d2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions ironfish-rust/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub enum IronfishErrorKind {
Io,
IsSmallOrder,
RandomnessError,
RoundTwoSigningFailure,
TryFromInt,
Utf8,
}
Expand Down
1 change: 1 addition & 0 deletions ironfish-rust/src/frost_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

pub mod round_one;
pub mod round_two;
pub mod split_secret;
27 changes: 27 additions & 0 deletions ironfish-rust/src/frost_utils/round_two.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

use ironfish_frost::frost::{
self,
keys::KeyPackage,
round1::SigningNonces,
round2::{Randomizer, SignatureShare},
SigningPackage,
};
use rand::{rngs::StdRng, SeedableRng};

use crate::errors::{IronfishError, IronfishErrorKind};

// Wrapper around frost::round2::sign that provides a seedable rng from u64
pub fn round_two(
signing_package: SigningPackage,
key_package: KeyPackage,
randomizer: Randomizer,
seed: u64,
) -> Result<SignatureShare, IronfishError> {
let mut rng = StdRng::seed_from_u64(seed);
let signer_nonces = SigningNonces::new(key_package.signing_share(), &mut rng);
frost::round2::sign(&signing_package, &signer_nonces, &key_package, randomizer)
.map_err(|_| IronfishError::new(IronfishErrorKind::RoundTwoSigningFailure))
}

0 comments on commit 44422d2

Please sign in to comment.