diff --git a/src/opaque.rs b/src/opaque.rs index 6600407..2fe0a33 100644 --- a/src/opaque.rs +++ b/src/opaque.rs @@ -251,7 +251,7 @@ impl LoginThirdMessage { /// The state elements the client holds to register itself pub struct ClientRegistration { /// a blinding factor - pub(crate) blinding_factor: <::Group as Group>::Scalar, + pub(crate) blinding_factor: ::Scalar, /// the client's password password: Vec, } @@ -261,7 +261,7 @@ impl TryFrom<&[u8]> for ClientRegistration { fn try_from(bytes: &[u8]) -> Result { // Check that the message is actually containing an element of the // correct subgroup - let scalar_len = <::Group as Group>::ScalarLen::to_usize(); + let scalar_len = ::ScalarLen::to_usize(); let blinding_factor_bytes = GenericArray::from_slice(&bytes[..scalar_len]); let blinding_factor = CS::Group::from_scalar_slice(blinding_factor_bytes)?; let password = bytes[scalar_len..].to_vec(); @@ -365,7 +365,7 @@ impl ClientRegistration { pub fn finish( self, r2: RegisterSecondMessage, - server_s_pk: &<::KeyFormat as KeyPair>::Repr, + server_s_pk: &::Repr, rng: &mut R, ) -> Result, ProtocolError> { let client_static_keypair = CS::KeyFormat::generate_random(rng)?; @@ -424,24 +424,24 @@ impl Drop for ClientLogin { /// The state elements the server holds to record a registration pub struct ServerRegistration { envelope: Option, - client_s_pk: Option<<::KeyFormat as KeyPair>::Repr>, - pub(crate) oprf_key: <::Group as Group>::Scalar, + client_s_pk: Option<::Repr>, + pub(crate) oprf_key: ::Scalar, } impl TryFrom<&[u8]> for ServerRegistration where - <<::KeyFormat as KeyPair>::Repr as SizedBytes>::Len: - std::ops::Add<<<::KeyFormat as KeyPair>::Repr as SizedBytes>::Len>, + <::Repr as SizedBytes>::Len: + std::ops::Add<<::Repr as SizedBytes>::Len>, generic_array::typenum::Sum< - <<::KeyFormat as KeyPair>::Repr as SizedBytes>::Len, - <<::KeyFormat as KeyPair>::Repr as SizedBytes>::Len, + <::Repr as SizedBytes>::Len, + <::Repr as SizedBytes>::Len, >: generic_array::ArrayLength, { type Error = ProtocolError; fn try_from(server_registration_bytes: &[u8]) -> Result { let key_len = - <<::KeyFormat as KeyPair>::Repr as SizedBytes>::Len::to_usize(); - let scalar_len = <::Group as Group>::ScalarLen::to_usize(); + <::Repr as SizedBytes>::Len::to_usize(); + let scalar_len = ::ScalarLen::to_usize(); let envelope_size = key_len + Envelope::additional_size(); if server_registration_bytes.len() == scalar_len { @@ -461,7 +461,7 @@ where )?; let oprf_key_bytes = GenericArray::from_slice(&checked_bytes[..scalar_len]); let oprf_key = CS::Group::from_scalar_slice(oprf_key_bytes)?; - let unchecked_client_s_pk = <::KeyFormat as KeyPair>::Repr::from_bytes( + let unchecked_client_s_pk = ::Repr::from_bytes( &checked_bytes[scalar_len..scalar_len + key_len], )?; let client_s_pk = CS::KeyFormat::check_public_key(unchecked_client_s_pk)?; @@ -477,11 +477,11 @@ where impl ServerRegistration where - <<::KeyFormat as KeyPair>::Repr as SizedBytes>::Len: - std::ops::Add<<<::KeyFormat as KeyPair>::Repr as SizedBytes>::Len>, + <::Repr as SizedBytes>::Len: + std::ops::Add<<::Repr as SizedBytes>::Len>, generic_array::typenum::Sum< - <<::KeyFormat as KeyPair>::Repr as SizedBytes>::Len, - <<::KeyFormat as KeyPair>::Repr as SizedBytes>::Len, + <::Repr as SizedBytes>::Len, + <::Repr as SizedBytes>::Len, >: generic_array::ArrayLength, { pub fn to_bytes(&self) -> Vec { @@ -594,7 +594,7 @@ pub struct ClientLogin { _key_format: PhantomData, /// A blinding factor, which is used to mask (and unmask) secret /// information before transmission - blinding_factor: <::Group as Group>::Scalar, + blinding_factor: ::Scalar, /// The user's password password: Vec, ke1_state: KE1State, @@ -603,7 +603,7 @@ pub struct ClientLogin { impl TryFrom<&[u8]> for ClientLogin { type Error = ProtocolError; fn try_from(bytes: &[u8]) -> Result { - let scalar_len = <::Group as Group>::ScalarLen::to_usize(); + let scalar_len = ::ScalarLen::to_usize(); let blinding_factor_bytes = GenericArray::from_slice(&bytes[..scalar_len]); let blinding_factor = CS::Group::from_scalar_slice(blinding_factor_bytes)?; let ke1_state = KE1State::try_from(&bytes[scalar_len..scalar_len + KE1_STATE_LEN])?; @@ -716,7 +716,7 @@ impl ClientLogin { pub fn finish( self, l2: LoginSecondMessage, - server_s_pk: &<::KeyFormat as KeyPair>::Repr, + server_s_pk: &::Repr, _client_e_sk_rng: &mut R, ) -> Result { let l2_bytes: Vec = [l2.beta.to_bytes().as_slice(), &l2.envelope.to_bytes()].concat();