tls13: Upstream various fix in prototype
- Adjust max input_max_frag_len - Guard transform_negotiate - Adjust function position - update comments - fix wrong requirements Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
2e19981e17
commit
ddda050604
4 changed files with 24 additions and 11 deletions
|
@ -2058,6 +2058,12 @@ int mbedtls_ssl_tls13_write_early_data_ext( mbedtls_ssl_context *ssl,
|
|||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
/*
|
||||
* Write Signature Algorithm extension
|
||||
*/
|
||||
MBEDTLS_CHECK_RETURN_CRITICAL
|
||||
int mbedtls_ssl_write_sig_alg_ext( mbedtls_ssl_context *ssl, unsigned char *buf,
|
||||
const unsigned char *end, size_t *out_len );
|
||||
/*
|
||||
* Parse TLS Signature Algorithm extension
|
||||
*/
|
||||
|
@ -2605,10 +2611,6 @@ int mbedtls_ssl_validate_ciphersuite(
|
|||
mbedtls_ssl_protocol_version min_tls_version,
|
||||
mbedtls_ssl_protocol_version max_tls_version );
|
||||
|
||||
MBEDTLS_CHECK_RETURN_CRITICAL
|
||||
int mbedtls_ssl_write_sig_alg_ext( mbedtls_ssl_context *ssl, unsigned char *buf,
|
||||
const unsigned char *end, size_t *out_len );
|
||||
|
||||
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
||||
MBEDTLS_CHECK_RETURN_CRITICAL
|
||||
int mbedtls_ssl_parse_server_name_ext( mbedtls_ssl_context *ssl,
|
||||
|
|
|
@ -3198,12 +3198,14 @@ size_t mbedtls_ssl_get_input_max_frag_len( const mbedtls_ssl_context *ssl )
|
|||
size_t max_len = MBEDTLS_SSL_IN_CONTENT_LEN;
|
||||
size_t read_mfl;
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
/* Use the configured MFL for the client if we're past SERVER_HELLO_DONE */
|
||||
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT &&
|
||||
ssl->state >= MBEDTLS_SSL_SERVER_HELLO_DONE )
|
||||
{
|
||||
return ssl_mfl_code_to_length( ssl->conf->mfl_code );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check if a smaller max length was negotiated */
|
||||
if( ssl->session_out != NULL )
|
||||
|
@ -3215,7 +3217,7 @@ size_t mbedtls_ssl_get_input_max_frag_len( const mbedtls_ssl_context *ssl )
|
|||
}
|
||||
}
|
||||
|
||||
// During a handshake, use the value being negotiated
|
||||
/* During a handshake, use the value being negotiated */
|
||||
if( ssl->session_negotiate != NULL )
|
||||
{
|
||||
read_mfl = ssl_mfl_code_to_length( ssl->session_negotiate->mfl_code );
|
||||
|
@ -3486,6 +3488,8 @@ static unsigned char ssl_serialized_session_header[] = {
|
|||
*
|
||||
* case MBEDTLS_SSL_VERSION_TLS1_2:
|
||||
* serialized_session_tls12 data;
|
||||
* case MBEDTLS_SSL_MINOR_VERSION_4:
|
||||
* serialized_session_tls13 data;
|
||||
*
|
||||
* };
|
||||
*
|
||||
|
@ -4525,7 +4529,7 @@ static int ssl_context_load( mbedtls_ssl_context *ssl,
|
|||
/* This has been allocated by ssl_handshake_init(), called by
|
||||
* by either mbedtls_ssl_session_reset_int() or mbedtls_ssl_setup(). */
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
ssl->transform = ssl->transform_negotiate;
|
||||
ssl->transform = ssl->transform_negotiate;
|
||||
ssl->transform_in = ssl->transform;
|
||||
ssl->transform_out = ssl->transform;
|
||||
ssl->transform_negotiate = NULL;
|
||||
|
|
|
@ -2805,11 +2805,10 @@ int mbedtls_ssl_tls13_handshake_client_step( mbedtls_ssl_context *ssl )
|
|||
|
||||
switch( ssl->state )
|
||||
{
|
||||
/*
|
||||
* ssl->state is initialized as HELLO_REQUEST. It is the same
|
||||
* as CLIENT_HELLO state.
|
||||
*/
|
||||
case MBEDTLS_SSL_HELLO_REQUEST:
|
||||
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_HELLO );
|
||||
break;
|
||||
|
||||
case MBEDTLS_SSL_CLIENT_HELLO:
|
||||
ret = mbedtls_ssl_write_client_hello( ssl );
|
||||
break;
|
||||
|
|
|
@ -2090,6 +2090,8 @@ run_test "Opaque keys for server authentication: EC + RSA, force ECDHE-ECDSA"
|
|||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
|
||||
requires_config_enabled MBEDTLS_RSA_C
|
||||
requires_config_enabled MBEDTLS_SSL_SRV_C
|
||||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3 opaque key: no suitable algorithm found" \
|
||||
"$P_SRV debug_level=4 force_version=tls13 auth_mode=required key_opaque=1 key_opaque_algs=rsa-decrypt,none" \
|
||||
"$P_CLI debug_level=4 key_opaque=1 key_opaque_algs=rsa-decrypt,rsa-sign-pss" \
|
||||
|
@ -2103,6 +2105,8 @@ run_test "TLS 1.3 opaque key: no suitable algorithm found" \
|
|||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
|
||||
requires_config_enabled MBEDTLS_RSA_C
|
||||
requires_config_enabled MBEDTLS_SSL_SRV_C
|
||||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3 opaque key: suitable algorithm found" \
|
||||
"$P_SRV debug_level=4 force_version=tls13 auth_mode=required key_opaque=1 key_opaque_algs=rsa-decrypt,rsa-sign-pss" \
|
||||
"$P_CLI debug_level=4 key_opaque=1 key_opaque_algs=rsa-decrypt,rsa-sign-pss" \
|
||||
|
@ -2111,11 +2115,13 @@ run_test "TLS 1.3 opaque key: suitable algorithm found" \
|
|||
-c "key type: Opaque" \
|
||||
-s "key types: Opaque, Opaque" \
|
||||
-C "error" \
|
||||
-S "error" \
|
||||
-S "error"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
|
||||
requires_config_enabled MBEDTLS_RSA_C
|
||||
requires_config_enabled MBEDTLS_SSL_SRV_C
|
||||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3 opaque key: first client sig alg not suitable" \
|
||||
"$P_SRV debug_level=4 force_version=tls13 auth_mode=required key_opaque=1 key_opaque_algs=rsa-sign-pss-sha512,none" \
|
||||
"$P_CLI debug_level=4 sig_algs=rsa_pss_rsae_sha256,rsa_pss_rsae_sha512" \
|
||||
|
@ -2130,6 +2136,8 @@ run_test "TLS 1.3 opaque key: first client sig alg not suitable" \
|
|||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
|
||||
requires_config_enabled MBEDTLS_RSA_C
|
||||
requires_config_enabled MBEDTLS_SSL_SRV_C
|
||||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3 opaque key: 2 keys on server, suitable algorithm found" \
|
||||
"$P_SRV debug_level=4 force_version=tls13 auth_mode=required key_opaque=1 key_opaque_algs2=ecdsa-sign,none key_opaque_algs=rsa-decrypt,rsa-sign-pss" \
|
||||
"$P_CLI debug_level=4 key_opaque=1 key_opaque_algs=rsa-decrypt,rsa-sign-pss" \
|
||||
|
|
Loading…
Reference in a new issue