Merge branch 'development' into rfc9146_2
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
commit
d384b64dd2
346 changed files with 24509 additions and 10001 deletions
|
@ -21,13 +21,7 @@
|
|||
|
||||
#if defined(MBEDTLS_SSL_SRV_C) && defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
|
||||
#if defined(MBEDTLS_PLATFORM_C)
|
||||
#include "mbedtls/platform.h"
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#define mbedtls_calloc calloc
|
||||
#define mbedtls_free free
|
||||
#endif
|
||||
|
||||
#include "mbedtls/ssl.h"
|
||||
#include "ssl_misc.h"
|
||||
|
@ -36,6 +30,7 @@
|
|||
#include "mbedtls/platform_util.h"
|
||||
#include "constant_time_internal.h"
|
||||
#include "mbedtls/constant_time.h"
|
||||
#include "hash_info.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -710,11 +705,13 @@ static int ssl_pick_cert( mbedtls_ssl_context *ssl,
|
|||
#endif
|
||||
list = ssl->conf->key_cert;
|
||||
|
||||
int pk_alg_is_none = 0;
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
if( pk_alg == PSA_ALG_NONE )
|
||||
pk_alg_is_none = ( pk_alg == PSA_ALG_NONE );
|
||||
#else
|
||||
if( pk_alg == MBEDTLS_PK_NONE )
|
||||
pk_alg_is_none = ( pk_alg == MBEDTLS_PK_NONE );
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
if( pk_alg_is_none )
|
||||
return( 0 );
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "ciphersuite requires certificate" ) );
|
||||
|
@ -731,18 +728,21 @@ static int ssl_pick_cert( mbedtls_ssl_context *ssl,
|
|||
MBEDTLS_SSL_DEBUG_CRT( 3, "candidate certificate chain, certificate",
|
||||
cur->cert );
|
||||
|
||||
int key_type_matches = 0;
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
#if defined(MBEDTLS_SSL_ASYNC_PRIVATE)
|
||||
if( ( ssl->conf->f_async_sign_start == NULL &&
|
||||
ssl->conf->f_async_decrypt_start == NULL &&
|
||||
! mbedtls_pk_can_do_ext( cur->key, pk_alg, pk_usage ) ) ||
|
||||
! mbedtls_pk_can_do_ext( &cur->cert->pk, pk_alg, pk_usage ) )
|
||||
key_type_matches = ( ( ssl->conf->f_async_sign_start != NULL ||
|
||||
ssl->conf->f_async_decrypt_start != NULL ||
|
||||
mbedtls_pk_can_do_ext( cur->key, pk_alg, pk_usage ) ) &&
|
||||
mbedtls_pk_can_do_ext( &cur->cert->pk, pk_alg, pk_usage ) );
|
||||
#else
|
||||
if( ! mbedtls_pk_can_do_ext( cur->key, pk_alg, pk_usage ) )
|
||||
key_type_matches = (
|
||||
mbedtls_pk_can_do_ext( cur->key, pk_alg, pk_usage ) );
|
||||
#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
|
||||
#else
|
||||
if( ! mbedtls_pk_can_do( &cur->cert->pk, pk_alg ) )
|
||||
key_type_matches = mbedtls_pk_can_do( &cur->cert->pk, pk_alg );
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
if( !key_type_matches )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "certificate mismatch: key type" ) );
|
||||
continue;
|
||||
|
@ -919,6 +919,8 @@ static int ssl_parse_client_hello( mbedtls_ssl_context *ssl )
|
|||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse client hello" ) );
|
||||
|
||||
int renegotiating;
|
||||
|
||||
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
|
||||
read_record_header:
|
||||
#endif
|
||||
|
@ -927,9 +929,11 @@ read_record_header:
|
|||
* otherwise read it ourselves manually in order to support SSLv2
|
||||
* ClientHello, which doesn't use the same record layer format.
|
||||
*/
|
||||
renegotiating = 0;
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
if( ssl->renego_status == MBEDTLS_SSL_INITIAL_HANDSHAKE )
|
||||
renegotiating = ( ssl->renego_status != MBEDTLS_SSL_INITIAL_HANDSHAKE );
|
||||
#endif
|
||||
if( !renegotiating )
|
||||
{
|
||||
if( ( ret = mbedtls_ssl_fetch_input( ssl, 5 ) ) != 0 )
|
||||
{
|
||||
|
@ -3053,11 +3057,8 @@ curve_matching_done:
|
|||
|
||||
size_t dig_signed_len = ssl->out_msg + ssl->out_msglen - dig_signed;
|
||||
size_t hashlen = 0;
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
unsigned char hash[PSA_HASH_MAX_SIZE];
|
||||
#else
|
||||
unsigned char hash[MBEDTLS_MD_MAX_SIZE];
|
||||
#endif
|
||||
unsigned char hash[MBEDTLS_HASH_MAX_SIZE];
|
||||
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue