mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-26 12:05:34 +00:00
Improve debugging output of client-side CID extension parsing
This commit is contained in:
parent
19976b5345
commit
8f68f87382
|
@ -1254,13 +1254,19 @@ static int ssl_parse_cid_ext( mbedtls_ssl_context *ssl,
|
||||||
if( /* CID extension only makes sense in DTLS */
|
if( /* CID extension only makes sense in DTLS */
|
||||||
ssl->conf->transport != MBEDTLS_SSL_TRANSPORT_DATAGRAM ||
|
ssl->conf->transport != MBEDTLS_SSL_TRANSPORT_DATAGRAM ||
|
||||||
/* The server must only send the CID extension if we have offered it. */
|
/* The server must only send the CID extension if we have offered it. */
|
||||||
ssl->negotiate_cid == MBEDTLS_SSL_CID_DISABLED ||
|
ssl->negotiate_cid == MBEDTLS_SSL_CID_DISABLED )
|
||||||
/* CID extension must at least contain the length byte */
|
|
||||||
len < 1 )
|
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching CID extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "CID extension unexpected" ) );
|
||||||
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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( len == 0 )
|
||||||
|
{
|
||||||
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "CID extension invalid" ) );
|
||||||
|
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
|
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1269,17 +1275,17 @@ static int ssl_parse_cid_ext( mbedtls_ssl_context *ssl,
|
||||||
|
|
||||||
if( peer_cid_len > MBEDTLS_SSL_CID_OUT_LEN_MAX )
|
if( peer_cid_len > MBEDTLS_SSL_CID_OUT_LEN_MAX )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching CID extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "CID extension invalid" ) );
|
||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( len != peer_cid_len )
|
if( len != peer_cid_len )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching CID extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "CID extension invalid" ) );
|
||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue