mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 00:25:36 +01:00
Included tests for the overflow
Conflicts: library/rsa.c
This commit is contained in:
parent
21ca00243c
commit
742783fe85
@ -525,7 +525,8 @@ int rsa_rsaes_oaep_encrypt( rsa_context *ctx,
|
||||
olen = ctx->len;
|
||||
hlen = md_get_size( md_info );
|
||||
|
||||
if( olen < ilen + 2 * hlen + 2 )
|
||||
// first comparison checks for overflow
|
||||
if( ilen + 2 * hlen + 2 < ilen || olen < ilen + 2 * hlen + 2 )
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
|
||||
memset( output, 0, olen );
|
||||
@ -592,7 +593,8 @@ int rsa_rsaes_pkcs1_v15_encrypt( rsa_context *ctx,
|
||||
|
||||
olen = ctx->len;
|
||||
|
||||
if( olen < ilen + 11 )
|
||||
// first comparison checks for overflow
|
||||
if( ilen + 11 < ilen || olen < ilen + 11 )
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
|
||||
nb_pad = olen - 3 - ilen;
|
||||
|
Loading…
Reference in New Issue
Block a user