mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 22:14:15 +01:00
Check that length is properly set in mbedtls_rsa_check_pubkey
This commit is contained in:
parent
2f8f06aa25
commit
ba1ba11a98
@ -1028,6 +1028,9 @@ int mbedtls_rsa_check_pubkey( const mbedtls_rsa_context *ctx )
|
|||||||
if( !ctx->N.p || !ctx->E.p )
|
if( !ctx->N.p || !ctx->E.p )
|
||||||
return( MBEDTLS_ERR_RSA_KEY_CHECK_FAILED );
|
return( MBEDTLS_ERR_RSA_KEY_CHECK_FAILED );
|
||||||
|
|
||||||
|
if( ctx->len != mbedtls_mpi_size( &ctx->N ) )
|
||||||
|
return( MBEDTLS_ERR_RSA_KEY_CHECK_FAILED );
|
||||||
|
|
||||||
if( ( ctx->N.p[0] & 1 ) == 0 ||
|
if( ( ctx->N.p[0] & 1 ) == 0 ||
|
||||||
( ctx->E.p[0] & 1 ) == 0 )
|
( ctx->E.p[0] & 1 ) == 0 )
|
||||||
return( MBEDTLS_ERR_RSA_KEY_CHECK_FAILED );
|
return( MBEDTLS_ERR_RSA_KEY_CHECK_FAILED );
|
||||||
|
Loading…
Reference in New Issue
Block a user