From 324542f760d1d38237619eebb69673fa2bf4efc5 Mon Sep 17 00:00:00 2001 From: UneBaguette <28904802+UneBaguette@users.noreply.github.com> Date: Tue, 30 Jun 2026 21:52:02 +0200 Subject: [PATCH] chore(deps): replace unmaintained paste and postcard with pastey and bincode-next - paste replaced by pastey 0.2 (RUSTSEC-2024-0436) - postcard replaced by bincode-next 3 with serde feature (RUSTSEC-2023-0089 via postcard/heapless/atomic-polyfill) --- Cargo.toml | 4 ++-- src/tests/full_test.rs | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 94d6b56..6a13d10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,7 +78,7 @@ getrandom = { version = "0.4", features = ["wasm_js"], optional = true } [dev-dependencies] anyhow = "1" -postcard = { version = "1", features = ["alloc"] } +bincode-next = { version = "3", features = ["serde", "alloc"] } chacha20poly1305 = "0.11" criterion = "0.8" cryptoki = "0.12" @@ -101,7 +101,7 @@ p521 = { version = "0.14.0-rc.15", default-features = false, features = [ "pkcs8", "oprf", ] } -paste = "1" +pastey = "0.2" proptest = "1" rand = "0.10" rand_chacha = "0.10" diff --git a/src/tests/full_test.rs b/src/tests/full_test.rs index 349e592..7768983 100644 --- a/src/tests/full_test.rs +++ b/src/tests/full_test.rs @@ -72,7 +72,7 @@ macro_rules! ciphersuite_types { macro_rules! generate { ($(#[$attr:meta])* $name:ident, $oprf:ty, $ke:ty, ($output:ident)) => { - paste::paste! { + pastey::paste! { $(#[$attr])* { let parameters = generate_parameters::<$name>()?; @@ -91,7 +91,7 @@ macro_rules! generate { macro_rules! run_all { ($(#[$attr:meta])* $name:ident, $oprf:ty, $ke:ty, ($fn:ident $(, $par:expr)*)) => { - paste::paste! { + pastey::paste! { $(#[$attr])* $fn::<$name>(super::full_test_vectors::[] $(, $par)*)?; } @@ -120,7 +120,7 @@ macro_rules! oprf_ciphersuites { #[$ke_attr_1:meta] #[$ke_attr_2:meta] [$ke_name:ident, $ke:ty], [$($(#[$oprf_attr:meta])? [$oprf_name:ident, $oprf:ty$(,)?]),+$(,)?], ) => { - paste::paste! { + pastey::paste! { $($macro!(#[$ke_attr_1] #[$ke_attr_2] $(#[$oprf_attr])? [<$oprf_name $ke_name>], $oprf, $ke, $par);)+ } }; @@ -129,7 +129,7 @@ macro_rules! oprf_ciphersuites { #[$ke_attr:meta] [$ke_name:ident, $ke:ty], [$($(#[$oprf_attr:meta])? [$oprf_name:ident, $oprf:ty$(,)?]),+$(,)?], ) => { - paste::paste! { + pastey::paste! { $($macro!(#[$ke_attr] $(#[$oprf_attr])? [<$oprf_name $ke_name>], $oprf, $ke, $par);)+ } }; @@ -138,7 +138,7 @@ macro_rules! oprf_ciphersuites { [$ke_name:ident, $ke:ty], [$($(#[$oprf_attr:meta])? [$oprf_name:ident, $oprf:ty$(,)?]),+$(,)?], ) => { - paste::paste! { + pastey::paste! { $($macro!($(#[$oprf_attr])? [<$oprf_name $ke_name>], $oprf, $ke, $par);)+ } } @@ -198,7 +198,7 @@ macro_rules! sigma_i_ciphersuites { $macro:ident!$par:tt => [$($(#[$sig_attr:meta])? [$sig_name:ident, $sig:ty]),+$(,)?], ) => { - paste::paste! { + pastey::paste! { $( oprf_ciphersuites!( $macro!$par => [ @@ -811,15 +811,17 @@ fn test_serialization() -> Result<(), ProtocolError> { let client_registration_start_result = ClientRegistration::::start(&mut rng, ¶meters.password)?; - // Test the postcard serialization (binary). + // Test the bincode serialization (binary). + let cfg = bincode_next::config::standard(); let registration_request = - postcard::to_allocvec(&client_registration_start_result.message).unwrap(); + bincode_next::serde::encode_to_vec(&client_registration_start_result.message, cfg) + .unwrap(); assert_eq!( registration_request.len(), RegistrationRequestLen::::USIZE ); - let registration_request: RegistrationRequest = - postcard::from_bytes(®istration_request).unwrap(); + let (registration_request, _): (RegistrationRequest, usize) = + bincode_next::serde::decode_from_slice(®istration_request, cfg).unwrap(); assert_eq!( hex::encode(client_registration_start_result.message.serialize()), hex::encode(registration_request.serialize()),