From 5c530f83caeae2e3f4b3d15151bc196879294f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gonz=C3=A1lez?= Date: Thu, 13 Jul 2023 15:49:09 +0100 Subject: [PATCH 1/3] Upgrade enumflags2 crate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'enumflags2' crate version 0.7.4 has been yanked. Update it to the 0.7.7 version. This is done with the cargo update --package enumflags2 command. Signed-off-by: Tomás González --- Cargo.lock | 55 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d2397609..e204fc9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,7 +61,7 @@ checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "synstructure", ] @@ -73,7 +73,7 @@ checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -145,7 +145,7 @@ dependencies = [ "regex", "rustc-hash", "shlex 1.1.0", - "syn", + "syn 1.0.109", "which", ] @@ -313,7 +313,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -324,7 +324,7 @@ checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -335,22 +335,22 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "enumflags2" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" +checksum = "c041f5090df68b32bcd905365fd51769c8b9d553fe87fde0b683534f10c01bd2" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.7.4" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" +checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.12", ] [[package]] @@ -479,7 +479,7 @@ checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -894,7 +894,7 @@ checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1184,7 +1184,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "version_check", ] @@ -1246,7 +1246,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1515,7 +1515,7 @@ checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1657,7 +1657,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1669,7 +1669,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1683,6 +1683,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79d9531f94112cfc3e4c8f5f02cb2b58f72c97b7efd85f70203cc6d8efda5927" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "synstructure" version = "0.12.6" @@ -1691,7 +1702,7 @@ checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "unicode-xid", ] @@ -1749,7 +1760,7 @@ checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1975,7 +1986,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -1997,7 +2008,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2185,6 +2196,6 @@ checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "synstructure", ] From 2adb41dbaf719d2cc92b7c2f397cd7c8ec3062e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gonz=C3=A1lez?= Date: Wed, 12 Jul 2023 17:06:21 +0100 Subject: [PATCH 2/3] Fix compilation issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix compilation warning and errors about redundant clones. Signed-off-by: Tomás González --- .../normal_tests/capability_discovery.rs | 21 +++++++++++++++++-- src/providers/mbed_crypto/asym_sign.rs | 7 ++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/e2e_tests/tests/per_provider/normal_tests/capability_discovery.rs b/e2e_tests/tests/per_provider/normal_tests/capability_discovery.rs index 196d4f6c..9a4b27d1 100644 --- a/e2e_tests/tests/per_provider/normal_tests/capability_discovery.rs +++ b/e2e_tests/tests/per_provider/normal_tests/capability_discovery.rs @@ -63,7 +63,12 @@ fn rsa_encrypt_use_check() { feature = "mbed-crypto-provider", feature = "trusted-service-provider", ))] - let supported_algs = all_algs.clone(); + let supported_algs = vec![ + AsymmetricEncryption::RsaPkcs1v15Crypt {}, + AsymmetricEncryption::RsaOaep { + hash_alg: Hash::Sha256, + }, + ]; #[cfg(feature = "cryptoauthlib-provider")] let supported_algs = vec![]; @@ -178,7 +183,19 @@ fn hash_use_check() { ]; #[cfg(any(feature = "mbed-crypto-provider", feature = "trusted-service-provider",))] - let supported_hashes = all_hashes.clone(); + let supported_hashes = vec![ + Hash::Ripemd160, + Hash::Sha224, + Hash::Sha256, + Hash::Sha384, + Hash::Sha512, + Hash::Sha512_224, + Hash::Sha512_256, + Hash::Sha3_224, + Hash::Sha3_256, + Hash::Sha3_384, + Hash::Sha3_512, + ]; #[cfg(feature = "tpm-provider")] let supported_hashes = vec![ diff --git a/src/providers/mbed_crypto/asym_sign.rs b/src/providers/mbed_crypto/asym_sign.rs index 2b3dd3d4..1fa89e5a 100644 --- a/src/providers/mbed_crypto/asym_sign.rs +++ b/src/providers/mbed_crypto/asym_sign.rs @@ -15,7 +15,6 @@ impl Provider { op: psa_sign_hash::Operation, ) -> Result { let key_name = op.key_name.clone(); - let hash = op.hash.clone(); let alg = op.alg; let key_identity = KeyIdentity::new( application_identity.clone(), @@ -36,7 +35,7 @@ impl Provider { op.validate(key_attributes)?; - match asym_signature::sign_hash(id, alg, &hash, &mut signature) { + match asym_signature::sign_hash(id, alg, &(op.hash), &mut signature) { Ok(size) => { signature.resize(size, 0); Ok(psa_sign_hash::Result { @@ -57,9 +56,7 @@ impl Provider { op: psa_verify_hash::Operation, ) -> Result { let key_name = op.key_name.clone(); - let hash = op.hash.clone(); let alg = op.alg; - let signature = op.signature.clone(); let key_identity = KeyIdentity::new( application_identity.clone(), self.provider_identity.clone(), @@ -77,7 +74,7 @@ impl Provider { op.validate(key_attributes)?; let id = key::Id::from_persistent_key_id(key_id)?; - match asym_signature::verify_hash(id, alg, &hash, &signature) { + match asym_signature::verify_hash(id, alg, &(op.hash), &(op.signature)) { Ok(()) => Ok(psa_verify_hash::Result {}), Err(error) => { let error = ResponseStatus::from(error); From 8c25be3eee87f983bac908dbd9d120dd23ec10bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gonz=C3=A1lez?= Date: Thu, 13 Jul 2023 14:10:52 +0100 Subject: [PATCH 3/3] Disable the optional features for the 'structopt' crate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'ansi_term' crate is currrently being flagged as unmaintained. The dependency tree that is bringing this crate is: ansi_term 0.12.1 └── clap 2.34.0 └── structopt 0.3.26 └── parsec-service 1.2.0 ansi_term is an optional dependency that we are bringing along. Remove this and other optional dependencies by disabling the default-features for structopt. Signed-off-by: Tomás González --- Cargo.lock | 25 ------------------------- Cargo.toml | 2 +- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d2397609..282358fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,15 +22,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anyhow" version = "1.0.69" @@ -220,13 +211,9 @@ version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ - "ansi_term", - "atty", "bitflags", - "strsim", "textwrap", "unicode-width", - "vec_map", ] [[package]] @@ -1630,12 +1617,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "structopt" version = "0.3.26" @@ -1925,12 +1906,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" diff --git a/Cargo.toml b/Cargo.toml index 4293ba5b..38e800fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ picky-asn1-der = { version = "0.2.4", optional = true } picky-asn1 = { version = "0.3.0", optional = true } tss-esapi = { version = "7.2.0", optional = true } bincode = "1.3.1" -structopt = "0.3.21" +structopt = { version = "0.3.21", default-features = false} derivative = "2.2.0" hex = { version = "0.4.2", optional = true } psa-crypto = { version = "0.10.0", default-features = false, features = ["operations"], optional = true }