Skip to content

Commit e8790da

Browse files
committed
fixup! checkquote: support more curves and hashes
1 parent 5abe48e commit e8790da

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

tss-esapi/src/utils/quote.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ where
4545
return Ok(false);
4646
};
4747
let Ok(public) = elliptic_curve::PublicKey::<C>::try_from(public) else {
48-
println!("public convert failed");
4948
return Ok(false);
5049
};
5150

@@ -326,16 +325,12 @@ pub fn checkquote(
326325
let Signature::EcDsa(sig) = signature else {
327326
return Ok(false);
328327
};
329-
println!("hash_alg: {:?}", sig.hashing_algorithm());
330-
331328
if !verify_ecdsa::<$curve>(&public, &bytes, &sig, sig.hashing_algorithm())?
332329
{
333-
println!("verification failed");
334330
return Ok(false);
335331
}
336332

337333
hash_alg = Some(sig.hashing_algorithm());
338-
println!("hash_alg: {hash_alg:?}");
339334
}
340335
};
341336
}

tss-esapi/tests/integration_tests/utils_tests/quote_test.rs

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,16 @@ mod test_quote {
193193
checkquote_ecc(HashingAlgorithm::Sha256);
194194
}
195195

196-
fn checkquote_rsa(keybits: RsaKeyBits, hash_alg: HashingAlgorithm) {
196+
#[test]
197+
fn checkquote_ecc_sha512() {
198+
checkquote_ecc(HashingAlgorithm::Sha512);
199+
}
200+
201+
fn checkquote_rsa(
202+
keybits: RsaKeyBits,
203+
hash_alg: HashingAlgorithm,
204+
sig_scheme: SignatureSchemeAlgorithm,
205+
) {
197206
let mut context = create_ctx_with_session();
198207
let ek_rsa = ek::create_ek_object(
199208
&mut context,
@@ -207,7 +216,7 @@ mod test_quote {
207216
ek_rsa,
208217
hash_alg,
209218
AsymmetricAlgorithmSelection::Rsa(keybits),
210-
SignatureSchemeAlgorithm::RsaPss,
219+
sig_scheme,
211220
Some(ak_auth.clone()),
212221
None,
213222
)
@@ -252,17 +261,29 @@ mod test_quote {
252261
}
253262

254263
#[test]
255-
fn checkquote_rsa_sha1() {
256-
checkquote_rsa(RsaKeyBits::Rsa2048, HashingAlgorithm::Sha1);
264+
fn checkquote_rsa_pss_sha1() {
265+
checkquote_rsa(
266+
RsaKeyBits::Rsa1024,
267+
HashingAlgorithm::Sha1,
268+
SignatureSchemeAlgorithm::RsaPss,
269+
);
257270
}
258271

259272
#[test]
260-
fn checkquote_rsa_sha256() {
261-
checkquote_rsa(RsaKeyBits::Rsa3072, HashingAlgorithm::Sha256);
273+
fn checkquote_rsa_ssa_sha256() {
274+
checkquote_rsa(
275+
RsaKeyBits::Rsa2048,
276+
HashingAlgorithm::Sha256,
277+
SignatureSchemeAlgorithm::RsaSsa,
278+
);
262279
}
263280

264281
#[test]
265-
fn checkquote_rsa_sha384() {
266-
checkquote_rsa(RsaKeyBits::Rsa3072, HashingAlgorithm::Sha384);
282+
fn checkquote_rsa_pss_sha384() {
283+
checkquote_rsa(
284+
RsaKeyBits::Rsa3072,
285+
HashingAlgorithm::Sha384,
286+
SignatureSchemeAlgorithm::RsaPss,
287+
);
267288
}
268289
}

0 commit comments

Comments
 (0)