Add missing guard around call to MD

PKCS#1 v1.5 mostly does not need hash operations. This is a first step
towards allowing builds with PKCS#1 v1.5 only (no v2.1) without MD.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard 2022-07-05 10:25:06 +02:00
parent b86279fc63
commit 3356b89b64

View File

@ -497,6 +497,7 @@ int mbedtls_rsa_set_padding( mbedtls_rsa_context *ctx, int padding,
return( MBEDTLS_ERR_RSA_INVALID_PADDING );
}
#if defined(MBEDTLS_PKCS1_V21)
if( ( padding == MBEDTLS_RSA_PKCS_V21 ) &&
( hash_id != MBEDTLS_MD_NONE ) )
{
@ -506,6 +507,7 @@ int mbedtls_rsa_set_padding( mbedtls_rsa_context *ctx, int padding,
if( md_info == NULL )
return( MBEDTLS_ERR_RSA_INVALID_PADDING );
}
#endif /* MBEDTLS_PKCS1_V21 */
ctx->padding = padding;
ctx->hash_id = hash_id;