Trait modular_frost::algorithm::Algorithm

source ·
pub trait Algorithm<C: Curve>: Send + Sync + Clone {
    type Transcript: Sync + Clone + Debug + Transcript;
    type Addendum: Addendum;
    type Signature: Clone + PartialEq + Debug;

    // Required methods
    fn transcript(&mut self) -> &mut Self::Transcript;
    fn nonces(&self) -> Vec<Vec<C::G>>;
    fn preprocess_addendum<R: RngCore + CryptoRng>(
        &mut self,
        rng: &mut R,
        keys: &ThresholdKeys<C>,
    ) -> Self::Addendum;
    fn read_addendum<R: Read>(&self, reader: &mut R) -> Result<Self::Addendum>;
    fn process_addendum(
        &mut self,
        params: &ThresholdView<C>,
        l: Participant,
        reader: Self::Addendum,
    ) -> Result<(), FrostError>;
    fn sign_share(
        &mut self,
        params: &ThresholdView<C>,
        nonce_sums: &[Vec<C::G>],
        nonces: Vec<Zeroizing<C::F>>,
        msg: &[u8],
    ) -> C::F;
    fn verify(
        &self,
        group_key: C::G,
        nonces: &[Vec<C::G>],
        sum: C::F,
    ) -> Option<Self::Signature>;
    fn verify_share(
        &self,
        verification_share: C::G,
        nonces: &[Vec<C::G>],
        share: C::F,
    ) -> Result<Vec<(C::F, C::G)>, ()>;
}
Expand description

Algorithm trait usable by the FROST signing machine to produce signatures..

Required Associated Types§

source

type Transcript: Sync + Clone + Debug + Transcript

The transcript format this algorithm uses. This likely should NOT be the IETF-compatible transcript included in this crate.

source

type Addendum: Addendum

Serializable addendum, used in algorithms requiring more data than just the nonces.

source

type Signature: Clone + PartialEq + Debug

The resulting type of the signatures this algorithm will produce.

Required Methods§

source

fn transcript(&mut self) -> &mut Self::Transcript

Obtain a mutable borrow of the underlying transcript.

source

fn nonces(&self) -> Vec<Vec<C::G>>

Obtain the list of nonces to generate, as specified by the generators to create commitments against per-nonce.

The Algorithm is responsible for all transcripting of these nonce specifications/generators.

The prover will be passed the commitments, and the commitments will be sent to all other participants. No guarantees the commitments are internally consistent (have the same discrete logarithm across generators) are made. Any Algorithm which specifies multiple generators for a single nonce must handle that itself.

source

fn preprocess_addendum<R: RngCore + CryptoRng>( &mut self, rng: &mut R, keys: &ThresholdKeys<C>, ) -> Self::Addendum

Generate an addendum to FROST“s preprocessing stage.

source

fn read_addendum<R: Read>(&self, reader: &mut R) -> Result<Self::Addendum>

Read an addendum from a reader.

source

fn process_addendum( &mut self, params: &ThresholdView<C>, l: Participant, reader: Self::Addendum, ) -> Result<(), FrostError>

Process the addendum for the specified participant. Guaranteed to be called in order.

source

fn sign_share( &mut self, params: &ThresholdView<C>, nonce_sums: &[Vec<C::G>], nonces: Vec<Zeroizing<C::F>>, msg: &[u8], ) -> C::F

Sign a share with the given secret/nonce. The secret will already have been its lagrange coefficient applied so it is the necessary key share. The nonce will already have been processed into the combined form d + (e * p).

source

fn verify( &self, group_key: C::G, nonces: &[Vec<C::G>], sum: C::F, ) -> Option<Self::Signature>

Verify a signature.

source

fn verify_share( &self, verification_share: C::G, nonces: &[Vec<C::G>], share: C::F, ) -> Result<Vec<(C::F, C::G)>, ()>

Verify a specific share given as a response. This function should return a series of pairs whose products should sum to zero for a valid share. Any error raised is treated as the share being invalid.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<C: Curve, T: Sync + Clone + Debug + Transcript, H: Hram<C>> Algorithm<C> for Schnorr<C, T, H>