summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_both.c
diff options
context:
space:
mode:
authorjsing <>2026-06-06 15:22:25 +0000
committerjsing <>2026-06-06 15:22:25 +0000
commitea2a1c165f2ed603b827d3bc22b989c30325f200 (patch)
tree12c0bfba49e96fa8237ea6a14943c6be2807405a /src/lib/libssl/d1_both.c
parent8191edd9cf4fcae6a4e5e054326fdf2e620b353b (diff)
downloadopenbsd-ea2a1c165f2ed603b827d3bc22b989c30325f200.tar.gz
openbsd-ea2a1c165f2ed603b827d3bc22b989c30325f200.tar.bz2
openbsd-ea2a1c165f2ed603b827d3bc22b989c30325f200.zip
Move DTLS handshake message handling to its own function.
When a TLSv1.2 handshake message has been built, call a separate function that can handle the DTLS specific processing rather than including this in the TLS code. ok kenjiro@ tb@
Diffstat (limited to 'src/lib/libssl/d1_both.c')
-rw-r--r--src/lib/libssl/d1_both.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c
index 2af307f594..0a0a80dad9 100644
--- a/src/lib/libssl/d1_both.c
+++ b/src/lib/libssl/d1_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_both.c,v 1.94 2026/05/16 08:20:41 jsing Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.95 2026/06/06 15:22:25 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.
@@ -1162,3 +1162,28 @@ dtls1_get_message_header(CBS *header, struct hm_header_st *msg_hdr)
1162 1162
1163 return 1; 1163 return 1;
1164} 1164}
1165
1166int
1167dtls12_handshake_msg_built(SSL *s)
1168{
1169 unsigned long len;
1170 uint8_t msg_type;
1171 CBS cbs;
1172
1173 CBS_init(&cbs, s->init_buf->data, s->init_num);
1174 if (!CBS_get_u8(&cbs, &msg_type))
1175 return 0;
1176
1177 if (s->init_off != 0)
1178 return 0;
1179 if (s->init_num < DTLS1_HM_HEADER_LENGTH)
1180 return 0;
1181
1182 len = s->init_num - DTLS1_HM_HEADER_LENGTH;
1183
1184 dtls1_set_message_header(s, msg_type, len, 0, len);
1185
1186 dtls1_buffer_message(s, 0);
1187
1188 return 1;
1189}