fix misuse of constants in KE2Message

This commit is contained in:
François Garillot
2020-09-19 19:16:34 -04:00
parent 3c2a208606
commit 887b4577fa
2 changed files with 9 additions and 7 deletions
+2 -3
View File
@@ -9,7 +9,6 @@
use crate::group::Group;
use curve25519_dalek::{edwards::EdwardsPoint, ristretto::RistrettoPoint};
use generic_array::GenericArray;
use hkdf::Hkdf;
use sha2::{Sha256, Sha512};
@@ -22,13 +21,13 @@ pub trait GroupWithMapToCurve: Group {
impl GroupWithMapToCurve for RistrettoPoint {
fn map_to_curve(password: &[u8], pepper: Option<&[u8]>) -> Self {
let (hashed_input, _) = Hkdf::<Sha512>::extract(pepper, password);
<Self as Group>::hash_to_curve(GenericArray::from_slice(&hashed_input))
<Self as Group>::hash_to_curve(&hashed_input)
}
}
impl GroupWithMapToCurve for EdwardsPoint {
fn map_to_curve(password: &[u8], pepper: Option<&[u8]>) -> Self {
let (hashed_input, _) = Hkdf::<Sha256>::extract(pepper, password);
<Self as Group>::hash_to_curve(GenericArray::from_slice(&hashed_input))
<Self as Group>::hash_to_curve(&hashed_input)
}
}