summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_lib.c
diff options
context:
space:
mode:
authorjsing <>2021-07-21 08:42:14 +0000
committerjsing <>2021-07-21 08:42:14 +0000
commit24017b25b6aa507cb8684a8f62c86469a7aa2c4d (patch)
treebae082e5c4f00caf24ddf7d2b8bb7f2636f17592 /src/lib/libssl/d1_lib.c
parent79b1c4fd5d0d72bf2e38130064b797ecc99c1cbe (diff)
downloadopenbsd-24017b25b6aa507cb8684a8f62c86469a7aa2c4d.tar.gz
openbsd-24017b25b6aa507cb8684a8f62c86469a7aa2c4d.tar.bz2
openbsd-24017b25b6aa507cb8684a8f62c86469a7aa2c4d.zip
Remove DTLS processed_rcds queue.
When DTLS handshake records are received from the next epoch, we will potentially queue them on the unprocessed_rcds queue - this is usually a Finished message that has been received without the ChangeCipherSuite (CCS) message (which may have been dropped or reordered). After the epoch increments (due to the CCS being received), the current code processes all records on the unprocessed queue and immediate queues them on the processed queue, which dtls1_get_record() then pulls from. This form of processing only adds more complexity and another queue. Instead, once the epoch increments, pull a single record from the unprocessed queue and process it, allowing the contents to be consumed by the caller. We repeat this process until the unprocessed queue is empty, at which point we go back to consuming messages from the wire. ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/d1_lib.c')
-rw-r--r--src/lib/libssl/d1_lib.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c
index 6d9959ff43..3db5629e23 100644
--- a/src/lib/libssl/d1_lib.c
+++ b/src/lib/libssl/d1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_lib.c,v 1.57 2021/07/01 17:53:39 jsing Exp $ */ 1/* $OpenBSD: d1_lib.c,v 1.58 2021/07/21 08:42:14 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -88,8 +88,6 @@ dtls1_new(SSL *s)
88 88
89 if ((s->d1->internal->unprocessed_rcds.q = pqueue_new()) == NULL) 89 if ((s->d1->internal->unprocessed_rcds.q = pqueue_new()) == NULL)
90 goto err; 90 goto err;
91 if ((s->d1->internal->processed_rcds.q = pqueue_new()) == NULL)
92 goto err;
93 if ((s->d1->internal->buffered_messages = pqueue_new()) == NULL) 91 if ((s->d1->internal->buffered_messages = pqueue_new()) == NULL)
94 goto err; 92 goto err;
95 if ((s->d1->sent_messages = pqueue_new()) == NULL) 93 if ((s->d1->sent_messages = pqueue_new()) == NULL)
@@ -143,7 +141,6 @@ static void
143dtls1_clear_queues(SSL *s) 141dtls1_clear_queues(SSL *s)
144{ 142{
145 dtls1_drain_records(D1I(s)->unprocessed_rcds.q); 143 dtls1_drain_records(D1I(s)->unprocessed_rcds.q);
146 dtls1_drain_records(D1I(s)->processed_rcds.q);
147 dtls1_drain_fragments(D1I(s)->buffered_messages); 144 dtls1_drain_fragments(D1I(s)->buffered_messages);
148 dtls1_drain_fragments(s->d1->sent_messages); 145 dtls1_drain_fragments(s->d1->sent_messages);
149 dtls1_drain_records(D1I(s)->buffered_app_data.q); 146 dtls1_drain_records(D1I(s)->buffered_app_data.q);
@@ -160,7 +157,6 @@ dtls1_free(SSL *s)
160 dtls1_clear_queues(s); 157 dtls1_clear_queues(s);
161 158
162 pqueue_free(D1I(s)->unprocessed_rcds.q); 159 pqueue_free(D1I(s)->unprocessed_rcds.q);
163 pqueue_free(D1I(s)->processed_rcds.q);
164 pqueue_free(D1I(s)->buffered_messages); 160 pqueue_free(D1I(s)->buffered_messages);
165 pqueue_free(s->d1->sent_messages); 161 pqueue_free(s->d1->sent_messages);
166 pqueue_free(D1I(s)->buffered_app_data.q); 162 pqueue_free(D1I(s)->buffered_app_data.q);
@@ -176,7 +172,6 @@ dtls1_clear(SSL *s)
176{ 172{
177 struct dtls1_state_internal_st *internal; 173 struct dtls1_state_internal_st *internal;
178 pqueue unprocessed_rcds; 174 pqueue unprocessed_rcds;
179 pqueue processed_rcds;
180 pqueue buffered_messages; 175 pqueue buffered_messages;
181 pqueue sent_messages; 176 pqueue sent_messages;
182 pqueue buffered_app_data; 177 pqueue buffered_app_data;
@@ -184,7 +179,6 @@ dtls1_clear(SSL *s)
184 179
185 if (s->d1) { 180 if (s->d1) {
186 unprocessed_rcds = D1I(s)->unprocessed_rcds.q; 181 unprocessed_rcds = D1I(s)->unprocessed_rcds.q;
187 processed_rcds = D1I(s)->processed_rcds.q;
188 buffered_messages = D1I(s)->buffered_messages; 182 buffered_messages = D1I(s)->buffered_messages;
189 sent_messages = s->d1->sent_messages; 183 sent_messages = s->d1->sent_messages;
190 buffered_app_data = D1I(s)->buffered_app_data.q; 184 buffered_app_data = D1I(s)->buffered_app_data.q;
@@ -200,7 +194,6 @@ dtls1_clear(SSL *s)
200 D1I(s)->r_epoch = 194 D1I(s)->r_epoch =
201 tls12_record_layer_initial_epoch(s->internal->rl); 195 tls12_record_layer_initial_epoch(s->internal->rl);
202 196
203 D1I(s)->processed_rcds.epoch = D1I(s)->r_epoch;
204 D1I(s)->unprocessed_rcds.epoch = D1I(s)->r_epoch + 1; 197 D1I(s)->unprocessed_rcds.epoch = D1I(s)->r_epoch + 1;
205 198
206 if (s->server) { 199 if (s->server) {
@@ -212,7 +205,6 @@ dtls1_clear(SSL *s)
212 } 205 }
213 206
214 D1I(s)->unprocessed_rcds.q = unprocessed_rcds; 207 D1I(s)->unprocessed_rcds.q = unprocessed_rcds;
215 D1I(s)->processed_rcds.q = processed_rcds;
216 D1I(s)->buffered_messages = buffered_messages; 208 D1I(s)->buffered_messages = buffered_messages;
217 s->d1->sent_messages = sent_messages; 209 s->d1->sent_messages = sent_messages;
218 D1I(s)->buffered_app_data.q = buffered_app_data; 210 D1I(s)->buffered_app_data.q = buffered_app_data;