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);