10 #define TLS_MAX_WRITE_MAC_SECRET_LEN 32
11 #define TLS_MAX_WRITE_KEY_LEN 32
12 #define TLS_MAX_IV_LEN 16
13 #define TLS_MAX_KEY_BLOCK_LEN (2 * (TLS_MAX_WRITE_MAC_SECRET_LEN + \
14 TLS_MAX_WRITE_KEY_LEN + TLS_MAX_IV_LEN))
16 #define TLS_SEQ_NUM_LEN 8
17 #define TLS_RECORD_HEADER_LEN 5
21 TLS_CONTENT_TYPE_CHANGE_CIPHER_SPEC = 20,
22 TLS_CONTENT_TYPE_ALERT = 21,
23 TLS_CONTENT_TYPE_HANDSHAKE = 22,
24 TLS_CONTENT_TYPE_APPLICATION_DATA = 23
30 u8 write_mac_secret[TLS_MAX_WRITE_MAC_SECRET_LEN];
31 u8 read_mac_secret[TLS_MAX_WRITE_MAC_SECRET_LEN];
32 u8 write_key[TLS_MAX_WRITE_KEY_LEN];
33 u8 read_key[TLS_MAX_WRITE_KEY_LEN];
34 u8 write_iv[TLS_MAX_IV_LEN];
35 u8 read_iv[TLS_MAX_IV_LEN];
38 size_t key_material_len;
41 enum crypto_hash_alg hash_alg;
42 enum crypto_cipher_alg cipher_alg;
44 u8 write_seq_num[TLS_SEQ_NUM_LEN];
45 u8 read_seq_num[TLS_SEQ_NUM_LEN];
48 u16 write_cipher_suite;
49 u16 read_cipher_suite;
61 size_t buf_size,
const u8 *payload,
size_t payload_len,
64 const u8 *in_data,
size_t in_len,
65 u8 *out_data,
size_t *out_len, u8 *alert);
int tlsv1_record_change_read_cipher(struct tlsv1_record_layer *rl)
TLS record layer: Change read cipher.
Definition: tlsv1_record.c:105
Wrapper functions for crypto libraries.
int tlsv1_record_change_write_cipher(struct tlsv1_record_layer *rl)
TLS record layer: Change write cipher.
Definition: tlsv1_record.c:71
Definition: crypto_gnutls.c:185
int tlsv1_record_send(struct tlsv1_record_layer *rl, u8 content_type, u8 *buf, size_t buf_size, const u8 *payload, size_t payload_len, size_t *out_len)
TLS record layer: Send a message.
Definition: tlsv1_record.c:146
Definition: tlsv1_record.h:27
int tlsv1_record_receive(struct tlsv1_record_layer *rl, const u8 *in_data, size_t in_len, u8 *out_data, size_t *out_len, u8 *alert)
TLS record layer: Process a received message.
Definition: tlsv1_record.c:274
int tlsv1_record_set_cipher_suite(struct tlsv1_record_layer *rl, u16 cipher_suite)
TLS record layer: Set cipher suite.
Definition: tlsv1_record.c:26