mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-27 02:35:53 +00:00
Included tests for the overflow
This commit is contained in:
parent
e007c9fede
commit
e33f559de1
|
@ -529,7 +529,8 @@ int mbedtls_rsa_rsaes_oaep_encrypt( mbedtls_rsa_context *ctx,
|
||||||
olen = ctx->len;
|
olen = ctx->len;
|
||||||
hlen = mbedtls_md_get_size( md_info );
|
hlen = mbedtls_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( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
||||||
|
|
||||||
memset( output, 0, olen );
|
memset( output, 0, olen );
|
||||||
|
@ -596,7 +597,8 @@ int mbedtls_rsa_rsaes_pkcs1_v15_encrypt( mbedtls_rsa_context *ctx,
|
||||||
|
|
||||||
olen = ctx->len;
|
olen = ctx->len;
|
||||||
|
|
||||||
if( olen < ilen + 11 )
|
// first comparison checks for overflow
|
||||||
|
if( ilen + 11 < ilen || olen < ilen + 11 )
|
||||||
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
|
||||||
|
|
||||||
nb_pad = olen - 3 - ilen;
|
nb_pad = olen - 3 - ilen;
|
||||||
|
|
Loading…
Reference in a new issue