Improve and align variable names for supported versions data

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2023-04-03 17:36:31 +02:00
parent 3bd2b02486
commit eff5673e09
4 changed files with 22 additions and 21 deletions

View file

@ -2055,11 +2055,12 @@ int mbedtls_ssl_tls13_fetch_handshake_msg(mbedtls_ssl_context *ssl,
* \param[in] ssl SSL context * \param[in] ssl SSL context
* \param[in] buf Address of the first byte of the extensions vector. * \param[in] buf Address of the first byte of the extensions vector.
* \param[in] end End of the buffer containing the list of extensions. * \param[in] end End of the buffer containing the list of extensions.
* \param[out] extension_data If the extension is present, address of its first * \param[out] supported_versions_data If the extension is present, address of
* byte of data, NULL otherwise. * its first byte of data, NULL otherwise.
* \param[out] extension_data_end If the extension is present, address of the * \param[out] supported_versions_data_end If the extension is present, address
* first byte immediately following the extension * of the first byte immediately
* data, NULL otherwise. * following the extension data, NULL
* otherwise.
* \return 0 if the list of extensions does not contain a supported_versions * \return 0 if the list of extensions does not contain a supported_versions
* extension. * extension.
* \return 1 if the list of extensions contains a supported_versions * \return 1 if the list of extensions contains a supported_versions
@ -2071,8 +2072,8 @@ MBEDTLS_CHECK_RETURN_CRITICAL
int mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts( int mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts(
mbedtls_ssl_context *ssl, mbedtls_ssl_context *ssl,
const unsigned char *buf, const unsigned char *end, const unsigned char *buf, const unsigned char *end,
const unsigned char **extension_data, const unsigned char **supported_versions_data,
const unsigned char **extension_data_end); const unsigned char **supported_versions_data_end);
/* /*
* Handler of TLS 1.3 server certificate message * Handler of TLS 1.3 server certificate message

View file

@ -1324,8 +1324,8 @@ static int ssl_tls13_is_supported_versions_ext_present(
{ {
const unsigned char *p = buf; const unsigned char *p = buf;
size_t legacy_session_id_echo_len; size_t legacy_session_id_echo_len;
const unsigned char *supported_versions_ext; const unsigned char *supported_versions_data;
const unsigned char *supported_versions_ext_end; const unsigned char *supported_versions_data_end;
/* /*
* Check there is enough data to access the legacy_session_id_echo vector * Check there is enough data to access the legacy_session_id_echo vector
@ -1349,7 +1349,7 @@ static int ssl_tls13_is_supported_versions_ext_present(
return mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts( return mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts(
ssl, p, end, ssl, p, end,
&supported_versions_ext, &supported_versions_ext_end); &supported_versions_data, &supported_versions_data_end);
} }
/* Returns a negative value on failure, and otherwise /* Returns a negative value on failure, and otherwise

View file

@ -89,15 +89,15 @@ cleanup:
int mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts( int mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts(
mbedtls_ssl_context *ssl, mbedtls_ssl_context *ssl,
const unsigned char *buf, const unsigned char *end, const unsigned char *buf, const unsigned char *end,
const unsigned char **extension_data, const unsigned char **supported_versions_data,
const unsigned char **extension_data_end) const unsigned char **supported_versions_data_end)
{ {
const unsigned char *p = buf; const unsigned char *p = buf;
size_t extensions_len; size_t extensions_len;
const unsigned char *extensions_end; const unsigned char *extensions_end;
*extension_data = NULL; *supported_versions_data = NULL;
*extension_data_end = NULL; *supported_versions_data_end = NULL;
/* Case of no extension */ /* Case of no extension */
if (p == end) { if (p == end) {
@ -131,8 +131,8 @@ int mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts(
MBEDTLS_SSL_CHK_BUF_READ_PTR(p, extensions_end, extension_data_len); MBEDTLS_SSL_CHK_BUF_READ_PTR(p, extensions_end, extension_data_len);
if (extension_type == MBEDTLS_TLS_EXT_SUPPORTED_VERSIONS) { if (extension_type == MBEDTLS_TLS_EXT_SUPPORTED_VERSIONS) {
*extension_data = p; *supported_versions_data = p;
*extension_data_end = p + extension_data_len; *supported_versions_data_end = p + extension_data_len;
return 1; return 1;
} }
p += extension_data_len; p += extension_data_len;

View file

@ -1255,8 +1255,8 @@ static int ssl_tls13_parse_client_hello(mbedtls_ssl_context *ssl,
const unsigned char *cipher_suites_end; const unsigned char *cipher_suites_end;
size_t extensions_len; size_t extensions_len;
const unsigned char *extensions_end; const unsigned char *extensions_end;
const unsigned char *supported_versions_ext; const unsigned char *supported_versions_data;
const unsigned char *supported_versions_ext_end; const unsigned char *supported_versions_data_end;
mbedtls_ssl_handshake_params *handshake = ssl->handshake; mbedtls_ssl_handshake_params *handshake = ssl->handshake;
int hrr_required = 0; int hrr_required = 0;
@ -1360,7 +1360,7 @@ static int ssl_tls13_parse_client_hello(mbedtls_ssl_context *ssl,
*/ */
ret = mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts( ret = mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts(
ssl, p + 2, end, ssl, p + 2, end,
&supported_versions_ext, &supported_versions_ext_end); &supported_versions_data, &supported_versions_data_end);
if (ret < 0) { if (ret < 0) {
MBEDTLS_SSL_DEBUG_RET(1, MBEDTLS_SSL_DEBUG_RET(1,
("mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts"), ret); ("mbedtls_ssl_tls13_is_supported_versions_ext_present_in_exts"), ret);
@ -1373,8 +1373,8 @@ static int ssl_tls13_parse_client_hello(mbedtls_ssl_context *ssl,
if (ret == 1) { if (ret == 1) {
ret = ssl_tls13_parse_supported_versions_ext(ssl, ret = ssl_tls13_parse_supported_versions_ext(ssl,
supported_versions_ext, supported_versions_data,
supported_versions_ext_end); supported_versions_data_end);
if (ret < 0) { if (ret < 0) {
MBEDTLS_SSL_DEBUG_RET(1, MBEDTLS_SSL_DEBUG_RET(1,
("ssl_tls13_parse_supported_versions_ext"), ret); ("ssl_tls13_parse_supported_versions_ext"), ret);