Merge branch 'mbedtls-2.7-proposed' into mbedtls-2.7-restricted-proposed

This commit is contained in:
Jaeden Amero 2018-03-14 18:01:54 +00:00
commit 8a032e6051
3 changed files with 32 additions and 3 deletions

View file

@ -5,11 +5,17 @@ mbed TLS ChangeLog (Sorted per branch, date)
Security Security
* Verify results of RSA private key operations to defend * Verify results of RSA private key operations to defend
against Bellcore glitch attack. against Bellcore glitch attack.
* Fix a buffer overread in ssl_parse_server_key_exchange() that could cause
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
* Extend PKCS#8 interface by introducing support for the entire SHA * Extend PKCS#8 interface by introducing support for the entire SHA
algorithms family when encrypting private keys using PKCS#5 v2.0. algorithms family when encrypting private keys using PKCS#5 v2.0.
Submitted by Antonio Quartulli, OpenVPN Inc. This allows reading encrypted PEM files produced by software that
uses PBKDF2-SHA2, such as OpenSSL 1.1. Submitted by Antonio Quartulli,
OpenVPN Inc. Fixes #1339
Bugfix Bugfix
* Fix setting version TLSv1 as minimal version, even if TLS 1 * Fix setting version TLSv1 as minimal version, even if TLS 1
@ -25,6 +31,12 @@ Bugfix
by Guido Vranken. #639 by Guido Vranken. #639
* Fix X509 CRT parsing that would potentially accept an invalid tag when * Fix X509 CRT parsing that would potentially accept an invalid tag when
parsing the subject alternative names. parsing the subject alternative names.
* 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.
* Don't define mbedtls_aes_decrypt and mbedtls_aes_encrypt under
MBEDTLS_DEPRECATED_REMOVED. #1388
Changes Changes
* Clarify the documentation of mbedtls_ssl_setup. * Clarify the documentation of mbedtls_ssl_setup.

View file

@ -765,12 +765,14 @@ int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
} }
#endif /* !MBEDTLS_AES_ENCRYPT_ALT */ #endif /* !MBEDTLS_AES_ENCRYPT_ALT */
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void mbedtls_aes_encrypt( mbedtls_aes_context *ctx, void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
const unsigned char input[16], const unsigned char input[16],
unsigned char output[16] ) unsigned char output[16] )
{ {
mbedtls_internal_aes_encrypt( ctx, input, output ); mbedtls_internal_aes_encrypt( ctx, input, output );
} }
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
/* /*
* AES-ECB block decryption * AES-ECB block decryption
@ -831,12 +833,14 @@ int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
} }
#endif /* !MBEDTLS_AES_DECRYPT_ALT */ #endif /* !MBEDTLS_AES_DECRYPT_ALT */
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void mbedtls_aes_decrypt( mbedtls_aes_context *ctx, void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
const unsigned char input[16], const unsigned char input[16],
unsigned char output[16] ) unsigned char output[16] )
{ {
mbedtls_internal_aes_decrypt( ctx, input, output ); mbedtls_internal_aes_decrypt( ctx, input, output );
} }
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
/* /*
* AES-ECB block encryption/decryption * AES-ECB block encryption/decryption

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)" ) );
@ -2478,10 +2484,17 @@ static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )
/* /*
* Read signature * Read signature
*/ */
if( p > end - 2 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
sig_len = ( p[0] << 8 ) | p[1]; sig_len = ( p[0] << 8 ) | p[1];
p += 2; p += 2;
if( end != p + sig_len ) if( p != end - sig_len )
{ {
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,