From 64096972d45d66446106b407f5c3c9ced45c7d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gonz=C3=A1lez?= Date: Thu, 21 Mar 2024 08:37:08 +0000 Subject: [PATCH 1/4] Bump bindgen to 0.69.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is to go in line with other parallaxsecond repositories, in preparation for the next parsec release. Signed-off-by: Tomás González --- Cargo.lock | 25 ++++++++++++++----------- psa-crypto-sys/Cargo.toml | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7e9ad8..6af2e92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,17 +31,17 @@ checksum = "e6b4d9b1225d28d360ec6a231d65af1fd99a2a095154c8040689617290569c5c" [[package]] name = "bindgen" -version = "0.66.1" +version = "0.69.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" dependencies = [ "bitflags", "cexpr", "clang-sys", + "itertools", "lazy_static", "lazycell", "log", - "peeking_take_while", "prettyplease", "proc-macro2", "quote", @@ -207,6 +207,15 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -332,12 +341,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "pem-rfc7468" version = "0.2.4" @@ -565,9 +568,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "smallvec" diff --git a/psa-crypto-sys/Cargo.toml b/psa-crypto-sys/Cargo.toml index 5e61e61..b784ae0 100644 --- a/psa-crypto-sys/Cargo.toml +++ b/psa-crypto-sys/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/parallaxsecond/rust-psa-crypto" rust-version = "1.66.0" [build-dependencies] -bindgen = { version = "0.66.1", optional = true } +bindgen = { version = "0.69.4", optional = true } cc = "1.0.59" cmake = "0.1.44" regex = "1.9.1" From 55fa787cb3484d316ad9fa1d617f546c27e616d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gonz=C3=A1lez?= Date: Thu, 21 Mar 2024 16:18:48 +0000 Subject: [PATCH 2/4] cipher.rs: Avoid complex blocks or closures with blocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Solve "block_in_conditions" error. Signed-off-by: Tomás González --- psa-crypto/src/operations/cipher.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/psa-crypto/src/operations/cipher.rs b/psa-crypto/src/operations/cipher.rs index b61ada7..778558e 100644 --- a/psa-crypto/src/operations/cipher.rs +++ b/psa-crypto/src/operations/cipher.rs @@ -32,7 +32,8 @@ fn crypt( let mut output_length = 0; let mut output_length_finish = 0; - match (|| { + + let status = { Status::from(unsafe { psa_crypto_sys::psa_cipher_set_iv(&mut operation, iv.as_ptr(), iv.len()) }) @@ -61,16 +62,16 @@ fn crypt( .to_result()?; Ok(()) - })() { - Ok(()) => (), + }; + + match status { + Ok(()) => Ok(output_length + output_length_finish), Err(x) => { Status::from(unsafe { psa_crypto_sys::psa_cipher_abort(&mut operation) }) .to_result()?; - return Err(x); + Err(x) } } - - Ok(output_length + output_length_finish) } /// Encrypt a short message with a key From 92811f2880530926346afab69696661de3e4f252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gonz=C3=A1lez?= Date: Thu, 21 Mar 2024 16:52:54 +0000 Subject: [PATCH 3/4] key_derivation.rs: Remove redundant import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás González --- psa-crypto/src/types/key_derivation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psa-crypto/src/types/key_derivation.rs b/psa-crypto/src/types/key_derivation.rs index ac7a4f5..2d76bc6 100644 --- a/psa-crypto/src/types/key_derivation.rs +++ b/psa-crypto/src/types/key_derivation.rs @@ -8,7 +8,7 @@ use super::key::Id; #[cfg(feature = "operations")] use super::status::{Error, Result, Status}; #[cfg(feature = "operations")] -use core::convert::{From, TryFrom}; +use core::convert::TryFrom; /// Key derivation operation for deriving keys from existing sources #[derive(Debug, Clone, Copy)] From d1dc55b5a9fbefac8a27bc540e23454ff2ce4a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gonz=C3=A1lez?= Date: Thu, 21 Mar 2024 16:53:50 +0000 Subject: [PATCH 4/4] psa-crypto-sys/build.rs: Allow unused imports in generated bindings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Solve the issue: unused import: self :: psa_crypto_driver_pake_step as psa_crypto_driver_pake_step_t Obtained from bindgen generating code for an unused type. There should not a be problem about not using certain bindings Signed-off-by: Tomás González --- psa-crypto-sys/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/psa-crypto-sys/src/lib.rs b/psa-crypto-sys/src/lib.rs index 14b84d8..a84ed98 100644 --- a/psa-crypto-sys/src/lib.rs +++ b/psa-crypto-sys/src/lib.rs @@ -23,6 +23,7 @@ #[allow(clippy::all)] #[cfg(feature = "interface")] mod psa_crypto_binding { + #![allow(unused_imports)] include!(concat!(env!("OUT_DIR"), "/shim_bindings.rs")); }