summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_lib.c
diff options
context:
space:
mode:
authorjsing <>2026-05-16 08:20:41 +0000
committerjsing <>2026-05-16 08:20:41 +0000
commit4aaf2a3333ff91e8329e1dddd19d905b9c523c02 (patch)
tree5809aca387325aef045e2152f28a8ac583810f9d /src/lib/libssl/d1_lib.c
parent62c0685f0e88cb58cba8344db87c9f6b6c25adc2 (diff)
downloadopenbsd-4aaf2a3333ff91e8329e1dddd19d905b9c523c02.tar.gz
openbsd-4aaf2a3333ff91e8329e1dddd19d905b9c523c02.tar.bz2
openbsd-4aaf2a3333ff91e8329e1dddd19d905b9c523c02.zip
Introduce and use dtls12_handshake_msg.
Add struct dtls12_handshake_msg and various related functions, which allow for the construction of DTLS handshake messages and associated fragments. Use this on the DTLS write path for sending handshake message fragments. This means that we no longer modify the init buffer, which also fixes a bug where the message callback is called with a corrupted handshake message when multiple fragments have been sent. We also now correctly track fragment offsets when sending a handshake message that results in multiple calls to dtls1_do_write_handshake_message(). This is the first step towards further untangling of the write path in the legacy TLS stack. ok kenjiro@ tb@
Diffstat (limited to 'src/lib/libssl/d1_lib.c')
-rw-r--r--src/lib/libssl/d1_lib.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c
index 69db8a0df4..fa546b381c 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.65 2024/07/23 14:40:53 jsing Exp $ */ 1/* $OpenBSD: d1_lib.c,v 1.66 2026/05/16 08:20:41 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.
@@ -179,6 +179,8 @@ dtls1_free(SSL *s)
179 pqueue_free(s->d1->sent_messages); 179 pqueue_free(s->d1->sent_messages);
180 pqueue_free(s->d1->buffered_app_data.q); 180 pqueue_free(s->d1->buffered_app_data.q);
181 181
182 dtls12_handshake_msg_free(s->d1->hs_msg);
183
182 freezero(s->d1, sizeof(*s->d1)); 184 freezero(s->d1, sizeof(*s->d1));
183 s->d1 = NULL; 185 s->d1 = NULL;
184} 186}
@@ -199,6 +201,9 @@ dtls1_clear(SSL *s)
199 buffered_app_data = s->d1->buffered_app_data.q; 201 buffered_app_data = s->d1->buffered_app_data.q;
200 mtu = s->d1->mtu; 202 mtu = s->d1->mtu;
201 203
204 dtls12_handshake_msg_free(s->d1->hs_msg);
205 s->d1->hs_msg = NULL;
206
202 dtls1_clear_queues(s); 207 dtls1_clear_queues(s);
203 208
204 memset(s->d1, 0, sizeof(*s->d1)); 209 memset(s->d1, 0, sizeof(*s->d1));