diff options
| author | jsing <> | 2026-04-29 14:57:29 +0000 |
|---|---|---|
| committer | jsing <> | 2026-04-29 14:57:29 +0000 |
| commit | 2eadc83a4acf23015d0374b9bbfa92f7b21a24d0 (patch) | |
| tree | 489de6ba4e305e0596fe9610a9487b816665d406 /src/lib | |
| parent | d8be18767d886bba95d5fb11a913fb86c47b0ed2 (diff) | |
| download | openbsd-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/lib')
| -rw-r--r-- | src/lib/libssl/d1_both.c | 21 |
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[] = { | |||
| 159 | static const unsigned int g_probable_mtu[] = {1500 - 28, 512 - 28, 256 - 28}; | 159 | static const unsigned int g_probable_mtu[] = {1500 - 28, 512 - 28, 256 - 28}; |
| 160 | 160 | ||
| 161 | static unsigned int dtls1_guess_mtu(unsigned int curr_mtu); | 161 | static unsigned int dtls1_guess_mtu(unsigned int curr_mtu); |
| 162 | static void dtls1_fix_message_header(SSL *s, unsigned long frag_off, | ||
| 163 | unsigned long frag_len); | ||
| 164 | static int dtls1_write_message_header(const struct hm_header_st *msg_hdr, | 162 | static 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); |
| 166 | static long dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, | 164 | 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) | |||
| 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 | ||
| 1104 | static void | ||
| 1105 | dtls1_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 | |||
| 1113 | static int | 1102 | static int |
| 1114 | dtls1_write_message_header(const struct hm_header_st *msg_hdr, | 1103 | dtls1_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) |
