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

Pull upstream to expose PSKs #30

Merged
merged 33 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4fdd47d
bring in update context proposal work for mutable metadata
nplasterer May 16, 2024
2de4fe1
fix format issue
nplasterer May 16, 2024
50101ea
Merge branch 'main' into np/update-context-proposals
nplasterer May 16, 2024
dd9c9dd
Don't store encryption key separately
franziskuskiefer May 17, 2024
7fbfd83
docs: not storing some values causes failures when loading the group
franziskuskiefer May 17, 2024
d5905aa
benchmarks for ml-kem
franziskuskiefer May 17, 2024
32f344b
dont make the crate public
nplasterer May 17, 2024
770ac98
Merge branch 'np/update-context-proposals' of https://github.com/npla…
nplasterer May 17, 2024
ab84c81
Merge pull request #1582 from openmls/franziskus/benchmarks-ml-kem2
franziskuskiefer May 20, 2024
9fb2714
Merge branch 'main' into franziskus/more-storage-docs
franziskuskiefer May 20, 2024
ba50744
Merge pull request #1581 from openmls/franziskus/more-storage-docs
franziskuskiefer May 20, 2024
5523a06
check that staged commit has gce proposal applied
franziskuskiefer May 22, 2024
9ae58bc
add logging to all tests
franziskuskiefer May 22, 2024
89c4b9d
Merge pull request #1583 from openmls/franziskus/gce-staged-commit-test
franziskuskiefer May 22, 2024
4952fcb
add changelog for new storage API
franziskuskiefer May 22, 2024
439c24d
Merge pull request #1584 from openmls/franziskus/changelog-storage
franziskuskiefer May 23, 2024
2e587c1
adds comment description for update_group_context_extensions
cameronvoell May 23, 2024
2741e2b
Merge branch 'main' into np/update-context-proposals
franziskuskiefer May 27, 2024
9d2f018
API for processed welcome
franziskuskiefer Jun 4, 2024
96fef7a
updated comments taking inspiration from add_members
cameronvoell Jun 5, 2024
fe15de6
added test for update_group_context_extensions function
cameronvoell Jun 5, 2024
0eae551
silence clippy
franziskuskiefer Jun 5, 2024
9d9a552
Merge pull request #1 from cameronvoell/cv/update-context-proposals-test
nplasterer Jun 5, 2024
5174c31
make the number of psks public
nplasterer Jun 6, 2024
edcc80b
Update openmls/src/group/mls_group/proposal.rs
franziskuskiefer Jun 6, 2024
fac0094
Update openmls/src/group/mls_group/proposal.rs
franziskuskiefer Jun 6, 2024
703fb76
also expose PSKs from welcome
franziskuskiefer Jun 6, 2024
45c5637
Merge remote-tracking branch 'upstream/1585-api-to-parse-welcome-|-pa…
nplasterer Jun 7, 2024
2fa5d2d
dont make the crate public
nplasterer Jun 7, 2024
718959c
Attempted fix for test runner (#1587)
raphaelrobert Jun 7, 2024
ab88304
Merge branch 'main' into np/update-context-proposals
franziskuskiefer Jun 7, 2024
556bc70
Merge pull request #1580 from nplasterer/np/update-context-proposals
franziskuskiefer Jun 7, 2024
8a86797
Merge remote-tracking branch 'upstream/main' into np/make-psk-number-…
nplasterer Jun 7, 2024
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: 2 additions & 0 deletions .github/workflows/interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ jobs:
make run-go || echo "Build despite errors."
cd test-runner
# TODO(#1366)
go get -u google.golang.org/grpc
go mod tidy -e
patch main.go main.go.patch
go build

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#1506](https://github.com/openmls/openmls/pull/1506): Add `StagedWelcome` and `StagedCoreWelcome` to make joining a group staged in order to inspect the `Welcome` message. This was followed up with PR [#1533](https://github.com/openmls/openmls/pull/1533) to adjust the API.
- [#1516](https://github.com/openmls/openmls/pull/1516): Add `MlsGroup::clear_pending_proposals` to the public API; this allows users to clear a group's internal `ProposalStore`
- [#1565](https://github.com/openmls/openmls/pull/1565): Add new `StorageProvider` trait to the `openmls_traits` crate.

### Changed

Expand All @@ -27,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#1548](https://github.com/openmls/openmls/pull/1548): CryptoConfig is now replaced by just Ciphersuite.
- [#1542](https://github.com/openmls/openmls/pull/1542): Add support for custom proposals. ProposalType::Unknown is now called ProposalType::Other. Proposal::Unknown is now called Proposal::Other.
- [#1559](https://github.com/openmls/openmls/pull/1559): Remove the `PartialEq` type constraint on the error type of both the `OpenMlsRand` and `OpenMlsKeyStore` traits. Additionally, remove the `Clone` type constraint on the error type of the `OpenMlsRand` trait.
- [#1565](https://github.com/openmls/openmls/pull/1565): Removed `OpenMlsKeyStore` and replace it with a new `StorageProvider` trait in the `openmls_traits` crate.

### Fixed

Expand Down
242 changes: 238 additions & 4 deletions openmls/benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ extern crate rand;
use criterion::Criterion;
use openmls::prelude::*;
use openmls_basic_credential::SignatureKeyPair;
use openmls_rust_crypto::OpenMlsRustCrypto;
use openmls_traits::{crypto::OpenMlsCrypto, OpenMlsProvider};

pub type OpenMlsRustCrypto = openmls_rust_crypto::OpenMlsRustCrypto;

fn criterion_kp_bundle(c: &mut Criterion, provider: &impl OpenMlsProvider) {
fn criterion_key_package(c: &mut Criterion, provider: &impl OpenMlsProvider) {
for &ciphersuite in provider.crypto().supported_ciphersuites().iter() {
c.bench_function(
&format!("KeyPackage create bundle with ciphersuite: {ciphersuite:?}"),
Expand Down Expand Up @@ -38,14 +37,249 @@ fn criterion_kp_bundle(c: &mut Criterion, provider: &impl OpenMlsProvider) {
}
}

fn create_welcome(c: &mut Criterion, provider: &impl OpenMlsProvider) {
for &ciphersuite in provider.crypto().supported_ciphersuites().iter() {
c.bench_function(
&format!("Create a welcome message with ciphersuite: {ciphersuite:?}"),
move |b| {
b.iter_with_setup(
|| {
let alice_credential = BasicCredential::new("Alice".into());
let alice_signer =
SignatureKeyPair::new(ciphersuite.signature_algorithm()).unwrap();
let alice_credential_with_key = CredentialWithKey {
credential: alice_credential.into(),
signature_key: alice_signer.to_public_vec().into(),
};

let bob_credential = BasicCredential::new("Bob".into());
let bob_signer =
SignatureKeyPair::new(ciphersuite.signature_algorithm()).unwrap();
let bob_credential_with_key = CredentialWithKey {
credential: bob_credential.into(),
signature_key: bob_signer.to_public_vec().into(),
};
let bob_key_package = KeyPackage::builder()
.build(
ciphersuite,
provider,
&bob_signer,
bob_credential_with_key.clone(),
)
.expect("An unexpected error occurred.");

let mls_group_create_config = MlsGroupCreateConfig::builder()
.wire_format_policy(PURE_PLAINTEXT_WIRE_FORMAT_POLICY)
.ciphersuite(ciphersuite)
.build();

// === Alice creates a group ===
let alice_group = MlsGroup::new(
provider,
&alice_signer,
&mls_group_create_config,
alice_credential_with_key.clone(),
)
.expect("An unexpected error occurred.");

(alice_signer, alice_group, bob_key_package)
},
|(alice_signer, mut alice_group, bob_key_package)| {
let _welcome = match alice_group.add_members(
provider,
&alice_signer,
&[bob_key_package.key_package().clone()],
) {
Ok((_, welcome, _)) => welcome,
Err(e) => panic!("Could not add member to group: {e:?}"),
};
},
);
},
);
}
}

fn join_group(c: &mut Criterion, provider: &impl OpenMlsProvider) {
for &ciphersuite in provider.crypto().supported_ciphersuites().iter() {
c.bench_function(
&format!("Join a group with ciphersuite: {ciphersuite:?}"),
move |b| {
b.iter_with_setup(
|| {
let alice_credential = BasicCredential::new("Alice".into());
let alice_signer =
SignatureKeyPair::new(ciphersuite.signature_algorithm()).unwrap();
let alice_credential_with_key = CredentialWithKey {
credential: alice_credential.into(),
signature_key: alice_signer.to_public_vec().into(),
};

let bob_credential = BasicCredential::new("Bob".into());
let bob_signer =
SignatureKeyPair::new(ciphersuite.signature_algorithm()).unwrap();
let bob_credential_with_key = CredentialWithKey {
credential: bob_credential.into(),
signature_key: bob_signer.to_public_vec().into(),
};
let bob_key_package = KeyPackage::builder()
.build(
ciphersuite,
provider,
&bob_signer,
bob_credential_with_key.clone(),
)
.expect("An unexpected error occurred.");

let mls_group_create_config = MlsGroupCreateConfig::builder()
.wire_format_policy(PURE_PLAINTEXT_WIRE_FORMAT_POLICY)
.ciphersuite(ciphersuite)
.build();

// === Alice creates a group ===
let mut alice_group = MlsGroup::new(
provider,
&alice_signer,
&mls_group_create_config,
alice_credential_with_key.clone(),
)
.expect("An unexpected error occurred.");

let welcome = match alice_group.add_members(
provider,
&alice_signer,
&[bob_key_package.key_package().clone()],
) {
Ok((_, welcome, _)) => welcome,
Err(e) => panic!("Could not add member to group: {e:?}"),
};

alice_group
.merge_pending_commit(provider)
.expect("error merging pending commit");

(alice_group, mls_group_create_config, welcome)
},
|(alice_group, mls_group_create_config, welcome)| {
let welcome: MlsMessageIn = welcome.into();
let welcome = welcome
.into_welcome()
.expect("expected the message to be a welcome message");
let _bob_group = StagedWelcome::new_from_welcome(
provider,
mls_group_create_config.join_config(),
welcome,
Some(alice_group.export_ratchet_tree().into()),
)
.unwrap()
.into_group(provider);
},
);
},
);
}
}

fn create_commit(c: &mut Criterion, provider: &impl OpenMlsProvider) {
for &ciphersuite in provider.crypto().supported_ciphersuites().iter() {
c.bench_function(
&format!("Create a commit with ciphersuite: {ciphersuite:?}"),
move |b| {
b.iter_with_setup(
|| {
let alice_credential = BasicCredential::new("Alice".into());
let alice_signer =
SignatureKeyPair::new(ciphersuite.signature_algorithm()).unwrap();
let alice_credential_with_key = CredentialWithKey {
credential: alice_credential.into(),
signature_key: alice_signer.to_public_vec().into(),
};

let bob_credential = BasicCredential::new("Bob".into());
let bob_signer =
SignatureKeyPair::new(ciphersuite.signature_algorithm()).unwrap();
let bob_credential_with_key = CredentialWithKey {
credential: bob_credential.into(),
signature_key: bob_signer.to_public_vec().into(),
};
let bob_key_package = KeyPackage::builder()
.build(
ciphersuite,
provider,
&bob_signer,
bob_credential_with_key.clone(),
)
.expect("An unexpected error occurred.");

let mls_group_create_config = MlsGroupCreateConfig::builder()
.wire_format_policy(PURE_PLAINTEXT_WIRE_FORMAT_POLICY)
.ciphersuite(ciphersuite)
.build();

// === Alice creates a group ===
let mut alice_group = MlsGroup::new(
provider,
&alice_signer,
&mls_group_create_config,
alice_credential_with_key.clone(),
)
.expect("An unexpected error occurred.");

let welcome = match alice_group.add_members(
provider,
&alice_signer,
&[bob_key_package.key_package().clone()],
) {
Ok((_, welcome, _)) => welcome,
Err(e) => panic!("Could not add member to group: {e:?}"),
};

alice_group
.merge_pending_commit(provider)
.expect("error merging pending commit");

let welcome: MlsMessageIn = welcome.into();
let welcome = welcome
.into_welcome()
.expect("expected the message to be a welcome message");
let bob_group = StagedWelcome::new_from_welcome(
provider,
mls_group_create_config.join_config(),
welcome,
Some(alice_group.export_ratchet_tree().into()),
)
.unwrap()
.into_group(provider)
.unwrap();

(bob_group, bob_signer)
},
|(mut bob_group, bob_signer)| {
let (queued_message, welcome_option, _group_info) =
bob_group.self_update(provider, &bob_signer).unwrap();

bob_group
.merge_pending_commit(provider)
.expect("error merging pending commit");
},
);
},
);
}
}

fn kp_bundle_rust_crypto(c: &mut Criterion) {
let provider = &OpenMlsRustCrypto::default();
println!("provider: RustCrypto");
criterion_kp_bundle(c, provider);
criterion_key_package(c, provider);
}

fn criterion_benchmark(c: &mut Criterion) {
kp_bundle_rust_crypto(c);
criterion_key_package(c, &openmls_libcrux_crypto::Provider::default());
create_welcome(c, &openmls_libcrux_crypto::Provider::default());
join_group(c, &openmls_libcrux_crypto::Provider::default());
create_commit(c, &openmls_libcrux_crypto::Provider::default());
}

criterion_group!(benches, criterion_benchmark);
Expand Down
2 changes: 1 addition & 1 deletion openmls/src/group/core_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! error, will still return a `Result` since they may throw a `LibraryError`.

// Private
mod new_from_welcome;
pub(super) mod new_from_welcome;

// Crate
pub(crate) mod create_commit_params;
Expand Down
Loading
Loading