Skip to content

Commit 3c4ea26

Browse files
e2e_tests/wrong_permitted_algorithm: Change used sha for hw compatibility
TPM 2.0 specifies in https://trustedcomputinggroup.org/wp-content/uploads/PC-Client-Specific-Platform-TPM-Profile-for-TPM-2p0-v1p05p_r14_pub.pdf#%5B%7B%22num%22%3A82%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C33%2C375%2C0%5D "A conformant TPM SHALL support SHA-384 (0x000C) and SHA-256 (0x000B)" * Use this SHAs for testing. * Update the Cargo.lock file to guarantee compilation of tests with MSRV. Signed-off-by: Tomas Gonzalez Orlando <[email protected]>
1 parent e987290 commit 3c4ea26

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

e2e_tests/Cargo.lock

Lines changed: 6 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e_tests/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,17 @@ impl TestClient {
522522
)
523523
}
524524

525+
/// Signs a short digest with an RSA key.
526+
pub fn sign_with_rsa_sha384(&mut self, key_name: String, hash: Vec<u8>) -> Result<Vec<u8>> {
527+
self.sign(
528+
key_name,
529+
AsymmetricSignature::RsaPkcs1v15Sign {
530+
hash_alg: Hash::Sha384.into(),
531+
},
532+
hash,
533+
)
534+
}
535+
525536
/// Signs a short digest with an ECDSA key.
526537
pub fn sign_with_ecdsa_sha256(&mut self, key_name: String, hash: Vec<u8>) -> Result<Vec<u8>> {
527538
self.sign(

e2e_tests/tests/per_provider/normal_tests/key_attributes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn wrong_permitted_algorithm() {
134134
// Do not permit RSA PKCS 1v15 signing algorithm with SHA-256.
135135
let permitted_algorithm =
136136
Algorithm::AsymmetricSignature(AsymmetricSignature::RsaPkcs1v15Sign {
137-
hash_alg: Hash::Sha512.into(),
137+
hash_alg: Hash::Sha256.into(),
138138
});
139139
let mut usage_flags: UsageFlags = Default::default();
140140
let _ = usage_flags.set_sign_hash();
@@ -159,7 +159,7 @@ fn wrong_permitted_algorithm() {
159159
.unwrap();
160160

161161
let status = client
162-
.sign_with_rsa_sha256(key_name, vec![0xDE; 32])
162+
.sign_with_rsa_sha384(key_name, vec![0xDE; 32])
163163
.unwrap_err();
164164

165165
assert_eq!(status, ResponseStatus::PsaErrorNotPermitted);

0 commit comments

Comments
 (0)