diff options
| author | jsing <> | 2026-07-16 14:43:22 +0000 |
|---|---|---|
| committer | jsing <> | 2026-07-16 14:43:22 +0000 |
| commit | d07193bbcefc36f53030480770ace8ab82b18912 (patch) | |
| tree | b4e657703d4bda7aa71896f44a24bbe67800bc45 /src/lib | |
| parent | 8ae67bc076214ca24ed2b1e80df490ba9ec3126b (diff) | |
| download | openbsd-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/lib')
| -rw-r--r-- | src/lib/libssl/d1_both.c | 9 |
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) | |||
| 354 | static int | 354 | static int |
| 355 | dtls1_do_write_ccs(SSL *s) | 355 | dtls1_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; |
