Merge remote-tracking branch 'public/pr/1889' into mbedtls-2.1

This commit is contained in:
Simon Butcher 2018-08-28 12:26:33 +01:00
commit 85e5bfd00c
3 changed files with 13 additions and 2 deletions

View File

@ -20,6 +20,8 @@ Bugfix
without providing a list of CAs. This was due to an overly strict bounds without providing a list of CAs. This was due to an overly strict bounds
check in parsing the CertificateRequest message, check in parsing the CertificateRequest message,
introduced in Mbed TLS 2.12.0. Fixes #1954. introduced in Mbed TLS 2.12.0. Fixes #1954.
* Fix undefined shifts with negative values in certificates parsing
(found by Catena cyber using oss-fuzz)
= mbed TLS 2.1.14 branch released 2018-07-25 = mbed TLS 2.1.14 branch released 2018-07-25

View File

@ -3098,8 +3098,8 @@ static int ssl_parse_new_session_ticket( mbedtls_ssl_context *ssl )
msg = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl ); msg = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );
lifetime = ( msg[0] << 24 ) | ( msg[1] << 16 ) | lifetime = ( ((uint32_t) msg[0]) << 24 ) | ( msg[1] << 16 ) |
( msg[2] << 8 ) | ( msg[3] ); ( msg[2] << 8 ) | ( msg[3] );
ticket_len = ( msg[4] << 8 ) | ( msg[5] ); ticket_len = ( msg[4] << 8 ) | ( msg[5] );

View File

@ -152,6 +152,9 @@ const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb =
static int x509_profile_check_md_alg( const mbedtls_x509_crt_profile *profile, static int x509_profile_check_md_alg( const mbedtls_x509_crt_profile *profile,
mbedtls_md_type_t md_alg ) mbedtls_md_type_t md_alg )
{ {
if( md_alg == MBEDTLS_MD_NONE )
return( -1 );
if( ( profile->allowed_mds & MBEDTLS_X509_ID_FLAG( md_alg ) ) != 0 ) if( ( profile->allowed_mds & MBEDTLS_X509_ID_FLAG( md_alg ) ) != 0 )
return( 0 ); return( 0 );
@ -165,6 +168,9 @@ static int x509_profile_check_md_alg( const mbedtls_x509_crt_profile *profile,
static int x509_profile_check_pk_alg( const mbedtls_x509_crt_profile *profile, static int x509_profile_check_pk_alg( const mbedtls_x509_crt_profile *profile,
mbedtls_pk_type_t pk_alg ) mbedtls_pk_type_t pk_alg )
{ {
if( pk_alg == MBEDTLS_PK_NONE )
return( -1 );
if( ( profile->allowed_pks & MBEDTLS_X509_ID_FLAG( pk_alg ) ) != 0 ) if( ( profile->allowed_pks & MBEDTLS_X509_ID_FLAG( pk_alg ) ) != 0 )
return( 0 ); return( 0 );
@ -196,6 +202,9 @@ static int x509_profile_check_key( const mbedtls_x509_crt_profile *profile,
{ {
mbedtls_ecp_group_id gid = mbedtls_pk_ec( *pk )->grp.id; mbedtls_ecp_group_id gid = mbedtls_pk_ec( *pk )->grp.id;
if( gid == MBEDTLS_ECP_DP_NONE )
return( -1 );
if( ( profile->allowed_curves & MBEDTLS_X509_ID_FLAG( gid ) ) != 0 ) if( ( profile->allowed_curves & MBEDTLS_X509_ID_FLAG( gid ) ) != 0 )
return( 0 ); return( 0 );