mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Fix 1_3/13 usages in macros and function names
Signed-off-by: Xiaofei Bai <xiaofei.bai@arm.com>
This commit is contained in:
@ -20,7 +20,7 @@
|
||||
#define MBEDTLS_SSL_TLS1_3_KEYS_H
|
||||
|
||||
/* This requires MBEDTLS_SSL_TLS1_3_LABEL( idx, name, string ) to be defined at
|
||||
* the point of use. See e.g. the definition of mbedtls_ssl_tls1_3_labels_union
|
||||
* the point of use. See e.g. the definition of mbedtls_ssl_tls13_labels_union
|
||||
* below. */
|
||||
#define MBEDTLS_SSL_TLS1_3_LABEL_LIST \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( finished , "finished" ) \
|
||||
@ -47,27 +47,27 @@
|
||||
#define MBEDTLS_SSL_TLS1_3_LABEL( name, string ) \
|
||||
const unsigned char name [ sizeof(string) - 1 ];
|
||||
|
||||
union mbedtls_ssl_tls1_3_labels_union
|
||||
union mbedtls_ssl_tls13_labels_union
|
||||
{
|
||||
MBEDTLS_SSL_TLS1_3_LABEL_LIST
|
||||
};
|
||||
struct mbedtls_ssl_tls1_3_labels_struct
|
||||
struct mbedtls_ssl_tls13_labels_struct
|
||||
{
|
||||
MBEDTLS_SSL_TLS1_3_LABEL_LIST
|
||||
};
|
||||
#undef MBEDTLS_SSL_TLS1_3_LABEL
|
||||
|
||||
extern const struct mbedtls_ssl_tls1_3_labels_struct mbedtls_ssl_tls1_3_labels;
|
||||
extern const struct mbedtls_ssl_tls13_labels_struct mbedtls_ssl_tls13_labels;
|
||||
|
||||
#define MBEDTLS_SSL_TLS1_3_LBL_LEN( LABEL ) \
|
||||
sizeof(mbedtls_ssl_tls1_3_labels.LABEL)
|
||||
sizeof(mbedtls_ssl_tls13_labels.LABEL)
|
||||
|
||||
#define MBEDTLS_SSL_TLS1_3_LBL_WITH_LEN( LABEL ) \
|
||||
mbedtls_ssl_tls1_3_labels.LABEL, \
|
||||
mbedtls_ssl_tls13_labels.LABEL, \
|
||||
MBEDTLS_SSL_TLS1_3_LBL_LEN( LABEL )
|
||||
|
||||
#define MBEDTLS_SSL_TLS1_3_KEY_SCHEDULE_MAX_LABEL_LEN \
|
||||
sizeof( union mbedtls_ssl_tls1_3_labels_union )
|
||||
sizeof( union mbedtls_ssl_tls13_labels_union )
|
||||
|
||||
/* The maximum length of HKDF contexts used in the TLS 1.3 standard.
|
||||
* Since contexts are always hashes of message transcripts, this can
|
||||
@ -79,7 +79,7 @@ extern const struct mbedtls_ssl_tls1_3_labels_struct mbedtls_ssl_tls1_3_labels;
|
||||
* by HKDF-Expand-Label.
|
||||
*
|
||||
* Warning: If this ever needs to be increased, the implementation
|
||||
* ssl_tls1_3_hkdf_encode_label() in ssl_tls13_keys.c needs to be
|
||||
* ssl_tls13_hkdf_encode_label() in ssl_tls13_keys.c needs to be
|
||||
* adjusted since it currently assumes that HKDF key expansion
|
||||
* is never used with more than 255 Bytes of output. */
|
||||
#define MBEDTLS_SSL_TLS1_3_KEY_SCHEDULE_MAX_EXPANSION_LEN 255
|
||||
@ -111,7 +111,7 @@ extern const struct mbedtls_ssl_tls1_3_labels_struct mbedtls_ssl_tls1_3_labels;
|
||||
* \return A negative error code on failure.
|
||||
*/
|
||||
|
||||
int mbedtls_ssl_tls1_3_hkdf_expand_label(
|
||||
int mbedtls_ssl_tls13_hkdf_expand_label(
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *secret, size_t slen,
|
||||
const unsigned char *label, size_t llen,
|
||||
@ -147,7 +147,7 @@ int mbedtls_ssl_tls1_3_hkdf_expand_label(
|
||||
* \returns A negative error code on failure.
|
||||
*/
|
||||
|
||||
int mbedtls_ssl_tls1_3_make_traffic_keys(
|
||||
int mbedtls_ssl_tls13_make_traffic_keys(
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *client_secret,
|
||||
const unsigned char *server_secret,
|
||||
@ -195,7 +195,7 @@ int mbedtls_ssl_tls1_3_make_traffic_keys(
|
||||
* \returns \c 0 on success.
|
||||
* \returns A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_ssl_tls1_3_derive_secret(
|
||||
int mbedtls_ssl_tls13_derive_secret(
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *secret, size_t slen,
|
||||
const unsigned char *label, size_t llen,
|
||||
@ -206,7 +206,7 @@ int mbedtls_ssl_tls1_3_derive_secret(
|
||||
/**
|
||||
* \brief Derive TLS 1.3 early data key material from early secret.
|
||||
*
|
||||
* This is a small wrapper invoking mbedtls_ssl_tls1_3_derive_secret()
|
||||
* This is a small wrapper invoking mbedtls_ssl_tls13_derive_secret()
|
||||
* with the appropriate labels.
|
||||
*
|
||||
* <tt>
|
||||
@ -223,11 +223,11 @@ int mbedtls_ssl_tls1_3_derive_secret(
|
||||
*
|
||||
* \note To obtain the actual key and IV for the early data traffic,
|
||||
* the client secret derived by this function need to be
|
||||
* further processed by mbedtls_ssl_tls1_3_make_traffic_keys().
|
||||
* further processed by mbedtls_ssl_tls13_make_traffic_keys().
|
||||
*
|
||||
* \note The binder key, which is also generated from the early secret,
|
||||
* is omitted here. Its calculation is part of the separate routine
|
||||
* mbedtls_ssl_tls1_3_create_psk_binder().
|
||||
* mbedtls_ssl_tls13_create_psk_binder().
|
||||
*
|
||||
* \param md_type The hash algorithm associated with the PSK for which
|
||||
* early data key material is being derived.
|
||||
@ -245,16 +245,16 @@ int mbedtls_ssl_tls1_3_derive_secret(
|
||||
* \returns \c 0 on success.
|
||||
* \returns A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_ssl_tls1_3_derive_early_secrets(
|
||||
int mbedtls_ssl_tls13_derive_early_secrets(
|
||||
mbedtls_md_type_t md_type,
|
||||
unsigned char const *early_secret,
|
||||
unsigned char const *transcript, size_t transcript_len,
|
||||
mbedtls_ssl_tls1_3_early_secrets *derived );
|
||||
mbedtls_ssl_tls13_early_secrets *derived );
|
||||
|
||||
/**
|
||||
* \brief Derive TLS 1.3 handshake key material from the handshake secret.
|
||||
*
|
||||
* This is a small wrapper invoking mbedtls_ssl_tls1_3_derive_secret()
|
||||
* This is a small wrapper invoking mbedtls_ssl_tls13_derive_secret()
|
||||
* with the appropriate labels from the standard.
|
||||
*
|
||||
* <tt>
|
||||
@ -272,7 +272,7 @@ int mbedtls_ssl_tls1_3_derive_early_secrets(
|
||||
*
|
||||
* \note To obtain the actual key and IV for the encrypted handshake traffic,
|
||||
* the client and server secret derived by this function need to be
|
||||
* further processed by mbedtls_ssl_tls1_3_make_traffic_keys().
|
||||
* further processed by mbedtls_ssl_tls13_make_traffic_keys().
|
||||
*
|
||||
* \param md_type The hash algorithm associated with the ciphersuite
|
||||
* that's being used for the connection.
|
||||
@ -290,16 +290,16 @@ int mbedtls_ssl_tls1_3_derive_early_secrets(
|
||||
* \returns \c 0 on success.
|
||||
* \returns A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_ssl_tls1_3_derive_handshake_secrets(
|
||||
int mbedtls_ssl_tls13_derive_handshake_secrets(
|
||||
mbedtls_md_type_t md_type,
|
||||
unsigned char const *handshake_secret,
|
||||
unsigned char const *transcript, size_t transcript_len,
|
||||
mbedtls_ssl_tls1_3_handshake_secrets *derived );
|
||||
mbedtls_ssl_tls13_handshake_secrets *derived );
|
||||
|
||||
/**
|
||||
* \brief Derive TLS 1.3 application key material from the master secret.
|
||||
*
|
||||
* This is a small wrapper invoking mbedtls_ssl_tls1_3_derive_secret()
|
||||
* This is a small wrapper invoking mbedtls_ssl_tls13_derive_secret()
|
||||
* with the appropriate labels from the standard.
|
||||
*
|
||||
* <tt>
|
||||
@ -321,7 +321,7 @@ int mbedtls_ssl_tls1_3_derive_handshake_secrets(
|
||||
*
|
||||
* \note To obtain the actual key and IV for the (0-th) application traffic,
|
||||
* the client and server secret derived by this function need to be
|
||||
* further processed by mbedtls_ssl_tls1_3_make_traffic_keys().
|
||||
* further processed by mbedtls_ssl_tls13_make_traffic_keys().
|
||||
*
|
||||
* \param md_type The hash algorithm associated with the ciphersuite
|
||||
* that's being used for the connection.
|
||||
@ -340,16 +340,16 @@ int mbedtls_ssl_tls1_3_derive_handshake_secrets(
|
||||
* \returns \c 0 on success.
|
||||
* \returns A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_ssl_tls1_3_derive_application_secrets(
|
||||
int mbedtls_ssl_tls13_derive_application_secrets(
|
||||
mbedtls_md_type_t md_type,
|
||||
unsigned char const *master_secret,
|
||||
unsigned char const *transcript, size_t transcript_len,
|
||||
mbedtls_ssl_tls1_3_application_secrets *derived );
|
||||
mbedtls_ssl_tls13_application_secrets *derived );
|
||||
|
||||
/**
|
||||
* \brief Derive TLS 1.3 resumption master secret from the master secret.
|
||||
*
|
||||
* This is a small wrapper invoking mbedtls_ssl_tls1_3_derive_secret()
|
||||
* This is a small wrapper invoking mbedtls_ssl_tls13_derive_secret()
|
||||
* with the appropriate labels from the standard.
|
||||
*
|
||||
* \param md_type The hash algorithm used in the application for which
|
||||
@ -370,11 +370,11 @@ int mbedtls_ssl_tls1_3_derive_application_secrets(
|
||||
* \returns \c 0 on success.
|
||||
* \returns A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_ssl_tls1_3_derive_resumption_master_secret(
|
||||
int mbedtls_ssl_tls13_derive_resumption_master_secret(
|
||||
mbedtls_md_type_t md_type,
|
||||
unsigned char const *application_secret,
|
||||
unsigned char const *transcript, size_t transcript_len,
|
||||
mbedtls_ssl_tls1_3_application_secrets *derived );
|
||||
mbedtls_ssl_tls13_application_secrets *derived );
|
||||
|
||||
/**
|
||||
* \brief Compute the next secret in the TLS 1.3 key schedule
|
||||
@ -406,7 +406,7 @@ int mbedtls_ssl_tls1_3_derive_resumption_master_secret(
|
||||
*
|
||||
* Each of the three secrets in turn is the basis for further
|
||||
* key derivations, such as the derivation of traffic keys and IVs;
|
||||
* see e.g. mbedtls_ssl_tls1_3_make_traffic_keys().
|
||||
* see e.g. mbedtls_ssl_tls13_make_traffic_keys().
|
||||
*
|
||||
* This function implements one step in this evolution of secrets:
|
||||
*
|
||||
@ -443,7 +443,7 @@ int mbedtls_ssl_tls1_3_derive_resumption_master_secret(
|
||||
* \returns A negative error code on failure.
|
||||
*/
|
||||
|
||||
int mbedtls_ssl_tls1_3_evolve_secret(
|
||||
int mbedtls_ssl_tls13_evolve_secret(
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *secret_old,
|
||||
const unsigned char *input, size_t input_len,
|
||||
@ -475,7 +475,7 @@ int mbedtls_ssl_tls1_3_evolve_secret(
|
||||
* \returns \c 0 on success.
|
||||
* \returns A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_ssl_tls1_3_create_psk_binder( mbedtls_ssl_context *ssl,
|
||||
int mbedtls_ssl_tls13_create_psk_binder( mbedtls_ssl_context *ssl,
|
||||
const mbedtls_md_type_t md_type,
|
||||
unsigned char const *psk, size_t psk_len,
|
||||
int psk_type,
|
||||
@ -520,7 +520,7 @@ int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
|
||||
*
|
||||
* Early -> Handshake -> Application
|
||||
*
|
||||
* Small wrappers around mbedtls_ssl_tls1_3_evolve_secret().
|
||||
* Small wrappers around mbedtls_ssl_tls13_evolve_secret().
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -535,7 +535,7 @@ int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
|
||||
* \returns \c 0 on success.
|
||||
* \returns A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_ssl_tls1_3_key_schedule_stage_early( mbedtls_ssl_context *ssl );
|
||||
int mbedtls_ssl_tls13_key_schedule_stage_early( mbedtls_ssl_context *ssl );
|
||||
|
||||
/**
|
||||
* \brief Transition into handshake stage of TLS 1.3 key schedule.
|
||||
|
Reference in New Issue
Block a user