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

build: tls_codec 0.4.0 #67

Merged
merged 5 commits into from
Nov 28, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- ubuntu-latest
- windows-latest
mode:
- debug
# - debug
- release
runs-on: ${{ matrix.os }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ resolver = "2"
async-trait = "0.1"

[workspace.dependencies.tls_codec]
version = "0.3.0"
version = "0.4.0"
features = ["derive", "serde", "mls"]

[workspace.dependencies.tls_codec_derive]
version = "0.3.0"
version = "0.4.0"
features = ["derive", "serde", "mls"]
8 changes: 4 additions & 4 deletions openmls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ serde_json = { version = "1.0", optional = true }
# Crypto backends required for KAT and testing - "test-utils" feature
openmls_rust_crypto = { version = "0.2.0", path = "../openmls_rust_crypto", optional = true }
async-lock = { version = "2.7", optional = true }
rstest = { version = "^0.16", optional = true }
rstest_reuse = { version = "0.4", optional = true }
rstest = { version = "0.18.2", optional = true }
rstest_reuse = { version = "0.6.0", optional = true }
tokio = { version = "1.24", optional = true, features = ["macros", "rt", "rt-multi-thread"] }

[features]
Expand All @@ -61,8 +61,8 @@ lazy_static = "1.4"
openmls = { path = ".", features = ["test-utils"] }
openmls_traits = { version = "0.2.0", path = "../traits", features = ["test-utils"] }
pretty_env_logger = "0.4"
rstest = "^0.16"
rstest_reuse = "0.4"
rstest = "0.18.2"
rstest_reuse = "0.6.0"
tempfile = "3"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
Expand Down
2 changes: 0 additions & 2 deletions openmls/src/binary_tree/array_representation/treemath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,6 @@ pub(crate) fn common_direct_path(
y: LeafNodeIndex,
size: TreeSize,
) -> Vec<ParentNodeIndex> {
let x = x;
let y = y;
let mut x_path = direct_path(x, size);
let mut y_path = direct_path(y, size);
x_path.reverse();
Expand Down
1 change: 1 addition & 0 deletions openmls/src/framing/test_framing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use openmls_rust_crypto::OpenMlsRustCrypto;
use signable::Verifiable;
use tls_codec::{Deserialize, Serialize};

use crate::test_utils::*;
use crate::{
binary_tree::{array_representation::TreeSize, LeafNodeIndex},
ciphersuite::signable::{Signable, SignatureError},
Expand Down
4 changes: 2 additions & 2 deletions openmls/src/group/core_group/proposals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ impl ProposalQueue {
if leaf_index != own_index {
members
.entry(leaf_index)
.or_insert_with(Member::default)
.or_default()
.updates
.push(queued_proposal.clone());
} else {
Expand All @@ -498,7 +498,7 @@ impl ProposalQueue {
let removed = remove_proposal.removed();
members
.entry(removed)
.or_insert_with(Member::default)
.or_default()
.updates
.push(queued_proposal.clone());
let proposal_reference = queued_proposal.proposal_reference();
Expand Down
10 changes: 5 additions & 5 deletions openmls/src/group/group_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use openmls_traits::types::Ciphersuite;

use super::*;
use crate::{
error::LibraryError,
framing::{mls_auth_content::AuthenticatedContent, ConfirmedTranscriptHashInput},
versions::ProtocolVersion,
error::LibraryError, framing::mls_auth_content::AuthenticatedContent, versions::ProtocolVersion,
};

#[derive(
Expand Down Expand Up @@ -93,8 +91,10 @@ impl GroupContext {
authenticated_content: &AuthenticatedContent,
) -> Result<(), LibraryError> {
let confirmed_transcript_hash = {
let input = ConfirmedTranscriptHashInput::try_from(authenticated_content)
.map_err(|_| LibraryError::custom("PublicMessage did not contain a commit"))?;
let input = crate::framing::public_message::ConfirmedTranscriptHashInput::try_from(
authenticated_content,
)
.map_err(|_| LibraryError::custom("PublicMessage did not contain a commit"))?;

input.calculate_confirmed_transcript_hash(
backend.crypto(),
Expand Down
9 changes: 6 additions & 3 deletions openmls/src/group/public_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use crate::{
ciphersuite::signable::Verifiable,
error::LibraryError,
extensions::RequiredCapabilitiesExtension,
framing::InterimTranscriptHashInput,
messages::{
group_info::{GroupInfo, VerifiableGroupInfo},
proposals::{Proposal, ProposalType},
Expand Down Expand Up @@ -77,7 +76,9 @@ impl PublicGroup {
initial_confirmation_tag: ConfirmationTag,
) -> Result<Self, LibraryError> {
let interim_transcript_hash = {
let input = InterimTranscriptHashInput::from(&initial_confirmation_tag);
let input = crate::framing::public_message::InterimTranscriptHashInput::from(
&initial_confirmation_tag,
);

input.calculate_interim_transcript_hash(
crypto,
Expand Down Expand Up @@ -146,7 +147,9 @@ impl PublicGroup {
let group_context = GroupContext::from(group_info.clone());

let interim_transcript_hash = {
let input = InterimTranscriptHashInput::from(group_info.confirmation_tag());
let input = crate::framing::public_message::InterimTranscriptHashInput::from(
group_info.confirmation_tag(),
);

input.calculate_interim_transcript_hash(
backend.crypto(),
Expand Down
1 change: 1 addition & 0 deletions openmls/src/group/public_group/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use crate::{
};

use super::PublicGroup;
use crate::test_utils::*;

#[apply(ciphersuites_and_backends)]
async fn public_group(ciphersuite: Ciphersuite, backend: &impl OpenMlsCryptoProvider) {
Expand Down
1 change: 1 addition & 0 deletions openmls/src/group/tests/external_add_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::{
use openmls_traits::types::Ciphersuite;

use super::utils::*;
use crate::test_utils::*;

wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

Expand Down
1 change: 1 addition & 0 deletions openmls/src/group/tests/external_remove_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::{
use openmls_traits::types::Ciphersuite;

use super::utils::*;
use crate::test_utils::*;

wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

Expand Down
8 changes: 6 additions & 2 deletions openmls/src/group/tests/kat_transcript_hashes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ pub fn run_test_vector(test_vector: TranscriptTestVector) {

// Verify that *`confirmed_transcript_hash_after`* and `interim_transcript_hash_after` are the result of updating `interim_transcript_hash_before` with `authenticated_content`.
let got_confirmed_transcript_hash_after = {
let input = ConfirmedTranscriptHashInput::try_from(&authenticated_content).unwrap();
let input = crate::framing::public_message::ConfirmedTranscriptHashInput::try_from(
&authenticated_content,
)
.unwrap();

input
.calculate_confirmed_transcript_hash(
Expand All @@ -117,7 +120,8 @@ pub fn run_test_vector(test_vector: TranscriptTestVector) {

// Verify that `confirmed_transcript_hash_after` and *`interim_transcript_hash_after`* are the result of updating `interim_transcript_hash_before` with `authenticated_content`.
let got_interim_transcript_hash_after = {
let input = InterimTranscriptHashInput::from(&got_confirmation_tag);
let input =
crate::framing::public_message::InterimTranscriptHashInput::from(&got_confirmation_tag);

input
.calculate_interim_transcript_hash(
Expand Down
1 change: 1 addition & 0 deletions openmls/src/group/tests/test_commit_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use tls_codec::{Deserialize, Serialize};
use super::utils::{
generate_credential_with_key, generate_key_package, resign_message, CredentialWithKeyAndSigner,
};
use crate::test_utils::*;
use crate::{
binary_tree::LeafNodeIndex,
ciphersuite::signable::Signable,
Expand Down
2 changes: 1 addition & 1 deletion openmls/src/group/tests/test_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use tls_codec::{Deserialize, Serialize};
use super::utils::*;
use crate::{
binary_tree::LeafNodeIndex, framing::*, group::*, key_packages::*, messages::*,
schedule::psk::store::ResumptionPskStore, test_utils::*, *,
schedule::psk::store::ResumptionPskStore, test_utils::*,
};
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

Expand Down
1 change: 1 addition & 0 deletions openmls/src/group/tests/test_external_commit_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use rstest_reuse::apply;
use tls_codec::{Deserialize, Serialize};

use self::utils::*;
use crate::test_utils::*;
use crate::{
ciphersuite::{hash_ref::ProposalRef, signable::Verifiable},
framing::{
Expand Down
14 changes: 7 additions & 7 deletions openmls/src/group/tests/test_framing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use crate::{
sender_ratchet::SenderRatchetConfiguration,
},
versions::ProtocolVersion,
*,
};

wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
Expand Down Expand Up @@ -202,12 +201,13 @@ async fn bad_padding(ciphersuite: Ciphersuite, backend: &impl OpenMlsCryptoProvi
};

let private_message_content_aad_bytes = {
let private_message_content_aad = PrivateContentAad {
group_id: group_id.clone(),
epoch,
content_type: plaintext.content().content_type(),
authenticated_data: VLByteSlice(plaintext.authenticated_data()),
};
let private_message_content_aad =
crate::framing::private_message::PrivateContentAad {
group_id: group_id.clone(),
epoch,
content_type: plaintext.content().content_type(),
authenticated_data: VLByteSlice(plaintext.authenticated_data()),
};

private_message_content_aad
.tls_serialize_detached()
Expand Down
1 change: 1 addition & 0 deletions openmls/src/group/tests/test_framing_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::{
use super::utils::{
generate_credential_with_key, generate_key_package, CredentialWithKeyAndSigner,
};
use crate::test_utils::*;

wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

Expand Down
3 changes: 1 addition & 2 deletions openmls/src/group/tests/test_past_secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
use openmls_rust_crypto::OpenMlsRustCrypto;
use openmls_traits::{types::Ciphersuite, OpenMlsCryptoProvider};

use rstest::*;
use rstest_reuse::{self, *};
use crate::test_utils::*;

use super::utils::{generate_credential_with_key, generate_key_package};
use crate::{
Expand Down
1 change: 1 addition & 0 deletions openmls/src/group/tests/test_proposal_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use tls_codec::{Deserialize, Serialize};
use super::utils::{
generate_credential_with_key, generate_key_package, resign_message, CredentialWithKeyAndSigner,
};
use crate::test_utils::*;
use crate::{
binary_tree::LeafNodeIndex,
ciphersuite::hash_ref::ProposalRef,
Expand Down
1 change: 0 additions & 1 deletion openmls/src/group/tests/test_remove_operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::{
framing::*,
group::{config::CryptoConfig, *},
test_utils::*,
*,
};
use openmls_rust_crypto::OpenMlsRustCrypto;

Expand Down
1 change: 1 addition & 0 deletions openmls/src/group/tests/test_wire_format_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use openmls_traits::{signatures::Signer, types::Ciphersuite, OpenMlsCryptoProvid
use rstest::*;
use rstest_reuse::{self, *};

use crate::test_utils::*;
use crate::{
framing::*,
group::{config::CryptoConfig, errors::*, *},
Expand Down
2 changes: 1 addition & 1 deletion openmls/src/group/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use tls_codec::Serialize;
use crate::{
ciphersuite::signable::Signable, credentials::*, framing::*, group::*, key_packages::*,
messages::ConfirmationTag, schedule::psk::store::ResumptionPskStore, test_utils::*,
versions::ProtocolVersion, *,
versions::ProtocolVersion,
};

/// Configuration of a client meant to be used in a test setup.
Expand Down
7 changes: 3 additions & 4 deletions openmls/src/messages/tests/test_codec.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use openmls_rust_crypto::OpenMlsRustCrypto;
use tls_codec::{Deserialize, Serialize};

use crate::test_utils::*;
use crate::{
extensions::Extensions,
group::GroupId,
messages::{PreSharedKeyProposal, ProtocolVersion, ReInitProposal},
schedule::psk::{ExternalPsk, PreSharedKeyId, Psk, ResumptionPsk, ResumptionPskUsage},
test_utils::*,
};
use openmls_rust_crypto::OpenMlsRustCrypto;
use tls_codec::{Deserialize, Serialize};

wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

Expand Down
10 changes: 3 additions & 7 deletions openmls/src/messages/tests/test_export_group_info.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
use tls_codec::{Deserialize, Serialize};

use crate::test_utils::*;
use crate::{
ciphersuite::signable::Verifiable,
group::test_core_group::setup_alice_group,
messages::{
group_info::{GroupInfo, VerifiableGroupInfo},
*,
},
test_utils::*,
messages::group_info::{GroupInfo, VerifiableGroupInfo},
};
use tls_codec::{Deserialize, Serialize};

wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

Expand Down
7 changes: 3 additions & 4 deletions openmls/src/messages/tests/test_proposals.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use openmls_rust_crypto::OpenMlsRustCrypto;
use tls_codec::{Deserialize, Serialize};

use crate::test_utils::*;
use crate::{
binary_tree::LeafNodeIndex,
ciphersuite::hash_ref::ProposalRef,
messages::{
proposals::{Proposal, ProposalOrRef, RemoveProposal},
proposals_in::ProposalOrRefIn,
},
test_utils::*,
};
use openmls_rust_crypto::OpenMlsRustCrypto;
use tls_codec::{Deserialize, Serialize};

wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

Expand Down
3 changes: 1 addition & 2 deletions openmls/src/messages/tests/test_welcome.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::test_utils::*;
use openmls_basic_credential::SignatureKeyPair;
use openmls_rust_crypto::OpenMlsRustCrypto;
use openmls_traits::{
crypto::OpenMlsCrypto, key_store::OpenMlsKeyStore, types::Ciphersuite, OpenMlsCryptoProvider,
};
use rstest::*;
use rstest_reuse::{self, *};
use tls_codec::{Deserialize, Serialize};

use crate::{
Expand Down
1 change: 1 addition & 0 deletions openmls/src/treesync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ impl TreeSync {
#[cfg(test)]
mod test {
use super::*;
use crate::test_utils::*;

#[cfg(debug_assertions)]
#[test]
Expand Down
1 change: 1 addition & 0 deletions openmls/src/treesync/tests_and_kats/tests/test_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use openmls_traits::{types::Ciphersuite, OpenMlsCryptoProvider};
use rstest::*;
use rstest_reuse::apply;

use crate::test_utils::*;
use crate::{
credentials::test_utils::new_credential,
key_packages::KeyPackageBundle,
Expand Down
1 change: 0 additions & 1 deletion openmls/tests/book_code.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use openmls::{
prelude::{config::CryptoConfig, *},
test_utils::*,
*,
};
use openmls_basic_credential::SignatureKeyPair;
use openmls_rust_crypto::OpenMlsRustCrypto;
Expand Down
2 changes: 1 addition & 1 deletion openmls/tests/key_store.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! A couple of simple tests on how to interact with the key store.
use openmls::{prelude::*, test_utils::*, *};
use openmls::{prelude::*, test_utils::*};
use openmls_basic_credential::SignatureKeyPair;

#[apply(ciphersuites_and_backends)]
Expand Down
1 change: 0 additions & 1 deletion openmls/tests/test_decryption_key_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use openmls::{
test_framework::{ActionType, CodecUse, MlsGroupTestSetup},
*,
},
*,
};

#[apply(ciphersuites)]
Expand Down
2 changes: 1 addition & 1 deletion openmls/tests/test_external_commit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use openmls::{
credentials::test_utils::new_credential, messages::group_info::VerifiableGroupInfo, prelude::*,
test_utils::*, *,
test_utils::*,
};
use openmls_basic_credential::SignatureKeyPair;

Expand Down
Loading
Loading