Fix compile and test issues

Signed-off-by: XiaokangQian <xiaokang.qian@arm.com>
This commit is contained in:
XiaokangQian 2022-02-17 09:41:26 +00:00
parent 5e4528cd12
commit a9c58419f2

View File

@ -22,7 +22,6 @@
#if defined(MBEDTLS_SSL_SRV_C) && defined(MBEDTLS_SSL_PROTO_TLS1_3) #if defined(MBEDTLS_SSL_SRV_C) && defined(MBEDTLS_SSL_PROTO_TLS1_3)
#include "mbedtls/debug.h" #include "mbedtls/debug.h"
#include "mbedtls/platform.h"
#include "ssl_misc.h" #include "ssl_misc.h"
#include "ssl_tls13_keys.h" #include "ssl_tls13_keys.h"
@ -33,7 +32,13 @@
#include "ecp_internal.h" #include "ecp_internal.h"
#endif /* MBEDTLS_ECP_C */ #endif /* MBEDTLS_ECP_C */
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) #if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdlib.h>
#define mbedtls_calloc calloc
#define mbedtls_free free
#endif /* MBEDTLS_PLATFORM_C */
/* From RFC 8446: /* From RFC 8446:
* struct { * struct {
@ -181,6 +186,7 @@ static int mbedtls_ssl_tls13_parse_supported_groups_ext(
} }
#endif /* MBEDTLS_ECDH_C || ( MBEDTLS_ECDSA_C */ #endif /* MBEDTLS_ECDH_C || ( MBEDTLS_ECDSA_C */
#if ( defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) )
/* TODO: Code for MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED missing */ /* TODO: Code for MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED missing */
/* /*
* ssl_tls13_parse_key_shares_ext() verifies whether the information in the * ssl_tls13_parse_key_shares_ext() verifies whether the information in the
@ -627,7 +633,7 @@ static int ssl_client_hello_parse( mbedtls_ssl_context *ssl,
/* /*
* For TLS 1.3 we are not using compression. * For TLS 1.3 we are not using compression.
*/ */
comp_len = buf[0]; comp_len = p[0];
p++; p++;
MBEDTLS_SSL_CHK_BUF_READ_PTR( p, end, comp_len ); MBEDTLS_SSL_CHK_BUF_READ_PTR( p, end, comp_len );
@ -635,7 +641,7 @@ static int ssl_client_hello_parse( mbedtls_ssl_context *ssl,
p, comp_len ); p, comp_len );
/* Determine whether we are indeed using null compression */ /* Determine whether we are indeed using null compression */
if( ( comp_len != 1 ) && ( p[1] == 0 ) ) if( ( comp_len != 1 ) && ( p[0] == 0 ) )
{ {
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad client hello message" ) ); MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
return( MBEDTLS_ERR_SSL_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_ILLEGAL_PARAMETER );