Updating to 0.5 with removing generic_bytes_derive (#150)
This commit is contained in:
+1
-3
@@ -9,7 +9,6 @@ use crate::errors::InternalPakeError;
|
||||
use crate::group::Group;
|
||||
use generic_array::{typenum::U32, GenericArray};
|
||||
use generic_bytes::{SizedBytes, TryFromSizedBytesError};
|
||||
use generic_bytes_derive::TryFromForSizedBytes;
|
||||
#[cfg(test)]
|
||||
use proptest::prelude::*;
|
||||
#[cfg(test)]
|
||||
@@ -120,8 +119,7 @@ impl<G: Group + Debug> KeyPair<G> {
|
||||
}
|
||||
|
||||
/// A minimalist key type built around a \[u8; 32\]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, TryFromForSizedBytes)]
|
||||
#[ErrorType = "::generic_bytes::TryFromSizedBytesError"]
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
#[repr(transparent)]
|
||||
pub struct Key(Vec<u8>);
|
||||
|
||||
|
||||
+7
-11
@@ -8,7 +8,7 @@ use crate::{
|
||||
errors::*,
|
||||
group::Group,
|
||||
key_exchange::tripledh::{NonceLen, TripleDH},
|
||||
keypair::Key,
|
||||
keypair::{Key, SizedBytesExt},
|
||||
opaque::*,
|
||||
slow_hash::NoOpHash,
|
||||
tests::mock_rng::CycleRng,
|
||||
@@ -19,7 +19,6 @@ use generic_array::typenum::Unsigned;
|
||||
use generic_bytes::SizedBytes;
|
||||
use rand::{rngs::OsRng, RngCore};
|
||||
use serde_json::Value;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
// Tests
|
||||
// =====
|
||||
@@ -453,7 +452,7 @@ fn test_registration_response() -> Result<(), ProtocolError> {
|
||||
ServerRegistration::<RistrettoSha5123dhNoSlowHash>::start(
|
||||
&mut oprf_key_rng,
|
||||
RegistrationRequest::deserialize(¶meters.registration_request[..])?,
|
||||
&Key::try_from(¶meters.server_s_pk[..])?,
|
||||
&Key::from_bytes(¶meters.server_s_pk[..])?,
|
||||
)?;
|
||||
assert_eq!(
|
||||
hex::encode(parameters.registration_response),
|
||||
@@ -548,7 +547,7 @@ fn test_credential_response() -> Result<(), ProtocolError> {
|
||||
let server_login_start_result = ServerLogin::<RistrettoSha5123dhNoSlowHash>::start(
|
||||
&mut server_e_sk_and_nonce_rng,
|
||||
ServerRegistration::deserialize(¶meters.password_file[..])?,
|
||||
&Key::try_from(¶meters.server_s_sk[..])?,
|
||||
&Key::from_bytes(¶meters.server_s_sk[..])?,
|
||||
CredentialRequest::<RistrettoSha5123dhNoSlowHash>::deserialize(
|
||||
¶meters.credential_request[..],
|
||||
)?,
|
||||
@@ -689,13 +688,10 @@ fn test_complete_flow(
|
||||
hex::encode(client_login_finish_result.export_key)
|
||||
);
|
||||
} else {
|
||||
let res = matches!(
|
||||
client_login_result,
|
||||
Err(ProtocolError::VerificationError(
|
||||
PakeError::InvalidLoginError
|
||||
))
|
||||
);
|
||||
assert!(res);
|
||||
assert!(match client_login_result {
|
||||
Err(ProtocolError::VerificationError(PakeError::InvalidLoginError)) => true,
|
||||
_ => false,
|
||||
});
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -4,12 +4,17 @@
|
||||
// LICENSE file in the root directory of this source tree.
|
||||
|
||||
use crate::{
|
||||
ciphersuite::CipherSuite, errors::*, key_exchange::tripledh::TripleDH, keypair::Key, opaque::*,
|
||||
slow_hash::NoOpHash, tests::mock_rng::CycleRng, *,
|
||||
ciphersuite::CipherSuite,
|
||||
errors::*,
|
||||
key_exchange::tripledh::TripleDH,
|
||||
keypair::{Key, SizedBytesExt},
|
||||
opaque::*,
|
||||
slow_hash::NoOpHash,
|
||||
tests::mock_rng::CycleRng,
|
||||
*,
|
||||
};
|
||||
use curve25519_dalek::ristretto::RistrettoPoint;
|
||||
use serde_json::Value;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
// Tests
|
||||
// =====
|
||||
@@ -351,7 +356,7 @@ fn get_password_file_bytes(parameters: &TestVectorParameters) -> Result<Vec<u8>,
|
||||
ServerRegistration::<Ristretto255Sha512NoSlowHash>::start(
|
||||
&mut oprf_key_rng,
|
||||
RegistrationRequest::deserialize(¶meters.registration_request[..]).unwrap(),
|
||||
&Key::try_from(¶meters.server_public_key[..]).unwrap(),
|
||||
&Key::from_bytes(¶meters.server_public_key[..]).unwrap(),
|
||||
)?;
|
||||
|
||||
let password_file = server_registration_start_result
|
||||
@@ -386,7 +391,7 @@ fn test_registration_response() -> Result<(), ProtocolError> {
|
||||
ServerRegistration::<Ristretto255Sha512NoSlowHash>::start(
|
||||
&mut oprf_key_rng,
|
||||
RegistrationRequest::deserialize(¶meters.registration_request[..]).unwrap(),
|
||||
&Key::try_from(¶meters.server_public_key[..]).unwrap(),
|
||||
&Key::from_bytes(¶meters.server_public_key[..]).unwrap(),
|
||||
)?;
|
||||
assert_eq!(
|
||||
hex::encode(parameters.registration_response),
|
||||
@@ -468,7 +473,7 @@ fn test_ke2() -> Result<(), ProtocolError> {
|
||||
let server_login_start_result = ServerLogin::<Ristretto255Sha512NoSlowHash>::start(
|
||||
&mut server_private_keyshare_and_nonce_rng,
|
||||
ServerRegistration::deserialize(&password_file_bytes[..]).unwrap(),
|
||||
&Key::try_from(¶meters.server_private_key[..]).unwrap(),
|
||||
&Key::from_bytes(¶meters.server_private_key[..]).unwrap(),
|
||||
CredentialRequest::<Ristretto255Sha512NoSlowHash>::deserialize(¶meters.KE1[..])
|
||||
.unwrap(),
|
||||
if parameters.envelope_mode == EnvelopeMode::CustomIdentifier {
|
||||
@@ -551,7 +556,7 @@ fn test_server_login_finish() -> Result<(), ProtocolError> {
|
||||
let server_login_start_result = ServerLogin::<Ristretto255Sha512NoSlowHash>::start(
|
||||
&mut server_private_keyshare_and_nonce_rng,
|
||||
ServerRegistration::deserialize(&password_file_bytes[..]).unwrap(),
|
||||
&Key::try_from(¶meters.server_private_key[..]).unwrap(),
|
||||
&Key::from_bytes(¶meters.server_private_key[..]).unwrap(),
|
||||
CredentialRequest::<Ristretto255Sha512NoSlowHash>::deserialize(¶meters.KE1[..])
|
||||
.unwrap(),
|
||||
if parameters.envelope_mode == EnvelopeMode::CustomIdentifier {
|
||||
|
||||
Reference in New Issue
Block a user