From 2eadc83a4acf23015d0374b9bbfa92f7b21a24d0 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Wed, 29 Apr 2026 14:57:29 +0000 Subject: 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@ --- src/lib/libssl/d1_both.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'src/lib') 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 @@ -/* $OpenBSD: d1_both.c,v 1.86 2026/04/29 14:55:21 jsing Exp $ */ +/* $OpenBSD: d1_both.c,v 1.87 2026/04/29 14:57:29 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -159,8 +159,6 @@ static const unsigned char bitmask_end_values[] = { static const unsigned int g_probable_mtu[] = {1500 - 28, 512 - 28, 256 - 28}; static unsigned int dtls1_guess_mtu(unsigned int curr_mtu); -static void dtls1_fix_message_header(SSL *s, unsigned long frag_off, - unsigned long frag_len); static int dtls1_write_message_header(const struct hm_header_st *msg_hdr, unsigned long frag_off, unsigned long frag_len, unsigned char *p); static long dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, @@ -276,15 +274,15 @@ dtls1_do_write(SSL *s, int type) len = s->init_num; } - dtls1_fix_message_header(s, frag_off, - len - DTLS1_HM_HEADER_LENGTH); + OPENSSL_assert(len >= DTLS1_HM_HEADER_LENGTH); + + s->d1->w_msg_hdr.frag_off = frag_off; + s->d1->w_msg_hdr.frag_len = len - DTLS1_HM_HEADER_LENGTH; if (!dtls1_write_message_header(&s->d1->w_msg_hdr, s->d1->w_msg_hdr.frag_off, s->d1->w_msg_hdr.frag_len, (unsigned char *)&s->init_buf->data[s->init_off])) return -1; - - OPENSSL_assert(len >= DTLS1_HM_HEADER_LENGTH); } ret = dtls1_write_bytes(s, type, @@ -1101,15 +1099,6 @@ dtls1_set_message_header_int(SSL *s, unsigned char mt, unsigned long len, msg_hdr->frag_len = frag_len; } -static void -dtls1_fix_message_header(SSL *s, unsigned long frag_off, unsigned long frag_len) -{ - struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr; - - msg_hdr->frag_off = frag_off; - msg_hdr->frag_len = frag_len; -} - static int dtls1_write_message_header(const struct hm_header_st *msg_hdr, unsigned long frag_off, unsigned long frag_len, unsigned char *p) -- cgit v1.2.3-55-g6feb