summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_clnt.c
diff options
context:
space:
mode:
authorjsing <>2017-01-23 13:36:13 +0000
committerjsing <>2017-01-23 13:36:13 +0000
commit0eff443f2ac1ae9043870f2d40d9dc0d57f236d6 (patch)
tree84ee9c4c985fe1078df40f818b7697846dba1c18 /src/lib/libssl/d1_clnt.c
parent76088a8d37b68292f56046a6a4dea9544ad5ab89 (diff)
downloadopenbsd-0eff443f2ac1ae9043870f2d40d9dc0d57f236d6.tar.gz
openbsd-0eff443f2ac1ae9043870f2d40d9dc0d57f236d6.tar.bz2
openbsd-0eff443f2ac1ae9043870f2d40d9dc0d57f236d6.zip
Split most of SSL_METHOD out into an internal variant, which is opaque.
Discussed with beck@
Diffstat (limited to 'src/lib/libssl/d1_clnt.c')
-rw-r--r--src/lib/libssl/d1_clnt.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/lib/libssl/d1_clnt.c b/src/lib/libssl/d1_clnt.c
index 503a1f7fc6..6b5510c1e3 100644
--- a/src/lib/libssl/d1_clnt.c
+++ b/src/lib/libssl/d1_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_clnt.c,v 1.68 2017/01/23 10:22:06 jsing Exp $ */ 1/* $OpenBSD: d1_clnt.c,v 1.69 2017/01/23 13:36:13 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.
@@ -130,7 +130,7 @@
130static const SSL_METHOD *dtls1_get_client_method(int ver); 130static const SSL_METHOD *dtls1_get_client_method(int ver);
131static int dtls1_get_hello_verify(SSL *s); 131static int dtls1_get_hello_verify(SSL *s);
132 132
133static const SSL_METHOD DTLSv1_client_method_data = { 133static const SSL_METHOD_INTERNAL DTLSv1_client_method_internal_data = {
134 .version = DTLS1_VERSION, 134 .version = DTLS1_VERSION,
135 .min_version = DTLS1_VERSION, 135 .min_version = DTLS1_VERSION,
136 .max_version = DTLS1_VERSION, 136 .max_version = DTLS1_VERSION,
@@ -143,21 +143,25 @@ static const SSL_METHOD DTLSv1_client_method_data = {
143 .ssl_peek = ssl3_peek, 143 .ssl_peek = ssl3_peek,
144 .ssl_write = ssl3_write, 144 .ssl_write = ssl3_write,
145 .ssl_shutdown = dtls1_shutdown, 145 .ssl_shutdown = dtls1_shutdown,
146 .ssl_pending = ssl3_pending,
147 .get_ssl_method = dtls1_get_client_method,
148 .get_timeout = dtls1_default_timeout,
149 .ssl_version = ssl_undefined_void_function,
146 .ssl_renegotiate = ssl3_renegotiate, 150 .ssl_renegotiate = ssl3_renegotiate,
147 .ssl_renegotiate_check = ssl3_renegotiate_check, 151 .ssl_renegotiate_check = ssl3_renegotiate_check,
148 .ssl_get_message = dtls1_get_message, 152 .ssl_get_message = dtls1_get_message,
149 .ssl_read_bytes = dtls1_read_bytes, 153 .ssl_read_bytes = dtls1_read_bytes,
150 .ssl_write_bytes = dtls1_write_app_data_bytes, 154 .ssl_write_bytes = dtls1_write_app_data_bytes,
155 .ssl3_enc = &DTLSv1_enc_data,
156};
157
158static const SSL_METHOD DTLSv1_client_method_data = {
151 .ssl_dispatch_alert = dtls1_dispatch_alert, 159 .ssl_dispatch_alert = dtls1_dispatch_alert,
152 .get_cipher_by_char = ssl3_get_cipher_by_char,
153 .put_cipher_by_char = ssl3_put_cipher_by_char,
154 .ssl_pending = ssl3_pending,
155 .num_ciphers = ssl3_num_ciphers, 160 .num_ciphers = ssl3_num_ciphers,
156 .get_cipher = dtls1_get_cipher, 161 .get_cipher = dtls1_get_cipher,
157 .get_ssl_method = dtls1_get_client_method, 162 .get_cipher_by_char = ssl3_get_cipher_by_char,
158 .get_timeout = dtls1_default_timeout, 163 .put_cipher_by_char = ssl3_put_cipher_by_char,
159 .ssl3_enc = &DTLSv1_enc_data, 164 .internal = &DTLSv1_client_method_internal_data,
160 .ssl_version = ssl_undefined_void_function,
161}; 165};
162 166
163const SSL_METHOD * 167const SSL_METHOD *
@@ -434,12 +438,12 @@ dtls1_connect(SSL *s)
434 s->internal->init_num = 0; 438 s->internal->init_num = 0;
435 439
436 s->session->cipher = S3I(s)->tmp.new_cipher; 440 s->session->cipher = S3I(s)->tmp.new_cipher;
437 if (!s->method->ssl3_enc->setup_key_block(s)) { 441 if (!s->method->internal->ssl3_enc->setup_key_block(s)) {
438 ret = -1; 442 ret = -1;
439 goto end; 443 goto end;
440 } 444 }
441 445
442 if (!s->method->ssl3_enc->change_cipher_state(s, 446 if (!s->method->internal->ssl3_enc->change_cipher_state(s,
443 SSL3_CHANGE_CIPHER_CLIENT_WRITE)) { 447 SSL3_CHANGE_CIPHER_CLIENT_WRITE)) {
444 ret = -1; 448 ret = -1;
445 goto end; 449 goto end;
@@ -455,8 +459,8 @@ dtls1_connect(SSL *s)
455 dtls1_start_timer(s); 459 dtls1_start_timer(s);
456 ret = ssl3_send_finished(s, 460 ret = ssl3_send_finished(s,
457 SSL3_ST_CW_FINISHED_A, SSL3_ST_CW_FINISHED_B, 461 SSL3_ST_CW_FINISHED_A, SSL3_ST_CW_FINISHED_B,
458 s->method->ssl3_enc->client_finished_label, 462 s->method->internal->ssl3_enc->client_finished_label,
459 s->method->ssl3_enc->client_finished_label_len); 463 s->method->internal->ssl3_enc->client_finished_label_len);
460 if (ret <= 0) 464 if (ret <= 0)
461 goto end; 465 goto end;
462 s->internal->state = SSL3_ST_CW_FLUSH; 466 s->internal->state = SSL3_ST_CW_FLUSH;
@@ -608,7 +612,7 @@ dtls1_get_hello_verify(SSL *s)
608 uint16_t ssl_version; 612 uint16_t ssl_version;
609 CBS hello_verify_request, cookie; 613 CBS hello_verify_request, cookie;
610 614
611 n = s->method->ssl_get_message(s, DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A, 615 n = s->method->internal->ssl_get_message(s, DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A,
612 DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B, -1, s->internal->max_cert_list, &ok); 616 DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B, -1, s->internal->max_cert_list, &ok);
613 617
614 if (!ok) 618 if (!ok)