From e99005f53b351b3c662664891d988adaa02c4d0b Mon Sep 17 00:00:00 2001 From: jsing <> Date: Tue, 19 Jan 2021 19:07:39 +0000 Subject: Add code to handle change of cipher state in the new TLSv1.2 record layer. This provides the basic framework for handling change of cipher state in the new TLSv1.2 record layer, creating new record protection. In the DTLS case we retain the previous write record protection and can switch back to it when retransmitting. This will allow the record layer to start owning sequence numbers and encryption/decryption state. ok inoguchi@ tb@ --- src/lib/libssl/d1_both.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/lib/libssl/d1_both.c') diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c index d6bf6dfd1b..8c4fec589f 100644 --- a/src/lib/libssl/d1_both.c +++ b/src/lib/libssl/d1_both.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_both.c,v 1.64 2021/01/19 18:51:08 jsing Exp $ */ +/* $OpenBSD: d1_both.c,v 1.65 2021/01/19 19:07:39 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -1055,9 +1055,8 @@ dtls1_retransmit_message(SSL *s, unsigned short seq, unsigned long frag_off, /* restore state in which the message was originally sent */ s->session = frag->msg_header.saved_retransmit_state.session; D1I(s)->w_epoch = frag->msg_header.saved_retransmit_state.epoch; - if (!tls12_record_layer_set_write_cipher_hash(s->internal->rl, - frag->msg_header.saved_retransmit_state.enc_write_ctx, - frag->msg_header.saved_retransmit_state.write_hash, 0)) + + if (!tls12_record_layer_use_write_epoch(s->internal->rl, D1I(s)->w_epoch)) return 0; if (frag->msg_header.saved_retransmit_state.epoch == @@ -1074,8 +1073,8 @@ dtls1_retransmit_message(SSL *s, unsigned short seq, unsigned long frag_off, /* restore current state */ s->session = saved_state.session; D1I(s)->w_epoch = saved_state.epoch; - if (!tls12_record_layer_set_write_cipher_hash(s->internal->rl, - s->internal->enc_write_ctx, s->internal->write_hash, 0)) + + if (!tls12_record_layer_use_write_epoch(s->internal->rl, D1I(s)->w_epoch)) return 0; if (frag->msg_header.saved_retransmit_state.epoch == -- cgit v1.2.3-55-g6feb