mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-22 19:49:22 +00:00
Add 'static/Send/Sync to specific traits in crypto
These were proven necessary by our real world usage.
This commit is contained in:
parent
2729882d65
commit
0bbf511062
3 changed files with 10 additions and 8 deletions
|
@ -42,7 +42,9 @@ mod ed448;
|
|||
pub use ed448::*;
|
||||
|
||||
/// Unified trait defining a ciphersuite around an elliptic curve.
|
||||
pub trait Ciphersuite: Clone + Copy + PartialEq + Eq + Debug + Zeroize {
|
||||
pub trait Ciphersuite:
|
||||
'static + Send + Sync + Clone + Copy + PartialEq + Eq + Debug + Zeroize
|
||||
{
|
||||
/// Scalar field element type.
|
||||
// This is available via G::Scalar yet `C::G::Scalar` is ambiguous, forcing horrific accesses
|
||||
type F: PrimeField + PrimeFieldBits + Zeroize;
|
||||
|
|
|
@ -21,11 +21,11 @@ impl WriteAddendum for () {
|
|||
}
|
||||
|
||||
/// Trait alias for the requirements to be used as an addendum.
|
||||
pub trait Addendum: Clone + PartialEq + Debug + WriteAddendum {}
|
||||
impl<A: Clone + PartialEq + Debug + WriteAddendum> Addendum for A {}
|
||||
pub trait Addendum: Send + Clone + PartialEq + Debug + WriteAddendum {}
|
||||
impl<A: Send + Clone + PartialEq + Debug + WriteAddendum> Addendum for A {}
|
||||
|
||||
/// Algorithm trait usable by the FROST signing machine to produce signatures..
|
||||
pub trait Algorithm<C: Curve>: Clone {
|
||||
pub trait Algorithm<C: Curve>: Send + Clone {
|
||||
/// The transcript format this algorithm uses. This likely should NOT be the IETF-compatible
|
||||
/// transcript included in this crate.
|
||||
type Transcript: Clone + Debug + Transcript;
|
||||
|
@ -120,7 +120,7 @@ mod sealed {
|
|||
pub(crate) use sealed::IetfTranscript;
|
||||
|
||||
/// HRAm usable by the included Schnorr signature algorithm to generate challenges.
|
||||
pub trait Hram<C: Curve>: Clone {
|
||||
pub trait Hram<C: Curve>: Send + Clone {
|
||||
/// 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)]
|
||||
|
|
|
@ -89,7 +89,7 @@ impl<C: Curve, A: Addendum> Writable for Preprocess<C, A> {
|
|||
pub struct CachedPreprocess(pub Zeroizing<[u8; 32]>);
|
||||
|
||||
/// Trait for the initial state machine of a two-round signing protocol.
|
||||
pub trait PreprocessMachine {
|
||||
pub trait PreprocessMachine: Send {
|
||||
/// Preprocess message for this machine.
|
||||
type Preprocess: Clone + PartialEq + Writable;
|
||||
/// Signature produced by this machine.
|
||||
|
@ -203,7 +203,7 @@ impl<C: Curve> SignatureShare<C> {
|
|||
}
|
||||
|
||||
/// Trait for the second machine of a two-round signing protocol.
|
||||
pub trait SignMachine<S>: Sized {
|
||||
pub trait SignMachine<S>: Send + Sized {
|
||||
/// Params used to instantiate this machine which can be used to rebuild from a cache.
|
||||
type Params: Clone;
|
||||
/// Keys used for signing operations.
|
||||
|
@ -436,7 +436,7 @@ impl<C: Curve, A: Algorithm<C>> SignMachine<A::Signature> for AlgorithmSignMachi
|
|||
}
|
||||
|
||||
/// Trait for the final machine of a two-round signing protocol.
|
||||
pub trait SignatureMachine<S> {
|
||||
pub trait SignatureMachine<S>: Send {
|
||||
/// SignatureShare message for this machine.
|
||||
type SignatureShare: Clone + PartialEq + Writable;
|
||||
|
||||
|
|
Loading…
Reference in a new issue