3.9.2 Better document rng_seed is allowed to conflict with challenge

This commit is contained in:
Luke Parker
2023-03-02 11:19:26 -05:00
parent 6fec95b1a7
commit 79124b9a33

View File

@@ -25,13 +25,19 @@ pub trait Transcript {
/// Append a message to the transcript. /// Append a message to the transcript.
fn append_message<M: AsRef<[u8]>>(&mut self, label: &'static [u8], message: M); fn append_message<M: AsRef<[u8]>>(&mut self, label: &'static [u8], message: M);
/// Produce a challenge. This MUST update the transcript as it does so, preventing the same /// Produce a challenge.
/// challenge from being generated multiple times. ///
/// Implementors MUST update the transcript as it does so, preventing the same challenge from
/// being generated multiple times.
fn challenge(&mut self, label: &'static [u8]) -> Self::Challenge; fn challenge(&mut self, label: &'static [u8]) -> Self::Challenge;
/// Produce a RNG seed. Helper function for parties needing to generate random data from an /// Produce a RNG seed.
/// agreed upon state. Internally calls the challenge function for the needed bytes, converting ///
/// them to the seed format rand_core expects. /// Helper function for parties needing to generate random data from an agreed upon state.
///
/// Implementors MAY internally call the challenge function for the needed bytes, and accordingly
/// produce a transcript conflict between two transcripts, one which called challenge(label) and
/// one which called rng_seed(label) at the same point.
fn rng_seed(&mut self, label: &'static [u8]) -> [u8; 32]; fn rng_seed(&mut self, label: &'static [u8]) -> [u8; 32];
} }