Move underflow test to make time constant

This commit is contained in:
Janos Follath 2016-02-11 11:08:18 +00:00 committed by Simon Butcher
parent 574b118bf8
commit 092f2c48c4

View File

@ -702,6 +702,12 @@ int rsa_rsaes_oaep_decrypt( rsa_context *ctx,
if( md_info == NULL )
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
hlen = mbedtls_md_get_size( md_info );
// checking for integer underflow
if( 2 * hlen + 2 > ilen )
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
/*
* RSA operation
*/