diff options
| author | jsing <> | 2026-06-06 15:24:26 +0000 |
|---|---|---|
| committer | jsing <> | 2026-06-06 15:24:26 +0000 |
| commit | 34bb3178dc6005cb170c6f002dfd49e503c94bf8 (patch) | |
| tree | f982a8a1b74e4fa1d9d89087ed58c156734b9b83 /src/lib/libssl | |
| parent | ea2a1c165f2ed603b827d3bc22b989c30325f200 (diff) | |
| download | openbsd-34bb3178dc6005cb170c6f002dfd49e503c94bf8.tar.gz openbsd-34bb3178dc6005cb170c6f002dfd49e503c94bf8.tar.bz2 openbsd-34bb3178dc6005cb170c6f002dfd49e503c94bf8.zip | |
Move DTLS change cipher spec handling to its own function.
When a TLSv1.2 change cipher spec message has been built, call a separate
function that can handle the DTLS specific processing rather than including
this in the TLS code.
ok kenjiro@ tb@
Diffstat (limited to 'src/lib/libssl')
| -rw-r--r-- | src/lib/libssl/d1_both.c | 15 | ||||
| -rw-r--r-- | src/lib/libssl/dtls_local.h | 3 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_clnt.c | 9 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_srvr.c | 9 |
4 files changed, 22 insertions, 14 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c index 0a0a80dad9..1e87d9e652 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.95 2026/06/06 15:22:25 jsing Exp $ */ | 1 | /* $OpenBSD: d1_both.c,v 1.96 2026/06/06 15:24:26 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. |
| @@ -1164,6 +1164,19 @@ dtls1_get_message_header(CBS *header, struct hm_header_st *msg_hdr) | |||
| 1164 | } | 1164 | } |
| 1165 | 1165 | ||
| 1166 | int | 1166 | int |
| 1167 | dtls12_ccs_built(SSL *s) | ||
| 1168 | { | ||
| 1169 | s->d1->handshake_write_seq = s->d1->next_handshake_write_seq; | ||
| 1170 | |||
| 1171 | dtls1_set_message_header_int(s, SSL3_MT_CCS, 0, | ||
| 1172 | s->d1->handshake_write_seq, 0, 0); | ||
| 1173 | |||
| 1174 | dtls1_buffer_message(s, 1); | ||
| 1175 | |||
| 1176 | return 1; | ||
| 1177 | } | ||
| 1178 | |||
| 1179 | int | ||
| 1167 | dtls12_handshake_msg_built(SSL *s) | 1180 | dtls12_handshake_msg_built(SSL *s) |
| 1168 | { | 1181 | { |
| 1169 | unsigned long len; | 1182 | unsigned long len; |
diff --git a/src/lib/libssl/dtls_local.h b/src/lib/libssl/dtls_local.h index 9da48d1739..9939928b38 100644 --- a/src/lib/libssl/dtls_local.h +++ b/src/lib/libssl/dtls_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dtls_local.h,v 1.7 2026/06/06 15:22:25 jsing Exp $ */ | 1 | /* $OpenBSD: dtls_local.h,v 1.8 2026/06/06 15:24:26 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. |
| @@ -222,6 +222,7 @@ long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg); | |||
| 222 | int dtls1_get_message(SSL *s, int st1, int stn, int mt, long max); | 222 | int dtls1_get_message(SSL *s, int st1, int stn, int mt, long max); |
| 223 | int dtls1_get_record(SSL *s); | 223 | int dtls1_get_record(SSL *s); |
| 224 | 224 | ||
| 225 | int dtls12_ccs_built(SSL *s); | ||
| 225 | int dtls12_handshake_msg_built(SSL *s); | 226 | int dtls12_handshake_msg_built(SSL *s); |
| 226 | __END_HIDDEN_DECLS | 227 | __END_HIDDEN_DECLS |
| 227 | 228 | ||
diff --git a/src/lib/libssl/ssl_clnt.c b/src/lib/libssl/ssl_clnt.c index b59ffa0eff..c7db7257b5 100644 --- a/src/lib/libssl/ssl_clnt.c +++ b/src/lib/libssl/ssl_clnt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_clnt.c,v 1.172 2026/05/31 14:34:44 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_clnt.c,v 1.173 2026/06/06 15:24:26 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -2258,11 +2258,8 @@ ssl3_send_client_change_cipher_spec(SSL *s) | |||
| 2258 | s->init_off = 0; | 2258 | s->init_off = 0; |
| 2259 | 2259 | ||
| 2260 | if (SSL_is_dtls(s)) { | 2260 | if (SSL_is_dtls(s)) { |
| 2261 | s->d1->handshake_write_seq = | 2261 | if (!dtls12_ccs_built(s)) |
| 2262 | s->d1->next_handshake_write_seq; | 2262 | goto err; |
| 2263 | dtls1_set_message_header_int(s, SSL3_MT_CCS, 0, | ||
| 2264 | s->d1->handshake_write_seq, 0, 0); | ||
| 2265 | dtls1_buffer_message(s, 1); | ||
| 2266 | } | 2263 | } |
| 2267 | 2264 | ||
| 2268 | s->s3->hs.state = SSL3_ST_CW_CHANGE_B; | 2265 | s->s3->hs.state = SSL3_ST_CW_CHANGE_B; |
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c index f9c4ef918a..73bdeacce0 100644 --- a/src/lib/libssl/ssl_srvr.c +++ b/src/lib/libssl/ssl_srvr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_srvr.c,v 1.169 2026/05/31 14:34:44 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_srvr.c,v 1.170 2026/06/06 15:24:26 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -2321,11 +2321,8 @@ ssl3_send_server_change_cipher_spec(SSL *s) | |||
| 2321 | s->init_off = 0; | 2321 | s->init_off = 0; |
| 2322 | 2322 | ||
| 2323 | if (SSL_is_dtls(s)) { | 2323 | if (SSL_is_dtls(s)) { |
| 2324 | s->d1->handshake_write_seq = | 2324 | if (!dtls12_ccs_built(s)) |
| 2325 | s->d1->next_handshake_write_seq; | 2325 | goto err; |
| 2326 | dtls1_set_message_header_int(s, SSL3_MT_CCS, 0, | ||
| 2327 | s->d1->handshake_write_seq, 0, 0); | ||
| 2328 | dtls1_buffer_message(s, 1); | ||
| 2329 | } | 2326 | } |
| 2330 | 2327 | ||
| 2331 | s->s3->hs.state = SSL3_ST_SW_CHANGE_B; | 2328 | s->s3->hs.state = SSL3_ST_SW_CHANGE_B; |
