Merge remote-tracking branch 'upstream-public/pr/1449' into mbedtls-2.7-proposed

This commit is contained in:
Jaeden Amero 2018-03-14 17:58:00 +00:00
commit 100273ddfb
2 changed files with 13 additions and 3 deletions

View file

@ -21,6 +21,10 @@ Bugfix
overflow. #1179 overflow. #1179
* Fix memory allocation corner cases in memory_buffer_alloc.c module. Found * Fix memory allocation corner cases in memory_buffer_alloc.c module. Found
by Guido Vranken. #639 by Guido Vranken. #639
* Fix a possible arithmetic overflow in ssl_parse_server_key_exchange()
that could cause a key exchange to fail on valid data.
* Fix a possible arithmetic overflow in ssl_parse_server_psk_hint() that
could cause a key exchange to fail on valid data.
Changes Changes
* Clarify the documentation of mbedtls_ssl_setup. * Clarify the documentation of mbedtls_ssl_setup.
@ -108,6 +112,8 @@ Security
manner. manner.
* Fix a buffer overread in ssl_parse_server_key_exchange() that could cause * Fix a buffer overread in ssl_parse_server_key_exchange() that could cause
a crash on invalid input. a crash on invalid input.
* Fix a buffer overread in ssl_parse_server_psk_hint() that could cause a
crash on invalid input.
Features Features
* Allow comments in test data files. * Allow comments in test data files.
@ -242,8 +248,6 @@ Bugfix
* In mbedtls_entropy_free(), properly free the message digest context. * In mbedtls_entropy_free(), properly free the message digest context.
* Fix status handshake status message in programs/ssl/dtls_client.c. Found * Fix status handshake status message in programs/ssl/dtls_client.c. Found
and fixed by muddog. and fixed by muddog.
* Fix a possible arithmetic overflow in ssl_parse_server_key_exchange()
that could cause a key exchange to fail on valid data.
Changes Changes
* Extend cert_write example program by options to set the certificate version * Extend cert_write example program by options to set the certificate version

View file

@ -2057,10 +2057,16 @@ static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl,
* *
* opaque psk_identity_hint<0..2^16-1>; * opaque psk_identity_hint<0..2^16-1>;
*/ */
if( (*p) > end - 2 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message "
"(psk_identity_hint length)" ) );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
len = (*p)[0] << 8 | (*p)[1]; len = (*p)[0] << 8 | (*p)[1];
*p += 2; *p += 2;
if( (*p) + len > end ) if( (*p) > end - len )
{ {
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message " MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message "
"(psk_identity_hint length)" ) ); "(psk_identity_hint length)" ) );