mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 16:55:40 +01:00
Introduce TLS 1.3 labels in a single place
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
This commit is contained in:
parent
1981cb2972
commit
e4435ea777
@ -28,30 +28,18 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#define LABEL( name, string ) \
|
||||
.name = string,
|
||||
|
||||
struct mbedtls_ssl_tls1_3_labels_struct const mbedtls_ssl_tls1_3_labels =
|
||||
{
|
||||
/* This seems to work in C, despite the string literal being one
|
||||
* character too long due to the 0-termination. */
|
||||
.finished = "finished",
|
||||
.resumption = "resumption",
|
||||
.traffic_upd = "traffic upd",
|
||||
.exporter = "exporter",
|
||||
.key = "key",
|
||||
.iv = "iv",
|
||||
.sn = "sn",
|
||||
.c_hs_traffic = "c hs traffic",
|
||||
.c_ap_traffic = "c ap traffic",
|
||||
.c_e_traffic = "c e traffic",
|
||||
.s_hs_traffic = "s hs traffic",
|
||||
.s_ap_traffic = "s ap traffic",
|
||||
.s_e_traffic = "s e traffic",
|
||||
.exp_master = "exp master",
|
||||
.res_master = "res master",
|
||||
.ext_binder = "ext binder",
|
||||
.res_binder = "res binder",
|
||||
.derived = "derived"
|
||||
MBEDTLS_SSL_TLS1_3_LABEL_LIST
|
||||
};
|
||||
|
||||
#undef LABEL
|
||||
|
||||
/*
|
||||
* This function creates a HkdfLabel structure used in the TLS 1.3 key schedule.
|
||||
*
|
||||
|
@ -20,25 +20,31 @@
|
||||
#define MBEDTLS_SSL_TLS1_3_KEYS_H
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL)
|
||||
#define MBEDTLS_SSL_TLS1_3_LABEL_LIST \
|
||||
const unsigned char finished [ sizeof("finished") - 1 ]; \
|
||||
const unsigned char resumption [ sizeof("resumption") - 1 ]; \
|
||||
const unsigned char traffic_upd [ sizeof("traffic upd") - 1 ]; \
|
||||
const unsigned char export [ sizeof("exporter") - 1 ]; \
|
||||
const unsigned char key [ sizeof("key") - 1 ]; \
|
||||
const unsigned char iv [ sizeof("iv") - 1 ]; \
|
||||
const unsigned char sn [ sizeof("sn") - 1 ]; \
|
||||
const unsigned char c_hs_traffic[ sizeof("c hs traffic") - 1 ]; \
|
||||
const unsigned char c_ap_traffic[ sizeof("c ap traffic") - 1 ]; \
|
||||
const unsigned char c_e_traffic [ sizeof("c e traffic") - 1 ]; \
|
||||
const unsigned char s_hs_traffic[ sizeof("s hs traffic") - 1 ]; \
|
||||
const unsigned char s_ap_traffic[ sizeof("s ap traffic") - 1 ]; \
|
||||
const unsigned char s_e_traffic [ sizeof("s e traffic") - 1 ]; \
|
||||
const unsigned char exp_master [ sizeof("exp master") - 1 ]; \
|
||||
const unsigned char res_master [ sizeof("res master") - 1 ]; \
|
||||
const unsigned char ext_binder [ sizeof("ext binder") - 1 ]; \
|
||||
const unsigned char res_binder [ sizeof("res binder") - 1 ]; \
|
||||
const unsigned char derived [ sizeof("derived") - 1 ]; \
|
||||
|
||||
/* This requires LABEL( name, string ) to be defined at the point of use.
|
||||
* See e.g. the definition of mbedtls_ssl_tls1_3_labels_union below. */
|
||||
#define MBEDTLS_SSL_TLS1_3_LABEL_LIST \
|
||||
LABEL( finished , "finished" ) \
|
||||
LABEL( resumption , "resumption" ) \
|
||||
LABEL( traffic_upd , "traffic upd" ) \
|
||||
LABEL( export , "exporter" ) \
|
||||
LABEL( key , "key" ) \
|
||||
LABEL( iv , "iv" ) \
|
||||
LABEL( sn , "sn" ) \
|
||||
LABEL( c_hs_traffic, "c hs traffic" ) \
|
||||
LABEL( c_ap_traffic, "c ap traffic" ) \
|
||||
LABEL( c_e_traffic , "c e traffic" ) \
|
||||
LABEL( s_hs_traffic, "s hs traffic" ) \
|
||||
LABEL( s_ap_traffic, "s ap traffic" ) \
|
||||
LABEL( s_e_traffic , "s e traffic" ) \
|
||||
LABEL( exp_master , "exp master" ) \
|
||||
LABEL( res_master , "res master" ) \
|
||||
LABEL( ext_binder , "ext binder" ) \
|
||||
LABEL( res_binder , "res binder" ) \
|
||||
LABEL( derived , "derived" )
|
||||
|
||||
#define LABEL( name, string ) \
|
||||
const unsigned char name [ sizeof(string) - 1 ];
|
||||
|
||||
union mbedtls_ssl_tls1_3_labels_union
|
||||
{
|
||||
@ -48,6 +54,8 @@ struct mbedtls_ssl_tls1_3_labels_struct
|
||||
{
|
||||
MBEDTLS_SSL_TLS1_3_LABEL_LIST
|
||||
};
|
||||
#undef LABEL
|
||||
|
||||
extern const struct mbedtls_ssl_tls1_3_labels_struct mbedtls_ssl_tls1_3_labels;
|
||||
|
||||
#define MBEDTLS_SSL_TLS1_3_LBL_WITH_LEN( LABEL ) \
|
||||
|
Loading…
Reference in New Issue
Block a user