diff options
Diffstat (limited to 'src/lib/libssl/tls12_record_layer.c')
-rw-r--r-- | src/lib/libssl/tls12_record_layer.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/libssl/tls12_record_layer.c b/src/lib/libssl/tls12_record_layer.c index b9a3320de8..652ca873a6 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.27 2021/05/05 10:05:27 jsing Exp $ */ | 1 | /* $OpenBSD: tls12_record_layer.c,v 1.28 2021/05/05 19:52:00 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -277,10 +277,10 @@ tls12_record_layer_set_version(struct tls12_record_layer *rl, uint16_t version) | |||
277 | rl->dtls = ((version >> 8) == DTLS1_VERSION_MAJOR); | 277 | rl->dtls = ((version >> 8) == DTLS1_VERSION_MAJOR); |
278 | } | 278 | } |
279 | 279 | ||
280 | void | 280 | uint16_t |
281 | tls12_record_layer_set_write_epoch(struct tls12_record_layer *rl, uint16_t epoch) | 281 | tls12_record_layer_write_epoch(struct tls12_record_layer *rl) |
282 | { | 282 | { |
283 | rl->write->epoch = epoch; | 283 | return rl->write->epoch; |
284 | } | 284 | } |
285 | 285 | ||
286 | int | 286 | int |
@@ -583,6 +583,10 @@ tls12_record_layer_change_write_cipher_state(struct tls12_record_layer *rl, | |||
583 | 583 | ||
584 | /* Write sequence number gets reset to zero. */ | 584 | /* Write sequence number gets reset to zero. */ |
585 | 585 | ||
586 | /* DTLS epoch is incremented and is permitted to wrap. */ | ||
587 | if (rl->dtls) | ||
588 | write_new->epoch = rl->write_current->epoch + 1; | ||
589 | |||
586 | if (!tls12_record_layer_change_cipher_state(rl, write_new, 1, | 590 | if (!tls12_record_layer_change_cipher_state(rl, write_new, 1, |
587 | mac_key, key, iv)) | 591 | mac_key, key, iv)) |
588 | goto err; | 592 | goto err; |