mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Remove rng_seed's additional entropy
It was never used as we derive entropy via the other fields in the transcript, and explicitly add fields directly as needed for entropy. Also drops an unused crate and corrects a bug in FROST's Schnorr implementation which used the Group's generator, instead of the Curve's. Also updates the Monero crate's description.
This commit is contained in:
@@ -14,7 +14,6 @@ rand_core = "0.6"
|
||||
ff = "0.11"
|
||||
group = "0.11"
|
||||
|
||||
blake2 = "0.10"
|
||||
transcript = { path = "../transcript" }
|
||||
|
||||
multiexp = { path = "../multiexp", features = ["batch"] }
|
||||
|
||||
@@ -72,7 +72,7 @@ impl Transcript for IetfTranscript {
|
||||
self.0.clone()
|
||||
}
|
||||
|
||||
fn rng_seed(&mut self, _: &'static [u8], _: Option<[u8; 32]>) -> [u8; 32] {
|
||||
fn rng_seed(&mut self, _: &'static [u8]) -> [u8; 32] {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use rand_core::{RngCore, CryptoRng};
|
||||
|
||||
use ff::Field;
|
||||
use group::Group;
|
||||
|
||||
use multiexp::BatchVerifier;
|
||||
|
||||
@@ -46,7 +45,7 @@ pub(crate) fn batch_verify<C: Curve, R: RngCore + CryptoRng>(
|
||||
rng: &mut R,
|
||||
triplets: &[(u16, C::G, C::F, SchnorrSignature<C>)]
|
||||
) -> Result<(), u16> {
|
||||
let mut values = [(C::F::one(), C::G::generator()); 3];
|
||||
let mut values = [(C::F::one(), C::generator()); 3];
|
||||
let mut batch = BatchVerifier::new(triplets.len(), C::little_endian());
|
||||
for triple in triplets {
|
||||
// s = r + ca
|
||||
|
||||
@@ -11,7 +11,7 @@ pub trait Transcript {
|
||||
fn domain_separate(&mut self, label: &[u8]);
|
||||
fn append_message(&mut self, label: &'static [u8], message: &[u8]);
|
||||
fn challenge(&mut self, label: &'static [u8]) -> Vec<u8>;
|
||||
fn rng_seed(&mut self, label: &'static [u8], additional_entropy: Option<[u8; 32]>) -> [u8; 32];
|
||||
fn rng_seed(&mut self, label: &'static [u8]) -> [u8; 32];
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -49,11 +49,7 @@ impl<D: Digest> Transcript for DigestTranscript<D> {
|
||||
D::new().chain_update(&self.0).finalize().to_vec()
|
||||
}
|
||||
|
||||
fn rng_seed(&mut self, label: &'static [u8], additional_entropy: Option<[u8; 32]>) -> [u8; 32] {
|
||||
if additional_entropy.is_some() {
|
||||
self.append_message(b"additional_entropy", &additional_entropy.unwrap());
|
||||
}
|
||||
|
||||
fn rng_seed(&mut self, label: &'static [u8]) -> [u8; 32] {
|
||||
let mut seed = [0; 32];
|
||||
seed.copy_from_slice(&self.challenge(label)[0 .. 32]);
|
||||
seed
|
||||
|
||||
@@ -30,11 +30,7 @@ impl Transcript for MerlinTranscript {
|
||||
challenge
|
||||
}
|
||||
|
||||
fn rng_seed(&mut self, label: &'static [u8], additional_entropy: Option<[u8; 32]>) -> [u8; 32] {
|
||||
if additional_entropy.is_some() {
|
||||
transcript.append_message(b"additional_entropy", &additional_entropy.unwrap());
|
||||
}
|
||||
|
||||
fn rng_seed(&mut self, label: &'static [u8]) -> [u8; 32] {
|
||||
let mut seed = [0; 32];
|
||||
transcript.challenge_bytes(label, &mut seed);
|
||||
seed
|
||||
|
||||
Reference in New Issue
Block a user