mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-09-12 13:19:56 +00:00
test_suite_pk: always test verify_ext with opaque keys in pk_psa_wrap_sign_ext()
Signed-off-by: Valerio Setti <[email protected]>
This commit is contained in:
@@ -2060,8 +2060,7 @@ void pk_psa_wrap_sign_ext(int pk_type, int key_bits, int key_pk_type, int md_alg
|
|||||||
sig, sizeof(sig), &sig_len,
|
sig, sizeof(sig), &sig_len,
|
||||||
mbedtls_test_rnd_std_rand, NULL), 0);
|
mbedtls_test_rnd_std_rand, NULL), 0);
|
||||||
|
|
||||||
/* Trying to perform a verify_ext() using the opaque context is not supported
|
/* verify_ext() is not supported when using an opaque context. */
|
||||||
* so here we verify that this does not crash. */
|
|
||||||
if (key_pk_type == MBEDTLS_PK_RSASSA_PSS) {
|
if (key_pk_type == MBEDTLS_PK_RSASSA_PSS) {
|
||||||
mbedtls_pk_rsassa_pss_options pss_opts = {
|
mbedtls_pk_rsassa_pss_options pss_opts = {
|
||||||
.mgf1_hash_id = md_alg,
|
.mgf1_hash_id = md_alg,
|
||||||
@@ -2070,6 +2069,10 @@ void pk_psa_wrap_sign_ext(int pk_type, int key_bits, int key_pk_type, int md_alg
|
|||||||
TEST_EQUAL(mbedtls_pk_verify_ext(key_pk_type, &pss_opts, &pk, md_alg,
|
TEST_EQUAL(mbedtls_pk_verify_ext(key_pk_type, &pss_opts, &pk, md_alg,
|
||||||
hash, hash_len, sig, sig_len),
|
hash, hash_len, sig, sig_len),
|
||||||
MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE);
|
MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE);
|
||||||
|
} else {
|
||||||
|
TEST_EQUAL(mbedtls_pk_verify_ext(key_pk_type, NULL, &pk, md_alg,
|
||||||
|
hash, hash_len, sig, sig_len),
|
||||||
|
MBEDTLS_ERR_PK_TYPE_MISMATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
mbedtls_pk_free(&pk);
|
mbedtls_pk_free(&pk);
|
||||||
|
|||||||
Reference in New Issue
Block a user