ssl_client.c: Rename TLS 1.3 ClientHello writing functions
Rename TLS 1.3 ClientHello writing functions aiming to support TLS 1.2 as well. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
3d580bf4bd
commit
71c2332860
1 changed files with 17 additions and 17 deletions
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_ALPN)
|
#if defined(MBEDTLS_SSL_ALPN)
|
||||||
/*
|
/*
|
||||||
* ssl_tls13_write_alpn_ext()
|
* ssl_write_alpn_ext()
|
||||||
*
|
*
|
||||||
* Structure of the application_layer_protocol_negotiation extension in
|
* Structure of the application_layer_protocol_negotiation extension in
|
||||||
* ClientHello:
|
* ClientHello:
|
||||||
|
@ -50,10 +50,10 @@
|
||||||
* } ProtocolNameList;
|
* } ProtocolNameList;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int ssl_tls13_write_alpn_ext( mbedtls_ssl_context *ssl,
|
static int ssl_write_alpn_ext( mbedtls_ssl_context *ssl,
|
||||||
unsigned char *buf,
|
unsigned char *buf,
|
||||||
const unsigned char *end,
|
const unsigned char *end,
|
||||||
size_t *out_len )
|
size_t *out_len )
|
||||||
{
|
{
|
||||||
unsigned char *p = buf;
|
unsigned char *p = buf;
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ static int ssl_tls13_write_alpn_ext( mbedtls_ssl_context *ssl,
|
||||||
/* Write cipher_suites
|
/* Write cipher_suites
|
||||||
* CipherSuite cipher_suites<2..2^16-2>;
|
* CipherSuite cipher_suites<2..2^16-2>;
|
||||||
*/
|
*/
|
||||||
static int ssl_tls13_write_client_hello_cipher_suites(
|
static int ssl_write_client_hello_cipher_suites(
|
||||||
mbedtls_ssl_context *ssl,
|
mbedtls_ssl_context *ssl,
|
||||||
unsigned char *buf,
|
unsigned char *buf,
|
||||||
unsigned char *end,
|
unsigned char *end,
|
||||||
|
@ -185,10 +185,10 @@ static int ssl_tls13_write_client_hello_cipher_suites(
|
||||||
* Extension extensions<8..2^16-1>;
|
* Extension extensions<8..2^16-1>;
|
||||||
* } ClientHello;
|
* } ClientHello;
|
||||||
*/
|
*/
|
||||||
static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
|
static int ssl_write_client_hello_body( mbedtls_ssl_context *ssl,
|
||||||
unsigned char *buf,
|
unsigned char *buf,
|
||||||
unsigned char *end,
|
unsigned char *end,
|
||||||
size_t *out_len )
|
size_t *out_len )
|
||||||
{
|
{
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -250,7 +250,7 @@ static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
|
||||||
#endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
|
#endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
|
||||||
|
|
||||||
/* Write cipher_suites */
|
/* Write cipher_suites */
|
||||||
ret = ssl_tls13_write_client_hello_cipher_suites( ssl, p, end, &output_len );
|
ret = ssl_write_client_hello_cipher_suites( ssl, p, end, &output_len );
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
return( ret );
|
return( ret );
|
||||||
p += output_len;
|
p += output_len;
|
||||||
|
@ -285,7 +285,7 @@ static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_ALPN)
|
#if defined(MBEDTLS_SSL_ALPN)
|
||||||
ret = ssl_tls13_write_alpn_ext( ssl, p, end, &output_len );
|
ret = ssl_write_alpn_ext( ssl, p, end, &output_len );
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
return( ret );
|
return( ret );
|
||||||
p += output_len;
|
p += output_len;
|
||||||
|
@ -332,7 +332,7 @@ static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ssl_tls13_prepare_client_hello( mbedtls_ssl_context *ssl )
|
static int ssl_prepare_client_hello( mbedtls_ssl_context *ssl )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -383,15 +383,15 @@ int mbedtls_ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write client hello" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write client hello" ) );
|
||||||
|
|
||||||
MBEDTLS_SSL_PROC_CHK( ssl_tls13_prepare_client_hello( ssl ) );
|
MBEDTLS_SSL_PROC_CHK( ssl_prepare_client_hello( ssl ) );
|
||||||
|
|
||||||
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_start_handshake_msg(
|
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_start_handshake_msg(
|
||||||
ssl, MBEDTLS_SSL_HS_CLIENT_HELLO,
|
ssl, MBEDTLS_SSL_HS_CLIENT_HELLO,
|
||||||
&buf, &buf_len ) );
|
&buf, &buf_len ) );
|
||||||
|
|
||||||
MBEDTLS_SSL_PROC_CHK( ssl_tls13_write_client_hello_body( ssl, buf,
|
MBEDTLS_SSL_PROC_CHK( ssl_write_client_hello_body( ssl, buf,
|
||||||
buf + buf_len,
|
buf + buf_len,
|
||||||
&msg_len ) );
|
&msg_len ) );
|
||||||
|
|
||||||
mbedtls_ssl_add_hs_msg_to_checksum( ssl, MBEDTLS_SSL_HS_CLIENT_HELLO,
|
mbedtls_ssl_add_hs_msg_to_checksum( ssl, MBEDTLS_SSL_HS_CLIENT_HELLO,
|
||||||
buf, msg_len );
|
buf, msg_len );
|
||||||
|
|
Loading…
Reference in a new issue