summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls12_record_layer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/tls12_record_layer.c')
-rw-r--r--src/lib/libssl/tls12_record_layer.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/libssl/tls12_record_layer.c b/src/lib/libssl/tls12_record_layer.c
index 481680d9cc..43edb6f0f5 100644
--- a/src/lib/libssl/tls12_record_layer.c
+++ b/src/lib/libssl/tls12_record_layer.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls12_record_layer.c,v 1.31 2021/06/14 14:22:52 jsing Exp $ */ 1/* $OpenBSD: tls12_record_layer.c,v 1.32 2021/06/19 16:52:47 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -161,6 +161,7 @@ tls12_record_protection_mac_len(struct tls12_record_protection *rp,
161 161
162struct tls12_record_layer { 162struct tls12_record_layer {
163 uint16_t version; 163 uint16_t version;
164 uint16_t initial_epoch;
164 int dtls; 165 int dtls;
165 166
166 uint8_t alert_desc; 167 uint8_t alert_desc;
@@ -283,6 +284,19 @@ tls12_record_layer_set_version(struct tls12_record_layer *rl, uint16_t version)
283 rl->dtls = ((version >> 8) == DTLS1_VERSION_MAJOR); 284 rl->dtls = ((version >> 8) == DTLS1_VERSION_MAJOR);
284} 285}
285 286
287void
288tls12_record_layer_set_initial_epoch(struct tls12_record_layer *rl,
289 uint16_t epoch)
290{
291 rl->initial_epoch = epoch;
292}
293
294uint16_t
295tls12_record_layer_initial_epoch(struct tls12_record_layer *rl)
296{
297 return rl->initial_epoch;
298}
299
286uint16_t 300uint16_t
287tls12_record_layer_write_epoch(struct tls12_record_layer *rl) 301tls12_record_layer_write_epoch(struct tls12_record_layer *rl)
288{ 302{
@@ -324,12 +338,14 @@ void
324tls12_record_layer_clear_read_state(struct tls12_record_layer *rl) 338tls12_record_layer_clear_read_state(struct tls12_record_layer *rl)
325{ 339{
326 tls12_record_protection_clear(rl->read); 340 tls12_record_protection_clear(rl->read);
341 rl->read->epoch = rl->initial_epoch;
327} 342}
328 343
329void 344void
330tls12_record_layer_clear_write_state(struct tls12_record_layer *rl) 345tls12_record_layer_clear_write_state(struct tls12_record_layer *rl)
331{ 346{
332 tls12_record_protection_clear(rl->write); 347 tls12_record_protection_clear(rl->write);
348 rl->write->epoch = rl->initial_epoch;
333 349
334 tls12_record_protection_free(rl->write_previous); 350 tls12_record_protection_free(rl->write_previous);
335 rl->write_previous = NULL; 351 rl->write_previous = NULL;