Fix variable names in ssl_tls13_generic/client.c
Signed-off-by: Xiaofei Bai <xiaofei.bai@arm.com>
This commit is contained in:
parent
746f9481ea
commit
eef150418f
2 changed files with 44 additions and 44 deletions
|
@ -152,9 +152,9 @@ static int ssl_tls13_write_named_group_list_ecdhe( mbedtls_ssl_context *ssl,
|
|||
|
||||
for ( ; *group_list != 0; group_list++ )
|
||||
{
|
||||
const mbedtls_ecp_curve_info *info;
|
||||
info = mbedtls_ecp_curve_info_from_tls_id( *group_list );
|
||||
if( info == NULL )
|
||||
const mbedtls_ecp_curve_info *curve_info;
|
||||
curve_info = mbedtls_ecp_curve_info_from_tls_id( *group_list );
|
||||
if( curve_info == NULL )
|
||||
continue;
|
||||
|
||||
if( !mbedtls_ssl_tls13_named_group_is_ecdhe( *group_list ) )
|
||||
|
@ -165,7 +165,7 @@ static int ssl_tls13_write_named_group_list_ecdhe( mbedtls_ssl_context *ssl,
|
|||
p += 2;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "NamedGroup: %s ( %x )",
|
||||
info->name, *group_list ) );
|
||||
curve_info->name, *group_list ) );
|
||||
}
|
||||
|
||||
*olen = p - buf;
|
||||
|
@ -205,7 +205,7 @@ static int ssl_tls13_write_supported_groups_ext( mbedtls_ssl_context *ssl,
|
|||
size_t *olen )
|
||||
{
|
||||
unsigned char *p = buf ;
|
||||
unsigned char *named_group_list_ptr; /* Start of named_group_list */
|
||||
unsigned char *named_group_list; /* Start of named_group_list */
|
||||
size_t named_group_list_len; /* Length of named_group_list */
|
||||
size_t output_len = 0;
|
||||
int ret_ecdhe, ret_dhe;
|
||||
|
@ -225,7 +225,7 @@ static int ssl_tls13_write_supported_groups_ext( mbedtls_ssl_context *ssl,
|
|||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 6 );
|
||||
p += 6;
|
||||
|
||||
named_group_list_ptr = p;
|
||||
named_group_list = p;
|
||||
ret_ecdhe = ssl_tls13_write_named_group_list_ecdhe( ssl, p, end, &output_len );
|
||||
if( ret_ecdhe != 0 )
|
||||
{
|
||||
|
@ -248,7 +248,7 @@ static int ssl_tls13_write_supported_groups_ext( mbedtls_ssl_context *ssl,
|
|||
}
|
||||
|
||||
/* Length of named_group_list*/
|
||||
named_group_list_len = p - named_group_list_ptr;
|
||||
named_group_list_len = p - named_group_list;
|
||||
if( named_group_list_len == 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "No group available." ) );
|
||||
|
@ -327,9 +327,9 @@ static int ssl_tls13_get_default_group_id( mbedtls_ssl_context *ssl,
|
|||
|
||||
for ( ; *group_list != 0; group_list++ )
|
||||
{
|
||||
const mbedtls_ecp_curve_info *info;
|
||||
info = mbedtls_ecp_curve_info_from_tls_id( *group_list );
|
||||
if( info != NULL &&
|
||||
const mbedtls_ecp_curve_info *curve_info;
|
||||
curve_info = mbedtls_ecp_curve_info_from_tls_id( *group_list );
|
||||
if( curve_info != NULL &&
|
||||
mbedtls_ssl_tls13_named_group_is_ecdhe( *group_list ) )
|
||||
{
|
||||
*group_id = *group_list;
|
||||
|
@ -368,7 +368,7 @@ static int ssl_tls13_write_key_share_ext( mbedtls_ssl_context *ssl,
|
|||
size_t *olen )
|
||||
{
|
||||
unsigned char *p = buf;
|
||||
unsigned char *client_shares_ptr; /* Start of client_shares */
|
||||
unsigned char *client_shares; /* Start of client_shares */
|
||||
size_t client_shares_len; /* Length of client_shares */
|
||||
uint16_t group_id;
|
||||
int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;
|
||||
|
@ -405,12 +405,12 @@ static int ssl_tls13_write_key_share_ext( mbedtls_ssl_context *ssl,
|
|||
* type of KEM, and dispatch to the corresponding crypto. And
|
||||
* only one key share entry is allowed.
|
||||
*/
|
||||
client_shares_ptr = p;
|
||||
client_shares = p;
|
||||
#if defined(MBEDTLS_ECDH_C)
|
||||
if( mbedtls_ssl_tls13_named_group_is_ecdhe( group_id ) )
|
||||
{
|
||||
/* Pointer to group */
|
||||
unsigned char *group_ptr = p;
|
||||
unsigned char *group = p;
|
||||
/* Length of key_exchange */
|
||||
size_t key_exchange_len;
|
||||
|
||||
|
@ -428,9 +428,9 @@ static int ssl_tls13_write_key_share_ext( mbedtls_ssl_context *ssl,
|
|||
return( ret );
|
||||
|
||||
/* Write group */
|
||||
MBEDTLS_PUT_UINT16_BE( group_id, group_ptr, 0 );
|
||||
MBEDTLS_PUT_UINT16_BE( group_id, group, 0 );
|
||||
/* Write key_exchange_length */
|
||||
MBEDTLS_PUT_UINT16_BE( key_exchange_len, group_ptr, 2 );
|
||||
MBEDTLS_PUT_UINT16_BE( key_exchange_len, group, 2 );
|
||||
}
|
||||
else
|
||||
#endif /* MBEDTLS_ECDH_C */
|
||||
|
@ -442,7 +442,7 @@ static int ssl_tls13_write_key_share_ext( mbedtls_ssl_context *ssl,
|
|||
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
|
||||
|
||||
/* Length of client_shares */
|
||||
client_shares_len = p - client_shares_ptr;
|
||||
client_shares_len = p - client_shares;
|
||||
if( client_shares_len == 0)
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "No key share defined." ) );
|
||||
|
@ -604,7 +604,7 @@ static int ssl_tls13_write_client_hello_cipher_suites(
|
|||
{
|
||||
unsigned char *p = buf;
|
||||
const int *ciphersuite_list;
|
||||
unsigned char *cipher_suites_ptr; /* Start of the cipher_suites list */
|
||||
unsigned char *cipher_suites; /* Start of the cipher_suites list */
|
||||
size_t cipher_suites_len;
|
||||
|
||||
*olen = 0 ;
|
||||
|
@ -624,7 +624,7 @@ static int ssl_tls13_write_client_hello_cipher_suites(
|
|||
p += 2;
|
||||
|
||||
/* Write cipher_suites */
|
||||
cipher_suites_ptr = p;
|
||||
cipher_suites = p;
|
||||
for ( size_t i = 0; ciphersuite_list[i] != 0; i++ )
|
||||
{
|
||||
int cipher_suite = ciphersuite_list[i];
|
||||
|
@ -648,7 +648,7 @@ static int ssl_tls13_write_client_hello_cipher_suites(
|
|||
}
|
||||
|
||||
/* Write the cipher_suites length in number of bytes */
|
||||
cipher_suites_len = p - cipher_suites_ptr;
|
||||
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",
|
||||
|
@ -679,7 +679,7 @@ static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
|
|||
{
|
||||
|
||||
int ret;
|
||||
unsigned char *extensions_len_ptr; /* Pointer to extensions length */
|
||||
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*/
|
||||
|
||||
|
@ -749,7 +749,7 @@ static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
|
|||
|
||||
/* First write extensions, then the total length */
|
||||
MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 );
|
||||
extensions_len_ptr = p;
|
||||
p_extensions_len = p;
|
||||
p += 2;
|
||||
|
||||
/* Write supported_versions extension
|
||||
|
@ -809,11 +809,11 @@ static int ssl_tls13_write_client_hello_body( mbedtls_ssl_context *ssl,
|
|||
/* Add more extensions here */
|
||||
|
||||
/* Write the length of the list of extensions. */
|
||||
extensions_len = p - extensions_len_ptr - 2;
|
||||
MBEDTLS_PUT_UINT16_BE( extensions_len, extensions_len_ptr, 0 );
|
||||
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", extensions_len_ptr, extensions_len );
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "client hello extensions", p_extensions_len, extensions_len );
|
||||
|
||||
*olen = p - buf;
|
||||
return( 0 );
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
int mbedtls_ssl_tls13_fetch_handshake_msg( mbedtls_ssl_context *ssl,
|
||||
unsigned hs_type,
|
||||
unsigned char **buf,
|
||||
size_t *buflen )
|
||||
size_t *buf_len )
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -66,7 +66,7 @@ int mbedtls_ssl_tls13_fetch_handshake_msg( mbedtls_ssl_context *ssl,
|
|||
* ...
|
||||
*/
|
||||
*buf = ssl->in_msg + 4;
|
||||
*buflen = ssl->in_hslen - 4;
|
||||
*buf_len = ssl->in_hslen - 4;
|
||||
|
||||
cleanup:
|
||||
|
||||
|
@ -99,12 +99,12 @@ int mbedtls_ssl_tls13_finish_handshake_msg( mbedtls_ssl_context *ssl,
|
|||
size_t msg_len )
|
||||
{
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
size_t msg_len_with_header;
|
||||
size_t msg_with_header_len;
|
||||
((void) buf_len);
|
||||
|
||||
/* Add reserved 4 bytes for handshake header */
|
||||
msg_len_with_header = msg_len + 4;
|
||||
ssl->out_msglen = msg_len_with_header;
|
||||
msg_with_header_len = msg_len + 4;
|
||||
ssl->out_msglen = msg_with_header_len;
|
||||
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_write_handshake_msg_ext( ssl, 0 ) );
|
||||
|
||||
cleanup:
|
||||
|
@ -160,7 +160,7 @@ int mbedtls_ssl_tls13_write_sig_alg_ext( mbedtls_ssl_context *ssl,
|
|||
size_t *olen )
|
||||
{
|
||||
unsigned char *p = buf;
|
||||
unsigned char *supported_sig_alg_ptr; /* Start of supported_signature_algorithms */
|
||||
unsigned char *supported_sig_alg; /* Start of supported_signature_algorithms */
|
||||
size_t supported_sig_alg_len = 0; /* Length of supported_signature_algorithms */
|
||||
|
||||
*olen = 0;
|
||||
|
@ -188,7 +188,7 @@ int mbedtls_ssl_tls13_write_sig_alg_ext( mbedtls_ssl_context *ssl,
|
|||
/*
|
||||
* Write supported_signature_algorithms
|
||||
*/
|
||||
supported_sig_alg_ptr = p;
|
||||
supported_sig_alg = p;
|
||||
for( const uint16_t *sig_alg = ssl->conf->tls13_sig_algs;
|
||||
*sig_alg != MBEDTLS_TLS1_3_SIG_NONE; sig_alg++ )
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ int mbedtls_ssl_tls13_write_sig_alg_ext( mbedtls_ssl_context *ssl,
|
|||
}
|
||||
|
||||
/* Length of supported_signature_algorithms */
|
||||
supported_sig_alg_len = p - supported_sig_alg_ptr;
|
||||
supported_sig_alg_len = p - supported_sig_alg;
|
||||
if( supported_sig_alg_len == 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "No signature algorithms defined." ) );
|
||||
|
@ -1020,7 +1020,7 @@ int mbedtls_ssl_tls13_process_finished_message( mbedtls_ssl_context *ssl )
|
|||
{
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
unsigned char *buf;
|
||||
size_t buflen;
|
||||
size_t buf_len;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse finished message" ) );
|
||||
|
||||
|
@ -1029,10 +1029,10 @@ int mbedtls_ssl_tls13_process_finished_message( mbedtls_ssl_context *ssl )
|
|||
|
||||
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_tls13_fetch_handshake_msg( ssl,
|
||||
MBEDTLS_SSL_HS_FINISHED,
|
||||
&buf, &buflen ) );
|
||||
MBEDTLS_SSL_PROC_CHK( ssl_tls13_parse_finished_message( ssl, buf, buf + buflen ) );
|
||||
&buf, &buf_len ) );
|
||||
MBEDTLS_SSL_PROC_CHK( ssl_tls13_parse_finished_message( ssl, buf, buf + buf_len ) );
|
||||
mbedtls_ssl_tls13_add_hs_msg_to_checksum(
|
||||
ssl, MBEDTLS_SSL_HS_FINISHED, buf, buflen );
|
||||
ssl, MBEDTLS_SSL_HS_FINISHED, buf, buf_len );
|
||||
MBEDTLS_SSL_PROC_CHK( ssl_tls13_postprocess_finished_message( ssl ) );
|
||||
|
||||
cleanup:
|
||||
|
|
Loading…
Reference in a new issue