mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-24 17:25:39 +00:00
Fix integer overflows in buffer bound checks
Fix potential integer overflows in the following functions: * mbedtls_md2_update() to be bypassed and cause * mbedtls_cipher_update() * mbedtls_ctr_drbg_reseed() This overflows would mainly be exploitable in 32-bit systems and could cause buffer bound checks to be bypassed.
This commit is contained in:
parent
c1d54bb7b2
commit
593e8b2793
10
ChangeLog
10
ChangeLog
|
@ -1,5 +1,15 @@
|
||||||
mbed TLS ChangeLog (Sorted per branch, date)
|
mbed TLS ChangeLog (Sorted per branch, date)
|
||||||
|
|
||||||
|
= mbed TLS 1.3.x branch released xxxx-xx-xx
|
||||||
|
|
||||||
|
Bugfix
|
||||||
|
* Fixed potential arithmetic overflow in mbedtls_ctr_drbg_reseed() that could
|
||||||
|
cause buffer bound checks to be bypassed. Found by Eyal Itkin.
|
||||||
|
* Fixed potential arithmetic overflows in mbedtls_cipher_update() that could
|
||||||
|
cause buffer bound checks to be bypassed. Found by Eyal Itkin.
|
||||||
|
* Fixed potential arithmetic overflow in mbedtls_md2_update() that could
|
||||||
|
cause buffer bound checks to be bypassed. Found by Eyal Itkin.
|
||||||
|
|
||||||
= mbed TLS 1.3.18 branch 2016-10-17
|
= mbed TLS 1.3.18 branch 2016-10-17
|
||||||
|
|
||||||
Security
|
Security
|
||||||
|
|
|
@ -315,9 +315,9 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input,
|
||||||
* If there is not enough data for a full block, cache it.
|
* If there is not enough data for a full block, cache it.
|
||||||
*/
|
*/
|
||||||
if( ( ctx->operation == POLARSSL_DECRYPT &&
|
if( ( ctx->operation == POLARSSL_DECRYPT &&
|
||||||
ilen + ctx->unprocessed_len <= cipher_get_block_size( ctx ) ) ||
|
ilen <= cipher_get_block_size( ctx ) - ctx->unprocessed_len ) ||
|
||||||
( ctx->operation == POLARSSL_ENCRYPT &&
|
( ctx->operation == POLARSSL_ENCRYPT &&
|
||||||
ilen + ctx->unprocessed_len < cipher_get_block_size( ctx ) ) )
|
ilen < cipher_get_block_size( ctx ) - ctx->unprocessed_len ) )
|
||||||
{
|
{
|
||||||
memcpy( &( ctx->unprocessed_data[ctx->unprocessed_len] ), input,
|
memcpy( &( ctx->unprocessed_data[ctx->unprocessed_len] ), input,
|
||||||
ilen );
|
ilen );
|
||||||
|
|
|
@ -277,7 +277,8 @@ int ctr_drbg_reseed( ctr_drbg_context *ctx,
|
||||||
unsigned char seed[CTR_DRBG_MAX_SEED_INPUT];
|
unsigned char seed[CTR_DRBG_MAX_SEED_INPUT];
|
||||||
size_t seedlen = 0;
|
size_t seedlen = 0;
|
||||||
|
|
||||||
if( ctx->entropy_len + len > CTR_DRBG_MAX_SEED_INPUT )
|
if( ctx->entropy_len > CTR_DRBG_MAX_SEED_INPUT ||
|
||||||
|
len > CTR_DRBG_MAX_SEED_INPUT - ctx->entropy_len )
|
||||||
return( POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG );
|
return( POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG );
|
||||||
|
|
||||||
memset( seed, 0, CTR_DRBG_MAX_SEED_INPUT );
|
memset( seed, 0, CTR_DRBG_MAX_SEED_INPUT );
|
||||||
|
|
|
@ -155,7 +155,7 @@ void md2_update( md2_context *ctx, const unsigned char *input, size_t ilen )
|
||||||
|
|
||||||
while( ilen > 0 )
|
while( ilen > 0 )
|
||||||
{
|
{
|
||||||
if( ctx->left + ilen > 16 )
|
if( ilen > 16 - ctx->left )
|
||||||
fill = 16 - ctx->left;
|
fill = 16 - ctx->left;
|
||||||
else
|
else
|
||||||
fill = ilen;
|
fill = ilen;
|
||||||
|
|
Loading…
Reference in a new issue