summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2026-04-29 14:57:29 +0000
committerjsing <>2026-04-29 14:57:29 +0000
commit2eadc83a4acf23015d0374b9bbfa92f7b21a24d0 (patch)
tree489de6ba4e305e0596fe9610a9487b816665d406 /src
parentd8be18767d886bba95d5fb11a913fb86c47b0ed2 (diff)
downloadopenbsd-2eadc83a4acf23015d0374b9bbfa92f7b21a24d0.tar.gz
openbsd-2eadc83a4acf23015d0374b9bbfa92f7b21a24d0.tar.bz2
openbsd-2eadc83a4acf23015d0374b9bbfa92f7b21a24d0.zip
Inline dtls1_fix_message_header().
This is only used in one place and it makes no sense to have it as a separate function. Furthermore, pull up an assertion so that we check before assigning frag_len. ok kenjiro@ tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/d1_both.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c
index 286e8bebde..61507a2194 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.86 2026/04/29 14:55:21 jsing Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.87 2026/04/29 14:57:29 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.
@@ -159,8 +159,6 @@ static const unsigned char bitmask_end_values[] = {
159static const unsigned int g_probable_mtu[] = {1500 - 28, 512 - 28, 256 - 28}; 159static const unsigned int g_probable_mtu[] = {1500 - 28, 512 - 28, 256 - 28};
160 160
161static unsigned int dtls1_guess_mtu(unsigned int curr_mtu); 161static unsigned int dtls1_guess_mtu(unsigned int curr_mtu);
162static void dtls1_fix_message_header(SSL *s, unsigned long frag_off,
163 unsigned long frag_len);
164static int dtls1_write_message_header(const struct hm_header_st *msg_hdr, 162static int dtls1_write_message_header(const struct hm_header_st *msg_hdr,
165 unsigned long frag_off, unsigned long frag_len, unsigned char *p); 163 unsigned long frag_off, unsigned long frag_len, unsigned char *p);
166static long dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, 164static long dtls1_get_message_fragment(SSL *s, int st1, int stn, long max,
@@ -276,15 +274,15 @@ dtls1_do_write(SSL *s, int type)
276 len = s->init_num; 274 len = s->init_num;
277 } 275 }
278 276
279 dtls1_fix_message_header(s, frag_off, 277 OPENSSL_assert(len >= DTLS1_HM_HEADER_LENGTH);
280 len - DTLS1_HM_HEADER_LENGTH); 278
279 s->d1->w_msg_hdr.frag_off = frag_off;
280 s->d1->w_msg_hdr.frag_len = len - DTLS1_HM_HEADER_LENGTH;
281 281
282 if (!dtls1_write_message_header(&s->d1->w_msg_hdr, 282 if (!dtls1_write_message_header(&s->d1->w_msg_hdr,
283 s->d1->w_msg_hdr.frag_off, s->d1->w_msg_hdr.frag_len, 283 s->d1->w_msg_hdr.frag_off, s->d1->w_msg_hdr.frag_len,
284 (unsigned char *)&s->init_buf->data[s->init_off])) 284 (unsigned char *)&s->init_buf->data[s->init_off]))
285 return -1; 285 return -1;
286
287 OPENSSL_assert(len >= DTLS1_HM_HEADER_LENGTH);
288 } 286 }
289 287
290 ret = dtls1_write_bytes(s, type, 288 ret = dtls1_write_bytes(s, type,
@@ -1101,15 +1099,6 @@ dtls1_set_message_header_int(SSL *s, unsigned char mt, unsigned long len,
1101 msg_hdr->frag_len = frag_len; 1099 msg_hdr->frag_len = frag_len;
1102} 1100}
1103 1101
1104static void
1105dtls1_fix_message_header(SSL *s, unsigned long frag_off, unsigned long frag_len)
1106{
1107 struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr;
1108
1109 msg_hdr->frag_off = frag_off;
1110 msg_hdr->frag_len = frag_len;
1111}
1112
1113static int 1102static int
1114dtls1_write_message_header(const struct hm_header_st *msg_hdr, 1103dtls1_write_message_header(const struct hm_header_st *msg_hdr,
1115 unsigned long frag_off, unsigned long frag_len, unsigned char *p) 1104 unsigned long frag_off, unsigned long frag_len, unsigned char *p)