Make oprf::generate_oprf1 generic in the Digest, as long as it matches the hash-to-curve intake of the group
We used to have three problems: - overuse of the <Sha256 as Digest>::OutputSize, which is just, well, U32. Sometimes used as a parameter (as in generate_oprf1), sometimes as a constant (as in generate_oprf3). - the `hash_to_curve` operation for `RistrettoPoint` which requires 64 bits of input entropy, is fed 64 bits of which the last 32 are zero, - the `hash_to_curve` operation for `Curve25519Point` which requires 32 bits of input entropy, is fed 64 bits of which the last 32 are discarded, This corrects all three and uses U32 where the size of the digest is not meant to be a constraint. Addresses #15 partially.
This commit is contained in:
+10
-5
@@ -9,17 +9,22 @@ use crate::{
|
||||
errors::InternalPakeError,
|
||||
group::Group,
|
||||
keypair::{Key, KeyPair},
|
||||
oprf::HkdfDigest,
|
||||
slow_hash::SlowHash,
|
||||
};
|
||||
use generic_array::typenum::{U32, U64};
|
||||
use digest::FixedOutput;
|
||||
use generic_array::typenum::{U32};
|
||||
use rand_core::{CryptoRng, RngCore};
|
||||
|
||||
/// Configures the underlying primitives used in OPAQUE
|
||||
/// * Group: a finite cyclic group along with a point representation
|
||||
/// * KeyFormat: a keypair type composed of public and private components
|
||||
/// * SlowHash: a slow hashing function, typically used for password hashing
|
||||
/// * `Digest`: a digest suitable for use in an Hkdf, with an output length equal
|
||||
/// to the input of the hash-to-curve function of the `Group` parameter.
|
||||
/// * `Group`: a finite cyclic group along with a point representation
|
||||
/// * `KeyFormat`: a keypair type composed of public and private components
|
||||
/// * `SlowHash`: a slow hashing function, typically used for password hashing
|
||||
pub trait CipherSuite {
|
||||
type Group: Group<ScalarLen = U32, UniformBytesLen = U64>;
|
||||
type Digest: HkdfDigest;
|
||||
type Group: Group<ScalarLen = U32, UniformBytesLen = <Self::Digest as FixedOutput>::OutputSize>;
|
||||
type KeyFormat: KeyPair<Repr = Key> + PartialEq;
|
||||
type SlowHash: SlowHash;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user