summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2026-07-16 14:43:22 +0000
committerjsing <>2026-07-16 14:43:22 +0000
commitd07193bbcefc36f53030480770ace8ab82b18912 (patch)
treeb4e657703d4bda7aa71896f44a24bbe67800bc45 /src
parent8ae67bc076214ca24ed2b1e80df490ba9ec3126b (diff)
downloadopenbsd-d07193bbcefc36f53030480770ace8ab82b18912.tar.gz
openbsd-d07193bbcefc36f53030480770ace8ab82b18912.tar.bz2
openbsd-d07193bbcefc36f53030480770ace8ab82b18912.zip
Make dtls1_do_write_ccs() self contained.
A ChangeCipherSpec message is always the same single byte. Make dtls1_do_write_ccs() know how to send this message, which avoids the use of buffers and needing to keep copies for retransmission. ok kenjiro@ tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/d1_both.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c
index 57390112c9..b57c8960c1 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.98 2026/07/16 14:37:21 jsing Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.99 2026/07/16 14:43:22 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.
@@ -354,18 +354,19 @@ dtls1_do_write_handshake_message(SSL *s)
354static int 354static int
355dtls1_do_write_ccs(SSL *s) 355dtls1_do_write_ccs(SSL *s)
356{ 356{
357 const uint8_t ccs[] = { SSL3_MT_CCS };
357 int ret; 358 int ret;
358 359
359 OPENSSL_assert(s->d1->mtu >= dtls1_min_mtu()); 360 OPENSSL_assert(s->d1->mtu >= dtls1_min_mtu());
360 361
361 if ((ret = dtls1_write_bytes(s, SSL3_RT_CHANGE_CIPHER_SPEC, 362 if ((ret = dtls1_write_bytes(s, SSL3_RT_CHANGE_CIPHER_SPEC,
362 &s->init_buf->data[s->init_off], s->init_num)) < 0) 363 ccs, sizeof(ccs))) < 0)
363 return -1; 364 return -1;
364 365
365 OPENSSL_assert(s->init_num == ret); 366 OPENSSL_assert(sizeof(ccs) == ret);
366 367
367 ssl_msg_callback(s, 1, SSL3_RT_CHANGE_CIPHER_SPEC, 368 ssl_msg_callback(s, 1, SSL3_RT_CHANGE_CIPHER_SPEC,
368 s->init_buf->data, s->init_num); 369 ccs, sizeof(ccs));
369 370
370 s->init_off = 0; 371 s->init_off = 0;
371 s->init_num = 0; 372 s->init_num = 0;