mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-03 19:41:10 +00:00
Merge pull request #4736 from daverodgman/alert_bugfixes_2.x
Backport 2.x: Fix alert raised for invalid fragment length
This commit is contained in:
commit
0a4046e9ca
5
ChangeLog.d/fix_tls_alert_codes.txt
Normal file
5
ChangeLog.d/fix_tls_alert_codes.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Bugfix
|
||||||
|
* Fix which alert is sent in some cases to conform to the
|
||||||
|
applicable RFC: on an invalid Finished message value, an
|
||||||
|
invalid max_fragment_length extension, or an
|
||||||
|
unsupported extension used by the server.
|
|
@ -1525,7 +1525,7 @@ static int ssl_parse_max_fragment_length_ext( mbedtls_ssl_context *ssl,
|
||||||
mbedtls_ssl_send_alert_message(
|
mbedtls_ssl_send_alert_message(
|
||||||
ssl,
|
ssl,
|
||||||
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1572,7 +1572,7 @@ static int ssl_parse_cid_ext( mbedtls_ssl_context *ssl,
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "CID extension unexpected" ) );
|
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_UNSUPPORTED_EXT );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1628,7 +1628,7 @@ static int ssl_parse_encrypt_then_mac_ext( mbedtls_ssl_context *ssl,
|
||||||
mbedtls_ssl_send_alert_message(
|
mbedtls_ssl_send_alert_message(
|
||||||
ssl,
|
ssl,
|
||||||
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1654,7 +1654,7 @@ static int ssl_parse_extended_ms_ext( mbedtls_ssl_context *ssl,
|
||||||
mbedtls_ssl_send_alert_message(
|
mbedtls_ssl_send_alert_message(
|
||||||
ssl,
|
ssl,
|
||||||
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1679,7 +1679,7 @@ static int ssl_parse_session_ticket_ext( mbedtls_ssl_context *ssl,
|
||||||
mbedtls_ssl_send_alert_message(
|
mbedtls_ssl_send_alert_message(
|
||||||
ssl,
|
ssl,
|
||||||
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1785,7 +1785,7 @@ static int ssl_parse_alpn_ext( mbedtls_ssl_context *ssl,
|
||||||
mbedtls_ssl_send_alert_message(
|
mbedtls_ssl_send_alert_message(
|
||||||
ssl,
|
ssl,
|
||||||
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||||
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
|
MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3610,7 +3610,7 @@ int mbedtls_ssl_parse_finished( mbedtls_ssl_context *ssl )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad finished message" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad finished 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_DECRYPT_ERROR );
|
||||||
return( MBEDTLS_ERR_SSL_BAD_HS_FINISHED );
|
return( MBEDTLS_ERR_SSL_BAD_HS_FINISHED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5992,7 +5992,7 @@ run_test "ECJPAKE: working, TLS" \
|
||||||
-S "SSL - Verification of the message MAC failed"
|
-S "SSL - Verification of the message MAC failed"
|
||||||
|
|
||||||
server_needs_more_time 1
|
server_needs_more_time 1
|
||||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE
|
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||||
run_test "ECJPAKE: password mismatch, TLS" \
|
run_test "ECJPAKE: password mismatch, TLS" \
|
||||||
"$P_SRV debug_level=3 ecjpake_pw=bla" \
|
"$P_SRV debug_level=3 ecjpake_pw=bla" \
|
||||||
"$P_CLI debug_level=3 ecjpake_pw=bad \
|
"$P_CLI debug_level=3 ecjpake_pw=bad \
|
||||||
|
@ -6001,7 +6001,7 @@ run_test "ECJPAKE: password mismatch, TLS" \
|
||||||
-C "re-using cached ecjpake parameters" \
|
-C "re-using cached ecjpake parameters" \
|
||||||
-s "SSL - Verification of the message MAC failed"
|
-s "SSL - Verification of the message MAC failed"
|
||||||
|
|
||||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE
|
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||||
run_test "ECJPAKE: working, DTLS" \
|
run_test "ECJPAKE: working, DTLS" \
|
||||||
"$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla" \
|
"$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla" \
|
||||||
"$P_CLI debug_level=3 dtls=1 ecjpake_pw=bla \
|
"$P_CLI debug_level=3 dtls=1 ecjpake_pw=bla \
|
||||||
|
@ -6010,7 +6010,7 @@ run_test "ECJPAKE: working, DTLS" \
|
||||||
-c "re-using cached ecjpake parameters" \
|
-c "re-using cached ecjpake parameters" \
|
||||||
-S "SSL - Verification of the message MAC failed"
|
-S "SSL - Verification of the message MAC failed"
|
||||||
|
|
||||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE
|
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||||
run_test "ECJPAKE: working, DTLS, no cookie" \
|
run_test "ECJPAKE: working, DTLS, no cookie" \
|
||||||
"$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla cookies=0" \
|
"$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla cookies=0" \
|
||||||
"$P_CLI debug_level=3 dtls=1 ecjpake_pw=bla \
|
"$P_CLI debug_level=3 dtls=1 ecjpake_pw=bla \
|
||||||
|
@ -6020,7 +6020,7 @@ run_test "ECJPAKE: working, DTLS, no cookie" \
|
||||||
-S "SSL - Verification of the message MAC failed"
|
-S "SSL - Verification of the message MAC failed"
|
||||||
|
|
||||||
server_needs_more_time 1
|
server_needs_more_time 1
|
||||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE
|
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||||
run_test "ECJPAKE: password mismatch, DTLS" \
|
run_test "ECJPAKE: password mismatch, DTLS" \
|
||||||
"$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla" \
|
"$P_SRV debug_level=3 dtls=1 ecjpake_pw=bla" \
|
||||||
"$P_CLI debug_level=3 dtls=1 ecjpake_pw=bad \
|
"$P_CLI debug_level=3 dtls=1 ecjpake_pw=bad \
|
||||||
|
@ -6030,7 +6030,7 @@ run_test "ECJPAKE: password mismatch, DTLS" \
|
||||||
-s "SSL - Verification of the message MAC failed"
|
-s "SSL - Verification of the message MAC failed"
|
||||||
|
|
||||||
# for tests with configs/config-thread.h
|
# for tests with configs/config-thread.h
|
||||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE
|
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||||
run_test "ECJPAKE: working, DTLS, nolog" \
|
run_test "ECJPAKE: working, DTLS, nolog" \
|
||||||
"$P_SRV dtls=1 ecjpake_pw=bla" \
|
"$P_SRV dtls=1 ecjpake_pw=bla" \
|
||||||
"$P_CLI dtls=1 ecjpake_pw=bla \
|
"$P_CLI dtls=1 ecjpake_pw=bla \
|
||||||
|
|
Loading…
Reference in a new issue