mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Switch to the new code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@ -23,46 +23,44 @@
|
||||
* the point of use. See e.g. the definition of mbedtls_ssl_tls1_3_labels_union
|
||||
* below. */
|
||||
#define MBEDTLS_SSL_TLS1_3_LABEL_LIST \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( finished , "finished" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( resumption , "resumption" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( traffic_upd , "traffic upd" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( exporter , "exporter" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( key , "key" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( iv , "iv" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( c_hs_traffic, "c hs traffic" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( c_ap_traffic, "c ap traffic" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( c_e_traffic , "c e traffic" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( s_hs_traffic, "s hs traffic" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( s_ap_traffic, "s ap traffic" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( s_e_traffic , "s e traffic" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( e_exp_master, "e exp master" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( res_master , "res master" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( exp_master , "exp master" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( ext_binder , "ext binder" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( res_binder , "res binder" ) \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL( derived , "derived" )
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(finished, "finished") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(resumption, "resumption") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(traffic_upd, "traffic upd") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(exporter, "exporter") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(key, "key") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(iv, "iv") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(c_hs_traffic, "c hs traffic") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(c_ap_traffic, "c ap traffic") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(c_e_traffic, "c e traffic") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(s_hs_traffic, "s hs traffic") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(s_ap_traffic, "s ap traffic") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(s_e_traffic, "s e traffic") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(e_exp_master, "e exp master") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(res_master, "res master") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(exp_master, "exp master") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(ext_binder, "ext binder") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(res_binder, "res binder") \
|
||||
MBEDTLS_SSL_TLS1_3_LABEL(derived, "derived")
|
||||
|
||||
#define MBEDTLS_SSL_TLS1_3_LABEL( name, string ) \
|
||||
const unsigned char name [ sizeof(string) - 1 ];
|
||||
#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_tls1_3_labels_union {
|
||||
MBEDTLS_SSL_TLS1_3_LABEL_LIST
|
||||
};
|
||||
struct mbedtls_ssl_tls1_3_labels_struct
|
||||
{
|
||||
struct mbedtls_ssl_tls1_3_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;
|
||||
|
||||
#define MBEDTLS_SSL_TLS1_3_LBL_WITH_LEN( LABEL ) \
|
||||
#define MBEDTLS_SSL_TLS1_3_LBL_WITH_LEN(LABEL) \
|
||||
mbedtls_ssl_tls1_3_labels.LABEL, \
|
||||
sizeof(mbedtls_ssl_tls1_3_labels.LABEL)
|
||||
|
||||
#define MBEDTLS_SSL_TLS1_3_KEY_SCHEDULE_MAX_LABEL_LEN \
|
||||
sizeof( union mbedtls_ssl_tls1_3_labels_union )
|
||||
sizeof(union mbedtls_ssl_tls1_3_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
|
||||
@ -107,11 +105,11 @@ extern const struct mbedtls_ssl_tls1_3_labels_struct mbedtls_ssl_tls1_3_labels;
|
||||
*/
|
||||
|
||||
int mbedtls_ssl_tls1_3_hkdf_expand_label(
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *secret, size_t slen,
|
||||
const unsigned char *label, size_t llen,
|
||||
const unsigned char *ctx, size_t clen,
|
||||
unsigned char *buf, size_t blen );
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *secret, size_t slen,
|
||||
const unsigned char *label, size_t llen,
|
||||
const unsigned char *ctx, size_t clen,
|
||||
unsigned char *buf, size_t blen);
|
||||
|
||||
/**
|
||||
* \brief This function is part of the TLS 1.3 key schedule.
|
||||
@ -143,11 +141,11 @@ int mbedtls_ssl_tls1_3_hkdf_expand_label(
|
||||
*/
|
||||
|
||||
int mbedtls_ssl_tls1_3_make_traffic_keys(
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *client_secret,
|
||||
const unsigned char *server_secret,
|
||||
size_t slen, size_t key_len, size_t iv_len,
|
||||
mbedtls_ssl_key_set *keys );
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *client_secret,
|
||||
const unsigned char *server_secret,
|
||||
size_t slen, size_t key_len, size_t iv_len,
|
||||
mbedtls_ssl_key_set *keys);
|
||||
|
||||
|
||||
#define MBEDTLS_SSL_TLS1_3_CONTEXT_UNHASHED 0
|
||||
@ -191,12 +189,12 @@ int mbedtls_ssl_tls1_3_make_traffic_keys(
|
||||
* \returns A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_ssl_tls1_3_derive_secret(
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *secret, size_t slen,
|
||||
const unsigned char *label, size_t llen,
|
||||
const unsigned char *ctx, size_t clen,
|
||||
int ctx_hashed,
|
||||
unsigned char *dstbuf, size_t buflen );
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *secret, size_t slen,
|
||||
const unsigned char *label, size_t llen,
|
||||
const unsigned char *ctx, size_t clen,
|
||||
int ctx_hashed,
|
||||
unsigned char *dstbuf, size_t buflen);
|
||||
|
||||
/**
|
||||
* \brief Compute the next secret in the TLS 1.3 key schedule
|
||||
@ -266,9 +264,9 @@ int mbedtls_ssl_tls1_3_derive_secret(
|
||||
*/
|
||||
|
||||
int mbedtls_ssl_tls1_3_evolve_secret(
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *secret_old,
|
||||
const unsigned char *input, size_t input_len,
|
||||
unsigned char *secret_new );
|
||||
mbedtls_md_type_t hash_alg,
|
||||
const unsigned char *secret_old,
|
||||
const unsigned char *input, size_t input_len,
|
||||
unsigned char *secret_new);
|
||||
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_KEYS_H */
|
||||
|
Reference in New Issue
Block a user