Update digest & hashes libraries to their latest versions

This commit is contained in:
François Garillot
2020-06-16 06:24:14 -07:00
parent aab8ff8e19
commit 4f9b7fe86f
8 changed files with 185 additions and 206 deletions
+11 -2
View File
@@ -15,6 +15,8 @@ use curve25519_dalek::ristretto::RistrettoPoint;
use chacha20poly1305::ChaCha20Poly1305;
use rand_core::{OsRng, RngCore};
use sha2::Digest;
use std::convert::TryFrom;
struct Default;
@@ -27,9 +29,16 @@ impl CipherSuite for Default {
fn random_ristretto_point() -> RistrettoPoint {
let mut rng = OsRng;
let mut random_bits = [0u8; 64];
rng.fill_bytes(&mut random_bits);
// This is because RistrettoPoint is on an obsolete sha2 version
let mut bits = [0u8; 64];
rng.fill_bytes(&mut bits);
RistrettoPoint::hash_from_bytes::<sha2::Sha512>(&bits)
let mut hasher = sha2::Sha512::new();
hasher.update(&random_bits[..]);
bits.copy_from_slice(&hasher.finalize());
RistrettoPoint::from_uniform_bytes(&bits)
}
#[test]