mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-22 19:49:22 +00:00
3.6.7 Seal IetfTranscript
This commit is contained in:
parent
5a3406bb5f
commit
a42a84e1e8
1 changed files with 24 additions and 19 deletions
|
@ -87,32 +87,37 @@ pub trait Algorithm<C: Curve>: Clone {
|
||||||
) -> Result<Vec<(C::F, C::G)>, ()>;
|
) -> Result<Vec<(C::F, C::G)>, ()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// IETF-compliant transcript. This is incredibly naive and should not be used within larger
|
mod sealed {
|
||||||
/// protocols.
|
pub use super::*;
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
pub struct IetfTranscript(Vec<u8>);
|
|
||||||
impl Transcript for IetfTranscript {
|
|
||||||
type Challenge = Vec<u8>;
|
|
||||||
|
|
||||||
fn new(_: &'static [u8]) -> IetfTranscript {
|
/// IETF-compliant transcript. This is incredibly naive and should not be used within larger
|
||||||
IetfTranscript(vec![])
|
/// protocols.
|
||||||
}
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct IetfTranscript(pub(crate) Vec<u8>);
|
||||||
|
impl Transcript for IetfTranscript {
|
||||||
|
type Challenge = Vec<u8>;
|
||||||
|
|
||||||
fn domain_separate(&mut self, _: &[u8]) {}
|
fn new(_: &'static [u8]) -> IetfTranscript {
|
||||||
|
IetfTranscript(vec![])
|
||||||
|
}
|
||||||
|
|
||||||
fn append_message<M: AsRef<[u8]>>(&mut self, _: &'static [u8], message: M) {
|
fn domain_separate(&mut self, _: &[u8]) {}
|
||||||
self.0.extend(message.as_ref());
|
|
||||||
}
|
|
||||||
|
|
||||||
fn challenge(&mut self, _: &'static [u8]) -> Vec<u8> {
|
fn append_message<M: AsRef<[u8]>>(&mut self, _: &'static [u8], message: M) {
|
||||||
self.0.clone()
|
self.0.extend(message.as_ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
// FROST won't use this and this shouldn't be used outside of FROST
|
fn challenge(&mut self, _: &'static [u8]) -> Vec<u8> {
|
||||||
fn rng_seed(&mut self, _: &'static [u8]) -> [u8; 32] {
|
self.0.clone()
|
||||||
unimplemented!()
|
}
|
||||||
|
|
||||||
|
// FROST won't use this and this shouldn't be used outside of FROST
|
||||||
|
fn rng_seed(&mut self, _: &'static [u8]) -> [u8; 32] {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub(crate) use sealed::IetfTranscript;
|
||||||
|
|
||||||
/// HRAm usable by the included Schnorr signature algorithm to generate challenges.
|
/// HRAm usable by the included Schnorr signature algorithm to generate challenges.
|
||||||
pub trait Hram<C: Curve>: Clone {
|
pub trait Hram<C: Curve>: Clone {
|
||||||
|
|
Loading…
Reference in a new issue