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:
Ronald Cron 2022-02-18 17:29:39 +01:00
parent 3d580bf4bd
commit 71c2332860

View file

@ -38,7 +38,7 @@
#if defined(MBEDTLS_SSL_ALPN)
/*
* ssl_tls13_write_alpn_ext()
* ssl_write_alpn_ext()
*
* Structure of the application_layer_protocol_negotiation extension in
* ClientHello:
@ -50,7 +50,7 @@
* } 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,
const unsigned char *end,
size_t *out_len )
@ -109,7 +109,7 @@ static int ssl_tls13_write_alpn_ext( mbedtls_ssl_context *ssl,
/* Write cipher_suites
* 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,
unsigned char *buf,
unsigned char *end,
@ -185,7 +185,7 @@ static int ssl_tls13_write_client_hello_cipher_suites(
* Extension extensions<8..2^16-1>;
* } 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 *end,
size_t *out_len )
@ -250,7 +250,7 @@ static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
#endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
/* 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 )
return( ret );
p += output_len;
@ -285,7 +285,7 @@ static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
#endif
#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 )
return( ret );
p += output_len;
@ -332,7 +332,7 @@ static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
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;
@ -383,13 +383,13 @@ int mbedtls_ssl_write_client_hello( mbedtls_ssl_context *ssl )
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(
ssl, MBEDTLS_SSL_HS_CLIENT_HELLO,
&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,
&msg_len ) );