mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-15 19:20:55 +00:00
pk: check PK context type in mbedtls_pk_verify_ext() before trying RSA PSS
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
d59caf4e51
commit
07500fd874
@ -1126,6 +1126,12 @@ int mbedtls_pk_verify_ext(mbedtls_pk_type_t type, const void *options,
|
||||
return mbedtls_pk_verify(ctx, md_alg, hash, hash_len, sig, sig_len);
|
||||
}
|
||||
|
||||
/* Ensure the PK context is of the right type otherwise mbedtls_pk_rsa()
|
||||
* below would return a NULL pointer. */
|
||||
if (mbedtls_pk_get_type(ctx) != MBEDTLS_PK_RSA) {
|
||||
return MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PKCS1_V21)
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
const mbedtls_pk_rsassa_pss_options *pss_opts;
|
||||
|
Loading…
x
Reference in New Issue
Block a user