mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
chore(deps): bump rand_core to 0.10.0-rc-5 (#870)
This commit is contained in:
parent
e5a7986970
commit
56a6bc07b8
6 changed files with 26 additions and 18 deletions
|
|
@ -14,5 +14,3 @@ opt-level = 2
|
|||
curve25519-dalek-derive = { path = "./curve25519-dalek-derive" }
|
||||
curve25519-dalek = { path = "./curve25519-dalek" }
|
||||
x25519-dalek = { path = "./x25519-dalek" }
|
||||
|
||||
rand = { git = "https://github.com/rust-random/rand", rev = "ff07ec205347dd749a586aaee7218cb21590ea4c" }
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ bincode = "1"
|
|||
criterion = { version = "0.5", features = ["html_reports"] }
|
||||
hex = "0.4.2"
|
||||
proptest = "1"
|
||||
rand = "0.10.0-rc.5"
|
||||
rand = "0.10.0-rc.7"
|
||||
|
||||
[build-dependencies]
|
||||
rustc_version = "0.4.0"
|
||||
|
|
@ -49,7 +49,7 @@ required-features = ["alloc", "rand_core"]
|
|||
cfg-if = "1"
|
||||
ff = { version = "=0.14.0-pre.0", package = "rustcrypto-ff", default-features = false, optional = true }
|
||||
group = { version = "=0.14.0-pre.0", package = "rustcrypto-group", default-features = false, optional = true }
|
||||
rand_core = { version = "0.10.0-rc-3", default-features = false, optional = true }
|
||||
rand_core = { version = "0.10.0-rc-5", default-features = false, optional = true }
|
||||
digest = { version = "0.11.0-rc.4", default-features = false, optional = true, features = [
|
||||
"block-api",
|
||||
] }
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ subtle = { version = "2.3.0", default-features = false }
|
|||
|
||||
# optional features
|
||||
keccak = { version = "0.2.0-rc.0", default-features = false, optional = true }
|
||||
rand_core = { version = "0.10.0-rc-3", default-features = false, optional = true }
|
||||
rand_core = { version = "0.10.0-rc-5", default-features = false, optional = true }
|
||||
serde = { version = "1.0", default-features = false, optional = true }
|
||||
zeroize = { version = "1.5", default-features = false, optional = true }
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ bincode = "1.0"
|
|||
serde_json = "1.0"
|
||||
criterion = { version = "0.5", features = ["html_reports"] }
|
||||
hex-literal = "1"
|
||||
rand = { version = "0.10.0-rc.5", features = ["chacha"] }
|
||||
rand = { version = "0.10.0-rc.7", features = ["chacha"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
strobe-rs = "0.5"
|
||||
toml = { version = "0.9" }
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ mod transcript;
|
|||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use core::convert::Infallible;
|
||||
use core::iter::once;
|
||||
|
||||
use curve25519_dalek::constants;
|
||||
|
|
@ -48,12 +49,14 @@ const MERLIN_PROTOCOL_LABEL: &[u8] = b"Merlin v1.0";
|
|||
/// yields a PRG whose input is the hashed transcript.
|
||||
struct ZeroRng;
|
||||
|
||||
impl rand_core::RngCore for ZeroRng {
|
||||
fn next_u32(&mut self) -> u32 {
|
||||
impl rand_core::TryRngCore for ZeroRng {
|
||||
type Error = Infallible;
|
||||
|
||||
fn try_next_u32(&mut self) -> Result<u32, Self::Error> {
|
||||
rand_core::utils::next_word_via_fill(self)
|
||||
}
|
||||
|
||||
fn next_u64(&mut self) -> u64 {
|
||||
fn try_next_u64(&mut self) -> Result<u64, Self::Error> {
|
||||
rand_core::utils::next_word_via_fill(self)
|
||||
}
|
||||
|
||||
|
|
@ -65,11 +68,13 @@ impl rand_core::RngCore for ZeroRng {
|
|||
/// STROBE state based on external randomness, we're doing an
|
||||
/// `ENC_{state}(00000000000000000000000000000000)` operation, which is
|
||||
/// identical to the STROBE `MAC` operation.
|
||||
fn fill_bytes(&mut self, _dest: &mut [u8]) {}
|
||||
fn try_fill_bytes(&mut self, _dest: &mut [u8]) -> Result<(), Self::Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
// `TranscriptRngBuilder::finalize()` requires a `CryptoRng`
|
||||
impl rand_core::CryptoRng for ZeroRng {}
|
||||
impl rand_core::TryCryptoRng for ZeroRng {}
|
||||
|
||||
// We write our own gen() function so we don't need to pull in the rand crate
|
||||
fn gen_u128<R: RngCore>(rng: &mut R) -> u128 {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use super::MERLIN_PROTOCOL_LABEL;
|
||||
use super::strobe::Strobe128;
|
||||
use core::convert::Infallible;
|
||||
|
||||
fn encode_usize_as_u32(x: usize) -> [u8; 4] {
|
||||
u32::try_from(x).expect("usize too large").to_le_bytes()
|
||||
|
|
@ -185,23 +186,27 @@ pub struct TranscriptRng {
|
|||
strobe: Strobe128,
|
||||
}
|
||||
|
||||
impl rand_core::RngCore for TranscriptRng {
|
||||
fn next_u32(&mut self) -> u32 {
|
||||
impl rand_core::TryRngCore for TranscriptRng {
|
||||
type Error = Infallible;
|
||||
|
||||
fn try_next_u32(&mut self) -> Result<u32, Self::Error> {
|
||||
rand_core::utils::next_word_via_fill(self)
|
||||
}
|
||||
|
||||
fn next_u64(&mut self) -> u64 {
|
||||
fn try_next_u64(&mut self) -> Result<u64, Self::Error> {
|
||||
rand_core::utils::next_word_via_fill(self)
|
||||
}
|
||||
|
||||
fn fill_bytes(&mut self, dest: &mut [u8]) {
|
||||
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Self::Error> {
|
||||
let dest_len = encode_usize_as_u32(dest.len());
|
||||
self.strobe.meta_ad(&dest_len, false);
|
||||
self.strobe.prf(dest, false);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl rand_core::CryptoRng for TranscriptRng {}
|
||||
impl rand_core::TryCryptoRng for TranscriptRng {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ all-features = true
|
|||
|
||||
[dependencies]
|
||||
curve25519-dalek = { version = "=5.0.0-pre.4", default-features = false }
|
||||
rand_core = { version = "0.10.0-rc-3", default-features = false }
|
||||
rand_core = { version = "0.10.0-rc-5", default-features = false }
|
||||
|
||||
# optional dependencies
|
||||
getrandom = { version = "0.4.0-rc.0", optional = true }
|
||||
|
|
@ -53,7 +53,7 @@ zeroize = { version = "1", default-features = false, optional = true }
|
|||
[dev-dependencies]
|
||||
bincode = "1"
|
||||
criterion = "0.5"
|
||||
rand = "0.10.0-rc.5"
|
||||
rand = "0.10.0-rc.7"
|
||||
|
||||
[[bench]]
|
||||
name = "x25519"
|
||||
|
|
|
|||
Loading…
Reference in a new issue