Skip to content

Commit

Permalink
Merge branch 'main' into base64-0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
gowthamsk-arm authored Jul 20, 2023
2 parents 86eb3a0 + e3d5561 commit 7b64864
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 55 deletions.
80 changes: 33 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
21 changes: 19 additions & 2 deletions e2e_tests/tests/per_provider/normal_tests/capability_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![];
Expand Down Expand Up @@ -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![
Expand Down
7 changes: 2 additions & 5 deletions src/providers/mbed_crypto/asym_sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ impl Provider {
op: psa_sign_hash::Operation,
) -> Result<psa_sign_hash::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(),
Expand All @@ -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 {
Expand All @@ -57,9 +56,7 @@ impl Provider {
op: psa_verify_hash::Operation,
) -> Result<psa_verify_hash::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(),
Expand All @@ -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);
Expand Down

0 comments on commit 7b64864

Please sign in to comment.