From b63c6b9493288dbf045c4e2efdeb5f2eac6fe583 Mon Sep 17 00:00:00 2001 From: beltram Date: Mon, 25 Mar 2024 13:14:50 +0100 Subject: [PATCH 1/2] fix: handle incomplete write in 'framed_content_tbs_serialized' --- openmls/src/framing/mls_content.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openmls/src/framing/mls_content.rs b/openmls/src/framing/mls_content.rs index 5bc9e75a22..2cf35d8e26 100644 --- a/openmls/src/framing/mls_content.rs +++ b/openmls/src/framing/mls_content.rs @@ -227,7 +227,8 @@ pub(crate) fn framed_content_tbs_serialized<'context, W: Write>( // NewMemberCommit. written += match serialized_context.into() { Some(context) if matches!(sender, Sender::Member(_) | Sender::NewMemberCommit) => { - writer.write(context)? + writer.write_all(context)?; + context.len() } _ => 0, }; From 227472c990646ce69f12cf96354818b13f2676ac Mon Sep 17 00:00:00 2001 From: beltram Date: Mon, 25 Mar 2024 14:46:20 +0100 Subject: [PATCH 2/2] chore: apply clippy lints for Rust 1.77 --- openmls/src/group/core_group/new_from_welcome.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openmls/src/group/core_group/new_from_welcome.rs b/openmls/src/group/core_group/new_from_welcome.rs index 08e5b4b272..d2d98de122 100644 --- a/openmls/src/group/core_group/new_from_welcome.rs +++ b/openmls/src/group/core_group/new_from_welcome.rs @@ -316,7 +316,7 @@ mod tests { fn psk_ids_should_be_valid() { let group_id = GroupId::from_slice(b"test"); let epoch = GroupEpoch(1); - let psks = vec![ + let psks = [ ResumptionPsk::new(ResumptionPskUsage::Reinit, group_id.clone(), epoch), ResumptionPsk::new(ResumptionPskUsage::Branch, group_id.clone(), epoch), ResumptionPsk::new(ResumptionPskUsage::Application, group_id, epoch), @@ -328,7 +328,7 @@ mod tests { fn psk_ids_should_be_valid_application() { let group_id = GroupId::from_slice(b"test"); let epoch = GroupEpoch(1); - let psks = vec![ + let psks = [ ResumptionPsk::new(ResumptionPskUsage::Application, group_id.clone(), epoch), ResumptionPsk::new(ResumptionPskUsage::Application, group_id.clone(), epoch), ResumptionPsk::new(ResumptionPskUsage::Application, group_id.clone(), epoch), @@ -341,7 +341,7 @@ mod tests { fn psk_ids_should_be_invalid_reinit() { let group_id = GroupId::from_slice(b"test"); let epoch = GroupEpoch(1); - let psks = vec![ + let psks = [ ResumptionPsk::new(ResumptionPskUsage::Reinit, group_id.clone(), epoch), ResumptionPsk::new(ResumptionPskUsage::Branch, group_id.clone(), epoch), ResumptionPsk::new(ResumptionPskUsage::Reinit, group_id.clone(), epoch), @@ -357,7 +357,7 @@ mod tests { fn psk_ids_should_be_invalid_branch() { let group_id = GroupId::from_slice(b"test"); let epoch = GroupEpoch(1); - let psks = vec![ + let psks = [ ResumptionPsk::new(ResumptionPskUsage::Reinit, group_id.clone(), epoch), ResumptionPsk::new(ResumptionPskUsage::Branch, group_id.clone(), epoch), ResumptionPsk::new(ResumptionPskUsage::Branch, group_id.clone(), epoch), @@ -373,7 +373,7 @@ mod tests { fn psk_ids_should_be_invalid() { let group_id = GroupId::from_slice(b"test"); let epoch = GroupEpoch(1); - let psks = vec![ + let psks = [ ResumptionPsk::new(ResumptionPskUsage::Reinit, group_id.clone(), epoch), ResumptionPsk::new(ResumptionPskUsage::Branch, group_id.clone(), epoch), ResumptionPsk::new(ResumptionPskUsage::Reinit, group_id.clone(), epoch),