Merge pull request #5640 from ronald-cron-arm/version-negotiation-2
TLS 1.2/1.3 version negotiation - 2
This commit is contained in:
commit
0e980e8e84
17 changed files with 2199 additions and 1730 deletions
|
@ -1118,10 +1118,11 @@ struct mbedtls_ssl_session
|
|||
|
||||
unsigned char MBEDTLS_PRIVATE(exported);
|
||||
|
||||
/* This field is temporarily duplicated with mbedtls_ssl_context.minor_ver.
|
||||
* Once runtime negotiation of TLS 1.2 and TLS 1.3 is implemented, it needs
|
||||
* to be studied whether one of them can be removed. */
|
||||
unsigned char MBEDTLS_PRIVATE(minor_ver); /*!< The TLS version used in the session. */
|
||||
/*!< Minor version negotiated in the session. Used if and when
|
||||
* renegotiating or resuming a session instead of the configured minor
|
||||
* version.
|
||||
*/
|
||||
unsigned char MBEDTLS_PRIVATE(minor_ver);
|
||||
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
mbedtls_time_t MBEDTLS_PRIVATE(start); /*!< starting time */
|
||||
|
@ -1495,12 +1496,25 @@ struct mbedtls_ssl_context
|
|||
renego_max_records is < 0 */
|
||||
#endif /* MBEDTLS_SSL_RENEGOTIATION */
|
||||
|
||||
int MBEDTLS_PRIVATE(major_ver); /*!< equal to MBEDTLS_SSL_MAJOR_VERSION_3 */
|
||||
/*!< Equal to MBEDTLS_SSL_MAJOR_VERSION_3 */
|
||||
int MBEDTLS_PRIVATE(major_ver);
|
||||
|
||||
/*!< Server: Negotiated minor version.
|
||||
* Client: Maximum minor version to be negotiated, then negotiated minor
|
||||
* version.
|
||||
*
|
||||
* It is initialized as the maximum minor version to be negotiated in the
|
||||
* ClientHello writing preparation stage and used throughout the
|
||||
* ClientHello writing. For a fresh handshake not linked to any previous
|
||||
* handshake, it is initialized to the configured maximum minor version
|
||||
* to be negotiated. When renegotiating or resuming a session, it is
|
||||
* initialized to the previously negotiated minor version.
|
||||
*
|
||||
* Updated to the negotiated minor version as soon as the ServerHello is
|
||||
* received.
|
||||
*/
|
||||
int MBEDTLS_PRIVATE(minor_ver);
|
||||
|
||||
/* This field is temporarily duplicated with mbedtls_ssl_context.minor_ver.
|
||||
* Once runtime negotiation of TLS 1.2 and TLS 1.3 is implemented, it needs
|
||||
* to be studied whether one of them can be removed. */
|
||||
int MBEDTLS_PRIVATE(minor_ver); /*!< one of MBEDTLS_SSL_MINOR_VERSION_x macros */
|
||||
unsigned MBEDTLS_PRIVATE(badmac_seen); /*!< records with a bad MAC received */
|
||||
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
|
|
|
@ -99,6 +99,7 @@ set(src_tls
|
|||
net_sockets.c
|
||||
ssl_cache.c
|
||||
ssl_ciphersuites.c
|
||||
ssl_client.c
|
||||
ssl_cookie.c
|
||||
ssl_msg.c
|
||||
ssl_ticket.c
|
||||
|
|
|
@ -168,6 +168,7 @@ OBJS_TLS= \
|
|||
net_sockets.o \
|
||||
ssl_cache.o \
|
||||
ssl_ciphersuites.o \
|
||||
ssl_client.o \
|
||||
ssl_cookie.o \
|
||||
ssl_msg.o \
|
||||
ssl_ticket.o \
|
||||
|
|
1041
library/ssl_client.c
Normal file
1041
library/ssl_client.c
Normal file
File diff suppressed because it is too large
Load diff
48
library/ssl_client.h
Normal file
48
library/ssl_client.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* TLS 1.2 and 1.3 client-side functions
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MBEDTLS_SSL_CLIENT_H
|
||||
#define MBEDTLS_SSL_CLIENT_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C)
|
||||
#include "ssl_misc.h"
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* \brief Validate cipher suite against config in SSL context.
|
||||
*
|
||||
* \param ssl SSL context
|
||||
* \param suite_info Cipher suite to validate
|
||||
* \param min_minor_ver Minimal minor version to accept a cipher suite
|
||||
* \param max_minor_ver Maximal minor version to accept a cipher suite
|
||||
*
|
||||
* \return 0 if valid, negative value otherwise.
|
||||
*/
|
||||
int mbedtls_ssl_validate_ciphersuite(
|
||||
const mbedtls_ssl_context *ssl,
|
||||
const mbedtls_ssl_ciphersuite_t *suite_info,
|
||||
int min_minor_ver, int max_minor_ver );
|
||||
|
||||
int mbedtls_ssl_write_client_hello( mbedtls_ssl_context *ssl );
|
||||
|
||||
#endif /* MBEDTLS_SSL_CLIENT_H */
|
|
@ -79,9 +79,6 @@
|
|||
#define MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_4
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
#define MBEDTLS_SSL_MIN_VALID_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_3
|
||||
#define MBEDTLS_SSL_MIN_VALID_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3
|
||||
|
||||
/* Determine maximum supported version */
|
||||
#define MBEDTLS_SSL_MAX_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3
|
||||
|
||||
|
@ -537,6 +534,28 @@ struct mbedtls_ssl_handshake_params
|
|||
uint8_t resume; /*!< session resume indicator*/
|
||||
uint8_t cli_exts; /*!< client extension presence*/
|
||||
|
||||
#if defined(MBEDTLS_SSL_CLI_C)
|
||||
/*!< Minimum minor version to be negotiated.
|
||||
*
|
||||
* It is set up in the ClientHello writing preparation stage and used
|
||||
* throughout the ClientHello writing. Not relevant anymore as soon as
|
||||
* the protocol version has been negotiated thus as soon as the
|
||||
* ServerHello is received.
|
||||
* For a fresh handshake not linked to any previous handshake, it is
|
||||
* equal to the configured minimum minor version to be negotiated. When
|
||||
* renegotiating or resuming a session, it is equal to the previously
|
||||
* negotiated minor version.
|
||||
*
|
||||
* There is no maximum minor version field in this handshake context.
|
||||
* From the start of the handshake, we need to define a current protocol
|
||||
* version for the record layer which we define as the maximum minor
|
||||
* version to be negotiated. The `minor_ver` field of the SSL context is
|
||||
* used to store this maximum value until it contains the actual
|
||||
* negotiated value.
|
||||
*/
|
||||
unsigned char min_minor_ver;
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
||||
uint8_t sni_authmode; /*!< authmode from SNI callback */
|
||||
#endif
|
||||
|
@ -1090,6 +1109,25 @@ struct mbedtls_ssl_flight_item
|
|||
};
|
||||
#endif /* MBEDTLS_SSL_PROTO_DTLS */
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
/**
|
||||
* \brief Given an SSL context and its associated configuration, write the TLS
|
||||
* 1.2 specific extensions of the ClientHello message.
|
||||
*
|
||||
* \param[in] ssl SSL context
|
||||
* \param[in] buf Base address of the buffer where to write the extensions
|
||||
* \param[in] end End address of the buffer where to write the extensions
|
||||
* \param uses_ec Whether one proposed ciphersuite uses an elliptic curve
|
||||
* (<> 0) or not ( 0 ).
|
||||
* \param[out] out_len Length of the data written into the buffer \p buf
|
||||
*/
|
||||
int mbedtls_ssl_tls12_write_client_hello_exts( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
const unsigned char *end,
|
||||
int uses_ec,
|
||||
size_t *out_len );
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \
|
||||
defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
|
||||
|
||||
|
@ -1137,13 +1175,6 @@ void mbedtls_ssl_set_inbound_transform( mbedtls_ssl_context *ssl,
|
|||
void mbedtls_ssl_set_outbound_transform( mbedtls_ssl_context *ssl,
|
||||
mbedtls_ssl_transform *transform );
|
||||
|
||||
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
||||
int mbedtls_ssl_write_hostname_ext( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
const unsigned char *end,
|
||||
size_t *olen );
|
||||
#endif
|
||||
|
||||
int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl );
|
||||
int mbedtls_ssl_handshake_server_step( mbedtls_ssl_context *ssl );
|
||||
void mbedtls_ssl_handshake_wrapup( mbedtls_ssl_context *ssl );
|
||||
|
@ -1291,6 +1322,9 @@ void mbedtls_ssl_add_hs_msg_to_checksum( mbedtls_ssl_context *ssl,
|
|||
#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
|
||||
int mbedtls_ssl_psk_derive_premaster( mbedtls_ssl_context *ssl,
|
||||
mbedtls_key_exchange_type_t key_ex );
|
||||
#if defined(MBEDTLS_SSL_CLI_C) && defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
int mbedtls_ssl_conf_has_static_psk( mbedtls_ssl_config const *conf );
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the first defined PSK by order of precedence:
|
||||
|
@ -1647,6 +1681,20 @@ int mbedtls_ssl_tls13_process_finished_message( mbedtls_ssl_context *ssl );
|
|||
int mbedtls_ssl_tls13_write_finished_message( mbedtls_ssl_context *ssl );
|
||||
void mbedtls_ssl_tls13_handshake_wrapup( mbedtls_ssl_context *ssl );
|
||||
|
||||
/**
|
||||
* \brief Given an SSL context and its associated configuration, write the TLS
|
||||
* 1.3 specific extensions of the ClientHello message.
|
||||
*
|
||||
* \param[in] ssl SSL context
|
||||
* \param[in] buf Base address of the buffer where to write the extensions
|
||||
* \param[in] end End address of the buffer where to write the extensions
|
||||
* \param[out] out_len Length of the data written into the buffer \p buf
|
||||
*/
|
||||
int mbedtls_ssl_tls13_write_client_hello_exts( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
unsigned char *end,
|
||||
size_t *out_len );
|
||||
|
||||
/**
|
||||
* \brief TLS 1.3 client side state machine entry
|
||||
*
|
||||
|
@ -1789,12 +1837,6 @@ int mbedtls_ssl_reset_transcript_for_hrr( mbedtls_ssl_context *ssl );
|
|||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
|
||||
/*
|
||||
* Write Signature Algorithm extension
|
||||
*/
|
||||
int mbedtls_ssl_write_sig_alg_ext( mbedtls_ssl_context *ssl, unsigned char *buf,
|
||||
const unsigned char *end, size_t *out_len );
|
||||
|
||||
/*
|
||||
* Parse TLS 1.3 Signature Algorithm extension
|
||||
*/
|
||||
|
@ -1872,17 +1914,6 @@ static inline int mbedtls_ssl_tls13_named_group_is_dhe( uint16_t named_group )
|
|||
named_group <= MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE8192 );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) || \
|
||||
defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||
int mbedtls_ssl_write_supported_groups_ext( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
const unsigned char *end,
|
||||
size_t *out_len );
|
||||
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED ||
|
||||
MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C ||
|
||||
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
||||
/*
|
||||
* Return supported signature algorithms.
|
||||
*
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#endif /* !MBEDTLS_PLATFORM_C */
|
||||
|
||||
#include "mbedtls/ssl.h"
|
||||
#include "ssl_client.h"
|
||||
#include "ssl_debug_helpers.h"
|
||||
#include "ssl_misc.h"
|
||||
#include "mbedtls/debug.h"
|
||||
#include "mbedtls/error.h"
|
||||
|
@ -908,13 +910,6 @@ static int ssl_conf_version_check( const mbedtls_ssl_context *ssl )
|
|||
const mbedtls_ssl_config *conf = ssl->conf;
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
if( mbedtls_ssl_conf_is_tls13_enabled( conf ) &&
|
||||
( conf->endpoint == MBEDTLS_SSL_IS_SERVER ) )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "TLS 1.3 server is not supported yet." ) );
|
||||
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
|
||||
if( mbedtls_ssl_conf_is_tls13_only( conf ) )
|
||||
{
|
||||
if( conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
|
||||
|
@ -922,6 +917,13 @@ static int ssl_conf_version_check( const mbedtls_ssl_context *ssl )
|
|||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "DTLS 1.3 is not yet supported." ) );
|
||||
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
|
||||
if( conf->endpoint == MBEDTLS_SSL_IS_SERVER )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "TLS 1.3 server is not supported yet." ) );
|
||||
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 4, ( "The SSL configuration is tls13 only." ) );
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -938,8 +940,20 @@ static int ssl_conf_version_check( const mbedtls_ssl_context *ssl )
|
|||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
if( mbedtls_ssl_conf_is_hybrid_tls12_tls13( conf ) )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "Hybrid TLS 1.2 + TLS 1.3 configurations are not yet supported" ) );
|
||||
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "DTLS not yet supported in Hybrid TLS 1.3 + TLS 1.2" ) );
|
||||
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
|
||||
if( conf->endpoint == MBEDTLS_SSL_IS_SERVER )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "TLS 1.3 server is not supported yet." ) );
|
||||
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 4, ( "The SSL configuration is TLS 1.3 or TLS 1.2." ) );
|
||||
return( 0 );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2847,15 +2861,31 @@ int mbedtls_ssl_handshake_step( mbedtls_ssl_context *ssl )
|
|||
#if defined(MBEDTLS_SSL_CLI_C)
|
||||
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT )
|
||||
{
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
if( mbedtls_ssl_conf_is_tls13_only( ssl->conf ) )
|
||||
ret = mbedtls_ssl_tls13_handshake_client_step( ssl );
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "client state: %s",
|
||||
mbedtls_ssl_states_str( ssl->state ) ) );
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
if( mbedtls_ssl_conf_is_tls12_only( ssl->conf ) )
|
||||
ret = mbedtls_ssl_handshake_client_step( ssl );
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
|
||||
switch( ssl->state )
|
||||
{
|
||||
case MBEDTLS_SSL_HELLO_REQUEST:
|
||||
ssl->state = MBEDTLS_SSL_CLIENT_HELLO;
|
||||
break;
|
||||
|
||||
case MBEDTLS_SSL_CLIENT_HELLO:
|
||||
ret = mbedtls_ssl_write_client_hello( ssl );
|
||||
break;
|
||||
|
||||
default:
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_4 )
|
||||
ret = mbedtls_ssl_tls13_handshake_client_step( ssl );
|
||||
else
|
||||
ret = mbedtls_ssl_handshake_client_step( ssl );
|
||||
#elif defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
ret = mbedtls_ssl_handshake_client_step( ssl );
|
||||
#else
|
||||
ret = mbedtls_ssl_tls13_handshake_client_step( ssl );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(MBEDTLS_SSL_SRV_C)
|
||||
|
@ -4228,16 +4258,30 @@ int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,
|
|||
* NSA Suite B
|
||||
*/
|
||||
case MBEDTLS_SSL_PRESET_SUITEB:
|
||||
conf->min_major_ver = MBEDTLS_SSL_MAJOR_VERSION_3;
|
||||
conf->min_minor_ver = MBEDTLS_SSL_MINOR_VERSION_3; /* TLS 1.2 */
|
||||
conf->min_major_ver = MBEDTLS_SSL_MIN_MAJOR_VERSION;
|
||||
conf->max_major_ver = MBEDTLS_SSL_MAX_MAJOR_VERSION;
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
/* Hybrid TLS 1.2/1.3 is not supported yet */
|
||||
conf->max_minor_ver = MBEDTLS_SSL_MINOR_VERSION_3;
|
||||
#else
|
||||
conf->max_minor_ver = MBEDTLS_SSL_MAX_MINOR_VERSION;
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 && MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
if( ( endpoint == MBEDTLS_SSL_IS_SERVER ) ||
|
||||
( transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) )
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
{
|
||||
conf->min_minor_ver = MBEDTLS_SSL_MINOR_VERSION_3;
|
||||
conf->max_minor_ver = MBEDTLS_SSL_MINOR_VERSION_3;
|
||||
}
|
||||
#else
|
||||
{
|
||||
conf->min_major_ver = 0;
|
||||
conf->max_major_ver = 0;
|
||||
conf->min_minor_ver = 0;
|
||||
conf->max_minor_ver = 0;
|
||||
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
conf->min_minor_ver = MBEDTLS_SSL_MIN_MINOR_VERSION;
|
||||
conf->max_minor_ver = MBEDTLS_SSL_MAX_MINOR_VERSION;
|
||||
}
|
||||
conf->ciphersuite_list = ssl_preset_suiteb_ciphersuites;
|
||||
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
|
@ -4266,26 +4310,31 @@ int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,
|
|||
* Default
|
||||
*/
|
||||
default:
|
||||
conf->min_major_ver = ( MBEDTLS_SSL_MIN_MAJOR_VERSION >
|
||||
MBEDTLS_SSL_MIN_VALID_MAJOR_VERSION ) ?
|
||||
MBEDTLS_SSL_MIN_MAJOR_VERSION :
|
||||
MBEDTLS_SSL_MIN_VALID_MAJOR_VERSION;
|
||||
conf->min_minor_ver = ( MBEDTLS_SSL_MIN_MINOR_VERSION >
|
||||
MBEDTLS_SSL_MIN_VALID_MINOR_VERSION ) ?
|
||||
MBEDTLS_SSL_MIN_MINOR_VERSION :
|
||||
MBEDTLS_SSL_MIN_VALID_MINOR_VERSION;
|
||||
conf->min_major_ver = MBEDTLS_SSL_MIN_MAJOR_VERSION;
|
||||
conf->max_major_ver = MBEDTLS_SSL_MAX_MAJOR_VERSION;
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
/* Hybrid TLS 1.2/1.3 is not supported yet */
|
||||
conf->max_minor_ver = MBEDTLS_SSL_MINOR_VERSION_3;
|
||||
#else
|
||||
conf->max_minor_ver = MBEDTLS_SSL_MAX_MINOR_VERSION;
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 && MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
if( transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
|
||||
if( ( endpoint == MBEDTLS_SSL_IS_SERVER ) ||
|
||||
( transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) )
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
{
|
||||
conf->min_minor_ver = MBEDTLS_SSL_MINOR_VERSION_3;
|
||||
conf->max_minor_ver = MBEDTLS_SSL_MINOR_VERSION_3;
|
||||
}
|
||||
#else
|
||||
{
|
||||
conf->min_major_ver = 0;
|
||||
conf->max_major_ver = 0;
|
||||
conf->min_minor_ver = 0;
|
||||
conf->max_minor_ver = 0;
|
||||
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
conf->min_minor_ver = MBEDTLS_SSL_MIN_MINOR_VERSION;
|
||||
conf->max_minor_ver = MBEDTLS_SSL_MAX_MINOR_VERSION;
|
||||
}
|
||||
|
||||
conf->ciphersuite_list = mbedtls_ssl_list_ciphersuites();
|
||||
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
|
@ -4709,305 +4758,6 @@ int mbedtls_ssl_get_handshake_transcript( mbedtls_ssl_context *ssl,
|
|||
|
||||
#endif /* !MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) || \
|
||||
defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||
/*
|
||||
* Function for writing a supported groups (TLS 1.3) or supported elliptic
|
||||
* curves (TLS 1.2) extension.
|
||||
*
|
||||
* The "extension_data" field of a supported groups extension contains a
|
||||
* "NamedGroupList" value (TLS 1.3 RFC8446):
|
||||
* enum {
|
||||
* secp256r1(0x0017), secp384r1(0x0018), secp521r1(0x0019),
|
||||
* x25519(0x001D), x448(0x001E),
|
||||
* ffdhe2048(0x0100), ffdhe3072(0x0101), ffdhe4096(0x0102),
|
||||
* ffdhe6144(0x0103), ffdhe8192(0x0104),
|
||||
* ffdhe_private_use(0x01FC..0x01FF),
|
||||
* ecdhe_private_use(0xFE00..0xFEFF),
|
||||
* (0xFFFF)
|
||||
* } NamedGroup;
|
||||
* struct {
|
||||
* NamedGroup named_group_list<2..2^16-1>;
|
||||
* } NamedGroupList;
|
||||
*
|
||||
* The "extension_data" field of a supported elliptic curves extension contains
|
||||
* a "NamedCurveList" value (TLS 1.2 RFC 8422):
|
||||
* enum {
|
||||
* deprecated(1..22),
|
||||
* secp256r1 (23), secp384r1 (24), secp521r1 (25),
|
||||
* x25519(29), x448(30),
|
||||
* reserved (0xFE00..0xFEFF),
|
||||
* deprecated(0xFF01..0xFF02),
|
||||
* (0xFFFF)
|
||||
* } NamedCurve;
|
||||
* struct {
|
||||
* NamedCurve named_curve_list<2..2^16-1>
|
||||
* } NamedCurveList;
|
||||
*
|
||||
* The TLS 1.3 supported groups extension was defined to be a compatible
|
||||
* generalization of the TLS 1.2 supported elliptic curves extension. They both
|
||||
* share the same extension identifier.
|
||||
*
|
||||
* DHE groups are not supported yet.
|
||||
*/
|
||||
int mbedtls_ssl_write_supported_groups_ext( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
const unsigned char *end,
|
||||
size_t *out_len )
|
||||
{
|
||||
unsigned char *p = buf ;
|
||||
unsigned char *named_group_list; /* Start of named_group_list */
|
||||
size_t named_group_list_len; /* Length of named_group_list */
|
||||
const uint16_t *group_list = mbedtls_ssl_get_groups( ssl );
|
||||
|
||||
*out_len = 0;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding supported_groups extension" ) );
|
||||
|
||||
/* Check if we have space for header and length fields:
|
||||
* - extension_type (2 bytes)
|
||||
* - extension_data_length (2 bytes)
|
||||
* - named_group_list_length (2 bytes)
|
||||
*/
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 6 );
|
||||
p += 6;
|
||||
|
||||
named_group_list = p;
|
||||
|
||||
if( group_list == NULL )
|
||||
return( MBEDTLS_ERR_SSL_BAD_CONFIG );
|
||||
|
||||
for( ; *group_list != 0; group_list++ )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "got supported group(%04x)", *group_list ) );
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
if( ( mbedtls_ssl_conf_is_tls13_enabled( ssl->conf ) &&
|
||||
mbedtls_ssl_tls13_named_group_is_ecdhe( *group_list ) ) ||
|
||||
( mbedtls_ssl_conf_is_tls12_enabled( ssl->conf ) &&
|
||||
mbedtls_ssl_tls12_named_group_is_ecdhe( *group_list ) ) )
|
||||
{
|
||||
const mbedtls_ecp_curve_info *curve_info;
|
||||
curve_info = mbedtls_ecp_curve_info_from_tls_id( *group_list );
|
||||
if( curve_info == NULL )
|
||||
continue;
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
MBEDTLS_PUT_UINT16_BE( *group_list, p, 0 );
|
||||
p += 2;
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "NamedGroup: %s ( %x )",
|
||||
curve_info->name, *group_list ) );
|
||||
}
|
||||
#endif /* MBEDTLS_ECP_C */
|
||||
/* Add DHE groups here */
|
||||
|
||||
}
|
||||
|
||||
/* Length of named_group_list */
|
||||
named_group_list_len = p - named_group_list;
|
||||
if( named_group_list_len == 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "No group available." ) );
|
||||
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
|
||||
}
|
||||
|
||||
/* Write extension_type */
|
||||
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_SUPPORTED_GROUPS, buf, 0 );
|
||||
/* Write extension_data_length */
|
||||
MBEDTLS_PUT_UINT16_BE( named_group_list_len + 2, buf, 2 );
|
||||
/* Write length of named_group_list */
|
||||
MBEDTLS_PUT_UINT16_BE( named_group_list_len, buf, 4 );
|
||||
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "Supported groups extension",
|
||||
buf + 4, named_group_list_len + 2 );
|
||||
|
||||
*out_len = p - buf;
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
ssl->handshake->extensions_present |= MBEDTLS_SSL_EXT_SUPPORTED_GROUPS;
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED ||
|
||||
MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C ||
|
||||
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
|
||||
/*
|
||||
* Function for writing a signature algorithm extension.
|
||||
*
|
||||
* The `extension_data` field of signature algorithm contains a `SignatureSchemeList`
|
||||
* value (TLS 1.3 RFC8446):
|
||||
* enum {
|
||||
* ....
|
||||
* ecdsa_secp256r1_sha256( 0x0403 ),
|
||||
* ecdsa_secp384r1_sha384( 0x0503 ),
|
||||
* ecdsa_secp521r1_sha512( 0x0603 ),
|
||||
* ....
|
||||
* } SignatureScheme;
|
||||
*
|
||||
* struct {
|
||||
* SignatureScheme supported_signature_algorithms<2..2^16-2>;
|
||||
* } SignatureSchemeList;
|
||||
*
|
||||
* The `extension_data` field of signature algorithm contains a `SignatureAndHashAlgorithm`
|
||||
* value (TLS 1.2 RFC5246):
|
||||
* enum {
|
||||
* none(0), md5(1), sha1(2), sha224(3), sha256(4), sha384(5),
|
||||
* sha512(6), (255)
|
||||
* } HashAlgorithm;
|
||||
*
|
||||
* enum { anonymous(0), rsa(1), dsa(2), ecdsa(3), (255) }
|
||||
* SignatureAlgorithm;
|
||||
*
|
||||
* struct {
|
||||
* HashAlgorithm hash;
|
||||
* SignatureAlgorithm signature;
|
||||
* } SignatureAndHashAlgorithm;
|
||||
*
|
||||
* SignatureAndHashAlgorithm
|
||||
* supported_signature_algorithms<2..2^16-2>;
|
||||
*
|
||||
* The TLS 1.3 signature algorithm extension was defined to be a compatible
|
||||
* generalization of the TLS 1.2 signature algorithm extension.
|
||||
* `SignatureAndHashAlgorithm` field of TLS 1.2 can be represented by
|
||||
* `SignatureScheme` field of TLS 1.3
|
||||
*
|
||||
*/
|
||||
int mbedtls_ssl_write_sig_alg_ext( mbedtls_ssl_context *ssl, unsigned char *buf,
|
||||
const unsigned char *end, size_t *out_len )
|
||||
{
|
||||
unsigned char *p = buf;
|
||||
unsigned char *supported_sig_alg; /* Start of supported_signature_algorithms */
|
||||
size_t supported_sig_alg_len = 0; /* Length of supported_signature_algorithms */
|
||||
|
||||
*out_len = 0;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "adding signature_algorithms extension" ) );
|
||||
|
||||
/* Check if we have space for header and length field:
|
||||
* - extension_type (2 bytes)
|
||||
* - extension_data_length (2 bytes)
|
||||
* - supported_signature_algorithms_length (2 bytes)
|
||||
*/
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 6 );
|
||||
p += 6;
|
||||
|
||||
/*
|
||||
* Write supported_signature_algorithms
|
||||
*/
|
||||
supported_sig_alg = p;
|
||||
const uint16_t *sig_alg = mbedtls_ssl_get_sig_algs( ssl );
|
||||
if( sig_alg == NULL )
|
||||
return( MBEDTLS_ERR_SSL_BAD_CONFIG );
|
||||
|
||||
for( ; *sig_alg != MBEDTLS_TLS1_3_SIG_NONE; sig_alg++ )
|
||||
{
|
||||
if( ! mbedtls_ssl_sig_alg_is_supported( ssl, *sig_alg ) )
|
||||
continue;
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
MBEDTLS_PUT_UINT16_BE( *sig_alg, p, 0 );
|
||||
p += 2;
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "signature scheme [%x]", *sig_alg ) );
|
||||
}
|
||||
|
||||
/* Length of supported_signature_algorithms */
|
||||
supported_sig_alg_len = p - supported_sig_alg;
|
||||
if( supported_sig_alg_len == 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "No signature algorithms defined." ) );
|
||||
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
|
||||
}
|
||||
|
||||
/* Write extension_type */
|
||||
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_SIG_ALG, buf, 0 );
|
||||
/* Write extension_data_length */
|
||||
MBEDTLS_PUT_UINT16_BE( supported_sig_alg_len + 2, buf, 2 );
|
||||
/* Write length of supported_signature_algorithms */
|
||||
MBEDTLS_PUT_UINT16_BE( supported_sig_alg_len, buf, 4 );
|
||||
|
||||
/* Output the total length of signature algorithms extension. */
|
||||
*out_len = p - buf;
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
ssl->handshake->extensions_present |= MBEDTLS_SSL_EXT_SIG_ALG;
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
|
||||
|
||||
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
||||
int mbedtls_ssl_write_hostname_ext( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
const unsigned char *end,
|
||||
size_t *olen )
|
||||
{
|
||||
unsigned char *p = buf;
|
||||
size_t hostname_len;
|
||||
|
||||
*olen = 0;
|
||||
|
||||
if( ssl->hostname == NULL )
|
||||
return( 0 );
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||
( "client hello, adding server name extension: %s",
|
||||
ssl->hostname ) );
|
||||
|
||||
hostname_len = strlen( ssl->hostname );
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, hostname_len + 9 );
|
||||
|
||||
/*
|
||||
* Sect. 3, RFC 6066 (TLS Extensions Definitions)
|
||||
*
|
||||
* In order to provide any of the server names, clients MAY include an
|
||||
* extension of type "server_name" in the (extended) client hello. The
|
||||
* "extension_data" field of this extension SHALL contain
|
||||
* "ServerNameList" where:
|
||||
*
|
||||
* struct {
|
||||
* NameType name_type;
|
||||
* select (name_type) {
|
||||
* case host_name: HostName;
|
||||
* } name;
|
||||
* } ServerName;
|
||||
*
|
||||
* enum {
|
||||
* host_name(0), (255)
|
||||
* } NameType;
|
||||
*
|
||||
* opaque HostName<1..2^16-1>;
|
||||
*
|
||||
* struct {
|
||||
* ServerName server_name_list<1..2^16-1>
|
||||
* } ServerNameList;
|
||||
*
|
||||
*/
|
||||
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_SERVERNAME, p, 0 );
|
||||
p += 2;
|
||||
|
||||
MBEDTLS_PUT_UINT16_BE( hostname_len + 5, p, 0 );
|
||||
p += 2;
|
||||
|
||||
MBEDTLS_PUT_UINT16_BE( hostname_len + 3, p, 0 );
|
||||
p += 2;
|
||||
|
||||
*p++ = MBEDTLS_BYTE_0( MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME );
|
||||
|
||||
MBEDTLS_PUT_UINT16_BE( hostname_len, p, 0 );
|
||||
p += 2;
|
||||
|
||||
memcpy( p, ssl->hostname, hostname_len );
|
||||
|
||||
*olen = hostname_len + 9;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#endif
|
||||
|
||||
#include "mbedtls/ssl.h"
|
||||
#include "ssl_client.h"
|
||||
#include "ssl_misc.h"
|
||||
#include "mbedtls/debug.h"
|
||||
#include "mbedtls/error.h"
|
||||
|
@ -53,7 +54,7 @@
|
|||
#endif
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
|
||||
static int ssl_conf_has_static_psk( mbedtls_ssl_config const *conf )
|
||||
int mbedtls_ssl_conf_has_static_psk( mbedtls_ssl_config const *conf )
|
||||
{
|
||||
if( conf->psk_identity == NULL ||
|
||||
conf->psk_identity_len == 0 )
|
||||
|
@ -415,65 +416,6 @@ static int ssl_write_session_ticket_ext( mbedtls_ssl_context *ssl,
|
|||
}
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||
|
||||
#if defined(MBEDTLS_SSL_ALPN)
|
||||
static int ssl_write_alpn_ext( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
const unsigned char *end,
|
||||
size_t *olen )
|
||||
{
|
||||
unsigned char *p = buf;
|
||||
size_t alpnlen = 0;
|
||||
const char **cur;
|
||||
|
||||
*olen = 0;
|
||||
|
||||
if( ssl->conf->alpn_list == NULL )
|
||||
return( 0 );
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding alpn extension" ) );
|
||||
|
||||
for( cur = ssl->conf->alpn_list; *cur != NULL; cur++ )
|
||||
alpnlen += strlen( *cur ) + 1;
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 6 + alpnlen );
|
||||
|
||||
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_ALPN, p, 0 );
|
||||
p += 2;
|
||||
|
||||
/*
|
||||
* opaque ProtocolName<1..2^8-1>;
|
||||
*
|
||||
* struct {
|
||||
* ProtocolName protocol_name_list<2..2^16-1>
|
||||
* } ProtocolNameList;
|
||||
*/
|
||||
|
||||
/* Skip writing extension and list length for now */
|
||||
p += 4;
|
||||
|
||||
for( cur = ssl->conf->alpn_list; *cur != NULL; cur++ )
|
||||
{
|
||||
/*
|
||||
* mbedtls_ssl_conf_set_alpn_protocols() checked that the length of
|
||||
* protocol names is less than 255.
|
||||
*/
|
||||
*p = (unsigned char)strlen( *cur );
|
||||
memcpy( p + 1, *cur, *p );
|
||||
p += 1 + *p;
|
||||
}
|
||||
|
||||
*olen = p - buf;
|
||||
|
||||
/* List length = olen - 2 (ext_type) - 2 (ext_len) - 2 (list_len) */
|
||||
MBEDTLS_PUT_UINT16_BE( *olen - 6, buf, 4 );
|
||||
|
||||
/* Extension length = olen - 2 (ext_type) - 2 (ext_len) */
|
||||
MBEDTLS_PUT_UINT16_BE( *olen - 4, buf, 2 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_ALPN */
|
||||
|
||||
#if defined(MBEDTLS_SSL_DTLS_SRTP)
|
||||
static int ssl_write_use_srtp_ext( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
|
@ -592,100 +534,11 @@ static int ssl_write_use_srtp_ext( mbedtls_ssl_context *ssl,
|
|||
}
|
||||
#endif /* MBEDTLS_SSL_DTLS_SRTP */
|
||||
|
||||
/*
|
||||
* Generate random bytes for ClientHello
|
||||
*/
|
||||
static int ssl_generate_random( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
unsigned char *p = ssl->handshake->randbytes;
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
mbedtls_time_t t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When responding to a verify request, MUST reuse random (RFC 6347 4.2.1)
|
||||
*/
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
|
||||
ssl->handshake->cookie != NULL )
|
||||
{
|
||||
return( 0 );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
t = mbedtls_time( NULL );
|
||||
MBEDTLS_PUT_UINT32_BE( t, p, 0 );
|
||||
p += 4;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, current time: %" MBEDTLS_PRINTF_LONGLONG,
|
||||
(long long) t ) );
|
||||
#else
|
||||
if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, p, 4 ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
p += 4;
|
||||
#endif /* MBEDTLS_HAVE_TIME */
|
||||
|
||||
if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, p, 28 ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Validate cipher suite against config in SSL context.
|
||||
*
|
||||
* \param suite_info cipher suite to validate
|
||||
* \param ssl SSL context
|
||||
* \param min_minor_ver Minimal minor version to accept a cipher suite
|
||||
* \param max_minor_ver Maximal minor version to accept a cipher suite
|
||||
*
|
||||
* \return 0 if valid, else 1
|
||||
*/
|
||||
static int ssl_validate_ciphersuite(
|
||||
const mbedtls_ssl_ciphersuite_t * suite_info,
|
||||
const mbedtls_ssl_context * ssl,
|
||||
int min_minor_ver, int max_minor_ver )
|
||||
{
|
||||
(void) ssl;
|
||||
if( suite_info == NULL )
|
||||
return( 1 );
|
||||
|
||||
if( suite_info->min_minor_ver > max_minor_ver ||
|
||||
suite_info->max_minor_ver < min_minor_ver )
|
||||
return( 1 );
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
|
||||
( suite_info->flags & MBEDTLS_CIPHERSUITE_NODTLS ) )
|
||||
return( 1 );
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||
if( suite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE &&
|
||||
mbedtls_ecjpake_check( &ssl->handshake->ecjpake_ctx ) != 0 )
|
||||
return( 1 );
|
||||
#endif
|
||||
|
||||
/* Don't suggest PSK-based ciphersuite if no PSK is available. */
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
|
||||
if( mbedtls_ssl_ciphersuite_uses_psk( suite_info ) &&
|
||||
ssl_conf_has_static_psk( ssl->conf ) == 0 )
|
||||
{
|
||||
return( 1 );
|
||||
}
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED */
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static int ssl_tls12_write_client_hello_exts( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
const unsigned char *end,
|
||||
int uses_ec,
|
||||
size_t *out_len )
|
||||
int mbedtls_ssl_tls12_write_client_hello_exts( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
const unsigned char *end,
|
||||
int uses_ec,
|
||||
size_t *out_len )
|
||||
{
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
unsigned char *p = buf;
|
||||
|
@ -793,350 +646,6 @@ static int ssl_tls12_write_client_hello_exts( mbedtls_ssl_context *ssl,
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
size_t i, n, olen, ext_len = 0;
|
||||
|
||||
unsigned char *buf;
|
||||
unsigned char *p, *q;
|
||||
const unsigned char *end;
|
||||
|
||||
const int *ciphersuites;
|
||||
const mbedtls_ssl_ciphersuite_t *ciphersuite_info;
|
||||
int uses_ec = 0;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write client hello" ) );
|
||||
|
||||
if( ssl->conf->f_rng == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "no RNG provided") );
|
||||
return( MBEDTLS_ERR_SSL_NO_RNG );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
if( ssl->renego_status == MBEDTLS_SSL_INITIAL_HANDSHAKE )
|
||||
#endif
|
||||
{
|
||||
ssl->major_ver = ssl->conf->min_major_ver;
|
||||
ssl->minor_ver = ssl->conf->min_minor_ver;
|
||||
}
|
||||
|
||||
if( ssl->conf->max_major_ver == 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1,
|
||||
( "configured max major version is invalid, consider using mbedtls_ssl_config_defaults()" ) );
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
buf = ssl->out_msg;
|
||||
end = buf + MBEDTLS_SSL_OUT_CONTENT_LEN;
|
||||
|
||||
/*
|
||||
* Check if there's enough space for the first part of the ClientHello
|
||||
* consisting of the 38 bytes described below, the session identifier (at
|
||||
* most 32 bytes) and its length (1 byte).
|
||||
*
|
||||
* Use static upper bounds instead of the actual values
|
||||
* to allow the compiler to optimize this away.
|
||||
*/
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( buf, end, 38 + 1 + 32 );
|
||||
|
||||
/*
|
||||
* The 38 first bytes of the ClientHello:
|
||||
* 0 . 0 handshake type (written later)
|
||||
* 1 . 3 handshake length (written later)
|
||||
* 4 . 5 highest version supported
|
||||
* 6 . 9 current UNIX time
|
||||
* 10 . 37 random bytes
|
||||
*
|
||||
* The current UNIX time (4 bytes) and following 28 random bytes are written
|
||||
* by ssl_generate_random() into ssl->handshake->randbytes buffer and then
|
||||
* copied from there into the output buffer.
|
||||
*/
|
||||
|
||||
p = buf + 4;
|
||||
mbedtls_ssl_write_version( ssl->conf->max_major_ver,
|
||||
ssl->conf->max_minor_ver,
|
||||
ssl->conf->transport, p );
|
||||
p += 2;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, max version: [%d:%d]",
|
||||
buf[4], buf[5] ) );
|
||||
|
||||
if( ( ret = ssl_generate_random( ssl ) ) != 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_RET( 1, "ssl_generate_random", ret );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
memcpy( p, ssl->handshake->randbytes, 32 );
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, random bytes", p, 32 );
|
||||
p += 32;
|
||||
|
||||
/*
|
||||
* 38 . 38 session id length
|
||||
* 39 . 39+n session id
|
||||
* 39+n . 39+n DTLS only: cookie length (1 byte)
|
||||
* 40+n . .. DTLS only: cookie
|
||||
* .. . .. ciphersuitelist length (2 bytes)
|
||||
* .. . .. ciphersuitelist
|
||||
* .. . .. compression methods length (1 byte)
|
||||
* .. . .. compression methods
|
||||
* .. . .. extensions length (2 bytes)
|
||||
* .. . .. extensions
|
||||
*/
|
||||
n = ssl->session_negotiate->id_len;
|
||||
|
||||
if( n < 16 || n > 32 ||
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
ssl->renego_status != MBEDTLS_SSL_INITIAL_HANDSHAKE ||
|
||||
#endif
|
||||
ssl->handshake->resume == 0 )
|
||||
{
|
||||
n = 0;
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||
/*
|
||||
* RFC 5077 section 3.4: "When presenting a ticket, the client MAY
|
||||
* generate and include a Session ID in the TLS ClientHello."
|
||||
*/
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
if( ssl->renego_status == MBEDTLS_SSL_INITIAL_HANDSHAKE )
|
||||
#endif
|
||||
{
|
||||
if( ssl->session_negotiate->ticket != NULL &&
|
||||
ssl->session_negotiate->ticket_len != 0 )
|
||||
{
|
||||
ret = ssl->conf->f_rng( ssl->conf->p_rng,
|
||||
ssl->session_negotiate->id, 32 );
|
||||
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
|
||||
ssl->session_negotiate->id_len = n = 32;
|
||||
}
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||
|
||||
/*
|
||||
* The first check of the output buffer size above (
|
||||
* MBEDTLS_SSL_CHK_BUF_PTR( buf, end, 38 + 1 + 32 );)
|
||||
* has checked that there is enough space in the output buffer for the
|
||||
* session identifier length byte and the session identifier (n <= 32).
|
||||
*/
|
||||
*p++ = (unsigned char) n;
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
*p++ = ssl->session_negotiate->id[i];
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, session id len.: %" MBEDTLS_PRINTF_SIZET, n ) );
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, session id", buf + 39, n );
|
||||
|
||||
/*
|
||||
* With 'n' being the length of the session identifier
|
||||
*
|
||||
* 39+n . 39+n DTLS only: cookie length (1 byte)
|
||||
* 40+n . .. DTLS only: cookie
|
||||
* .. . .. ciphersuitelist length (2 bytes)
|
||||
* .. . .. ciphersuitelist
|
||||
* .. . .. compression methods length (1 byte)
|
||||
* .. . .. compression methods
|
||||
* .. . .. extensions length (2 bytes)
|
||||
* .. . .. extensions
|
||||
*/
|
||||
|
||||
/*
|
||||
* DTLS cookie
|
||||
*/
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
|
||||
{
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 1 );
|
||||
|
||||
if( ssl->handshake->cookie == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "no verify cookie to send" ) );
|
||||
*p++ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, cookie",
|
||||
ssl->handshake->cookie,
|
||||
ssl->handshake->verify_cookie_len );
|
||||
|
||||
*p++ = ssl->handshake->verify_cookie_len;
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end,
|
||||
ssl->handshake->verify_cookie_len );
|
||||
memcpy( p, ssl->handshake->cookie,
|
||||
ssl->handshake->verify_cookie_len );
|
||||
p += ssl->handshake->verify_cookie_len;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ciphersuite list
|
||||
*/
|
||||
ciphersuites = ssl->conf->ciphersuite_list;
|
||||
|
||||
/* Skip writing ciphersuite length for now */
|
||||
n = 0;
|
||||
q = p;
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
p += 2;
|
||||
|
||||
for( i = 0; ciphersuites[i] != 0; i++ )
|
||||
{
|
||||
ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( ciphersuites[i] );
|
||||
|
||||
if( ssl_validate_ciphersuite( ciphersuite_info, ssl,
|
||||
ssl->conf->min_minor_ver,
|
||||
ssl->conf->max_minor_ver ) != 0 )
|
||||
continue;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, add ciphersuite: %#04x (%s)",
|
||||
(unsigned int)ciphersuites[i], ciphersuite_info->name ) );
|
||||
|
||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||
uses_ec |= mbedtls_ssl_ciphersuite_uses_ec( ciphersuite_info );
|
||||
#endif
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
|
||||
n++;
|
||||
MBEDTLS_PUT_UINT16_BE( ciphersuites[i], p, 0 );
|
||||
p += 2;
|
||||
}
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||
( "client hello, got %" MBEDTLS_PRINTF_SIZET " ciphersuites (excluding SCSVs)", n ) );
|
||||
|
||||
/*
|
||||
* Add TLS_EMPTY_RENEGOTIATION_INFO_SCSV
|
||||
*/
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
if( ssl->renego_status == MBEDTLS_SSL_INITIAL_HANDSHAKE )
|
||||
#endif
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "adding EMPTY_RENEGOTIATION_INFO_SCSV" ) );
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
MBEDTLS_PUT_UINT16_BE( MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO, p, 0 );
|
||||
p += 2;
|
||||
n++;
|
||||
}
|
||||
|
||||
*q++ = (unsigned char)( n >> 7 );
|
||||
*q++ = (unsigned char)( n << 1 );
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, compress len.: %d", 1 ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, compress alg.: %d",
|
||||
MBEDTLS_SSL_COMPRESS_NULL ) );
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
*p++ = 1;
|
||||
*p++ = MBEDTLS_SSL_COMPRESS_NULL;
|
||||
|
||||
/* First write extensions, then the total length */
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
|
||||
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
||||
if( ( ret = mbedtls_ssl_write_hostname_ext( ssl, p + 2 + ext_len,
|
||||
end, &olen ) ) != 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_write_hostname_ext", ret );
|
||||
return( ret );
|
||||
}
|
||||
ext_len += olen;
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_ALPN)
|
||||
if( ( ret = ssl_write_alpn_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_alpn_ext", ret );
|
||||
return( ret );
|
||||
}
|
||||
ext_len += olen;
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
|
||||
if( ( ret = mbedtls_ssl_write_sig_alg_ext( ssl, p + 2 + ext_len,
|
||||
end, &olen ) ) != 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_write_sig_alg_ext", ret );
|
||||
return( ret );
|
||||
}
|
||||
ext_len += olen;
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
|
||||
|
||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
||||
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||
if( uses_ec )
|
||||
{
|
||||
if( ( ret = mbedtls_ssl_write_supported_groups_ext( ssl, p + 2 + ext_len,
|
||||
end, &olen ) ) != 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_supported_groups_ext", ret );
|
||||
return( ret );
|
||||
}
|
||||
ext_len += olen;
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = ssl_tls12_write_client_hello_exts( ssl, p + 2 + ext_len, end, uses_ec,
|
||||
&olen );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
ext_len += olen;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||
( "client hello, total extension length: %" MBEDTLS_PRINTF_SIZET,
|
||||
ext_len ) );
|
||||
|
||||
if( ext_len > 0 )
|
||||
{
|
||||
/* No need to check for space here, because the extension
|
||||
* writing functions already took care of that. */
|
||||
MBEDTLS_PUT_UINT16_BE( ext_len, p, 0 );
|
||||
p += 2 + ext_len;
|
||||
}
|
||||
|
||||
ssl->out_msglen = p - buf;
|
||||
ssl->out_msgtype = MBEDTLS_SSL_MSG_HANDSHAKE;
|
||||
ssl->out_msg[0] = MBEDTLS_SSL_HS_CLIENT_HELLO;
|
||||
|
||||
ssl->state++;
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
|
||||
mbedtls_ssl_send_flight_completed( ssl );
|
||||
#endif
|
||||
|
||||
if( ( ret = mbedtls_ssl_write_handshake_msg( ssl ) ) != 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_write_handshake_msg", ret );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
|
||||
( ret = mbedtls_ssl_flight_transmit( ssl ) ) != 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_flight_transmit", ret );
|
||||
return( ret );
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_PROTO_DTLS */
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write client hello" ) );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static int ssl_parse_renegotiation_info( mbedtls_ssl_context *ssl,
|
||||
const unsigned char *buf,
|
||||
size_t len )
|
||||
|
@ -1966,8 +1475,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||
|
||||
suite_info = mbedtls_ssl_ciphersuite_from_id(
|
||||
ssl->session_negotiate->ciphersuite );
|
||||
if( ssl_validate_ciphersuite( suite_info, ssl, ssl->minor_ver,
|
||||
ssl->minor_ver ) != 0 )
|
||||
if( mbedtls_ssl_validate_ciphersuite( ssl, suite_info, ssl->minor_ver,
|
||||
ssl->minor_ver ) != 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||
mbedtls_ssl_send_alert_message(
|
||||
|
@ -3495,7 +3004,7 @@ ecdh_calc_secret:
|
|||
/*
|
||||
* opaque psk_identity<0..2^16-1>;
|
||||
*/
|
||||
if( ssl_conf_has_static_psk( ssl->conf ) == 0 )
|
||||
if( mbedtls_ssl_conf_has_static_psk( ssl->conf ) == 0 )
|
||||
{
|
||||
/* We don't offer PSK suites if we don't have a PSK,
|
||||
* and we check that the server's choice is among the
|
||||
|
@ -3982,8 +3491,6 @@ int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl )
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "client state: %d", ssl->state ) );
|
||||
|
||||
/* Change state now, so that it is right in mbedtls_ssl_read_record(), used
|
||||
* by DTLS for dropping out-of-sequence ChangeCipherSpec records */
|
||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||
|
@ -4004,7 +3511,7 @@ int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl )
|
|||
* ==> ClientHello
|
||||
*/
|
||||
case MBEDTLS_SSL_CLIENT_HELLO:
|
||||
ret = ssl_write_client_hello( ssl );
|
||||
ret = mbedtls_ssl_write_client_hello( ssl );
|
||||
break;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1061,12 +1061,6 @@ static int ssl_ciphersuite_match( mbedtls_ssl_context *ssl, int suite_id,
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
|
||||
( suite_info->flags & MBEDTLS_CIPHERSUITE_NODTLS ) )
|
||||
return( 0 );
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||
if( suite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE &&
|
||||
( ssl->handshake->cli_exts & MBEDTLS_TLS_EXT_ECJPAKE_KKPP_OK ) == 0 )
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
|
||||
#include "ssl_misc.h"
|
||||
#include "ecdh_misc.h"
|
||||
#include "ssl_client.h"
|
||||
#include "ssl_tls13_keys.h"
|
||||
#include "ssl_debug_helpers.h"
|
||||
|
||||
/* Write extensions */
|
||||
|
||||
|
@ -49,6 +49,8 @@ static int ssl_tls13_write_supported_versions_ext( mbedtls_ssl_context *ssl,
|
|||
size_t *out_len )
|
||||
{
|
||||
unsigned char *p = buf;
|
||||
unsigned char versions_len = ( ssl->handshake->min_minor_ver <=
|
||||
MBEDTLS_SSL_MINOR_VERSION_3 ) ? 4 : 2;
|
||||
|
||||
*out_len = 0;
|
||||
|
||||
|
@ -58,35 +60,36 @@ static int ssl_tls13_write_supported_versions_ext( mbedtls_ssl_context *ssl,
|
|||
* - extension_type (2 bytes)
|
||||
* - extension_data_length (2 bytes)
|
||||
* - versions_length (1 byte )
|
||||
* - versions (2 bytes)
|
||||
* - versions (2 or 4 bytes)
|
||||
*/
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 7 );
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 5 + versions_len );
|
||||
|
||||
/* Write extension_type */
|
||||
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_SUPPORTED_VERSIONS, p, 0 );
|
||||
|
||||
/* Write extension_data_length */
|
||||
MBEDTLS_PUT_UINT16_BE( 3, p, 2 );
|
||||
MBEDTLS_PUT_UINT16_BE( versions_len + 1, p, 2 );
|
||||
p += 4;
|
||||
|
||||
/* Length of versions */
|
||||
*p++ = 0x2;
|
||||
*p++ = versions_len;
|
||||
|
||||
/* Write values of supported versions.
|
||||
*
|
||||
* They are defined by the configuration.
|
||||
*
|
||||
* Currently, only one version is advertised.
|
||||
* Currently, we advertise only TLS 1.3 or both TLS 1.3 and TLS 1.2.
|
||||
*/
|
||||
mbedtls_ssl_write_version( ssl->conf->max_major_ver,
|
||||
ssl->conf->max_minor_ver,
|
||||
ssl->conf->transport, p );
|
||||
mbedtls_ssl_write_version( MBEDTLS_SSL_MAJOR_VERSION_3,
|
||||
MBEDTLS_SSL_MINOR_VERSION_4,
|
||||
MBEDTLS_SSL_TRANSPORT_STREAM, p );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "supported version: [3:4]" ) );
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "supported version: [%d:%d]",
|
||||
ssl->conf->max_major_ver,
|
||||
ssl->conf->max_minor_ver ) );
|
||||
|
||||
*out_len = 7;
|
||||
if( ssl->handshake->min_minor_ver <= MBEDTLS_SSL_MINOR_VERSION_3 )
|
||||
{
|
||||
mbedtls_ssl_write_version( MBEDTLS_SSL_MAJOR_VERSION_3,
|
||||
MBEDTLS_SSL_MINOR_VERSION_3,
|
||||
MBEDTLS_SSL_TRANSPORT_STREAM, p + 2 );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "supported version: [3:3]" ) );
|
||||
}
|
||||
|
||||
*out_len = 5 + versions_len;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -97,7 +100,7 @@ static int ssl_tls13_parse_supported_versions_ext( mbedtls_ssl_context *ssl,
|
|||
{
|
||||
((void) ssl);
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_READ_PTR( buf, end, 2);
|
||||
MBEDTLS_SSL_CHK_BUF_READ_PTR( buf, end, 2 );
|
||||
if( buf[0] != MBEDTLS_SSL_MAJOR_VERSION_3 ||
|
||||
buf[1] != MBEDTLS_SSL_MINOR_VERSION_4 )
|
||||
{
|
||||
|
@ -108,78 +111,18 @@ static int ssl_tls13_parse_supported_versions_ext( mbedtls_ssl_context *ssl,
|
|||
return( MBEDTLS_ERR_SSL_ILLEGAL_PARAMETER );
|
||||
}
|
||||
|
||||
if( &buf[2] != end )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "supported_versions ext data length incorrect" ) );
|
||||
MBEDTLS_SSL_PEND_FATAL_ALERT( MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR,
|
||||
MBEDTLS_ERR_SSL_DECODE_ERROR );
|
||||
return( MBEDTLS_ERR_SSL_DECODE_ERROR );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_ALPN)
|
||||
/*
|
||||
* ssl_tls13_write_alpn_ext()
|
||||
*
|
||||
* Structure of the application_layer_protocol_negotiation extension in
|
||||
* ClientHello:
|
||||
*
|
||||
* opaque ProtocolName<1..2^8-1>;
|
||||
*
|
||||
* struct {
|
||||
* ProtocolName protocol_name_list<2..2^16-1>
|
||||
* } ProtocolNameList;
|
||||
*
|
||||
*/
|
||||
static int ssl_tls13_write_alpn_ext( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
const unsigned char *end,
|
||||
size_t *out_len )
|
||||
{
|
||||
unsigned char *p = buf;
|
||||
|
||||
*out_len = 0;
|
||||
|
||||
if( ssl->conf->alpn_list == NULL )
|
||||
return( 0 );
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding alpn extension" ) );
|
||||
|
||||
|
||||
/* Check we have enough space for the extension type (2 bytes), the
|
||||
* extension length (2 bytes) and the protocol_name_list length (2 bytes).
|
||||
*/
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 6 );
|
||||
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_ALPN, p, 0 );
|
||||
/* Skip writing extension and list length for now */
|
||||
p += 6;
|
||||
|
||||
/*
|
||||
* opaque ProtocolName<1..2^8-1>;
|
||||
*
|
||||
* struct {
|
||||
* ProtocolName protocol_name_list<2..2^16-1>
|
||||
* } ProtocolNameList;
|
||||
*/
|
||||
for( const char **cur = ssl->conf->alpn_list; *cur != NULL; cur++ )
|
||||
{
|
||||
/*
|
||||
* mbedtls_ssl_conf_set_alpn_protocols() checked that the length of
|
||||
* protocol names is less than 255.
|
||||
*/
|
||||
size_t protocol_name_len = strlen( *cur );
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 1 + protocol_name_len );
|
||||
*p++ = (unsigned char)protocol_name_len;
|
||||
memcpy( p, *cur, protocol_name_len );
|
||||
p += protocol_name_len;
|
||||
}
|
||||
|
||||
*out_len = p - buf;
|
||||
|
||||
/* List length = *out_len - 2 (ext_type) - 2 (ext_len) - 2 (list_len) */
|
||||
MBEDTLS_PUT_UINT16_BE( *out_len - 6, buf, 4 );
|
||||
|
||||
/* Extension length = *out_len - 2 (ext_type) - 2 (ext_len) */
|
||||
MBEDTLS_PUT_UINT16_BE( *out_len - 4, buf, 2 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static int ssl_tls13_parse_alpn_ext( mbedtls_ssl_context *ssl,
|
||||
const unsigned char *buf, size_t len )
|
||||
{
|
||||
|
@ -226,8 +169,6 @@ static int ssl_tls13_parse_alpn_ext( mbedtls_ssl_context *ssl,
|
|||
}
|
||||
#endif /* MBEDTLS_SSL_ALPN */
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
|
||||
|
||||
static int ssl_tls13_reset_key_share( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
uint16_t group_id = ssl->handshake->offered_group_id;
|
||||
|
@ -651,8 +592,6 @@ static int ssl_tls13_parse_key_share_ext( mbedtls_ssl_context *ssl,
|
|||
return( ret );
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
|
||||
|
||||
/*
|
||||
* ssl_tls13_parse_cookie_ext()
|
||||
* Parse cookie extension in Hello Retry Request
|
||||
|
@ -738,77 +677,10 @@ static int ssl_tls13_write_cookie_ext( mbedtls_ssl_context *ssl,
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
/* Write cipher_suites
|
||||
* CipherSuite cipher_suites<2..2^16-2>;
|
||||
*/
|
||||
static int ssl_tls13_write_client_hello_cipher_suites(
|
||||
mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
unsigned char *end,
|
||||
size_t *out_len )
|
||||
{
|
||||
unsigned char *p = buf;
|
||||
const int *ciphersuite_list;
|
||||
unsigned char *cipher_suites; /* Start of the cipher_suites list */
|
||||
size_t cipher_suites_len;
|
||||
|
||||
*out_len = 0 ;
|
||||
|
||||
/*
|
||||
* Ciphersuite list
|
||||
*
|
||||
* This is a list of the symmetric cipher options supported by
|
||||
* the client, specifically the record protection algorithm
|
||||
* ( including secret key length ) and a hash to be used with
|
||||
* HKDF, in descending order of client preference.
|
||||
*/
|
||||
ciphersuite_list = ssl->conf->ciphersuite_list;
|
||||
|
||||
/* Check there is space for the cipher suite list length (2 bytes). */
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
p += 2;
|
||||
|
||||
/* Write cipher_suites */
|
||||
cipher_suites = p;
|
||||
for ( size_t i = 0; ciphersuite_list[i] != 0; i++ )
|
||||
{
|
||||
int cipher_suite = ciphersuite_list[i];
|
||||
const mbedtls_ssl_ciphersuite_t *ciphersuite_info;
|
||||
|
||||
ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( cipher_suite );
|
||||
if( ciphersuite_info == NULL )
|
||||
continue;
|
||||
if( !( MBEDTLS_SSL_MINOR_VERSION_4 >= ciphersuite_info->min_minor_ver &&
|
||||
MBEDTLS_SSL_MINOR_VERSION_4 <= ciphersuite_info->max_minor_ver ) )
|
||||
continue;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, add ciphersuite: %04x, %s",
|
||||
(unsigned int) cipher_suite,
|
||||
ciphersuite_info->name ) );
|
||||
|
||||
/* Check there is space for the cipher suite identifier (2 bytes). */
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
MBEDTLS_PUT_UINT16_BE( cipher_suite, p, 0 );
|
||||
p += 2;
|
||||
}
|
||||
|
||||
/* Write the cipher_suites length in number of bytes */
|
||||
cipher_suites_len = p - cipher_suites;
|
||||
MBEDTLS_PUT_UINT16_BE( cipher_suites_len, buf, 0 );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||
( "client hello, got %" MBEDTLS_PRINTF_SIZET " cipher suites",
|
||||
cipher_suites_len/2 ) );
|
||||
|
||||
/* Output the total length of cipher_suites field. */
|
||||
*out_len = p - buf;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static int ssl_tls13_write_client_hello_exts( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
unsigned char *end,
|
||||
size_t *out_len )
|
||||
int mbedtls_ssl_tls13_write_client_hello_exts( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
unsigned char *end,
|
||||
size_t *out_len )
|
||||
{
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
unsigned char *p = buf;
|
||||
|
@ -833,7 +705,6 @@ static int ssl_tls13_write_client_hello_exts( mbedtls_ssl_context *ssl,
|
|||
return( ret );
|
||||
p += ext_len;
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
|
||||
if( mbedtls_ssl_conf_tls13_some_ephemeral_enabled( ssl ) )
|
||||
{
|
||||
ret = ssl_tls13_write_key_share_ext( ssl, p, end, &ext_len );
|
||||
|
@ -841,251 +712,96 @@ static int ssl_tls13_write_client_hello_exts( mbedtls_ssl_context *ssl,
|
|||
return( ret );
|
||||
p += ext_len;
|
||||
}
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
|
||||
|
||||
*out_len = p - buf;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* Structure of ClientHello message:
|
||||
*
|
||||
* struct {
|
||||
* ProtocolVersion legacy_version = 0x0303; // TLS v1.2
|
||||
* Random random;
|
||||
* opaque legacy_session_id<0..32>;
|
||||
* CipherSuite cipher_suites<2..2^16-2>;
|
||||
* opaque legacy_compression_methods<1..2^8-1>;
|
||||
* Extension extensions<8..2^16-1>;
|
||||
* } ClientHello;
|
||||
*/
|
||||
static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
|
||||
unsigned char *buf,
|
||||
unsigned char *end,
|
||||
size_t *out_len )
|
||||
{
|
||||
|
||||
int ret;
|
||||
unsigned char *p_extensions_len; /* Pointer to extensions length */
|
||||
size_t output_len; /* Length of buffer used by function */
|
||||
size_t extensions_len; /* Length of the list of extensions*/
|
||||
|
||||
/* Buffer management */
|
||||
unsigned char *p = buf;
|
||||
|
||||
*out_len = 0;
|
||||
|
||||
/* No validation needed here. It has been done by ssl_conf_check() */
|
||||
ssl->major_ver = ssl->conf->min_major_ver;
|
||||
ssl->minor_ver = ssl->conf->min_minor_ver;
|
||||
|
||||
/*
|
||||
* Write legacy_version
|
||||
* ProtocolVersion legacy_version = 0x0303; // TLS v1.2
|
||||
*
|
||||
* For TLS 1.3 we use the legacy version number {0x03, 0x03}
|
||||
* instead of the true version number.
|
||||
*/
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
MBEDTLS_PUT_UINT16_BE( 0x0303, p, 0 );
|
||||
p += 2;
|
||||
|
||||
/* Write the random bytes ( random ).*/
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, MBEDTLS_CLIENT_HELLO_RANDOM_LEN );
|
||||
memcpy( p, ssl->handshake->randbytes, MBEDTLS_CLIENT_HELLO_RANDOM_LEN );
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, random bytes",
|
||||
p, MBEDTLS_CLIENT_HELLO_RANDOM_LEN );
|
||||
p += MBEDTLS_CLIENT_HELLO_RANDOM_LEN;
|
||||
|
||||
/*
|
||||
* Write legacy_session_id
|
||||
*
|
||||
* Versions of TLS before TLS 1.3 supported a "session resumption" feature
|
||||
* which has been merged with pre-shared keys in this version. A client
|
||||
* which has a cached session ID set by a pre-TLS 1.3 server SHOULD set
|
||||
* this field to that value. In compatibility mode, this field MUST be
|
||||
* non-empty, so a client not offering a pre-TLS 1.3 session MUST generate
|
||||
* a new 32-byte value. This value need not be random but SHOULD be
|
||||
* unpredictable to avoid implementations fixating on a specific value
|
||||
* ( also known as ossification ). Otherwise, it MUST be set as a zero-length
|
||||
* vector ( i.e., a zero-valued single byte length field ).
|
||||
*/
|
||||
#if defined(MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE)
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, ssl->session_negotiate->id_len + 1 );
|
||||
*p++ = (unsigned char)ssl->session_negotiate->id_len;
|
||||
memcpy( p, ssl->session_negotiate->id, ssl->session_negotiate->id_len );
|
||||
p += ssl->session_negotiate->id_len;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "session id", ssl->session_negotiate->id,
|
||||
ssl->session_negotiate->id_len );
|
||||
#else
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 1 );
|
||||
*p++ = 0; /* session id length set to zero */
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
|
||||
|
||||
/* Write cipher_suites */
|
||||
ret = ssl_tls13_write_client_hello_cipher_suites( ssl, p, end, &output_len );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
p += output_len;
|
||||
|
||||
/* Write legacy_compression_methods
|
||||
*
|
||||
* For every TLS 1.3 ClientHello, this vector MUST contain exactly
|
||||
* one byte set to zero, which corresponds to the 'null' compression
|
||||
* method in prior versions of TLS.
|
||||
*/
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
*p++ = 1;
|
||||
*p++ = MBEDTLS_SSL_COMPRESS_NULL;
|
||||
|
||||
/* Write extensions */
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
/* Keeping track of the included extensions */
|
||||
ssl->handshake->extensions_present = MBEDTLS_SSL_EXT_NONE;
|
||||
#endif
|
||||
|
||||
/* First write extensions, then the total length */
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
p_extensions_len = p;
|
||||
p += 2;
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
ret = ssl_tls13_write_client_hello_exts( ssl, p, end, &output_len );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
p += output_len;
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_ALPN)
|
||||
ret = ssl_tls13_write_alpn_ext( ssl, p, end, &output_len );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
p += output_len;
|
||||
#endif /* MBEDTLS_SSL_ALPN */
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
|
||||
if( mbedtls_ssl_conf_tls13_some_ephemeral_enabled( ssl ) )
|
||||
{
|
||||
ret = mbedtls_ssl_write_supported_groups_ext( ssl, p, end, &output_len );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
p += output_len;
|
||||
}
|
||||
|
||||
if( mbedtls_ssl_conf_tls13_ephemeral_enabled( ssl ) )
|
||||
{
|
||||
ret = mbedtls_ssl_write_sig_alg_ext( ssl, p, end, &output_len );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
p += output_len;
|
||||
}
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
||||
/* Write server name extension */
|
||||
ret = mbedtls_ssl_write_hostname_ext( ssl, p, end, &output_len );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
p += output_len;
|
||||
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
|
||||
|
||||
/* Add more extensions here */
|
||||
|
||||
/* Write the length of the list of extensions. */
|
||||
extensions_len = p - p_extensions_len - 2;
|
||||
MBEDTLS_PUT_UINT16_BE( extensions_len, p_extensions_len, 0 );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, total extension length: %" MBEDTLS_PRINTF_SIZET ,
|
||||
extensions_len ) );
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "client hello extensions", p_extensions_len, extensions_len );
|
||||
|
||||
*out_len = p - buf;
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static int ssl_tls13_prepare_client_hello( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
int ret;
|
||||
|
||||
if( ssl->conf->f_rng == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "no RNG provided" ) );
|
||||
return( MBEDTLS_ERR_SSL_NO_RNG );
|
||||
}
|
||||
|
||||
if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng,
|
||||
ssl->handshake->randbytes,
|
||||
MBEDTLS_CLIENT_HELLO_RANDOM_LEN ) ) != 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_RET( 1, "f_rng", ret );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE)
|
||||
/*
|
||||
* Create a session identifier for the purpose of middlebox compatibility
|
||||
* only if one has not been created already.
|
||||
*/
|
||||
if( ssl->session_negotiate->id_len == 0 )
|
||||
{
|
||||
/* Creating a session id with 32 byte length */
|
||||
if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng,
|
||||
ssl->session_negotiate->id, 32 ) ) != 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_RET( 1, "creating session id failed", ret );
|
||||
return( ret );
|
||||
}
|
||||
ssl->session_negotiate->id_len = 32;
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* Write ClientHello handshake message.
|
||||
* Handler for MBEDTLS_SSL_CLIENT_HELLO
|
||||
*/
|
||||
static int ssl_tls13_write_client_hello( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned char *buf;
|
||||
size_t buf_len, msg_len;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write client hello" ) );
|
||||
|
||||
MBEDTLS_SSL_PROC_CHK( ssl_tls13_prepare_client_hello( ssl ) );
|
||||
|
||||
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_start_handshake_msg(
|
||||
ssl, MBEDTLS_SSL_HS_CLIENT_HELLO,
|
||||
&buf, &buf_len ) );
|
||||
|
||||
MBEDTLS_SSL_PROC_CHK( ssl_tls13_write_client_hello_body( ssl, buf,
|
||||
buf + buf_len,
|
||||
&msg_len ) );
|
||||
|
||||
mbedtls_ssl_add_hs_msg_to_checksum( ssl, MBEDTLS_SSL_HS_CLIENT_HELLO,
|
||||
buf, msg_len );
|
||||
|
||||
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_finish_handshake_msg( ssl,
|
||||
buf_len,
|
||||
msg_len ) );
|
||||
|
||||
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_SERVER_HELLO );
|
||||
|
||||
cleanup:
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write client hello" ) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Functions for parsing and processing Server Hello
|
||||
*/
|
||||
/**
|
||||
* \brief Detect if the ServerHello contains a supported_versions extension
|
||||
* or not.
|
||||
*
|
||||
* \param[in] ssl SSL context
|
||||
* \param[in] buf Buffer containing the ServerHello message
|
||||
* \param[in] end End of the buffer containing the ServerHello message
|
||||
*
|
||||
* \return 0 if the ServerHello does not contain a supported_versions extension
|
||||
* \return 1 if the ServerHello contains a supported_versions extension
|
||||
* \return A negative value if an error occurred while parsing the ServerHello.
|
||||
*/
|
||||
static int ssl_tls13_is_supported_versions_ext_present(
|
||||
mbedtls_ssl_context *ssl,
|
||||
const unsigned char *buf,
|
||||
const unsigned char *end )
|
||||
{
|
||||
const unsigned char *p = buf;
|
||||
size_t legacy_session_id_echo_len;
|
||||
size_t extensions_len;
|
||||
const unsigned char *extensions_end;
|
||||
|
||||
/*
|
||||
* Check there is enough data to access the legacy_session_id_echo vector
|
||||
* length:
|
||||
* - legacy_version 2 bytes
|
||||
* - random MBEDTLS_SERVER_HELLO_RANDOM_LEN bytes
|
||||
* - legacy_session_id_echo length 1 byte
|
||||
*/
|
||||
MBEDTLS_SSL_CHK_BUF_READ_PTR( p, end, MBEDTLS_SERVER_HELLO_RANDOM_LEN + 3 );
|
||||
p += MBEDTLS_SERVER_HELLO_RANDOM_LEN + 2;
|
||||
legacy_session_id_echo_len = *p;
|
||||
|
||||
/*
|
||||
* Jump to the extensions, jumping over:
|
||||
* - legacy_session_id_echo (legacy_session_id_echo_len + 1) bytes
|
||||
* - cipher_suite 2 bytes
|
||||
* - legacy_compression_method 1 byte
|
||||
*/
|
||||
p += legacy_session_id_echo_len + 4;
|
||||
|
||||
/* Case of no extension */
|
||||
if( p == end )
|
||||
return( 0 );
|
||||
|
||||
/* ...
|
||||
* Extension extensions<6..2^16-1>;
|
||||
* ...
|
||||
* struct {
|
||||
* ExtensionType extension_type; (2 bytes)
|
||||
* opaque extension_data<0..2^16-1>;
|
||||
* } Extension;
|
||||
*/
|
||||
MBEDTLS_SSL_CHK_BUF_READ_PTR( p, end, 2 );
|
||||
extensions_len = MBEDTLS_GET_UINT16_BE( p, 0 );
|
||||
p += 2;
|
||||
|
||||
/* Check extensions do not go beyond the buffer of data. */
|
||||
MBEDTLS_SSL_CHK_BUF_READ_PTR( p, end, extensions_len );
|
||||
extensions_end = p + extensions_len;
|
||||
|
||||
while( p < extensions_end )
|
||||
{
|
||||
unsigned int extension_type;
|
||||
size_t extension_data_len;
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_READ_PTR( p, extensions_end, 4 );
|
||||
extension_type = MBEDTLS_GET_UINT16_BE( p, 0 );
|
||||
extension_data_len = MBEDTLS_GET_UINT16_BE( p, 2 );
|
||||
p += 4;
|
||||
|
||||
if( extension_type == MBEDTLS_TLS_EXT_SUPPORTED_VERSIONS )
|
||||
return( 1 );
|
||||
|
||||
MBEDTLS_SSL_CHK_BUF_READ_PTR( p, extensions_end, extension_data_len );
|
||||
p += extension_data_len;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Returns a negative value on failure, and otherwise
|
||||
* - SSL_SERVER_HELLO_COORDINATE_HELLO or
|
||||
* - SSL_SERVER_HELLO_COORDINATE_HRR
|
||||
|
@ -1131,8 +847,10 @@ static int ssl_server_hello_is_hrr( mbedtls_ssl_context *ssl,
|
|||
/* Fetch and preprocess
|
||||
* Returns a negative value on failure, and otherwise
|
||||
* - SSL_SERVER_HELLO_COORDINATE_HELLO or
|
||||
* - SSL_SERVER_HELLO_COORDINATE_HRR
|
||||
* - SSL_SERVER_HELLO_COORDINATE_HRR or
|
||||
* - SSL_SERVER_HELLO_COORDINATE_TLS1_2
|
||||
*/
|
||||
#define SSL_SERVER_HELLO_COORDINATE_TLS1_2 2
|
||||
static int ssl_tls13_server_hello_coordinate( mbedtls_ssl_context *ssl,
|
||||
unsigned char **buf,
|
||||
size_t *buf_len )
|
||||
|
@ -1143,6 +861,36 @@ static int ssl_tls13_server_hello_coordinate( mbedtls_ssl_context *ssl,
|
|||
MBEDTLS_SSL_HS_SERVER_HELLO,
|
||||
buf, buf_len ) );
|
||||
|
||||
MBEDTLS_SSL_PROC_CHK_NEG( ssl_tls13_is_supported_versions_ext_present(
|
||||
ssl, *buf, *buf + *buf_len ) );
|
||||
if( ret == 0 )
|
||||
{
|
||||
/* If the supported versions extension is not present but we were
|
||||
* expecting it, abort the handshake. Otherwise, switch to TLS 1.2
|
||||
* handshake.
|
||||
*/
|
||||
if( ssl->handshake->min_minor_ver > MBEDTLS_SSL_MINOR_VERSION_3 )
|
||||
{
|
||||
MBEDTLS_SSL_PEND_FATAL_ALERT( MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER,
|
||||
MBEDTLS_ERR_SSL_ILLEGAL_PARAMETER );
|
||||
return( MBEDTLS_ERR_SSL_ILLEGAL_PARAMETER );
|
||||
}
|
||||
|
||||
ssl->keep_current_message = 1;
|
||||
ssl->minor_ver = MBEDTLS_SSL_MINOR_VERSION_3;
|
||||
mbedtls_ssl_add_hs_msg_to_checksum( ssl, MBEDTLS_SSL_HS_SERVER_HELLO,
|
||||
*buf, *buf_len );
|
||||
|
||||
if( mbedtls_ssl_conf_tls13_some_ephemeral_enabled( ssl ) )
|
||||
{
|
||||
ret = ssl_tls13_reset_key_share( ssl );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
}
|
||||
|
||||
return( SSL_SERVER_HELLO_COORDINATE_TLS1_2 );
|
||||
}
|
||||
|
||||
ret = ssl_server_hello_is_hrr( ssl, *buf, *buf + *buf_len );
|
||||
switch( ret )
|
||||
{
|
||||
|
@ -1264,7 +1012,6 @@ static int ssl_tls13_parse_server_hello( mbedtls_ssl_context *ssl,
|
|||
const unsigned char *extensions_end;
|
||||
uint16_t cipher_suite;
|
||||
const mbedtls_ssl_ciphersuite_t *ciphersuite_info;
|
||||
int supported_versions_ext_found = 0;
|
||||
int fatal_alert = 0;
|
||||
|
||||
/*
|
||||
|
@ -1336,12 +1083,11 @@ static int ssl_tls13_parse_server_hello( mbedtls_ssl_context *ssl,
|
|||
|
||||
ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( cipher_suite );
|
||||
/*
|
||||
* Check whether this ciphersuite is supported and offered.
|
||||
* Via the force_ciphersuite version we may have instructed the client
|
||||
* to use a different ciphersuite.
|
||||
* Check whether this ciphersuite is valid and offered.
|
||||
*/
|
||||
if( ciphersuite_info == NULL ||
|
||||
ssl_tls13_cipher_suite_is_offered( ssl, cipher_suite ) == 0 )
|
||||
if( ( mbedtls_ssl_validate_ciphersuite(
|
||||
ssl, ciphersuite_info, ssl->minor_ver, ssl->minor_ver ) != 0 ) ||
|
||||
!ssl_tls13_cipher_suite_is_offered( ssl, cipher_suite ) )
|
||||
{
|
||||
fatal_alert = MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER;
|
||||
}
|
||||
|
@ -1444,10 +1190,6 @@ static int ssl_tls13_parse_server_hello( mbedtls_ssl_context *ssl,
|
|||
break;
|
||||
|
||||
case MBEDTLS_TLS_EXT_SUPPORTED_VERSIONS:
|
||||
supported_versions_ext_found = 1;
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3,
|
||||
( "found supported_versions extension" ) );
|
||||
|
||||
ret = ssl_tls13_parse_supported_versions_ext( ssl,
|
||||
p,
|
||||
extension_data_end );
|
||||
|
@ -1462,7 +1204,6 @@ static int ssl_tls13_parse_server_hello( mbedtls_ssl_context *ssl,
|
|||
fatal_alert = MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT;
|
||||
goto cleanup;
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
|
||||
case MBEDTLS_TLS_EXT_KEY_SHARE:
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found key_shares extension" ) );
|
||||
if( ! mbedtls_ssl_conf_tls13_some_ephemeral_enabled( ssl ) )
|
||||
|
@ -1485,7 +1226,6 @@ static int ssl_tls13_parse_server_hello( mbedtls_ssl_context *ssl,
|
|||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
|
||||
|
||||
default:
|
||||
MBEDTLS_SSL_DEBUG_MSG(
|
||||
|
@ -1500,13 +1240,6 @@ static int ssl_tls13_parse_server_hello( mbedtls_ssl_context *ssl,
|
|||
p += extension_data_len;
|
||||
}
|
||||
|
||||
if( !supported_versions_ext_found )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "supported_versions not found" ) );
|
||||
fatal_alert = MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
if( fatal_alert == MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT )
|
||||
|
@ -1640,7 +1373,6 @@ cleanup:
|
|||
|
||||
static int ssl_tls13_postprocess_hrr( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE)
|
||||
|
@ -1665,9 +1397,6 @@ static int ssl_tls13_postprocess_hrr( mbedtls_ssl_context *ssl )
|
|||
ret = ssl_tls13_reset_key_share( ssl );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
#else
|
||||
((void) ssl);
|
||||
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -1699,6 +1428,12 @@ static int ssl_tls13_process_server_hello( mbedtls_ssl_context *ssl )
|
|||
else
|
||||
is_hrr = ( ret == SSL_SERVER_HELLO_COORDINATE_HRR );
|
||||
|
||||
if( ret == SSL_SERVER_HELLO_COORDINATE_TLS1_2 )
|
||||
{
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
MBEDTLS_SSL_PROC_CHK( ssl_tls13_parse_server_hello( ssl, buf,
|
||||
buf + buf_len,
|
||||
is_hrr ) );
|
||||
|
@ -2234,10 +1969,6 @@ int mbedtls_ssl_tls13_handshake_client_step( mbedtls_ssl_context *ssl )
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "tls13 client state: %s(%d)",
|
||||
mbedtls_ssl_states_str( ssl->state ),
|
||||
ssl->state ) );
|
||||
|
||||
switch( ssl->state )
|
||||
{
|
||||
/*
|
||||
|
@ -2246,7 +1977,7 @@ int mbedtls_ssl_tls13_handshake_client_step( mbedtls_ssl_context *ssl )
|
|||
*/
|
||||
case MBEDTLS_SSL_HELLO_REQUEST:
|
||||
case MBEDTLS_SSL_CLIENT_HELLO:
|
||||
ret = ssl_tls13_write_client_hello( ssl );
|
||||
ret = mbedtls_ssl_write_client_hello( ssl );
|
||||
break;
|
||||
|
||||
case MBEDTLS_SSL_SERVER_HELLO:
|
||||
|
|
|
@ -282,8 +282,11 @@ psa_key_usage_t mbedtls_test_update_key_usage_flags( psa_key_usage_t usage_flags
|
|||
/** \def USE_PSA_INIT
|
||||
*
|
||||
* Call this macro to initialize the PSA subsystem if #MBEDTLS_USE_PSA_CRYPTO
|
||||
* is enabled and do nothing otherwise. If the initialization fails, mark
|
||||
* the test case as failed and jump to the \p exit label.
|
||||
* or #MBEDTLS_SSL_PROTO_TLS1_3 (In contrast to TLS 1.2 implementation, the
|
||||
* TLS 1.3 one uses PSA independently of the definition of
|
||||
* #MBEDTLS_USE_PSA_CRYPTO) is enabled and do nothing otherwise. If the
|
||||
* initialization fails, mark the test case as failed and jump to the \p exit
|
||||
* label.
|
||||
*/
|
||||
/** \def USE_PSA_DONE
|
||||
*
|
||||
|
@ -291,15 +294,15 @@ psa_key_usage_t mbedtls_test_update_key_usage_flags( psa_key_usage_t usage_flags
|
|||
* This is like #PSA_DONE, except that it does nothing if
|
||||
* #MBEDTLS_USE_PSA_CRYPTO is disabled.
|
||||
*/
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO) || defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
#define USE_PSA_INIT( ) PSA_INIT( )
|
||||
#define USE_PSA_DONE( ) PSA_DONE( )
|
||||
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
#else /* MBEDTLS_USE_PSA_CRYPTO || MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
/* Define empty macros so that we can use them in the preamble and teardown
|
||||
* of every test function that uses PSA conditionally based on
|
||||
* MBEDTLS_USE_PSA_CRYPTO. */
|
||||
#define USE_PSA_INIT( ) ( (void) 0 )
|
||||
#define USE_PSA_DONE( ) ( (void) 0 )
|
||||
#endif /* !MBEDTLS_USE_PSA_CRYPTO */
|
||||
#endif /* !MBEDTLS_USE_PSA_CRYPTO && !MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
#endif /* PSA_CRYPTO_HELPERS_H */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1059,6 +1059,7 @@ component_test_no_ctr_drbg_classic () {
|
|||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_CTR_DRBG_C
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
|
||||
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
@ -1104,6 +1105,7 @@ component_test_no_hmac_drbg_classic () {
|
|||
scripts/config.py unset MBEDTLS_HMAC_DRBG_C
|
||||
scripts/config.py unset MBEDTLS_ECDSA_DETERMINISTIC # requires HMAC_DRBG
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
|
||||
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
@ -1156,6 +1158,7 @@ component_test_psa_external_rng_no_drbg_classic () {
|
|||
msg "build: PSA_CRYPTO_EXTERNAL_RNG minus *_DRBG, classic crypto in TLS"
|
||||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
|
||||
scripts/config.py unset MBEDTLS_ENTROPY_C
|
||||
scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED
|
||||
|
@ -1634,6 +1637,7 @@ component_test_psa_crypto_config_accel_ecdsa () {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py unset MBEDTLS_ECDSA_C
|
||||
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
|
||||
|
@ -1806,6 +1810,7 @@ component_test_psa_crypto_config_no_driver() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
make CC=gcc CFLAGS="$ASAN_CFLAGS -O2" LDFLAGS="$ASAN_CFLAGS"
|
||||
|
||||
msg "test: full + MBEDTLS_PSA_CRYPTO_CONFIG minus MBEDTLS_PSA_CRYPTO_DRIVERS"
|
||||
|
@ -1836,6 +1841,7 @@ component_build_psa_accel_alg_ecdsa() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py unset MBEDTLS_ECDSA_C
|
||||
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
|
||||
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
@ -1852,6 +1858,7 @@ component_build_psa_accel_alg_ecdh() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py unset MBEDTLS_ECDH_C
|
||||
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
|
||||
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
|
||||
|
@ -1870,6 +1877,7 @@ component_build_psa_accel_key_type_ecc_key_pair() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_KEY_TYPE_ECC_KEY_PAIR 1
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1
|
||||
# Need to define the correct symbol and include the test driver header path in order to build with the test driver
|
||||
|
@ -1884,6 +1892,7 @@ component_build_psa_accel_key_type_ecc_public_key() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY 1
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR
|
||||
# Need to define the correct symbol and include the test driver header path in order to build with the test driver
|
||||
|
@ -1898,6 +1907,7 @@ component_build_psa_accel_alg_hmac() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
# Need to define the correct symbol and include the test driver header path in order to build with the test driver
|
||||
make CC=gcc CFLAGS="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST -DMBEDTLS_PSA_ACCEL_ALG_HMAC -I../tests/include -O2" LDFLAGS="$ASAN_CFLAGS"
|
||||
}
|
||||
|
@ -1911,6 +1921,7 @@ component_build_psa_accel_alg_hkdf() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py unset MBEDTLS_HKDF_C
|
||||
# Make sure to unset TLS1_3 since it requires HKDF_C and will not build properly without it.
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
|
@ -1926,6 +1937,7 @@ component_build_psa_accel_alg_md5() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_224
|
||||
|
@ -1944,6 +1956,7 @@ component_build_psa_accel_alg_ripemd160() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_224
|
||||
|
@ -1962,6 +1975,7 @@ component_build_psa_accel_alg_sha1() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_224
|
||||
|
@ -1980,6 +1994,7 @@ component_build_psa_accel_alg_sha224() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
|
||||
|
@ -1997,6 +2012,7 @@ component_build_psa_accel_alg_sha256() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
|
||||
|
@ -2015,6 +2031,7 @@ component_build_psa_accel_alg_sha384() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
|
||||
|
@ -2032,6 +2049,7 @@ component_build_psa_accel_alg_sha512() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_MD5
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RIPEMD160
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_SHA_1
|
||||
|
@ -2050,6 +2068,7 @@ component_build_psa_accel_alg_rsa_pkcs1v15_crypt() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_PKCS1V15_CRYPT 1
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_OAEP
|
||||
|
@ -2066,6 +2085,7 @@ component_build_psa_accel_alg_rsa_pkcs1v15_sign() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_PKCS1V15_SIGN 1
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_OAEP
|
||||
|
@ -2082,6 +2102,7 @@ component_build_psa_accel_alg_rsa_oaep() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_OAEP 1
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN
|
||||
|
@ -2098,6 +2119,7 @@ component_build_psa_accel_alg_rsa_pss() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_PSS 1
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_CRYPT
|
||||
scripts/config.py -f include/psa/crypto_config.h unset PSA_WANT_ALG_RSA_PKCS1V15_SIGN
|
||||
|
@ -2114,6 +2136,7 @@ component_build_psa_accel_key_type_rsa_key_pair() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_PSS 1
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1
|
||||
# Need to define the correct symbol and include the test driver header path in order to build with the test driver
|
||||
|
@ -2128,6 +2151,7 @@ component_build_psa_accel_key_type_rsa_public_key() {
|
|||
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_DRIVERS
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_ALG_RSA_PSS 1
|
||||
scripts/config.py -f include/psa/crypto_config.h set PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1
|
||||
# Need to define the correct symbol and include the test driver header path in order to build with the test driver
|
||||
|
|
|
@ -291,7 +291,7 @@ class MbedTLSCli(TLSProgram):
|
|||
super().cmd()
|
||||
ret = ['$P_CLI']
|
||||
ret += ['server_addr=127.0.0.1', 'server_port=$SRV_PORT',
|
||||
'debug_level=4', 'force_version=tls13']
|
||||
'debug_level=4']
|
||||
ret += ['ca_file={cafile}'.format(
|
||||
cafile=CERTIFICATES[self._cert_sig_algs[0]].cafile)]
|
||||
|
||||
|
@ -325,7 +325,7 @@ class MbedTLSCli(TLSProgram):
|
|||
return ret
|
||||
|
||||
def post_checks(self):
|
||||
check_strings = []
|
||||
check_strings = ["Protocol is TLSv1.3"]
|
||||
if self._ciphers:
|
||||
check_strings.append(
|
||||
"server hello, chosen ciphersuite: ( {:04x} ) - {}".format(
|
||||
|
|
378
tests/ssl-opt.sh
378
tests/ssl-opt.sh
|
@ -1196,7 +1196,7 @@ run_test_psa() {
|
|||
requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
|
||||
run_test "PSA-supported ciphersuite: $1" \
|
||||
"$P_SRV debug_level=3 force_version=tls12" \
|
||||
"$P_CLI debug_level=3 force_version=tls12 force_ciphersuite=$1" \
|
||||
"$P_CLI debug_level=3 force_ciphersuite=$1" \
|
||||
0 \
|
||||
-c "PSA calc verify" \
|
||||
-c "calc PSA finished" \
|
||||
|
@ -1216,7 +1216,7 @@ run_test_psa_force_curve() {
|
|||
requires_config_enabled MBEDTLS_USE_PSA_CRYPTO
|
||||
run_test "PSA - ECDH with $1" \
|
||||
"$P_SRV debug_level=4 force_version=tls12 curves=$1" \
|
||||
"$P_CLI debug_level=4 force_version=tls12 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256 curves=$1" \
|
||||
"$P_CLI debug_level=4 force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256 curves=$1" \
|
||||
0 \
|
||||
-c "PSA calc verify" \
|
||||
-c "calc PSA finished" \
|
||||
|
@ -1245,7 +1245,7 @@ run_test_memory_after_hanshake_with_mfl()
|
|||
|
||||
run_test "Handshake memory usage (MFL $1)" \
|
||||
"$P_SRV debug_level=3 auth_mode=required force_version=tls12" \
|
||||
"$P_CLI debug_level=3 force_version=tls12 \
|
||||
"$P_CLI debug_level=3 \
|
||||
crt_file=data_files/server5.crt key_file=data_files/server5.key \
|
||||
force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM max_frag_len=$1" \
|
||||
0 \
|
||||
|
@ -1264,7 +1264,7 @@ run_tests_memory_after_hanshake()
|
|||
MEMORY_USAGE_MFL_16K=0
|
||||
run_test "Handshake memory usage initial (MFL 16384 - default)" \
|
||||
"$P_SRV debug_level=3 auth_mode=required force_version=tls12" \
|
||||
"$P_CLI debug_level=3 force_version=tls12 \
|
||||
"$P_CLI debug_level=3 \
|
||||
crt_file=data_files/server5.crt key_file=data_files/server5.key \
|
||||
force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CCM" \
|
||||
0 \
|
||||
|
@ -2790,9 +2790,9 @@ run_test "Encrypt then MAC, DTLS: disabled, empty application data record" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "CBC Record splitting: TLS 1.2, no splitting" \
|
||||
"$P_SRV" \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA \
|
||||
request_size=123 force_version=tls12" \
|
||||
request_size=123" \
|
||||
0 \
|
||||
-s "Read from client: 123 bytes read" \
|
||||
-S "Read from client: 1 bytes read" \
|
||||
|
@ -2877,7 +2877,7 @@ run_test "Session resume using tickets: session copy" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Session resume using tickets: openssl server" \
|
||||
"$O_SRV" \
|
||||
"$O_SRV -tls1_2" \
|
||||
"$P_CLI debug_level=3 tickets=1 reconnect=1" \
|
||||
0 \
|
||||
-c "client hello, adding session ticket extension" \
|
||||
|
@ -3318,7 +3318,7 @@ run_test "Session resume using cache: openssl client" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Session resume using cache: openssl server" \
|
||||
"$O_SRV" \
|
||||
"$O_SRV -tls1_2" \
|
||||
"$P_CLI debug_level=3 tickets=0 reconnect=1" \
|
||||
0 \
|
||||
-C "found session_ticket extension" \
|
||||
|
@ -3752,7 +3752,7 @@ requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
|||
requires_gnutls
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Max fragment length: gnutls server" \
|
||||
"$G_SRV" \
|
||||
"$G_SRV --priority=NORMAL:-VERS-ALL:+VERS-TLS1.2" \
|
||||
"$P_CLI debug_level=3 max_frag_len=4096" \
|
||||
0 \
|
||||
-c "Maximum incoming record payload length is 4096" \
|
||||
|
@ -4151,7 +4151,7 @@ run_test "Renegotiation: nbio, server-initiated" \
|
|||
requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Renegotiation: openssl server, client-initiated" \
|
||||
"$O_SRV -www" \
|
||||
"$O_SRV -www -tls1_2" \
|
||||
"$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
|
||||
0 \
|
||||
-c "client hello, adding renegotiation extension" \
|
||||
|
@ -4165,7 +4165,7 @@ requires_gnutls
|
|||
requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Renegotiation: gnutls server strict, client-initiated" \
|
||||
"$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \
|
||||
"$G_SRV --priority=NORMAL:-VERS-ALL:+VERS-TLS1.2:%SAFE_RENEGOTIATION" \
|
||||
"$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
|
||||
0 \
|
||||
-c "client hello, adding renegotiation extension" \
|
||||
|
@ -4179,7 +4179,7 @@ requires_gnutls
|
|||
requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Renegotiation: gnutls server unsafe, client-initiated default" \
|
||||
"$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
|
||||
"$G_SRV --priority=NORMAL:-VERS-ALL:+VERS-TLS1.2:%DISABLE_SAFE_RENEGOTIATION" \
|
||||
"$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1" \
|
||||
1 \
|
||||
-c "client hello, adding renegotiation extension" \
|
||||
|
@ -4193,7 +4193,7 @@ requires_gnutls
|
|||
requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Renegotiation: gnutls server unsafe, client-inititated no legacy" \
|
||||
"$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
|
||||
"$G_SRV --priority=NORMAL:-VERS-ALL:+VERS-TLS1.2:%DISABLE_SAFE_RENEGOTIATION" \
|
||||
"$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \
|
||||
allow_legacy=0" \
|
||||
1 \
|
||||
|
@ -4208,7 +4208,7 @@ requires_gnutls
|
|||
requires_config_enabled MBEDTLS_SSL_RENEGOTIATION
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Renegotiation: gnutls server unsafe, client-inititated legacy" \
|
||||
"$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
|
||||
"$G_SRV --priority=NORMAL:-VERS-ALL:+VERS-TLS1.2:%DISABLE_SAFE_RENEGOTIATION" \
|
||||
"$P_CLI debug_level=3 exchanges=1 renegotiation=1 renegotiate=1 \
|
||||
allow_legacy=1" \
|
||||
0 \
|
||||
|
@ -4284,7 +4284,7 @@ run_test "Renegotiation: DTLS, gnutls server, client-initiated" \
|
|||
requires_gnutls
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Renego ext: gnutls server strict, client default" \
|
||||
"$G_SRV --priority=NORMAL:%SAFE_RENEGOTIATION" \
|
||||
"$G_SRV --priority=NORMAL:-VERS-ALL:+VERS-TLS1.2:%SAFE_RENEGOTIATION" \
|
||||
"$P_CLI debug_level=3" \
|
||||
0 \
|
||||
-c "found renegotiation extension" \
|
||||
|
@ -4294,7 +4294,7 @@ run_test "Renego ext: gnutls server strict, client default" \
|
|||
requires_gnutls
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Renego ext: gnutls server unsafe, client default" \
|
||||
"$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
|
||||
"$G_SRV --priority=NORMAL:-VERS-ALL:+VERS-TLS1.2:%DISABLE_SAFE_RENEGOTIATION" \
|
||||
"$P_CLI debug_level=3" \
|
||||
0 \
|
||||
-C "found renegotiation extension" \
|
||||
|
@ -4304,7 +4304,7 @@ run_test "Renego ext: gnutls server unsafe, client default" \
|
|||
requires_gnutls
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Renego ext: gnutls server unsafe, client break legacy" \
|
||||
"$G_SRV --priority=NORMAL:%DISABLE_SAFE_RENEGOTIATION" \
|
||||
"$G_SRV --priority=NORMAL:-VERS-ALL:+VERS-TLS1.2:%DISABLE_SAFE_RENEGOTIATION" \
|
||||
"$P_CLI debug_level=3 allow_legacy=-1" \
|
||||
1 \
|
||||
-C "found renegotiation extension" \
|
||||
|
@ -4650,7 +4650,7 @@ run_test "Authentication: openssl client no cert, server optional" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Authentication: client no cert, openssl server optional" \
|
||||
"$O_SRV -verify 10" \
|
||||
"$O_SRV -verify 10 -tls1_2" \
|
||||
"$P_CLI debug_level=3 crt_file=none key_file=none" \
|
||||
0 \
|
||||
-C "skip parse certificate request" \
|
||||
|
@ -4661,7 +4661,7 @@ run_test "Authentication: client no cert, openssl server optional" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Authentication: client no cert, openssl server required" \
|
||||
"$O_SRV -Verify 10" \
|
||||
"$O_SRV -Verify 10 -tls1_2" \
|
||||
"$P_CLI debug_level=3 crt_file=none key_file=none" \
|
||||
1 \
|
||||
-C "skip parse certificate request" \
|
||||
|
@ -5021,11 +5021,11 @@ run_test "Authentication, CA callback: client max_int chain, server required"
|
|||
requires_config_disabled MBEDTLS_X509_REMOVE_INFO
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Certificate hash: client TLS 1.2 -> SHA-2" \
|
||||
"$P_SRV crt_file=data_files/server5.crt \
|
||||
"$P_SRV force_version=tls12 crt_file=data_files/server5.crt \
|
||||
key_file=data_files/server5.key \
|
||||
crt_file2=data_files/server5-sha1.crt \
|
||||
key_file2=data_files/server5.key" \
|
||||
"$P_CLI force_version=tls12" \
|
||||
"$P_CLI" \
|
||||
0 \
|
||||
-c "signed using.*ECDSA with SHA256" \
|
||||
-C "signed using.*ECDSA with SHA1"
|
||||
|
@ -5723,7 +5723,7 @@ run_test "keyUsage srv: ECDSA, keyEncipherment -> fail" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "keyUsage cli: DigitalSignature+KeyEncipherment, RSA: OK" \
|
||||
"$O_SRV -key data_files/server2.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server2.key \
|
||||
-cert data_files/server2.ku-ds_ke.crt" \
|
||||
"$P_CLI debug_level=1 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
|
||||
|
@ -5734,7 +5734,7 @@ run_test "keyUsage cli: DigitalSignature+KeyEncipherment, RSA: OK" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "keyUsage cli: DigitalSignature+KeyEncipherment, DHE-RSA: OK" \
|
||||
"$O_SRV -key data_files/server2.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server2.key \
|
||||
-cert data_files/server2.ku-ds_ke.crt" \
|
||||
"$P_CLI debug_level=1 \
|
||||
force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
|
||||
|
@ -5745,7 +5745,7 @@ run_test "keyUsage cli: DigitalSignature+KeyEncipherment, DHE-RSA: OK" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "keyUsage cli: KeyEncipherment, RSA: OK" \
|
||||
"$O_SRV -key data_files/server2.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server2.key \
|
||||
-cert data_files/server2.ku-ke.crt" \
|
||||
"$P_CLI debug_level=1 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
|
||||
|
@ -5756,7 +5756,7 @@ run_test "keyUsage cli: KeyEncipherment, RSA: OK" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail" \
|
||||
"$O_SRV -key data_files/server2.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server2.key \
|
||||
-cert data_files/server2.ku-ke.crt" \
|
||||
"$P_CLI debug_level=1 \
|
||||
force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
|
||||
|
@ -5767,7 +5767,7 @@ run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail, soft" \
|
||||
"$O_SRV -key data_files/server2.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server2.key \
|
||||
-cert data_files/server2.ku-ke.crt" \
|
||||
"$P_CLI debug_level=1 auth_mode=optional \
|
||||
force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
|
||||
|
@ -5779,7 +5779,7 @@ run_test "keyUsage cli: KeyEncipherment, DHE-RSA: fail, soft" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "keyUsage cli: DigitalSignature, DHE-RSA: OK" \
|
||||
"$O_SRV -key data_files/server2.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server2.key \
|
||||
-cert data_files/server2.ku-ds.crt" \
|
||||
"$P_CLI debug_level=1 \
|
||||
force_ciphersuite=TLS-DHE-RSA-WITH-AES-128-CBC-SHA" \
|
||||
|
@ -5790,7 +5790,7 @@ run_test "keyUsage cli: DigitalSignature, DHE-RSA: OK" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "keyUsage cli: DigitalSignature, RSA: fail" \
|
||||
"$O_SRV -key data_files/server2.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server2.key \
|
||||
-cert data_files/server2.ku-ds.crt" \
|
||||
"$P_CLI debug_level=1 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
|
||||
|
@ -5801,7 +5801,7 @@ run_test "keyUsage cli: DigitalSignature, RSA: fail" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "keyUsage cli: DigitalSignature, RSA: fail, soft" \
|
||||
"$O_SRV -key data_files/server2.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server2.key \
|
||||
-cert data_files/server2.ku-ds.crt" \
|
||||
"$P_CLI debug_level=1 auth_mode=optional \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-128-CBC-SHA" \
|
||||
|
@ -5893,7 +5893,7 @@ run_test "extKeyUsage srv: codeSign -> fail" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "extKeyUsage cli: serverAuth -> OK" \
|
||||
"$O_SRV -key data_files/server5.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server5.key \
|
||||
-cert data_files/server5.eku-srv.crt" \
|
||||
"$P_CLI debug_level=1" \
|
||||
0 \
|
||||
|
@ -5903,7 +5903,7 @@ run_test "extKeyUsage cli: serverAuth -> OK" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "extKeyUsage cli: serverAuth,clientAuth -> OK" \
|
||||
"$O_SRV -key data_files/server5.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server5.key \
|
||||
-cert data_files/server5.eku-srv_cli.crt" \
|
||||
"$P_CLI debug_level=1" \
|
||||
0 \
|
||||
|
@ -5913,7 +5913,7 @@ run_test "extKeyUsage cli: serverAuth,clientAuth -> OK" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "extKeyUsage cli: codeSign,anyEKU -> OK" \
|
||||
"$O_SRV -key data_files/server5.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server5.key \
|
||||
-cert data_files/server5.eku-cs_any.crt" \
|
||||
"$P_CLI debug_level=1" \
|
||||
0 \
|
||||
|
@ -5923,7 +5923,7 @@ run_test "extKeyUsage cli: codeSign,anyEKU -> OK" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "extKeyUsage cli: codeSign -> fail" \
|
||||
"$O_SRV -key data_files/server5.key \
|
||||
"$O_SRV -tls1_2 -key data_files/server5.key \
|
||||
-cert data_files/server5.eku-cs.crt" \
|
||||
"$P_CLI debug_level=1" \
|
||||
1 \
|
||||
|
@ -6427,7 +6427,7 @@ run_test "ECJPAKE: server not configured" \
|
|||
"$P_CLI debug_level=3 ecjpake_pw=bla \
|
||||
force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \
|
||||
1 \
|
||||
-c "add ciphersuite: 0xc0ff" \
|
||||
-c "add ciphersuite: c0ff" \
|
||||
-c "adding ecjpake_kkpp extension" \
|
||||
-s "found ecjpake kkpp extension" \
|
||||
-s "skip ecjpake kkpp extension" \
|
||||
|
@ -6443,7 +6443,7 @@ run_test "ECJPAKE: working, TLS" \
|
|||
"$P_CLI debug_level=3 ecjpake_pw=bla \
|
||||
force_ciphersuite=TLS-ECJPAKE-WITH-AES-128-CCM-8" \
|
||||
0 \
|
||||
-c "add ciphersuite: 0xc0ff" \
|
||||
-c "add ciphersuite: c0ff" \
|
||||
-c "adding ecjpake_kkpp extension" \
|
||||
-C "re-using cached ecjpake parameters" \
|
||||
-s "found ecjpake kkpp extension" \
|
||||
|
@ -6535,40 +6535,40 @@ run_test "mbedtls_ssl_get_bytes_avail: extra data" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Small client packet TLS 1.2 BlockCipher" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=1 force_version=tls12 \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI request_size=1 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
||||
0 \
|
||||
-s "Read from client: 1 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Small client packet TLS 1.2 BlockCipher, without EtM" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=1 force_version=tls12 \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI request_size=1 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA etm=0" \
|
||||
0 \
|
||||
-s "Read from client: 1 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Small client packet TLS 1.2 BlockCipher larger MAC" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=1 force_version=tls12 \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI request_size=1 \
|
||||
force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
|
||||
0 \
|
||||
-s "Read from client: 1 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Small client packet TLS 1.2 AEAD" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=1 force_version=tls12 \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI request_size=1 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
|
||||
0 \
|
||||
-s "Read from client: 1 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Small client packet TLS 1.2 AEAD shorter tag" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=1 force_version=tls12 \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI request_size=1 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
|
||||
0 \
|
||||
-s "Read from client: 1 bytes read"
|
||||
|
@ -6597,41 +6597,36 @@ run_test "Small client packet DTLS 1.2, without EtM" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Small server packet TLS 1.2 BlockCipher" \
|
||||
"$P_SRV response_size=1" \
|
||||
"$P_CLI force_version=tls12 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
||||
"$P_SRV response_size=1 force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
||||
0 \
|
||||
-c "Read from server: 1 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Small server packet TLS 1.2 BlockCipher, without EtM" \
|
||||
"$P_SRV response_size=1" \
|
||||
"$P_CLI force_version=tls12 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA etm=0" \
|
||||
"$P_SRV response_size=1 force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA etm=0" \
|
||||
0 \
|
||||
-c "Read from server: 1 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Small server packet TLS 1.2 BlockCipher larger MAC" \
|
||||
"$P_SRV response_size=1" \
|
||||
"$P_CLI force_version=tls12 \
|
||||
force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
|
||||
"$P_SRV response_size=1 force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
|
||||
0 \
|
||||
-c "Read from server: 1 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Small server packet TLS 1.2 AEAD" \
|
||||
"$P_SRV response_size=1" \
|
||||
"$P_CLI force_version=tls12 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
|
||||
"$P_SRV response_size=1 force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
|
||||
0 \
|
||||
-c "Read from server: 1 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Small server packet TLS 1.2 AEAD shorter tag" \
|
||||
"$P_SRV response_size=1" \
|
||||
"$P_CLI force_version=tls12 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
|
||||
"$P_SRV response_size=1 force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
|
||||
0 \
|
||||
-c "Read from server: 1 bytes read"
|
||||
|
||||
|
@ -6664,8 +6659,8 @@ fragments_for_write() {
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large client packet TLS 1.2 BlockCipher" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=16384 force_version=tls12 \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI request_size=16384 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
||||
0 \
|
||||
-c "16384 bytes written in $(fragments_for_write 16384) fragments" \
|
||||
|
@ -6673,16 +6668,16 @@ run_test "Large client packet TLS 1.2 BlockCipher" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large client packet TLS 1.2 BlockCipher, without EtM" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=16384 force_version=tls12 etm=0 \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI request_size=16384 etm=0 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
||||
0 \
|
||||
-s "Read from client: $MAX_CONTENT_LEN bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large client packet TLS 1.2 BlockCipher larger MAC" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=16384 force_version=tls12 \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI request_size=16384 \
|
||||
force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
|
||||
0 \
|
||||
-c "16384 bytes written in $(fragments_for_write 16384) fragments" \
|
||||
|
@ -6690,8 +6685,8 @@ run_test "Large client packet TLS 1.2 BlockCipher larger MAC" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large client packet TLS 1.2 AEAD" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=16384 force_version=tls12 \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI request_size=16384 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
|
||||
0 \
|
||||
-c "16384 bytes written in $(fragments_for_write 16384) fragments" \
|
||||
|
@ -6699,8 +6694,8 @@ run_test "Large client packet TLS 1.2 AEAD" \
|
|||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large client packet TLS 1.2 AEAD shorter tag" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=16384 force_version=tls12 \
|
||||
"$P_SRV force_version=tls12" \
|
||||
"$P_CLI request_size=16384 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
|
||||
0 \
|
||||
-c "16384 bytes written in $(fragments_for_write 16384) fragments" \
|
||||
|
@ -6709,51 +6704,45 @@ run_test "Large client packet TLS 1.2 AEAD shorter tag" \
|
|||
# The tests below fail when the server's OUT_CONTENT_LEN is less than 16384.
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large server packet TLS 1.2 BlockCipher" \
|
||||
"$P_SRV response_size=16384" \
|
||||
"$P_CLI force_version=tls12 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
||||
"$P_SRV response_size=16384 force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
||||
0 \
|
||||
-c "Read from server: 16384 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large server packet TLS 1.2 BlockCipher, without EtM" \
|
||||
"$P_SRV response_size=16384" \
|
||||
"$P_CLI force_version=tls12 etm=0 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
||||
"$P_SRV response_size=16384 force_version=tls12" \
|
||||
"$P_CLI etm=0 force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA" \
|
||||
0 \
|
||||
-s "16384 bytes written in 1 fragments" \
|
||||
-c "Read from server: 16384 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large server packet TLS 1.2 BlockCipher larger MAC" \
|
||||
"$P_SRV response_size=16384" \
|
||||
"$P_CLI force_version=tls12 \
|
||||
force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
|
||||
"$P_SRV response_size=16384 force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" \
|
||||
0 \
|
||||
-c "Read from server: 16384 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large server packet TLS 1.2 BlockCipher, without EtM, truncated MAC" \
|
||||
"$P_SRV response_size=16384 trunc_hmac=1" \
|
||||
"$P_CLI force_version=tls12 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
|
||||
"$P_SRV response_size=16384 trunc_hmac=1 force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-256-CBC-SHA trunc_hmac=1 etm=0" \
|
||||
0 \
|
||||
-s "16384 bytes written in 1 fragments" \
|
||||
-c "Read from server: 16384 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large server packet TLS 1.2 AEAD" \
|
||||
"$P_SRV response_size=16384" \
|
||||
"$P_CLI force_version=tls12 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
|
||||
"$P_SRV response_size=16384 force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-256-CCM" \
|
||||
0 \
|
||||
-c "Read from server: 16384 bytes read"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Large server packet TLS 1.2 AEAD shorter tag" \
|
||||
"$P_SRV response_size=16384" \
|
||||
"$P_CLI force_version=tls12 \
|
||||
force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
|
||||
"$P_SRV response_size=16384 force_version=tls12" \
|
||||
"$P_CLI force_ciphersuite=TLS-RSA-WITH-AES-256-CCM-8" \
|
||||
0 \
|
||||
-c "Read from server: 16384 bytes read"
|
||||
|
||||
|
@ -9630,23 +9619,13 @@ run_test "TLS 1.3: Test gnutls tls1_3 feature" \
|
|||
-c "Version: TLS1.3"
|
||||
|
||||
# TLS1.3 test cases
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
skip_handshake_stage_check
|
||||
run_test "TLS 1.3: Not supported version check: tls12 and tls13" \
|
||||
"$P_SRV debug_level=1" \
|
||||
"$P_CLI debug_level=1 min_version=tls12 max_version=tls13" \
|
||||
1 \
|
||||
-c "SSL - The requested feature is not available" \
|
||||
-c "Hybrid TLS 1.2 + TLS 1.3 configurations are not yet supported"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
skip_handshake_stage_check
|
||||
run_test "TLS 1.3: No server support" \
|
||||
"$P_SRV debug_level=2 force_version=tls13" \
|
||||
"$P_CLI debug_level=2 force_version=tls13" \
|
||||
1 \
|
||||
-s "TLS 1.3 server is not supported yet."
|
||||
-s "The requested feature is not available"
|
||||
|
||||
requires_openssl_tls1_3
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
|
@ -9655,26 +9634,26 @@ requires_config_enabled MBEDTLS_DEBUG_C
|
|||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3: minimal feature sets - openssl" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache" \
|
||||
"$P_CLI debug_level=3 min_version=tls13 max_version=tls13" \
|
||||
"$P_CLI debug_level=3" \
|
||||
0 \
|
||||
-c "tls13 client state: MBEDTLS_SSL_HELLO_REQUEST(0)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_HELLO(2)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_ENCRYPTED_EXTENSIONS(19)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CERTIFICATE_REQUEST(5)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_CERTIFICATE(3)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CERTIFICATE_VERIFY(9)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_FINISHED(13)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CLIENT_FINISHED(11)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_FLUSH_BUFFERS(14)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_HANDSHAKE_WRAPUP(15)" \
|
||||
-c "client state: MBEDTLS_SSL_HELLO_REQUEST" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_HELLO" \
|
||||
-c "client state: MBEDTLS_SSL_ENCRYPTED_EXTENSIONS" \
|
||||
-c "client state: MBEDTLS_SSL_CERTIFICATE_REQUEST" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_CERTIFICATE" \
|
||||
-c "client state: MBEDTLS_SSL_CERTIFICATE_VERIFY" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_FINISHED" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_FINISHED" \
|
||||
-c "client state: MBEDTLS_SSL_FLUSH_BUFFERS" \
|
||||
-c "client state: MBEDTLS_SSL_HANDSHAKE_WRAPUP" \
|
||||
-c "<= ssl_tls13_process_server_hello" \
|
||||
-c "server hello, chosen ciphersuite: ( 1301 ) - TLS1-3-AES-128-GCM-SHA256" \
|
||||
-c "ECDH curve: x25519" \
|
||||
-c "ECDH curve: x25519" \
|
||||
-c "=> ssl_tls13_process_server_hello" \
|
||||
-c "<= parse encrypted extensions" \
|
||||
-c "<= parse encrypted extensions" \
|
||||
-c "Certificate verification flags clear" \
|
||||
-c "=> parse certificate verify" \
|
||||
-c "<= parse certificate verify" \
|
||||
-c "=> parse certificate verify" \
|
||||
-c "<= parse certificate verify" \
|
||||
-c "mbedtls_ssl_tls13_process_certificate_verify() returned 0" \
|
||||
-c "<= parse finished message" \
|
||||
-c "Protocol is TLSv1.3" \
|
||||
|
@ -9688,27 +9667,27 @@ requires_config_enabled MBEDTLS_DEBUG_C
|
|||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3: minimal feature sets - gnutls" \
|
||||
"$G_NEXT_SRV --debug=4 --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:%NO_TICKETS --disable-client-cert" \
|
||||
"$P_CLI debug_level=3 min_version=tls13 max_version=tls13" \
|
||||
"$P_CLI debug_level=3" \
|
||||
0 \
|
||||
-s "SERVER HELLO was queued" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_HELLO_REQUEST(0)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_HELLO(2)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_ENCRYPTED_EXTENSIONS(19)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CERTIFICATE_REQUEST(5)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_CERTIFICATE(3)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CERTIFICATE_VERIFY(9)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_FINISHED(13)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CLIENT_FINISHED(11)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_FLUSH_BUFFERS(14)" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_HANDSHAKE_WRAPUP(15)" \
|
||||
-s "SERVER HELLO was queued" \
|
||||
-c "client state: MBEDTLS_SSL_HELLO_REQUEST" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_HELLO" \
|
||||
-c "client state: MBEDTLS_SSL_ENCRYPTED_EXTENSIONS" \
|
||||
-c "client state: MBEDTLS_SSL_CERTIFICATE_REQUEST" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_CERTIFICATE" \
|
||||
-c "client state: MBEDTLS_SSL_CERTIFICATE_VERIFY" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_FINISHED" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_FINISHED" \
|
||||
-c "client state: MBEDTLS_SSL_FLUSH_BUFFERS" \
|
||||
-c "client state: MBEDTLS_SSL_HANDSHAKE_WRAPUP" \
|
||||
-c "<= ssl_tls13_process_server_hello" \
|
||||
-c "server hello, chosen ciphersuite: ( 1301 ) - TLS1-3-AES-128-GCM-SHA256" \
|
||||
-c "ECDH curve: x25519" \
|
||||
-c "ECDH curve: x25519" \
|
||||
-c "=> ssl_tls13_process_server_hello" \
|
||||
-c "<= parse encrypted extensions" \
|
||||
-c "<= parse encrypted extensions" \
|
||||
-c "Certificate verification flags clear" \
|
||||
-c "=> parse certificate verify" \
|
||||
-c "<= parse certificate verify" \
|
||||
-c "=> parse certificate verify" \
|
||||
-c "<= parse certificate verify" \
|
||||
-c "mbedtls_ssl_tls13_process_certificate_verify() returned 0" \
|
||||
-c "<= parse finished message" \
|
||||
-c "Protocol is TLSv1.3" \
|
||||
|
@ -9723,28 +9702,29 @@ requires_config_enabled MBEDTLS_SSL_ALPN
|
|||
requires_config_disabled MBEDTLS_USE_PSA_CRYPTO
|
||||
run_test "TLS 1.3: alpn - openssl" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache -alpn h2" \
|
||||
"$P_CLI debug_level=3 min_version=tls13 max_version=tls13 alpn=h2" \
|
||||
"$P_CLI debug_level=3 alpn=h2" \
|
||||
0 \
|
||||
-c "tls13 client state: MBEDTLS_SSL_HELLO_REQUEST" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_HELLO" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_ENCRYPTED_EXTENSIONS" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CERTIFICATE_REQUEST" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_CERTIFICATE" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CERTIFICATE_VERIFY" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_FINISHED" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CLIENT_FINISHED" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_FLUSH_BUFFERS" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_HANDSHAKE_WRAPUP" \
|
||||
-c "client state: MBEDTLS_SSL_HELLO_REQUEST" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_HELLO" \
|
||||
-c "client state: MBEDTLS_SSL_ENCRYPTED_EXTENSIONS" \
|
||||
-c "client state: MBEDTLS_SSL_CERTIFICATE_REQUEST" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_CERTIFICATE" \
|
||||
-c "client state: MBEDTLS_SSL_CERTIFICATE_VERIFY" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_FINISHED" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_FINISHED" \
|
||||
-c "client state: MBEDTLS_SSL_FLUSH_BUFFERS" \
|
||||
-c "client state: MBEDTLS_SSL_HANDSHAKE_WRAPUP" \
|
||||
-c "<= ssl_tls13_process_server_hello" \
|
||||
-c "server hello, chosen ciphersuite: ( 1301 ) - TLS1-3-AES-128-GCM-SHA256" \
|
||||
-c "ECDH curve: x25519" \
|
||||
-c "ECDH curve: x25519" \
|
||||
-c "=> ssl_tls13_process_server_hello" \
|
||||
-c "<= parse encrypted extensions" \
|
||||
-c "<= parse encrypted extensions" \
|
||||
-c "Certificate verification flags clear" \
|
||||
-c "=> parse certificate verify" \
|
||||
-c "<= parse certificate verify" \
|
||||
-c "=> parse certificate verify" \
|
||||
-c "<= parse certificate verify" \
|
||||
-c "mbedtls_ssl_tls13_process_certificate_verify() returned 0" \
|
||||
-c "<= parse finished message" \
|
||||
-c "Protocol is TLSv1.3" \
|
||||
-c "HTTP/1.0 200 ok" \
|
||||
-c "Application Layer Protocol is h2"
|
||||
|
||||
|
@ -9758,29 +9738,30 @@ requires_config_enabled MBEDTLS_SSL_ALPN
|
|||
requires_config_disabled MBEDTLS_USE_PSA_CRYPTO
|
||||
run_test "TLS 1.3: alpn - gnutls" \
|
||||
"$G_NEXT_SRV --debug=4 --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:%NO_TICKETS --disable-client-cert --alpn=h2" \
|
||||
"$P_CLI debug_level=3 min_version=tls13 max_version=tls13 alpn=h2" \
|
||||
"$P_CLI debug_level=3 alpn=h2" \
|
||||
0 \
|
||||
-s "SERVER HELLO was queued" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_HELLO_REQUEST" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_HELLO" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_ENCRYPTED_EXTENSIONS" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CERTIFICATE_REQUEST" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_CERTIFICATE" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CERTIFICATE_VERIFY" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_SERVER_FINISHED" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CLIENT_FINISHED" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_FLUSH_BUFFERS" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_HANDSHAKE_WRAPUP" \
|
||||
-s "SERVER HELLO was queued" \
|
||||
-c "client state: MBEDTLS_SSL_HELLO_REQUEST" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_HELLO" \
|
||||
-c "client state: MBEDTLS_SSL_ENCRYPTED_EXTENSIONS" \
|
||||
-c "client state: MBEDTLS_SSL_CERTIFICATE_REQUEST" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_CERTIFICATE" \
|
||||
-c "client state: MBEDTLS_SSL_CERTIFICATE_VERIFY" \
|
||||
-c "client state: MBEDTLS_SSL_SERVER_FINISHED" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_FINISHED" \
|
||||
-c "client state: MBEDTLS_SSL_FLUSH_BUFFERS" \
|
||||
-c "client state: MBEDTLS_SSL_HANDSHAKE_WRAPUP" \
|
||||
-c "<= ssl_tls13_process_server_hello" \
|
||||
-c "server hello, chosen ciphersuite: ( 1301 ) - TLS1-3-AES-128-GCM-SHA256" \
|
||||
-c "ECDH curve: x25519" \
|
||||
-c "ECDH curve: x25519" \
|
||||
-c "=> ssl_tls13_process_server_hello" \
|
||||
-c "<= parse encrypted extensions" \
|
||||
-c "<= parse encrypted extensions" \
|
||||
-c "Certificate verification flags clear" \
|
||||
-c "=> parse certificate verify" \
|
||||
-c "<= parse certificate verify" \
|
||||
-c "=> parse certificate verify" \
|
||||
-c "<= parse certificate verify" \
|
||||
-c "mbedtls_ssl_tls13_process_certificate_verify() returned 0" \
|
||||
-c "<= parse finished message" \
|
||||
-c "Protocol is TLSv1.3" \
|
||||
-c "HTTP/1.0 200 OK" \
|
||||
-c "Application Layer Protocol is h2"
|
||||
|
||||
|
@ -9791,10 +9772,9 @@ skip_handshake_stage_check
|
|||
requires_gnutls_tls1_3
|
||||
run_test "TLS 1.3:Not supported version check:gnutls: srv max TLS 1.0" \
|
||||
"$G_NEXT_SRV --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0 -d 4" \
|
||||
"$P_CLI min_version=tls13 max_version=tls13 debug_level=4" \
|
||||
"$P_CLI debug_level=4" \
|
||||
1 \
|
||||
-s "Client's version: 3.3" \
|
||||
-c "is a fatal alert message (msg 40)" \
|
||||
-S "Version: TLS1.0" \
|
||||
-C "Protocol is TLSv1.0"
|
||||
|
||||
|
@ -9805,10 +9785,9 @@ skip_handshake_stage_check
|
|||
requires_gnutls_tls1_3
|
||||
run_test "TLS 1.3:Not supported version check:gnutls: srv max TLS 1.1" \
|
||||
"$G_NEXT_SRV --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.1 -d 4" \
|
||||
"$P_CLI min_version=tls13 max_version=tls13 debug_level=4" \
|
||||
"$P_CLI debug_level=4" \
|
||||
1 \
|
||||
-s "Client's version: 3.3" \
|
||||
-c "is a fatal alert message (msg 40)" \
|
||||
-S "Version: TLS1.1" \
|
||||
-C "Protocol is TLSv1.1"
|
||||
|
||||
|
@ -9819,7 +9798,7 @@ skip_handshake_stage_check
|
|||
requires_gnutls_tls1_3
|
||||
run_test "TLS 1.3:Not supported version check:gnutls: srv max TLS 1.2" \
|
||||
"$G_NEXT_SRV --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2 -d 4" \
|
||||
"$P_CLI min_version=tls13 max_version=tls13 debug_level=4" \
|
||||
"$P_CLI force_version=tls13 debug_level=4" \
|
||||
1 \
|
||||
-s "Client's version: 3.3" \
|
||||
-c "is a fatal alert message (msg 40)" \
|
||||
|
@ -9833,7 +9812,7 @@ skip_handshake_stage_check
|
|||
requires_openssl_next
|
||||
run_test "TLS 1.3:Not supported version check:openssl: srv max TLS 1.0" \
|
||||
"$O_NEXT_SRV -msg -tls1" \
|
||||
"$P_CLI min_version=tls13 max_version=tls13 debug_level=4" \
|
||||
"$P_CLI debug_level=4" \
|
||||
1 \
|
||||
-s "fatal protocol_version" \
|
||||
-c "is a fatal alert message (msg 70)" \
|
||||
|
@ -9847,7 +9826,7 @@ skip_handshake_stage_check
|
|||
requires_openssl_next
|
||||
run_test "TLS 1.3:Not supported version check:openssl: srv max TLS 1.1" \
|
||||
"$O_NEXT_SRV -msg -tls1_1" \
|
||||
"$P_CLI min_version=tls13 max_version=tls13 debug_level=4" \
|
||||
"$P_CLI debug_level=4" \
|
||||
1 \
|
||||
-s "fatal protocol_version" \
|
||||
-c "is a fatal alert message (msg 70)" \
|
||||
|
@ -9861,7 +9840,7 @@ skip_handshake_stage_check
|
|||
requires_openssl_next
|
||||
run_test "TLS 1.3:Not supported version check:openssl: srv max TLS 1.2" \
|
||||
"$O_NEXT_SRV -msg -tls1_2" \
|
||||
"$P_CLI min_version=tls13 max_version=tls13 debug_level=4" \
|
||||
"$P_CLI force_version=tls13 debug_level=4" \
|
||||
1 \
|
||||
-s "fatal protocol_version" \
|
||||
-c "is a fatal alert message (msg 70)" \
|
||||
|
@ -9875,8 +9854,7 @@ requires_config_enabled MBEDTLS_SSL_CLI_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, no client certificate - openssl" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache -verify 10" \
|
||||
"$P_CLI debug_level=4 force_version=tls13 crt_file=none \
|
||||
key_file=none" \
|
||||
"$P_CLI debug_level=4 crt_file=none key_file=none" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_CERTIFICATE" \
|
||||
|
@ -9892,8 +9870,7 @@ requires_config_enabled MBEDTLS_SSL_CLI_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, no client certificate - gnutls" \
|
||||
"$G_NEXT_SRV --debug=4 --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:%NO_TICKETS --verify-client-cert" \
|
||||
"$P_CLI debug_level=3 min_version=tls13 max_version=tls13 crt_file=none \
|
||||
key_file=none" \
|
||||
"$P_CLI debug_level=3 crt_file=none key_file=none" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_CERTIFICATE"\
|
||||
|
@ -9908,8 +9885,7 @@ requires_config_enabled MBEDTLS_DEBUG_C
|
|||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3: Client authentication, no server middlebox compat - openssl" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache -Verify 10 -no_middlebox" \
|
||||
"$P_CLI debug_level=4 force_version=tls13 crt_file=data_files/cli2.crt \
|
||||
key_file=data_files/cli2.key" \
|
||||
"$P_CLI debug_level=4 crt_file=data_files/cli2.crt key_file=data_files/cli2.key" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_CERTIFICATE" \
|
||||
|
@ -9923,7 +9899,7 @@ requires_config_enabled MBEDTLS_DEBUG_C
|
|||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3: Client authentication, no server middlebox compat - gnutls" \
|
||||
"$G_NEXT_SRV --debug=4 --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:%NO_TICKETS:%DISABLE_TLS13_COMPAT_MODE" \
|
||||
"$P_CLI debug_level=3 min_version=tls13 max_version=tls13 crt_file=data_files/cli2.crt \
|
||||
"$P_CLI debug_level=3 crt_file=data_files/cli2.crt \
|
||||
key_file=data_files/cli2.key" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -9938,7 +9914,7 @@ requires_config_enabled MBEDTLS_SSL_CLI_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, ecdsa_secp256r1_sha256 - openssl" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache -Verify 10" \
|
||||
"$P_CLI debug_level=4 force_version=tls13 crt_file=data_files/ecdsa_secp256r1.crt \
|
||||
"$P_CLI debug_level=4 crt_file=data_files/ecdsa_secp256r1.crt \
|
||||
key_file=data_files/ecdsa_secp256r1.key" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -9954,7 +9930,7 @@ requires_config_enabled MBEDTLS_SSL_CLI_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, ecdsa_secp256r1_sha256 - gnutls" \
|
||||
"$G_NEXT_SRV --debug=4 --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:%NO_TICKETS" \
|
||||
"$P_CLI debug_level=3 force_version=tls13 crt_file=data_files/ecdsa_secp256r1.crt \
|
||||
"$P_CLI debug_level=3 crt_file=data_files/ecdsa_secp256r1.crt \
|
||||
key_file=data_files/ecdsa_secp256r1.key" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -9969,7 +9945,7 @@ requires_config_enabled MBEDTLS_SSL_CLI_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, ecdsa_secp384r1_sha384 - openssl" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache -Verify 10" \
|
||||
"$P_CLI debug_level=4 force_version=tls13 crt_file=data_files/ecdsa_secp384r1.crt \
|
||||
"$P_CLI debug_level=4 crt_file=data_files/ecdsa_secp384r1.crt \
|
||||
key_file=data_files/ecdsa_secp384r1.key" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -9985,7 +9961,7 @@ requires_config_enabled MBEDTLS_SSL_CLI_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, ecdsa_secp384r1_sha384 - gnutls" \
|
||||
"$G_NEXT_SRV --debug=4 --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:%NO_TICKETS" \
|
||||
"$P_CLI debug_level=3 force_version=tls13 crt_file=data_files/ecdsa_secp384r1.crt \
|
||||
"$P_CLI debug_level=3 crt_file=data_files/ecdsa_secp384r1.crt \
|
||||
key_file=data_files/ecdsa_secp384r1.key" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -10000,7 +9976,7 @@ requires_config_enabled MBEDTLS_SSL_CLI_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, ecdsa_secp521r1_sha512 - openssl" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache -Verify 10" \
|
||||
"$P_CLI debug_level=4 force_version=tls13 crt_file=data_files/ecdsa_secp521r1.crt \
|
||||
"$P_CLI debug_level=4 crt_file=data_files/ecdsa_secp521r1.crt \
|
||||
key_file=data_files/ecdsa_secp521r1.key" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -10016,7 +9992,7 @@ requires_config_enabled MBEDTLS_SSL_CLI_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, ecdsa_secp521r1_sha512 - gnutls" \
|
||||
"$G_NEXT_SRV --debug=4 --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:%NO_TICKETS" \
|
||||
"$P_CLI debug_level=3 force_version=tls13 crt_file=data_files/ecdsa_secp521r1.crt \
|
||||
"$P_CLI debug_level=3 crt_file=data_files/ecdsa_secp521r1.crt \
|
||||
key_file=data_files/ecdsa_secp521r1.key" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -10032,7 +10008,7 @@ requires_config_enabled MBEDTLS_RSA_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, rsa_pss_rsae_sha256 - openssl" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache -Verify 10" \
|
||||
"$P_CLI debug_level=4 force_version=tls13 crt_file=data_files/cert_sha256.crt \
|
||||
"$P_CLI debug_level=4 crt_file=data_files/cert_sha256.crt \
|
||||
key_file=data_files/server1.key sig_algs=ecdsa_secp256r1_sha256,rsa_pss_rsae_sha256" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -10049,7 +10025,7 @@ requires_config_enabled MBEDTLS_RSA_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, rsa_pss_rsae_sha256 - gnutls" \
|
||||
"$G_NEXT_SRV --debug=4 --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:%NO_TICKETS" \
|
||||
"$P_CLI debug_level=3 force_version=tls13 crt_file=data_files/server2-sha256.crt \
|
||||
"$P_CLI debug_level=3 crt_file=data_files/server2-sha256.crt \
|
||||
key_file=data_files/server2.key sig_algs=ecdsa_secp256r1_sha256,rsa_pss_rsae_sha256" \
|
||||
0 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -10132,7 +10108,7 @@ requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
|||
run_test "TLS 1.3: Client authentication, client alg not in server list - openssl" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache -Verify 10
|
||||
-sigalgs ecdsa_secp256r1_sha256" \
|
||||
"$P_CLI debug_level=3 force_version=tls13 crt_file=data_files/ecdsa_secp521r1.crt \
|
||||
"$P_CLI debug_level=3 crt_file=data_files/ecdsa_secp521r1.crt \
|
||||
key_file=data_files/ecdsa_secp521r1.key sig_algs=ecdsa_secp256r1_sha256,ecdsa_secp521r1_sha512" \
|
||||
1 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -10150,7 +10126,7 @@ requires_config_enabled MBEDTLS_RSA_C
|
|||
requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
run_test "TLS 1.3: Client authentication, client alg not in server list - gnutls" \
|
||||
"$G_NEXT_SRV --debug=4 --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:-SIGN-ALL:+SIGN-ECDSA-SECP256R1-SHA256:%NO_TICKETS" \
|
||||
"$P_CLI debug_level=3 force_version=tls13 crt_file=data_files/ecdsa_secp521r1.crt \
|
||||
"$P_CLI debug_level=3 crt_file=data_files/ecdsa_secp521r1.crt \
|
||||
key_file=data_files/ecdsa_secp521r1.key sig_algs=ecdsa_secp256r1_sha256,ecdsa_secp521r1_sha512" \
|
||||
1 \
|
||||
-c "got a certificate request" \
|
||||
|
@ -10166,11 +10142,12 @@ requires_config_enabled MBEDTLS_SSL_CLI_C
|
|||
requires_openssl_tls1_3
|
||||
run_test "TLS 1.3: HelloRetryRequest check, ciphersuite TLS_AES_128_GCM_SHA256 - openssl" \
|
||||
"$O_NEXT_SRV -ciphersuites TLS_AES_128_GCM_SHA256 -sigalgs ecdsa_secp256r1_sha256 -groups P-256 -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache" \
|
||||
"$P_CLI debug_level=4 force_version=tls13" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "received HelloRetryRequest message" \
|
||||
-c "<= ssl_tls13_process_server_hello ( HelloRetryRequest )" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CLIENT_HELLO" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_HELLO" \
|
||||
-c "Protocol is TLSv1.3" \
|
||||
-c "HTTP/1.0 200 ok"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
|
@ -10180,11 +10157,12 @@ requires_config_enabled MBEDTLS_SSL_CLI_C
|
|||
requires_openssl_tls1_3
|
||||
run_test "TLS 1.3: HelloRetryRequest check, ciphersuite TLS_AES_256_GCM_SHA384 - openssl" \
|
||||
"$O_NEXT_SRV -ciphersuites TLS_AES_256_GCM_SHA384 -sigalgs ecdsa_secp256r1_sha256 -groups P-256 -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache" \
|
||||
"$P_CLI debug_level=4 force_version=tls13" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "received HelloRetryRequest message" \
|
||||
-c "<= ssl_tls13_process_server_hello ( HelloRetryRequest )" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CLIENT_HELLO" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_HELLO" \
|
||||
-c "Protocol is TLSv1.3" \
|
||||
-c "HTTP/1.0 200 ok"
|
||||
|
||||
requires_gnutls_tls1_3
|
||||
|
@ -10195,11 +10173,12 @@ requires_config_enabled MBEDTLS_DEBUG_C
|
|||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3: HelloRetryRequest check, ciphersuite TLS_AES_128_GCM_SHA256 - gnutls" \
|
||||
"$G_NEXT_SRV -d 4 --priority=NONE:+GROUP-SECP256R1:+AES-128-GCM:+SHA256:+AEAD:+SIGN-ECDSA-SECP256R1-SHA256:+VERS-TLS1.3:%NO_TICKETS --disable-client-cert" \
|
||||
"$P_CLI debug_level=4 force_version=tls13" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "received HelloRetryRequest message" \
|
||||
-c "<= ssl_tls13_process_server_hello ( HelloRetryRequest )" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CLIENT_HELLO" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_HELLO" \
|
||||
-c "Protocol is TLSv1.3" \
|
||||
-c "HTTP/1.0 200 OK"
|
||||
|
||||
requires_gnutls_tls1_3
|
||||
|
@ -10210,11 +10189,12 @@ requires_config_enabled MBEDTLS_DEBUG_C
|
|||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3: HelloRetryRequest check, ciphersuite TLS_AES_256_GCM_SHA384 - gnutls" \
|
||||
"$G_NEXT_SRV -d 4 --priority=NONE:+GROUP-SECP256R1:+AES-256-GCM:+SHA384:+AEAD:+SIGN-ECDSA-SECP256R1-SHA256:+VERS-TLS1.3:%NO_TICKETS --disable-client-cert" \
|
||||
"$P_CLI debug_level=4 force_version=tls13" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "received HelloRetryRequest message" \
|
||||
-c "<= ssl_tls13_process_server_hello ( HelloRetryRequest )" \
|
||||
-c "tls13 client state: MBEDTLS_SSL_CLIENT_HELLO" \
|
||||
-c "client state: MBEDTLS_SSL_CLIENT_HELLO" \
|
||||
-c "Protocol is TLSv1.3" \
|
||||
-c "HTTP/1.0 200 OK"
|
||||
|
||||
for i in opt-testcases/*.sh
|
||||
|
@ -10232,8 +10212,9 @@ requires_config_enabled MBEDTLS_DEBUG_C
|
|||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3 m->O both peers do not support middlebox compatibility" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -no_middlebox -num_tickets 0 -no_resume_ephemeral -no_cache" \
|
||||
"$P_CLI debug_level=3 min_version=tls13 max_version=tls13" \
|
||||
"$P_CLI debug_level=3" \
|
||||
0 \
|
||||
-c "Protocol is TLSv1.3" \
|
||||
-c "HTTP/1.0 200 ok"
|
||||
|
||||
requires_openssl_tls1_3
|
||||
|
@ -10243,7 +10224,7 @@ requires_config_enabled MBEDTLS_DEBUG_C
|
|||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3 m->O server with middlebox compat support, not client" \
|
||||
"$O_NEXT_SRV -msg -tls1_3 -num_tickets 0 -no_resume_ephemeral -no_cache" \
|
||||
"$P_CLI debug_level=3 min_version=tls13 max_version=tls13" \
|
||||
"$P_CLI debug_level=3" \
|
||||
1 \
|
||||
-c "ChangeCipherSpec invalid in TLS 1.3 without compatibility mode"
|
||||
|
||||
|
@ -10256,8 +10237,9 @@ requires_config_enabled MBEDTLS_DEBUG_C
|
|||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3 m->G both peers do not support middlebox compatibility" \
|
||||
"$G_NEXT_SRV --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:%NO_TICKETS:%DISABLE_TLS13_COMPAT_MODE --disable-client-cert" \
|
||||
"$P_CLI debug_level=3 min_version=tls13 max_version=tls13" \
|
||||
"$P_CLI debug_level=3" \
|
||||
0 \
|
||||
-c "Protocol is TLSv1.3" \
|
||||
-c "HTTP/1.0 200 OK"
|
||||
|
||||
requires_gnutls_tls1_3
|
||||
|
@ -10268,7 +10250,7 @@ requires_config_enabled MBEDTLS_DEBUG_C
|
|||
requires_config_enabled MBEDTLS_SSL_CLI_C
|
||||
run_test "TLS 1.3 m->G server with middlebox compat support, not client" \
|
||||
"$G_NEXT_SRV --priority=NORMAL:-VERS-ALL:+VERS-TLS1.3:+CIPHER-ALL:%NO_TICKETS --disable-client-cert" \
|
||||
"$P_CLI debug_level=3 min_version=tls13 max_version=tls13" \
|
||||
"$P_CLI debug_level=3" \
|
||||
1 \
|
||||
-c "ChangeCipherSpec invalid in TLS 1.3 without compatibility mode"
|
||||
|
||||
|
|
|
@ -3237,6 +3237,124 @@ conf_curve:
|
|||
Test configuration of groups for DHE through mbedtls_ssl_conf_groups()
|
||||
conf_group:
|
||||
|
||||
Version config: valid client TLS 1.2 only
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_STREAM:3:3:3:3:0
|
||||
|
||||
Version config: valid client DTLS 1.2 only
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:3:3:3:0
|
||||
|
||||
Version config: valid server TLS 1.2 only
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_STREAM:3:3:3:3:0
|
||||
|
||||
Version config: valid server DTLS 1.2 only
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:3:3:3:0
|
||||
|
||||
Version config: invalid client TLS 1.2 only
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_STREAM:3:3:3:3:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: invalid client DTLS 1.2 only
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:3:3:3:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: invalid server TLS 1.2 only
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_STREAM:3:3:3:3:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: invalid server DTLS 1.2 only
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:3:3:3:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: valid client TLS 1.3 only
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_STREAM:3:4:3:4:0
|
||||
|
||||
Version config: unsupported client DTLS 1.3 only
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:4:3:4:MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE
|
||||
|
||||
Version config: unsupported server TLS 1.3 only
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_STREAM:3:4:3:4:MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE
|
||||
|
||||
Version config: unsupported server DTLS 1.3 only
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:4:3:4:MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE
|
||||
|
||||
Version config: invalid client TLS 1.3 only
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_STREAM:3:4:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: invalid client DTLS 1.3 only
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:4:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: invalid server TLS 1.3 only
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_STREAM:3:4:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: invalid server DTLS 1.3 only
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:4:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: valid client hybrid TLS 1.2/3
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_STREAM:3:3:3:4:0
|
||||
|
||||
Version config: unsupported client hybrid DTLS 1.2/3
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:3:3:4:MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE
|
||||
|
||||
Version config: unsupported server hybrid TLS 1.2/3
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_STREAM:3:3:3:4:MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE
|
||||
|
||||
Version config: unsupported server hybrid DTLS 1.2/3
|
||||
depends_on:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:3:3:4:MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE
|
||||
|
||||
Version config: valid client hybrid TLS 1.2/3, no TLS 1.2
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_STREAM:3:3:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: unsupported client hybrid DTLS 1.2/3, no TLS 1.2
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:3:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: unsupported server hybrid TLS 1.2/3, no TLS 1.2
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_STREAM:3:3:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: unsupported server hybrid DTLS 1.2/3, no TLS 1.2
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_2
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:3:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: valid client hybrid TLS 1.2/3, no TLS 1.3
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_STREAM:3:3:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: unsupported client hybrid DTLS 1.2/3, no TLS 1.3
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:3:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: unsupported server hybrid TLS 1.2/3, no TLS 1.3
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_STREAM:3:3:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: unsupported server hybrid DTLS 1.2/3, no TLS 1.3
|
||||
depends_on:!MBEDTLS_SSL_PROTO_TLS1_3
|
||||
conf_version:MBEDTLS_SSL_IS_SERVER:MBEDTLS_SSL_TRANSPORT_DATAGRAM:3:3:3:4:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: invalid minimum version
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_STREAM:3:2:3:3:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Version config: invalid maximum version
|
||||
conf_version:MBEDTLS_SSL_IS_CLIENT:MBEDTLS_SSL_TRANSPORT_STREAM:3:4:3:5:MBEDTLS_ERR_SSL_BAD_CONFIG
|
||||
|
||||
Test accessor into timing_delay_context
|
||||
timing_final_delay_accessor
|
||||
|
||||
|
|
|
@ -4839,7 +4839,7 @@ void ssl_session_serialize_version_check( int corrupt_major,
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_ENTROPY_C:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:!MBEDTLS_SSL_PROTO_TLS1_3:MBEDTLS_PKCS1_V15:MBEDTLS_ENTROPY_C:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
void mbedtls_endpoint_sanity( int endpoint_type )
|
||||
{
|
||||
enum { BUFFSIZE = 1024 };
|
||||
|
@ -4862,7 +4862,7 @@ exit:
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_ENTROPY_C:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:!MBEDTLS_SSL_PROTO_TLS1_3:MBEDTLS_PKCS1_V15:MBEDTLS_ENTROPY_C:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
void move_handshake_to_state(int endpoint_type, int state, int need_pass)
|
||||
{
|
||||
enum { BUFFSIZE = 1024 };
|
||||
|
@ -4976,7 +4976,7 @@ void app_data( int mfl, int cli_msg_len, int srv_msg_len,
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:!MBEDTLS_SSL_PROTO_TLS1_3:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
void app_data_tls( int mfl, int cli_msg_len, int srv_msg_len,
|
||||
int expected_cli_fragments,
|
||||
int expected_srv_fragments )
|
||||
|
@ -4988,7 +4988,7 @@ void app_data_tls( int mfl, int cli_msg_len, int srv_msg_len,
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:!MBEDTLS_SSL_PROTO_TLS1_3:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
void app_data_dtls( int mfl, int cli_msg_len, int srv_msg_len,
|
||||
int expected_cli_fragments,
|
||||
int expected_srv_fragments )
|
||||
|
@ -5000,7 +5000,7 @@ void app_data_dtls( int mfl, int cli_msg_len, int srv_msg_len,
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_SSL_RENEGOTIATION:MBEDTLS_SSL_CONTEXT_SERIALIZATION:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:!MBEDTLS_SSL_PROTO_TLS1_3:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_SSL_RENEGOTIATION:MBEDTLS_SSL_CONTEXT_SERIALIZATION:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
void handshake_serialization( )
|
||||
{
|
||||
handshake_test_options options;
|
||||
|
@ -5014,7 +5014,7 @@ void handshake_serialization( )
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_DEBUG_C:MBEDTLS_SSL_MAX_FRAGMENT_LENGTH:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:!MBEDTLS_SSL_PROTO_TLS1_3:MBEDTLS_PKCS1_V15:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_DEBUG_C:MBEDTLS_SSL_MAX_FRAGMENT_LENGTH:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
void handshake_fragmentation( int mfl, int expected_srv_hs_fragmentation, int expected_cli_hs_fragmentation)
|
||||
{
|
||||
handshake_test_options options;
|
||||
|
@ -5050,7 +5050,7 @@ void handshake_fragmentation( int mfl, int expected_srv_hs_fragmentation, int ex
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_SSL_RENEGOTIATION:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:!MBEDTLS_SSL_PROTO_TLS1_3:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_SSL_RENEGOTIATION:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
void renegotiation( int legacy_renegotiation )
|
||||
{
|
||||
handshake_test_options options;
|
||||
|
@ -5066,7 +5066,7 @@ void renegotiation( int legacy_renegotiation )
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:!MBEDTLS_SSL_PROTO_TLS1_3:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
void resize_buffers( int mfl, int renegotiation, int legacy_renegotiation,
|
||||
int serialize, int dtls, char *cipher )
|
||||
{
|
||||
|
@ -5087,7 +5087,7 @@ void resize_buffers( int mfl, int renegotiation, int legacy_renegotiation,
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH:MBEDTLS_SSL_CONTEXT_SERIALIZATION:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:!MBEDTLS_SSL_PROTO_TLS1_3:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH:MBEDTLS_SSL_CONTEXT_SERIALIZATION:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
void resize_buffers_serialize_mfl( int mfl )
|
||||
{
|
||||
test_resize_buffers( mfl, 0, MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION, 1, 1,
|
||||
|
@ -5098,7 +5098,7 @@ void resize_buffers_serialize_mfl( int mfl )
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH:MBEDTLS_SSL_RENEGOTIATION:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:!MBEDTLS_SSL_PROTO_TLS1_3:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH:MBEDTLS_SSL_RENEGOTIATION:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
|
||||
void resize_buffers_renegotiate_mfl( int mfl, int legacy_renegotiation,
|
||||
char *cipher )
|
||||
{
|
||||
|
@ -5400,6 +5400,30 @@ exit:
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void conf_version( int endpoint, int transport,
|
||||
int min_version_major, int min_version_minor,
|
||||
int max_version_major, int max_version_minor,
|
||||
int expected_ssl_setup_result )
|
||||
{
|
||||
mbedtls_ssl_config conf;
|
||||
mbedtls_ssl_context ssl;
|
||||
|
||||
mbedtls_ssl_config_init( &conf );
|
||||
mbedtls_ssl_init( &ssl );
|
||||
|
||||
mbedtls_ssl_conf_endpoint( &conf, endpoint );
|
||||
mbedtls_ssl_conf_transport( &conf, transport );
|
||||
mbedtls_ssl_conf_min_version( &conf, min_version_major, min_version_minor );
|
||||
mbedtls_ssl_conf_max_version( &conf, max_version_major, max_version_minor );
|
||||
|
||||
TEST_ASSERT( mbedtls_ssl_setup( &ssl, &conf ) == expected_ssl_setup_result );
|
||||
|
||||
mbedtls_ssl_free( &ssl );
|
||||
mbedtls_ssl_config_free( &conf );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_ECP_C:!MBEDTLS_DEPRECATED_REMOVED:!MBEDTLS_DEPRECATED_WARNING:MBEDTLS_ECP_DP_SECP192R1_ENABLED:MBEDTLS_ECP_DP_SECP224R1_ENABLED:MBEDTLS_ECP_DP_SECP256R1_ENABLED */
|
||||
void conf_curve()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue