mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 14:15:51 +01:00
Shorten lines in library/ssl_cli.c to at most 80 characters
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
d9f694960f
commit
b2fff6d7ed
@ -108,7 +108,8 @@ static void ssl_write_hostname_ext( mbedtls_ssl_context *ssl,
|
|||||||
if( ssl->hostname == NULL )
|
if( ssl->hostname == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding server name extension: %s",
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "client hello, adding server name extension: %s",
|
||||||
ssl->hostname ) );
|
ssl->hostname ) );
|
||||||
|
|
||||||
hostname_len = strlen( ssl->hostname );
|
hostname_len = strlen( ssl->hostname );
|
||||||
@ -180,7 +181,8 @@ static void ssl_write_renegotiation_ext( mbedtls_ssl_context *ssl,
|
|||||||
if( ssl->renego_status != MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS )
|
if( ssl->renego_status != MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding renegotiation extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "client hello, adding renegotiation extension" ) );
|
||||||
|
|
||||||
if( end < p || (size_t)( end - p ) < 5 + ssl->verify_data_len )
|
if( end < p || (size_t)( end - p ) < 5 + ssl->verify_data_len )
|
||||||
{
|
{
|
||||||
@ -191,8 +193,10 @@ static void ssl_write_renegotiation_ext( mbedtls_ssl_context *ssl,
|
|||||||
/*
|
/*
|
||||||
* Secure renegotiation
|
* Secure renegotiation
|
||||||
*/
|
*/
|
||||||
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_RENEGOTIATION_INFO >> 8 ) & 0xFF );
|
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_RENEGOTIATION_INFO >> 8 )
|
||||||
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_RENEGOTIATION_INFO ) & 0xFF );
|
& 0xFF );
|
||||||
|
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_RENEGOTIATION_INFO )
|
||||||
|
& 0xFF );
|
||||||
|
|
||||||
*p++ = 0x00;
|
*p++ = 0x00;
|
||||||
*p++ = ( ssl->verify_data_len + 1 ) & 0xFF;
|
*p++ = ( ssl->verify_data_len + 1 ) & 0xFF;
|
||||||
@ -226,7 +230,8 @@ static void ssl_write_signature_algorithms_ext( mbedtls_ssl_context *ssl,
|
|||||||
if( ssl->conf->max_minor_ver != MBEDTLS_SSL_MINOR_VERSION_3 )
|
if( ssl->conf->max_minor_ver != MBEDTLS_SSL_MINOR_VERSION_3 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding signature_algorithms extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "client hello, adding signature_algorithms extension" ) );
|
||||||
|
|
||||||
for( md = ssl->conf->sig_hashes; *md != MBEDTLS_MD_NONE; md++ )
|
for( md = ssl->conf->sig_hashes; *md != MBEDTLS_MD_NONE; md++ )
|
||||||
{
|
{
|
||||||
@ -311,12 +316,17 @@ static void ssl_write_supported_elliptic_curves_ext( mbedtls_ssl_context *ssl,
|
|||||||
|
|
||||||
*olen = 0;
|
*olen = 0;
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding supported_elliptic_curves extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "client hello, adding supported_elliptic_curves extension" ) );
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECP_C)
|
#if defined(MBEDTLS_ECP_C)
|
||||||
for( grp_id = ssl->conf->curve_list; *grp_id != MBEDTLS_ECP_DP_NONE; grp_id++ )
|
for( grp_id = ssl->conf->curve_list;
|
||||||
|
*grp_id != MBEDTLS_ECP_DP_NONE;
|
||||||
|
grp_id++ )
|
||||||
#else
|
#else
|
||||||
for( info = mbedtls_ecp_curve_list(); info->grp_id != MBEDTLS_ECP_DP_NONE; info++ )
|
for( info = mbedtls_ecp_curve_list();
|
||||||
|
info->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||||
|
info++ )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_ECP_C)
|
#if defined(MBEDTLS_ECP_C)
|
||||||
@ -324,7 +334,8 @@ static void ssl_write_supported_elliptic_curves_ext( mbedtls_ssl_context *ssl,
|
|||||||
#endif
|
#endif
|
||||||
if( info == NULL )
|
if( info == NULL )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "invalid curve in ssl configuration" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
|
( "invalid curve in ssl configuration" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,9 +351,13 @@ static void ssl_write_supported_elliptic_curves_ext( mbedtls_ssl_context *ssl,
|
|||||||
elliptic_curve_len = 0;
|
elliptic_curve_len = 0;
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECP_C)
|
#if defined(MBEDTLS_ECP_C)
|
||||||
for( grp_id = ssl->conf->curve_list; *grp_id != MBEDTLS_ECP_DP_NONE; grp_id++ )
|
for( grp_id = ssl->conf->curve_list;
|
||||||
|
*grp_id != MBEDTLS_ECP_DP_NONE;
|
||||||
|
grp_id++ )
|
||||||
#else
|
#else
|
||||||
for( info = mbedtls_ecp_curve_list(); info->grp_id != MBEDTLS_ECP_DP_NONE; info++ )
|
for( info = mbedtls_ecp_curve_list();
|
||||||
|
info->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||||
|
info++ )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_ECP_C)
|
#if defined(MBEDTLS_ECP_C)
|
||||||
@ -355,8 +370,10 @@ static void ssl_write_supported_elliptic_curves_ext( mbedtls_ssl_context *ssl,
|
|||||||
if( elliptic_curve_len == 0 )
|
if( elliptic_curve_len == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES >> 8 ) & 0xFF );
|
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES >> 8 )
|
||||||
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES ) & 0xFF );
|
& 0xFF );
|
||||||
|
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES )
|
||||||
|
& 0xFF );
|
||||||
|
|
||||||
*p++ = (unsigned char)( ( ( elliptic_curve_len + 2 ) >> 8 ) & 0xFF );
|
*p++ = (unsigned char)( ( ( elliptic_curve_len + 2 ) >> 8 ) & 0xFF );
|
||||||
*p++ = (unsigned char)( ( ( elliptic_curve_len + 2 ) ) & 0xFF );
|
*p++ = (unsigned char)( ( ( elliptic_curve_len + 2 ) ) & 0xFF );
|
||||||
@ -376,7 +393,8 @@ static void ssl_write_supported_point_formats_ext( mbedtls_ssl_context *ssl,
|
|||||||
|
|
||||||
*olen = 0;
|
*olen = 0;
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding supported_point_formats extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "client hello, adding supported_point_formats extension" ) );
|
||||||
|
|
||||||
if( end < p || (size_t)( end - p ) < 6 )
|
if( end < p || (size_t)( end - p ) < 6 )
|
||||||
{
|
{
|
||||||
@ -384,8 +402,10 @@ static void ssl_write_supported_point_formats_ext( mbedtls_ssl_context *ssl,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS >> 8 ) & 0xFF );
|
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS >> 8 )
|
||||||
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS ) & 0xFF );
|
& 0xFF );
|
||||||
|
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS )
|
||||||
|
& 0xFF );
|
||||||
|
|
||||||
*p++ = 0x00;
|
*p++ = 0x00;
|
||||||
*p++ = 2;
|
*p++ = 2;
|
||||||
@ -414,7 +434,8 @@ static void ssl_write_ecjpake_kkpp_ext( mbedtls_ssl_context *ssl,
|
|||||||
if( mbedtls_ecjpake_check( &ssl->handshake->ecjpake_ctx ) != 0 )
|
if( mbedtls_ecjpake_check( &ssl->handshake->ecjpake_ctx ) != 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding ecjpake_kkpp extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "client hello, adding ecjpake_kkpp extension" ) );
|
||||||
|
|
||||||
if( end - p < 4 )
|
if( end - p < 4 )
|
||||||
{
|
{
|
||||||
@ -440,7 +461,8 @@ static void ssl_write_ecjpake_kkpp_ext( mbedtls_ssl_context *ssl,
|
|||||||
ssl->conf->f_rng, ssl->conf->p_rng );
|
ssl->conf->f_rng, ssl->conf->p_rng );
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1 , "mbedtls_ecjpake_write_round_one", ret );
|
MBEDTLS_SSL_DEBUG_RET( 1 ,
|
||||||
|
"mbedtls_ecjpake_write_round_one", ret );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +560,8 @@ static void ssl_write_max_fragment_length_ext( mbedtls_ssl_context *ssl,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding max_fragment_length extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "client hello, adding max_fragment_length extension" ) );
|
||||||
|
|
||||||
if( end < p || (size_t)( end - p ) < 5 )
|
if( end < p || (size_t)( end - p ) < 5 )
|
||||||
{
|
{
|
||||||
@ -546,8 +569,10 @@ static void ssl_write_max_fragment_length_ext( mbedtls_ssl_context *ssl,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH >> 8 ) & 0xFF );
|
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH >> 8 )
|
||||||
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH ) & 0xFF );
|
& 0xFF );
|
||||||
|
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH )
|
||||||
|
& 0xFF );
|
||||||
|
|
||||||
*p++ = 0x00;
|
*p++ = 0x00;
|
||||||
*p++ = 1;
|
*p++ = 1;
|
||||||
@ -572,7 +597,8 @@ static void ssl_write_truncated_hmac_ext( mbedtls_ssl_context *ssl,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding truncated_hmac extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "client hello, adding truncated_hmac extension" ) );
|
||||||
|
|
||||||
if( end < p || (size_t)( end - p ) < 4 )
|
if( end < p || (size_t)( end - p ) < 4 )
|
||||||
{
|
{
|
||||||
@ -605,8 +631,8 @@ static void ssl_write_encrypt_then_mac_ext( mbedtls_ssl_context *ssl,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding encrypt_then_mac "
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
"extension" ) );
|
( "client hello, adding encrypt_then_mac extension" ) );
|
||||||
|
|
||||||
if( end < p || (size_t)( end - p ) < 4 )
|
if( end < p || (size_t)( end - p ) < 4 )
|
||||||
{
|
{
|
||||||
@ -639,8 +665,8 @@ static void ssl_write_extended_ms_ext( mbedtls_ssl_context *ssl,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding extended_master_secret "
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
"extension" ) );
|
( "client hello, adding extended_master_secret extension" ) );
|
||||||
|
|
||||||
if( end < p || (size_t)( end - p ) < 4 )
|
if( end < p || (size_t)( end - p ) < 4 )
|
||||||
{
|
{
|
||||||
@ -648,8 +674,10 @@ static void ssl_write_extended_ms_ext( mbedtls_ssl_context *ssl,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET >> 8 ) & 0xFF );
|
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET >> 8 )
|
||||||
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET ) & 0xFF );
|
& 0xFF );
|
||||||
|
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET )
|
||||||
|
& 0xFF );
|
||||||
|
|
||||||
*p++ = 0x00;
|
*p++ = 0x00;
|
||||||
*p++ = 0x00;
|
*p++ = 0x00;
|
||||||
@ -673,7 +701,8 @@ static void ssl_write_session_ticket_ext( mbedtls_ssl_context *ssl,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding session ticket extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "client hello, adding session ticket extension" ) );
|
||||||
|
|
||||||
if( end < p || (size_t)( end - p ) < 4 + tlen )
|
if( end < p || (size_t)( end - p ) < 4 + tlen )
|
||||||
{
|
{
|
||||||
@ -694,7 +723,8 @@ static void ssl_write_session_ticket_ext( mbedtls_ssl_context *ssl,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "sending session ticket of length %d", tlen ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "sending session ticket of length %d", tlen ) );
|
||||||
|
|
||||||
memcpy( p, ssl->session_negotiate->ticket, tlen );
|
memcpy( p, ssl->session_negotiate->ticket, tlen );
|
||||||
|
|
||||||
@ -815,7 +845,8 @@ static int ssl_generate_random( mbedtls_ssl_context *ssl )
|
|||||||
*
|
*
|
||||||
* \return 0 if valid, else 1
|
* \return 0 if valid, else 1
|
||||||
*/
|
*/
|
||||||
static int ssl_validate_ciphersuite( const mbedtls_ssl_ciphersuite_t * suite_info,
|
static int ssl_validate_ciphersuite(
|
||||||
|
const mbedtls_ssl_ciphersuite_t * suite_info,
|
||||||
const mbedtls_ssl_context * ssl,
|
const mbedtls_ssl_context * ssl,
|
||||||
int min_minor_ver, int max_minor_ver )
|
int min_minor_ver, int max_minor_ver )
|
||||||
{
|
{
|
||||||
@ -889,8 +920,8 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
|||||||
|
|
||||||
if( ssl->conf->max_major_ver == 0 )
|
if( ssl->conf->max_major_ver == 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "configured max major version is invalid, "
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
"consider using mbedtls_ssl_config_defaults()" ) );
|
( "configured max major version is invalid, consider using mbedtls_ssl_config_defaults()" ) );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,7 +935,8 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
|||||||
buf = ssl->out_msg;
|
buf = ssl->out_msg;
|
||||||
p = buf + 4;
|
p = buf + 4;
|
||||||
|
|
||||||
mbedtls_ssl_write_version( ssl->conf->max_major_ver, ssl->conf->max_minor_ver,
|
mbedtls_ssl_write_version( ssl->conf->max_major_ver,
|
||||||
|
ssl->conf->max_minor_ver,
|
||||||
ssl->conf->transport, p );
|
ssl->conf->transport, p );
|
||||||
p += 2;
|
p += 2;
|
||||||
|
|
||||||
@ -956,7 +988,8 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
|||||||
if( ssl->session_negotiate->ticket != NULL &&
|
if( ssl->session_negotiate->ticket != NULL &&
|
||||||
ssl->session_negotiate->ticket_len != 0 )
|
ssl->session_negotiate->ticket_len != 0 )
|
||||||
{
|
{
|
||||||
ret = ssl->conf->f_rng( ssl->conf->p_rng, ssl->session_negotiate->id, 32 );
|
ret = ssl->conf->f_rng( ssl->conf->p_rng,
|
||||||
|
ssl->session_negotiate->id, 32 );
|
||||||
|
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
return( ret );
|
return( ret );
|
||||||
@ -1031,7 +1064,8 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
|||||||
*p++ = (unsigned char)( ciphersuites[i] );
|
*p++ = (unsigned char)( ciphersuites[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, got %d ciphersuites (excluding SCSVs)", n ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "client hello, got %d ciphersuites (excluding SCSVs)", n ) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add TLS_EMPTY_RENEGOTIATION_INFO_SCSV
|
* Add TLS_EMPTY_RENEGOTIATION_INFO_SCSV
|
||||||
@ -1081,7 +1115,8 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
|||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, compress len.: %d", 2 ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, compress len.: %d", 2 ) );
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, compress alg.: %d %d",
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, compress alg.: %d %d",
|
||||||
MBEDTLS_SSL_COMPRESS_DEFLATE, MBEDTLS_SSL_COMPRESS_NULL ) );
|
MBEDTLS_SSL_COMPRESS_DEFLATE,
|
||||||
|
MBEDTLS_SSL_COMPRESS_NULL ) );
|
||||||
|
|
||||||
*p++ = 2;
|
*p++ = 2;
|
||||||
*p++ = MBEDTLS_SSL_COMPRESS_DEFLATE;
|
*p++ = MBEDTLS_SSL_COMPRESS_DEFLATE;
|
||||||
@ -1229,7 +1264,9 @@ static int ssl_parse_renegotiation_info( mbedtls_ssl_context *ssl,
|
|||||||
ssl->peer_verify_data, ssl->verify_data_len ) != 0 )
|
ssl->peer_verify_data, ssl->verify_data_len ) != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching renegotiation info" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching renegotiation info" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1239,8 +1276,11 @@ static int ssl_parse_renegotiation_info( mbedtls_ssl_context *ssl,
|
|||||||
{
|
{
|
||||||
if( len != 1 || buf[0] != 0x00 )
|
if( len != 1 || buf[0] != 0x00 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-zero length renegotiation info" ) );
|
MBEDTLS_SSL_DEBUG_MSG(
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
1, ( "non-zero length renegotiation info" ) );
|
||||||
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1264,8 +1304,11 @@ static int ssl_parse_max_fragment_length_ext( mbedtls_ssl_context *ssl,
|
|||||||
len != 1 ||
|
len != 1 ||
|
||||||
buf[0] != ssl->conf->mfl_code )
|
buf[0] != ssl->conf->mfl_code )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching max fragment length extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
( "non-matching max fragment length extension" ) );
|
||||||
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1282,8 +1325,11 @@ static int ssl_parse_truncated_hmac_ext( mbedtls_ssl_context *ssl,
|
|||||||
if( ssl->conf->trunc_hmac == MBEDTLS_SSL_TRUNC_HMAC_DISABLED ||
|
if( ssl->conf->trunc_hmac == MBEDTLS_SSL_TRUNC_HMAC_DISABLED ||
|
||||||
len != 0 )
|
len != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching truncated HMAC extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
( "non-matching truncated HMAC extension" ) );
|
||||||
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1361,8 +1407,11 @@ static int ssl_parse_encrypt_then_mac_ext( mbedtls_ssl_context *ssl,
|
|||||||
ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ||
|
ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ||
|
||||||
len != 0 )
|
len != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching encrypt-then-MAC extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
( "non-matching encrypt-then-MAC extension" ) );
|
||||||
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1384,8 +1433,11 @@ static int ssl_parse_extended_ms_ext( mbedtls_ssl_context *ssl,
|
|||||||
ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ||
|
ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ||
|
||||||
len != 0 )
|
len != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching extended master secret extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
( "non-matching extended master secret extension" ) );
|
||||||
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1406,8 +1458,11 @@ static int ssl_parse_session_ticket_ext( mbedtls_ssl_context *ssl,
|
|||||||
if( ssl->conf->session_tickets == MBEDTLS_SSL_SESSION_TICKETS_DISABLED ||
|
if( ssl->conf->session_tickets == MBEDTLS_SSL_SESSION_TICKETS_DISABLED ||
|
||||||
len != 0 )
|
len != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching session ticket extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
( "non-matching session ticket extension" ) );
|
||||||
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1489,7 +1544,9 @@ static int ssl_parse_ecjpake_kkpp( mbedtls_ssl_context *ssl,
|
|||||||
buf, len ) ) != 0 )
|
buf, len ) ) != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_read_round_one", ret );
|
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_read_round_one", ret );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
@ -1509,7 +1566,9 @@ static int ssl_parse_alpn_ext( mbedtls_ssl_context *ssl,
|
|||||||
if( ssl->conf->alpn_list == NULL )
|
if( ssl->conf->alpn_list == NULL )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching ALPN extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching ALPN extension" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1690,12 +1749,13 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
if( ssl->conf->renego_max_records >= 0 &&
|
if( ssl->conf->renego_max_records >= 0 &&
|
||||||
ssl->renego_records_seen > ssl->conf->renego_max_records )
|
ssl->renego_records_seen > ssl->conf->renego_max_records )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation requested, "
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
"but not honored by server" ) );
|
( "renegotiation requested, but not honored by server" ) );
|
||||||
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-handshake message during renego" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
|
( "non-handshake message during renegotiation" ) );
|
||||||
|
|
||||||
ssl->keep_current_message = 1;
|
ssl->keep_current_message = 1;
|
||||||
return( MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO );
|
return( MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO );
|
||||||
@ -1703,7 +1763,9 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
#endif /* MBEDTLS_SSL_RENEGOTIATION */
|
#endif /* MBEDTLS_SSL_RENEGOTIATION */
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
|
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
|
||||||
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||||
}
|
}
|
||||||
@ -1758,11 +1820,13 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
ssl->major_ver > ssl->conf->max_major_ver ||
|
ssl->major_ver > ssl->conf->max_major_ver ||
|
||||||
ssl->minor_ver > ssl->conf->max_minor_ver )
|
ssl->minor_ver > ssl->conf->max_minor_ver )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "server version out of bounds - "
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
" min: [%d:%d], server: [%d:%d], max: [%d:%d]",
|
( "server version out of bounds - min: [%d:%d], server: [%d:%d], max: [%d:%d]",
|
||||||
ssl->conf->min_major_ver, ssl->conf->min_minor_ver,
|
ssl->conf->min_major_ver,
|
||||||
|
ssl->conf->min_minor_ver,
|
||||||
ssl->major_ver, ssl->minor_ver,
|
ssl->major_ver, ssl->minor_ver,
|
||||||
ssl->conf->max_major_ver, ssl->conf->max_minor_ver ) );
|
ssl->conf->max_major_ver,
|
||||||
|
ssl->conf->max_minor_ver ) );
|
||||||
|
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION );
|
MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION );
|
||||||
@ -1799,7 +1863,9 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
ssl->in_hslen != mbedtls_ssl_hs_hdr_len( ssl ) + 40 + n + ext_len )
|
ssl->in_hslen != mbedtls_ssl_hs_hdr_len( ssl ) + 40 + n + ext_len )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
|
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1839,8 +1905,11 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
if( comp != MBEDTLS_SSL_COMPRESS_NULL )
|
if( comp != MBEDTLS_SSL_COMPRESS_NULL )
|
||||||
#endif/* MBEDTLS_ZLIB_SUPPORT */
|
#endif/* MBEDTLS_ZLIB_SUPPORT */
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "server hello, bad compression: %d", comp ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
( "server hello, bad compression: %d", comp ) );
|
||||||
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
|
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||||
}
|
}
|
||||||
@ -1851,7 +1920,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
ssl->handshake->ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( i );
|
ssl->handshake->ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( i );
|
||||||
if( ssl->handshake->ciphersuite_info == NULL )
|
if( ssl->handshake->ciphersuite_info == NULL )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "ciphersuite info for %04x not found", i ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
|
( "ciphersuite info for %04x not found", i ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR );
|
MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||||
@ -1891,7 +1961,9 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
if( ( ret = mbedtls_ssl_derive_keys( ssl ) ) != 0 )
|
if( ( ret = mbedtls_ssl_derive_keys( ssl ) ) != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_derive_keys", ret );
|
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_derive_keys", ret );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR );
|
MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR );
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
@ -1901,7 +1973,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
ssl->handshake->resume ? "a" : "no" ) );
|
ssl->handshake->resume ? "a" : "no" ) );
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %04x", i ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %04x", i ) );
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, compress alg.: %d", buf[37 + n] ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, compress alg.: %d",
|
||||||
|
buf[37 + n] ) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform cipher suite validation in same way as in ssl_write_client_hello.
|
* Perform cipher suite validation in same way as in ssl_write_client_hello.
|
||||||
@ -1912,7 +1985,9 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
if( ssl->conf->ciphersuite_list[ssl->minor_ver][i] == 0 )
|
if( ssl->conf->ciphersuite_list[ssl->minor_ver][i] == 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1924,16 +1999,21 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suite_info = mbedtls_ssl_ciphersuite_from_id( ssl->session_negotiate->ciphersuite );
|
suite_info = mbedtls_ssl_ciphersuite_from_id(
|
||||||
if( ssl_validate_ciphersuite( suite_info, ssl, ssl->minor_ver, ssl->minor_ver ) != 0 )
|
ssl->session_negotiate->ciphersuite );
|
||||||
|
if( ssl_validate_ciphersuite( suite_info, ssl, ssl->minor_ver,
|
||||||
|
ssl->minor_ver ) != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %s", suite_info->name ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "server hello, chosen ciphersuite: %s", suite_info->name ) );
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_ECP_RESTARTABLE_ENABLED)
|
#if defined(MBEDTLS_SSL_ECP_RESTARTABLE_ENABLED)
|
||||||
if( suite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA &&
|
if( suite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA &&
|
||||||
@ -1950,7 +2030,9 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1958,7 +2040,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
|
|
||||||
ext = buf + 40 + n;
|
ext = buf + 40 + n;
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "server hello, total extension length: %d", ext_len ) );
|
MBEDTLS_SSL_DEBUG_MSG( 2,
|
||||||
|
( "server hello, total extension length: %d", ext_len ) );
|
||||||
|
|
||||||
while( ext_len )
|
while( ext_len )
|
||||||
{
|
{
|
||||||
@ -1970,7 +2053,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
if( ext_size + 4 > ext_len )
|
if( ext_size + 4 > ext_len )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
|
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -1991,7 +2075,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
|
|
||||||
#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
|
#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
|
||||||
case MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH:
|
case MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH:
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found max_fragment_length extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "found max_fragment_length extension" ) );
|
||||||
|
|
||||||
if( ( ret = ssl_parse_max_fragment_length_ext( ssl,
|
if( ( ret = ssl_parse_max_fragment_length_ext( ssl,
|
||||||
ext + 4, ext_size ) ) != 0 )
|
ext + 4, ext_size ) ) != 0 )
|
||||||
@ -2044,7 +2129,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
|
|
||||||
#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
|
#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET)
|
||||||
case MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET:
|
case MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET:
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found extended_master_secret extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "found extended_master_secret extension" ) );
|
||||||
|
|
||||||
if( ( ret = ssl_parse_extended_ms_ext( ssl,
|
if( ( ret = ssl_parse_extended_ms_ext( ssl,
|
||||||
ext + 4, ext_size ) ) != 0 )
|
ext + 4, ext_size ) ) != 0 )
|
||||||
@ -2071,7 +2157,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
case MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS:
|
case MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS:
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found supported_point_formats extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
|
( "found supported_point_formats extension" ) );
|
||||||
|
|
||||||
if( ( ret = ssl_parse_supported_point_formats_ext( ssl,
|
if( ( ret = ssl_parse_supported_point_formats_ext( ssl,
|
||||||
ext + 4, ext_size ) ) != 0 )
|
ext + 4, ext_size ) ) != 0 )
|
||||||
@ -2107,8 +2194,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
#endif /* MBEDTLS_SSL_ALPN */
|
#endif /* MBEDTLS_SSL_ALPN */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "unknown extension found: %d (ignoring)",
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
ext_id ) );
|
( "unknown extension found: %d (ignoring)", ext_id ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ext_len -= 4 + ext_size;
|
ext_len -= 4 + ext_size;
|
||||||
@ -2125,9 +2212,11 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
* Renegotiation security checks
|
* Renegotiation security checks
|
||||||
*/
|
*/
|
||||||
if( ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
|
if( ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
|
||||||
ssl->conf->allow_legacy_renegotiation == MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE )
|
ssl->conf->allow_legacy_renegotiation ==
|
||||||
|
MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "legacy renegotiation, breaking off handshake" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
|
( "legacy renegotiation, breaking off handshake" ) );
|
||||||
handshake_failure = 1;
|
handshake_failure = 1;
|
||||||
}
|
}
|
||||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||||
@ -2135,12 +2224,14 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
ssl->secure_renegotiation == MBEDTLS_SSL_SECURE_RENEGOTIATION &&
|
ssl->secure_renegotiation == MBEDTLS_SSL_SECURE_RENEGOTIATION &&
|
||||||
renegotiation_info_seen == 0 )
|
renegotiation_info_seen == 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation_info extension missing (secure)" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
|
( "renegotiation_info extension missing (secure)" ) );
|
||||||
handshake_failure = 1;
|
handshake_failure = 1;
|
||||||
}
|
}
|
||||||
else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS &&
|
else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS &&
|
||||||
ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
|
ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
|
||||||
ssl->conf->allow_legacy_renegotiation == MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION )
|
ssl->conf->allow_legacy_renegotiation ==
|
||||||
|
MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "legacy renegotiation not allowed" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "legacy renegotiation not allowed" ) );
|
||||||
handshake_failure = 1;
|
handshake_failure = 1;
|
||||||
@ -2149,14 +2240,17 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
|
ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
|
||||||
renegotiation_info_seen == 1 )
|
renegotiation_info_seen == 1 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation_info extension present (legacy)" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
|
( "renegotiation_info extension present (legacy)" ) );
|
||||||
handshake_failure = 1;
|
handshake_failure = 1;
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_SSL_RENEGOTIATION */
|
#endif /* MBEDTLS_SSL_RENEGOTIATION */
|
||||||
|
|
||||||
if( handshake_failure == 1 )
|
if( handshake_failure == 1 )
|
||||||
{
|
{
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
@ -2168,7 +2262,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
|
|
||||||
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
|
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
|
||||||
defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
|
defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
|
||||||
static int ssl_parse_server_dh_params( mbedtls_ssl_context *ssl, unsigned char **p,
|
static int ssl_parse_server_dh_params( mbedtls_ssl_context *ssl,
|
||||||
|
unsigned char **p,
|
||||||
unsigned char *end )
|
unsigned char *end )
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;
|
int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;
|
||||||
@ -2182,7 +2277,8 @@ static int ssl_parse_server_dh_params( mbedtls_ssl_context *ssl, unsigned char *
|
|||||||
* opaque dh_Ys<1..2^16-1>;
|
* opaque dh_Ys<1..2^16-1>;
|
||||||
* } ServerDHParams;
|
* } ServerDHParams;
|
||||||
*/
|
*/
|
||||||
if( ( ret = mbedtls_dhm_read_params( &ssl->handshake->dhm_ctx, p, end ) ) != 0 )
|
if( ( ret = mbedtls_dhm_read_params( &ssl->handshake->dhm_ctx,
|
||||||
|
p, end ) ) != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 2, ( "mbedtls_dhm_read_params" ), ret );
|
MBEDTLS_SSL_DEBUG_RET( 2, ( "mbedtls_dhm_read_params" ), ret );
|
||||||
return( ret );
|
return( ret );
|
||||||
@ -2340,7 +2436,8 @@ static int ssl_parse_server_ecdh_params( mbedtls_ssl_context *ssl,
|
|||||||
|
|
||||||
if( ssl_check_server_ecdh_params( ssl ) != 0 )
|
if( ssl_check_server_ecdh_params( ssl ) != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message (ECDHE curve)" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
|
( "bad server key exchange message (ECDHE curve)" ) );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2366,8 +2463,8 @@ static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl,
|
|||||||
*/
|
*/
|
||||||
if( end - (*p) < 2 )
|
if( end - (*p) < 2 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message "
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
"(psk_identity_hint length)" ) );
|
( "bad server key exchange message (psk_identity_hint length)" ) );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
len = (*p)[0] << 8 | (*p)[1];
|
len = (*p)[0] << 8 | (*p)[1];
|
||||||
@ -2375,8 +2472,8 @@ static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl,
|
|||||||
|
|
||||||
if( end - (*p) < len )
|
if( end - (*p) < len )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message "
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
"(psk_identity_hint length)" ) );
|
( "bad server key exchange message (psk_identity_hint length)" ) );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2419,7 +2516,8 @@ static int ssl_write_encrypted_pms( mbedtls_ssl_context *ssl,
|
|||||||
* opaque random[46];
|
* opaque random[46];
|
||||||
* } PreMasterSecret;
|
* } PreMasterSecret;
|
||||||
*/
|
*/
|
||||||
mbedtls_ssl_write_version( ssl->conf->max_major_ver, ssl->conf->max_minor_ver,
|
mbedtls_ssl_write_version( ssl->conf->max_major_ver,
|
||||||
|
ssl->conf->max_minor_ver,
|
||||||
ssl->conf->transport, p );
|
ssl->conf->transport, p );
|
||||||
|
|
||||||
if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, p + 2, 46 ) ) != 0 )
|
if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, p + 2, 46 ) ) != 0 )
|
||||||
@ -2506,20 +2604,22 @@ static int ssl_parse_signature_algorithm( mbedtls_ssl_context *ssl,
|
|||||||
/*
|
/*
|
||||||
* Get hash algorithm
|
* Get hash algorithm
|
||||||
*/
|
*/
|
||||||
if( ( *md_alg = mbedtls_ssl_md_alg_from_hash( (*p)[0] ) ) == MBEDTLS_MD_NONE )
|
if( ( *md_alg = mbedtls_ssl_md_alg_from_hash( (*p)[0] ) )
|
||||||
|
== MBEDTLS_MD_NONE )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "Server used unsupported "
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
"HashAlgorithm %d", *(p)[0] ) );
|
( "Server used unsupported HashAlgorithm %d", *(p)[0] ) );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get signature algorithm
|
* Get signature algorithm
|
||||||
*/
|
*/
|
||||||
if( ( *pk_alg = mbedtls_ssl_pk_alg_from_sig( (*p)[1] ) ) == MBEDTLS_PK_NONE )
|
if( ( *pk_alg = mbedtls_ssl_pk_alg_from_sig( (*p)[1] ) )
|
||||||
|
== MBEDTLS_PK_NONE )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "server used unsupported "
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
"SignatureAlgorithm %d", (*p)[1] ) );
|
( "server used unsupported SignatureAlgorithm %d", (*p)[1] ) );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2528,13 +2628,15 @@ static int ssl_parse_signature_algorithm( mbedtls_ssl_context *ssl,
|
|||||||
*/
|
*/
|
||||||
if( mbedtls_ssl_check_sig_hash( ssl, *md_alg ) != 0 )
|
if( mbedtls_ssl_check_sig_hash( ssl, *md_alg ) != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "server used HashAlgorithm %d that was not offered",
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
*(p)[0] ) );
|
( "server used HashAlgorithm %d that was not offered", *(p)[0] ) );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "Server used SignatureAlgorithm %d", (*p)[1] ) );
|
MBEDTLS_SSL_DEBUG_MSG( 2, ( "Server used SignatureAlgorithm %d",
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "Server used HashAlgorithm %d", (*p)[0] ) );
|
(*p)[1] ) );
|
||||||
|
MBEDTLS_SSL_DEBUG_MSG( 2, ( "Server used HashAlgorithm %d",
|
||||||
|
(*p)[0] ) );
|
||||||
*p += 2;
|
*p += 2;
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
@ -2625,7 +2727,9 @@ static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )
|
|||||||
if( ( ret = ssl_get_ecdh_params_from_cert( ssl ) ) != 0 )
|
if( ( ret = ssl_get_ecdh_params_from_cert( ssl ) ) != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "ssl_get_ecdh_params_from_cert", ret );
|
MBEDTLS_SSL_DEBUG_RET( 1, "ssl_get_ecdh_params_from_cert", ret );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
@ -2656,7 +2760,9 @@ static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )
|
|||||||
if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )
|
if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )
|
||||||
{
|
{
|
||||||
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,
|
||||||
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
|
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
|
||||||
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||||
}
|
}
|
||||||
@ -2676,9 +2782,11 @@ static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "server key exchange message must "
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
"not be skipped" ) );
|
( "server key exchange message must not be skipped" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
|
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
|
||||||
|
|
||||||
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||||
@ -2703,7 +2811,9 @@ start_processing:
|
|||||||
if( ssl_parse_server_psk_hint( ssl, &p, end ) != 0 )
|
if( ssl_parse_server_psk_hint( ssl, &p, end ) != 0 )
|
||||||
{
|
{
|
||||||
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,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
@ -2726,7 +2836,9 @@ start_processing:
|
|||||||
if( ssl_parse_server_dh_params( ssl, &p, end ) != 0 )
|
if( ssl_parse_server_dh_params( ssl, &p, end ) != 0 )
|
||||||
{
|
{
|
||||||
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,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
@ -2743,7 +2855,9 @@ start_processing:
|
|||||||
if( ssl_parse_server_ecdh_params_psa( ssl, &p, end ) != 0 )
|
if( ssl_parse_server_ecdh_params_psa( ssl, &p, end ) != 0 )
|
||||||
{
|
{
|
||||||
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,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
@ -2762,7 +2876,9 @@ start_processing:
|
|||||||
if( ssl_parse_server_ecdh_params( ssl, &p, end ) != 0 )
|
if( ssl_parse_server_ecdh_params( ssl, &p, end ) != 0 )
|
||||||
{
|
{
|
||||||
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,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
@ -2779,7 +2895,9 @@ start_processing:
|
|||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_read_round_two", ret );
|
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_read_round_two", ret );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
@ -2813,16 +2931,23 @@ start_processing:
|
|||||||
if( ssl_parse_signature_algorithm( ssl, &p, end,
|
if( ssl_parse_signature_algorithm( ssl, &p, end,
|
||||||
&md_alg, &pk_alg ) != 0 )
|
&md_alg, &pk_alg ) != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
( "bad server key exchange message" ) );
|
||||||
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pk_alg != mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ) )
|
if( pk_alg !=
|
||||||
|
mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ) )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
( "bad server key exchange message" ) );
|
||||||
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
@ -2853,7 +2978,9 @@ start_processing:
|
|||||||
if( p > end - 2 )
|
if( p > end - 2 )
|
||||||
{
|
{
|
||||||
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,
|
||||||
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
|
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
@ -2863,7 +2990,9 @@ start_processing:
|
|||||||
if( p != end - 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,
|
||||||
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
|
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
}
|
}
|
||||||
@ -2924,7 +3053,9 @@ start_processing:
|
|||||||
if( !mbedtls_pk_can_do( peer_pk, pk_alg ) )
|
if( !mbedtls_pk_can_do( peer_pk, pk_alg ) )
|
||||||
{
|
{
|
||||||
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,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH );
|
return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH );
|
||||||
}
|
}
|
||||||
@ -2940,7 +3071,9 @@ start_processing:
|
|||||||
#if defined(MBEDTLS_SSL_ECP_RESTARTABLE_ENABLED)
|
#if defined(MBEDTLS_SSL_ECP_RESTARTABLE_ENABLED)
|
||||||
if( ret != MBEDTLS_ERR_ECP_IN_PROGRESS )
|
if( ret != MBEDTLS_ERR_ECP_IN_PROGRESS )
|
||||||
#endif
|
#endif
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR );
|
MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR );
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_pk_verify", ret );
|
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_pk_verify", ret );
|
||||||
#if defined(MBEDTLS_SSL_ECP_RESTARTABLE_ENABLED)
|
#if defined(MBEDTLS_SSL_ECP_RESTARTABLE_ENABLED)
|
||||||
@ -3013,7 +3146,9 @@ static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl )
|
|||||||
if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )
|
if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad certificate request message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad certificate request message" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
|
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
|
||||||
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||||
}
|
}
|
||||||
@ -3090,7 +3225,8 @@ static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl )
|
|||||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||||
if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 )
|
if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 )
|
||||||
{
|
{
|
||||||
size_t sig_alg_len = ( ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 1 + n] << 8 )
|
size_t sig_alg_len =
|
||||||
|
( ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 1 + n] << 8 )
|
||||||
| ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 2 + n] ) );
|
| ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 2 + n] ) );
|
||||||
#if defined(MBEDTLS_DEBUG_C)
|
#if defined(MBEDTLS_DEBUG_C)
|
||||||
unsigned char* sig_alg;
|
unsigned char* sig_alg;
|
||||||
@ -3109,10 +3245,13 @@ static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl )
|
|||||||
* buf[...hdr_len + 3 + n + sig_alg_len],
|
* buf[...hdr_len + 3 + n + sig_alg_len],
|
||||||
* which is one less than we need the buf to be.
|
* which is one less than we need the buf to be.
|
||||||
*/
|
*/
|
||||||
if( ssl->in_hslen <= mbedtls_ssl_hs_hdr_len( ssl ) + 3 + n + sig_alg_len )
|
if( ssl->in_hslen <= mbedtls_ssl_hs_hdr_len( ssl )
|
||||||
|
+ 3 + n + sig_alg_len )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad certificate request message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad certificate request message" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
|
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST );
|
return( MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST );
|
||||||
}
|
}
|
||||||
@ -3121,8 +3260,9 @@ static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl )
|
|||||||
sig_alg = buf + mbedtls_ssl_hs_hdr_len( ssl ) + 3 + n;
|
sig_alg = buf + mbedtls_ssl_hs_hdr_len( ssl ) + 3 + n;
|
||||||
for( i = 0; i < sig_alg_len; i += 2 )
|
for( i = 0; i < sig_alg_len; i += 2 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "Supported Signature Algorithm found: %d"
|
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||||
",%d", sig_alg[i], sig_alg[i + 1] ) );
|
( "Supported Signature Algorithm found: %d,%d",
|
||||||
|
sig_alg[i], sig_alg[i + 1] ) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3419,8 +3559,8 @@ ecdh_calc_secret:
|
|||||||
|
|
||||||
if( header_len + 2 + content_len > MBEDTLS_SSL_OUT_CONTENT_LEN )
|
if( header_len + 2 + content_len > MBEDTLS_SSL_OUT_CONTENT_LEN )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "psk identity too long or "
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
"SSL buffer too short" ) );
|
( "psk identity too long or SSL buffer too short" ) );
|
||||||
return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
|
return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3471,8 +3611,8 @@ ecdh_calc_secret:
|
|||||||
if( header_len + 2 + content_len >
|
if( header_len + 2 + content_len >
|
||||||
MBEDTLS_SSL_OUT_CONTENT_LEN )
|
MBEDTLS_SSL_OUT_CONTENT_LEN )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "psk identity or DHM size too long"
|
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||||
" or SSL buffer too short" ) );
|
( "psk identity or DHM size too long or SSL buffer too short" ) );
|
||||||
return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
|
return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3530,7 +3670,8 @@ ecdh_calc_secret:
|
|||||||
ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 &&
|
ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 &&
|
||||||
ssl_conf_has_static_raw_psk( ssl->conf ) == 0 )
|
ssl_conf_has_static_raw_psk( ssl->conf ) == 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "skip PMS generation for opaque PSK" ) );
|
MBEDTLS_SSL_DEBUG_MSG(
|
||||||
|
1, ( "skip PMS generation for opaque PSK" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* MBEDTLS_USE_PSA_CRYPTO &&
|
#endif /* MBEDTLS_USE_PSA_CRYPTO &&
|
||||||
@ -3538,7 +3679,8 @@ ecdh_calc_secret:
|
|||||||
if( ( ret = mbedtls_ssl_psk_derive_premaster( ssl,
|
if( ( ret = mbedtls_ssl_psk_derive_premaster( ssl,
|
||||||
ciphersuite_info->key_exchange ) ) != 0 )
|
ciphersuite_info->key_exchange ) ) != 0 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_psk_derive_premaster", ret );
|
MBEDTLS_SSL_DEBUG_RET(
|
||||||
|
1, "mbedtls_ssl_psk_derive_premaster", ret );
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3736,8 +3878,9 @@ sign:
|
|||||||
* Until we encounter a server that does not, we will take this
|
* Until we encounter a server that does not, we will take this
|
||||||
* shortcut.
|
* shortcut.
|
||||||
*
|
*
|
||||||
* Reason: Otherwise we should have running hashes for SHA512 and SHA224
|
* Reason: Otherwise we should have running hashes for SHA512 and
|
||||||
* in order to satisfy 'weird' needs from the server side.
|
* SHA224 in order to satisfy 'weird' needs from the server
|
||||||
|
* side.
|
||||||
*/
|
*/
|
||||||
if( ssl->handshake->ciphersuite_info->mac == MBEDTLS_MD_SHA384 )
|
if( ssl->handshake->ciphersuite_info->mac == MBEDTLS_MD_SHA384 )
|
||||||
{
|
{
|
||||||
@ -3821,7 +3964,9 @@ static int ssl_parse_new_session_ticket( mbedtls_ssl_context *ssl )
|
|||||||
if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )
|
if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad new session ticket message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad new session ticket message" ) );
|
||||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
mbedtls_ssl_send_alert_message(
|
||||||
|
ssl,
|
||||||
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
|
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
|
||||||
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user