mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 04:55:51 +01:00
Move RSA_ALT pk_info type check to the respective check_pair function
This commit is contained in:
parent
3b450a1798
commit
7f4b10b5bd
@ -329,12 +329,7 @@ int mbedtls_pk_check_pair( const mbedtls_pk_context *pub, const mbedtls_pk_conte
|
||||
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
|
||||
if( prv->pk_info->type == MBEDTLS_PK_RSA_ALT )
|
||||
{
|
||||
if( pub->pk_info->type != MBEDTLS_PK_RSA )
|
||||
return( MBEDTLS_ERR_PK_TYPE_MISMATCH );
|
||||
}
|
||||
else if( prv->pk_info->type != MBEDTLS_PK_OPAQUE )
|
||||
if( prv->pk_info->type != MBEDTLS_PK_OPAQUE )
|
||||
{
|
||||
if( pub->pk_info != prv->pk_info )
|
||||
return( MBEDTLS_ERR_PK_TYPE_MISMATCH );
|
||||
|
@ -486,6 +486,13 @@ static int rsa_alt_check_pair( const mbedtls_pk_context *pub, const void *prv )
|
||||
unsigned char hash[32];
|
||||
size_t sig_len = 0;
|
||||
int ret;
|
||||
const mbedtls_pk_context* prv_context = prv;
|
||||
|
||||
if( prv_context->pk_info->type == MBEDTLS_PK_RSA_ALT )
|
||||
{
|
||||
if( pub->pk_info->type != MBEDTLS_PK_RSA )
|
||||
return( MBEDTLS_ERR_PK_TYPE_MISMATCH );
|
||||
}
|
||||
|
||||
if( rsa_alt_get_bitlen( prv ) != rsa_get_bitlen( pub->pk_ctx ) )
|
||||
return( MBEDTLS_ERR_RSA_KEY_CHECK_FAILED );
|
||||
|
Loading…
Reference in New Issue
Block a user