mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 20:59:23 +00:00
Update to FROST v10
Further expands documentation to near-completion.
This commit is contained in:
@@ -8,8 +8,10 @@ use transcript::Transcript;
|
||||
use crate::{Curve, FrostError, FrostView, schnorr};
|
||||
pub use schnorr::SchnorrSignature;
|
||||
|
||||
/// Algorithm to use FROST with.
|
||||
/// Algorithm trait usable by the FROST signing machine to produce signatures..
|
||||
pub trait Algorithm<C: Curve>: Clone {
|
||||
/// The transcript format this algorithm uses. This likely should NOT be the IETF-compatible
|
||||
/// transcript included in this crate.
|
||||
type Transcript: Transcript + Clone + Debug;
|
||||
/// The resulting type of the signatures this algorithm will produce.
|
||||
type Signature: Clone + PartialEq + Debug;
|
||||
@@ -58,7 +60,8 @@ pub trait Algorithm<C: Curve>: Clone {
|
||||
fn verify_share(&self, verification_share: C::G, nonces: &[Vec<C::G>], share: C::F) -> bool;
|
||||
}
|
||||
|
||||
// Transcript which will create an IETF compliant serialization for the binding factor
|
||||
/// IETF-compliant transcript. This is incredibly naive and should not be used within larger
|
||||
/// protocols.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct IetfTranscript(Vec<u8>);
|
||||
impl Transcript for IetfTranscript {
|
||||
@@ -83,13 +86,15 @@ impl Transcript for IetfTranscript {
|
||||
}
|
||||
}
|
||||
|
||||
/// HRAm usable by the included Schnorr signature algorithm to generate challenges.
|
||||
pub trait Hram<C: Curve>: Clone {
|
||||
/// HRAM function to generate a challenge.
|
||||
/// HRAm function to generate a challenge.
|
||||
/// H2 from the IETF draft, despite having a different argument set (not being pre-formatted).
|
||||
#[allow(non_snake_case)]
|
||||
fn hram(R: &C::G, A: &C::G, m: &[u8]) -> C::F;
|
||||
}
|
||||
|
||||
/// IETF-compliant Schnorr signature algorithm ((R, s) where s = r + cx).
|
||||
#[derive(Clone)]
|
||||
pub struct Schnorr<C: Curve, H: Hram<C>> {
|
||||
transcript: IetfTranscript,
|
||||
@@ -109,7 +114,6 @@ impl<C: Curve, H: Hram<C>> Schnorr<C, H> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Implementation of Schnorr signatures for use with FROST.
|
||||
impl<C: Curve, H: Hram<C>> Algorithm<C> for Schnorr<C, H> {
|
||||
type Transcript = IetfTranscript;
|
||||
type Signature = SchnorrSignature<C>;
|
||||
|
||||
Reference in New Issue
Block a user