mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-07 06:42:56 +03:00
Rename static functions in ssl_tls13_keys.c
As some static functions are only used inside ssl_tls13_keys.c, the prefix mbedtls_ should be removed. Furthermore, code format is also maintained to fix code style. Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
@@ -651,7 +651,7 @@ int mbedtls_ssl_tls13_derive_resumption_master_secret(
|
|||||||
* with states Initial -> Early -> Handshake -> Application, and
|
* with states Initial -> Early -> Handshake -> Application, and
|
||||||
* this function represents the Handshake -> Application transition.
|
* this function represents the Handshake -> Application transition.
|
||||||
*
|
*
|
||||||
* In the handshake stage, mbedtls_ssl_tls13_generate_application_keys()
|
* In the handshake stage, ssl_tls13_generate_application_keys()
|
||||||
* can be used to derive the handshake traffic keys.
|
* can be used to derive the handshake traffic keys.
|
||||||
*
|
*
|
||||||
* \param ssl The SSL context to operate on. This must be in key schedule
|
* \param ssl The SSL context to operate on. This must be in key schedule
|
||||||
@@ -661,7 +661,7 @@ int mbedtls_ssl_tls13_derive_resumption_master_secret(
|
|||||||
* \returns A negative error code on failure.
|
* \returns A negative error code on failure.
|
||||||
*/
|
*/
|
||||||
MBEDTLS_CHECK_RETURN_CRITICAL
|
MBEDTLS_CHECK_RETURN_CRITICAL
|
||||||
static int mbedtls_ssl_tls13_key_schedule_stage_application(mbedtls_ssl_context *ssl)
|
static int ssl_tls13_key_schedule_stage_application(mbedtls_ssl_context *ssl)
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
mbedtls_ssl_handshake_params *handshake = ssl->handshake;
|
mbedtls_ssl_handshake_params *handshake = ssl->handshake;
|
||||||
@@ -1302,13 +1302,13 @@ int mbedtls_ssl_tls13_key_schedule_stage_early(mbedtls_ssl_context *ssl)
|
|||||||
/**
|
/**
|
||||||
* \brief Compute TLS 1.3 handshake traffic keys.
|
* \brief Compute TLS 1.3 handshake traffic keys.
|
||||||
*
|
*
|
||||||
* mbedtls_ssl_tls13_generate_handshake_keys() generates keys necessary
|
* ssl_tls13_generate_handshake_keys() generates keys necessary for
|
||||||
* for protecting the handshake messages, as described in Section 7
|
* protecting the handshake messages, as described in Section 7 of
|
||||||
* of TLS 1.3.
|
* TLS 1.3.
|
||||||
*
|
*
|
||||||
* \param ssl The SSL context to operate on. This must be in
|
* \param ssl The SSL context to operate on. This must be in
|
||||||
* key schedule stage \c Handshake, see
|
* key schedule stage \c Handshake, see
|
||||||
* mbedtls_ssl_tls13_key_schedule_stage_handshake().
|
* ssl_tls13_key_schedule_stage_handshake().
|
||||||
* \param traffic_keys The address at which to store the handshake traffic key
|
* \param traffic_keys The address at which to store the handshake traffic key
|
||||||
* keys. This must be writable but may be uninitialized.
|
* keys. This must be writable but may be uninitialized.
|
||||||
*
|
*
|
||||||
@@ -1316,8 +1316,8 @@ int mbedtls_ssl_tls13_key_schedule_stage_early(mbedtls_ssl_context *ssl)
|
|||||||
* \returns A negative error code on failure.
|
* \returns A negative error code on failure.
|
||||||
*/
|
*/
|
||||||
MBEDTLS_CHECK_RETURN_CRITICAL
|
MBEDTLS_CHECK_RETURN_CRITICAL
|
||||||
static int mbedtls_ssl_tls13_generate_handshake_keys(mbedtls_ssl_context *ssl,
|
static int ssl_tls13_generate_handshake_keys(mbedtls_ssl_context *ssl,
|
||||||
mbedtls_ssl_key_set *traffic_keys)
|
mbedtls_ssl_key_set *traffic_keys)
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
mbedtls_md_type_t md_type;
|
mbedtls_md_type_t md_type;
|
||||||
@@ -1332,7 +1332,7 @@ static int mbedtls_ssl_tls13_generate_handshake_keys(mbedtls_ssl_context *ssl,
|
|||||||
const mbedtls_ssl_ciphersuite_t *ciphersuite_info = handshake->ciphersuite_info;
|
const mbedtls_ssl_ciphersuite_t *ciphersuite_info = handshake->ciphersuite_info;
|
||||||
mbedtls_ssl_tls13_handshake_secrets *tls13_hs_secrets = &handshake->tls13_hs_secrets;
|
mbedtls_ssl_tls13_handshake_secrets *tls13_hs_secrets = &handshake->tls13_hs_secrets;
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG(2, ("=> mbedtls_ssl_tls13_generate_handshake_keys"));
|
MBEDTLS_SSL_DEBUG_MSG(2, ("=> ssl_tls13_generate_handshake_keys"));
|
||||||
|
|
||||||
ret = ssl_tls13_get_cipher_key_info(ciphersuite_info, &key_len, &iv_len);
|
ret = ssl_tls13_get_cipher_key_info(ciphersuite_info, &key_len, &iv_len);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -1418,7 +1418,7 @@ static int mbedtls_ssl_tls13_generate_handshake_keys(mbedtls_ssl_context *ssl,
|
|||||||
traffic_keys->server_write_iv,
|
traffic_keys->server_write_iv,
|
||||||
traffic_keys->iv_len);
|
traffic_keys->iv_len);
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG(2, ("<= mbedtls_ssl_tls13_generate_handshake_keys"));
|
MBEDTLS_SSL_DEBUG_MSG(2, ("<= ssl_tls13_generate_handshake_keys"));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
@@ -1432,7 +1432,7 @@ exit:
|
|||||||
* with states Initial -> Early -> Handshake -> Application, and
|
* with states Initial -> Early -> Handshake -> Application, and
|
||||||
* this function represents the Early -> Handshake transition.
|
* this function represents the Early -> Handshake transition.
|
||||||
*
|
*
|
||||||
* In the handshake stage, mbedtls_ssl_tls13_generate_handshake_keys()
|
* In the handshake stage, ssl_tls13_generate_handshake_keys()
|
||||||
* can be used to derive the handshake traffic keys.
|
* can be used to derive the handshake traffic keys.
|
||||||
*
|
*
|
||||||
* \param ssl The SSL context to operate on. This must be in key schedule
|
* \param ssl The SSL context to operate on. This must be in key schedule
|
||||||
@@ -1442,7 +1442,7 @@ exit:
|
|||||||
* \returns A negative error code on failure.
|
* \returns A negative error code on failure.
|
||||||
*/
|
*/
|
||||||
MBEDTLS_CHECK_RETURN_CRITICAL
|
MBEDTLS_CHECK_RETURN_CRITICAL
|
||||||
static int mbedtls_ssl_tls13_key_schedule_stage_handshake(mbedtls_ssl_context *ssl)
|
static int ssl_tls13_key_schedule_stage_handshake(mbedtls_ssl_context *ssl)
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
mbedtls_ssl_handshake_params *handshake = ssl->handshake;
|
mbedtls_ssl_handshake_params *handshake = ssl->handshake;
|
||||||
@@ -1531,13 +1531,13 @@ cleanup:
|
|||||||
/**
|
/**
|
||||||
* \brief Compute TLS 1.3 application traffic keys.
|
* \brief Compute TLS 1.3 application traffic keys.
|
||||||
*
|
*
|
||||||
* mbedtls_ssl_tls13_generate_application_keys() generates application
|
* ssl_tls13_generate_application_keys() generates application traffic
|
||||||
* traffic keys, since any records following a 1-RTT Finished message
|
* keys, since any records following a 1-RTT Finished message MUST be
|
||||||
* MUST be encrypted under the application traffic key.
|
* encrypted under the application traffic key.
|
||||||
*
|
*
|
||||||
* \param ssl The SSL context to operate on. This must be in
|
* \param ssl The SSL context to operate on. This must be in
|
||||||
* key schedule stage \c Application, see
|
* key schedule stage \c Application, see
|
||||||
* mbedtls_ssl_tls13_key_schedule_stage_application().
|
* ssl_tls13_key_schedule_stage_application().
|
||||||
* \param traffic_keys The address at which to store the application traffic key
|
* \param traffic_keys The address at which to store the application traffic key
|
||||||
* keys. This must be writable but may be uninitialized.
|
* keys. This must be writable but may be uninitialized.
|
||||||
*
|
*
|
||||||
@@ -1545,7 +1545,7 @@ cleanup:
|
|||||||
* \returns A negative error code on failure.
|
* \returns A negative error code on failure.
|
||||||
*/
|
*/
|
||||||
MBEDTLS_CHECK_RETURN_CRITICAL
|
MBEDTLS_CHECK_RETURN_CRITICAL
|
||||||
static int mbedtls_ssl_tls13_generate_application_keys(
|
static int ssl_tls13_generate_application_keys(
|
||||||
mbedtls_ssl_context *ssl,
|
mbedtls_ssl_context *ssl,
|
||||||
mbedtls_ssl_key_set *traffic_keys)
|
mbedtls_ssl_key_set *traffic_keys)
|
||||||
{
|
{
|
||||||
@@ -1675,7 +1675,7 @@ int mbedtls_ssl_tls13_compute_handshake_transform(mbedtls_ssl_context *ssl)
|
|||||||
mbedtls_ssl_handshake_params *handshake = ssl->handshake;
|
mbedtls_ssl_handshake_params *handshake = ssl->handshake;
|
||||||
|
|
||||||
/* Compute handshake secret */
|
/* Compute handshake secret */
|
||||||
ret = mbedtls_ssl_tls13_key_schedule_stage_handshake(ssl);
|
ret = ssl_tls13_key_schedule_stage_handshake(ssl);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_ssl_tls13_derive_master_secret", ret);
|
MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_ssl_tls13_derive_master_secret", ret);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -1683,9 +1683,9 @@ int mbedtls_ssl_tls13_compute_handshake_transform(mbedtls_ssl_context *ssl)
|
|||||||
|
|
||||||
/* Next evolution in key schedule: Establish handshake secret and
|
/* Next evolution in key schedule: Establish handshake secret and
|
||||||
* key material. */
|
* key material. */
|
||||||
ret = mbedtls_ssl_tls13_generate_handshake_keys(ssl, &traffic_keys);
|
ret = ssl_tls13_generate_handshake_keys(ssl, &traffic_keys);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_ssl_tls13_generate_handshake_keys",
|
MBEDTLS_SSL_DEBUG_RET(1, "ssl_tls13_generate_handshake_keys",
|
||||||
ret);
|
ret);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -1765,17 +1765,17 @@ int mbedtls_ssl_tls13_compute_application_transform(mbedtls_ssl_context *ssl)
|
|||||||
mbedtls_ssl_key_set traffic_keys;
|
mbedtls_ssl_key_set traffic_keys;
|
||||||
mbedtls_ssl_transform *transform_application = NULL;
|
mbedtls_ssl_transform *transform_application = NULL;
|
||||||
|
|
||||||
ret = mbedtls_ssl_tls13_key_schedule_stage_application(ssl);
|
ret = ssl_tls13_key_schedule_stage_application(ssl);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
MBEDTLS_SSL_DEBUG_RET(1,
|
MBEDTLS_SSL_DEBUG_RET(1,
|
||||||
"mbedtls_ssl_tls13_key_schedule_stage_application", ret);
|
"ssl_tls13_key_schedule_stage_application", ret);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = mbedtls_ssl_tls13_generate_application_keys(ssl, &traffic_keys);
|
ret = ssl_tls13_generate_application_keys(ssl, &traffic_keys);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
MBEDTLS_SSL_DEBUG_RET(1,
|
MBEDTLS_SSL_DEBUG_RET(1,
|
||||||
"mbedtls_ssl_tls13_generate_application_keys", ret);
|
"ssl_tls13_generate_application_keys", ret);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user