Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating voprf dependency #360

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- --features serde
toolchain:
- stable
- 1.70.0
- 1.74.0
name: test
steps:
- name: Checkout sources
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
matrix:
toolchain:
- stable
- 1.70.0
- 1.74.0
name: test simple_login command-line example
steps:
- name: install expect
Expand All @@ -101,7 +101,7 @@ jobs:
matrix:
toolchain:
- stable
- 1.70.0
- 1.74.0
name: test digital_locker command-line example
steps:
- name: install expect
Expand Down
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ serde = { version = "1", default-features = false, features = [
"derive",
], optional = true }
subtle = { version = "2.3", default-features = false }
voprf = { version = "=0.5.0-pre.6", default-features = false, features = [
"danger",
] }
voprf = { version = "0.5", default-features = false, features = ["danger"] }
zeroize = { version = "1.5", features = ["zeroize_derive"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down Expand Up @@ -69,7 +67,7 @@ proptest = "1"
rand = "0.8"
regex = "1"
# MSRV
rustyline = "13"
rustyline = "14"
scrypt = "0.11"
serde_json = "1"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ opaque-ke = "3.0.0-pre.4"

### Minimum Supported Rust Version

Rust **1.70** or higher.
Rust **1.74** or higher.

Audit
-----
Expand Down
1 change: 1 addition & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub enum InternalError<T = Infallible> {
Custom(T),
/// Deserializing from a byte sequence failed
InvalidByteSequence,
#[allow(clippy::doc_markdown)]
/// Invalid length for {name}: expected {len}, but is actually {actual_len}.
SizeError {
/// name
Expand Down
2 changes: 1 addition & 1 deletion src/key_exchange/tripledh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ where
.chain_iter(id_s.into_iter())
.chain_iter(l2_bytes)
.chain(server_nonce)
.chain(&server_e_kp.public().serialize());
.chain(server_e_kp.public().serialize());

let result = derive_3dh_keys::<D, KG, S>(
TripleDhComponents {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//!
//! ### Minimum Supported Rust Version
//!
//! Rust **1.65** or higher.
//! Rust **1.74** or higher.
//!
//! # Overview
//!
Expand Down
8 changes: 1 addition & 7 deletions src/opaque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,13 +716,7 @@ where
};

let client_s_pk = record.0.client_s_pk.clone();

let context = if let Some(context) = context {
context
} else {
&[]
};

let context = context.unwrap_or(&[]);
let server_s_sk = server_setup.keypair.private();
let server_s_pk = server_s_sk.public_key()?;

Expand Down
16 changes: 1 addition & 15 deletions src/serialization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use generic_array::typenum::{U0, U2};
use generic_array::{ArrayLength, GenericArray};
use hmac::Mac;

use crate::errors::{InternalError, ProtocolError};
use crate::errors::ProtocolError;

// Corresponds to the I2OSP() function from RFC8017
pub(crate) fn i2osp<L: ArrayLength<u8>>(
Expand Down Expand Up @@ -154,20 +154,6 @@ impl<T: Mac> MacExt for T {
}
}

pub(crate) trait GenericArrayExt {
fn try_from_slice(slice: &[u8]) -> Result<&Self, InternalError>;
}

impl<L: ArrayLength<u8>> GenericArrayExt for GenericArray<u8, L> {
fn try_from_slice(slice: &[u8]) -> Result<&Self, InternalError> {
if slice.len() == L::USIZE {
Ok(Self::from_slice(slice))
} else {
Err(InternalError::InvalidByteSequence)
}
}
}

#[cfg(test)]
mod tests;

Expand Down
2 changes: 1 addition & 1 deletion src/tests/full_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ fn test_credential_finalization() -> Result<(), ProtocolError> {

assert_eq!(
hex::encode(&parameters.server_s_pk),
hex::encode(&client_login_finish_result.server_s_pk.serialize())
hex::encode(client_login_finish_result.server_s_pk.serialize())
);
assert_eq!(
hex::encode(&parameters.session_key),
Expand Down
9 changes: 5 additions & 4 deletions src/tests/test_opaque_vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub struct OpaqueTestVectorParameters {
pub dummy_private_key: Vec<u8>,
pub dummy_masking_key: Vec<u8>,
pub context: Vec<u8>,
#[allow(dead_code)] // client_private_key is not tested in the test vectors
pub client_private_key: Option<Vec<u8>>,
pub client_keyshare_seed: Vec<u8>,
pub server_public_key: Vec<u8>,
Expand All @@ -56,8 +57,6 @@ pub struct OpaqueTestVectorParameters {
pub envelope_nonce: Vec<u8>,
pub client_nonce: Vec<u8>,
pub server_nonce: Vec<u8>,
pub client_info: Vec<u8>,
pub server_info: Vec<u8>,
pub registration_request: Vec<u8>,
pub registration_response: Vec<u8>,
pub registration_upload: Vec<u8>,
Expand Down Expand Up @@ -139,8 +138,6 @@ where
envelope_nonce: parse!(values, "envelope_nonce"),
client_nonce: parse!(values, "client_nonce"),
server_nonce: parse!(values, "server_nonce"),
client_info: parse!(values, "client_info"),
server_info: parse!(values, "server_info"),
registration_request: parse!(values, "registration_request"),
registration_response: parse!(values, "registration_response"),
registration_upload: parse!(values, "registration_upload"),
Expand Down Expand Up @@ -371,6 +368,10 @@ where
RegistrationRequest::deserialize(&parameters.registration_request).unwrap(),
&parameters.credential_identifier,
)?;
assert_eq!(
hex::encode(&parameters.server_public_key),
hex::encode(server_setup.keypair().public().serialize()),
);
assert_eq!(
hex::encode(&parameters.oprf_key),
hex::encode(server_registration_start_result.oprf_key)
Expand Down
Loading