summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r--src/lib/libssl/ssl_lib.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index dd46bf9423..bb4b700e0b 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.261 2021/06/19 16:52:47 jsing Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.262 2021/07/01 17:53:39 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 *
@@ -187,7 +187,7 @@ SSL_clear(SSL *s)
187 return (0); 187 return (0);
188 } 188 }
189 189
190 s->version = s->method->internal->version; 190 s->version = s->method->version;
191 s->client_version = s->version; 191 s->client_version = s->version;
192 s->internal->rwstate = SSL_NOTHING; 192 s->internal->rwstate = SSL_NOTHING;
193 s->internal->rstate = SSL_ST_READ_HEADER; 193 s->internal->rstate = SSL_ST_READ_HEADER;
@@ -207,12 +207,12 @@ SSL_clear(SSL *s)
207 */ 207 */
208 if (!s->internal->in_handshake && (s->session == NULL) && 208 if (!s->internal->in_handshake && (s->session == NULL) &&
209 (s->method != s->ctx->method)) { 209 (s->method != s->ctx->method)) {
210 s->method->internal->ssl_free(s); 210 s->method->ssl_free(s);
211 s->method = s->ctx->method; 211 s->method = s->ctx->method;
212 if (!s->method->internal->ssl_new(s)) 212 if (!s->method->ssl_new(s))
213 return (0); 213 return (0);
214 } else 214 } else
215 s->method->internal->ssl_clear(s); 215 s->method->ssl_clear(s);
216 216
217 return (1); 217 return (1);
218} 218}
@@ -342,11 +342,11 @@ SSL_new(SSL_CTX *ctx)
342 342
343 s->method = ctx->method; 343 s->method = ctx->method;
344 344
345 if (!s->method->internal->ssl_new(s)) 345 if (!s->method->ssl_new(s))
346 goto err; 346 goto err;
347 347
348 s->references = 1; 348 s->references = 1;
349 s->server = ctx->method->internal->server; 349 s->server = ctx->method->server;
350 350
351 SSL_clear(s); 351 SSL_clear(s);
352 352
@@ -566,7 +566,7 @@ SSL_free(SSL *s)
566 sk_X509_NAME_pop_free(s->internal->client_CA, X509_NAME_free); 566 sk_X509_NAME_pop_free(s->internal->client_CA, X509_NAME_free);
567 567
568 if (s->method != NULL) 568 if (s->method != NULL)
569 s->method->internal->ssl_free(s); 569 s->method->ssl_free(s);
570 570
571 SSL_CTX_free(s->ctx); 571 SSL_CTX_free(s->ctx);
572 572
@@ -811,7 +811,7 @@ SSL_get_read_ahead(const SSL *s)
811int 811int
812SSL_pending(const SSL *s) 812SSL_pending(const SSL *s)
813{ 813{
814 return (s->method->internal->ssl_pending(s)); 814 return (s->method->ssl_pending(s));
815} 815}
816 816
817X509 * 817X509 *
@@ -866,9 +866,9 @@ SSL_copy_session_id(SSL *t, const SSL *f)
866 866
867 /* What if we are set up for one protocol but want to talk another? */ 867 /* What if we are set up for one protocol but want to talk another? */
868 if (t->method != f->method) { 868 if (t->method != f->method) {
869 t->method->internal->ssl_free(t); 869 t->method->ssl_free(t);
870 t->method = f->method; 870 t->method = f->method;
871 if (!t->method->internal->ssl_new(t)) 871 if (!t->method->ssl_new(t))
872 return 0; 872 return 0;
873 } 873 }
874 874
@@ -933,7 +933,7 @@ SSL_accept(SSL *s)
933 if (s->internal->handshake_func == NULL) 933 if (s->internal->handshake_func == NULL)
934 SSL_set_accept_state(s); /* Not properly initialized yet */ 934 SSL_set_accept_state(s); /* Not properly initialized yet */
935 935
936 return (s->method->internal->ssl_accept(s)); 936 return (s->method->ssl_accept(s));
937} 937}
938 938
939int 939int
@@ -942,13 +942,13 @@ SSL_connect(SSL *s)
942 if (s->internal->handshake_func == NULL) 942 if (s->internal->handshake_func == NULL)
943 SSL_set_connect_state(s); /* Not properly initialized yet */ 943 SSL_set_connect_state(s); /* Not properly initialized yet */
944 944
945 return (s->method->internal->ssl_connect(s)); 945 return (s->method->ssl_connect(s));
946} 946}
947 947
948int 948int
949SSL_is_dtls(const SSL *s) 949SSL_is_dtls(const SSL *s)
950{ 950{
951 return s->method->internal->dtls; 951 return s->method->dtls;
952} 952}
953 953
954int 954int
@@ -1085,7 +1085,7 @@ SSL_shutdown(SSL *s)
1085 } 1085 }
1086 1086
1087 if (s != NULL && !SSL_in_init(s)) 1087 if (s != NULL && !SSL_in_init(s))
1088 return (s->method->internal->ssl_shutdown(s)); 1088 return (s->method->ssl_shutdown(s));
1089 1089
1090 return (1); 1090 return (1);
1091} 1091}
@@ -1098,7 +1098,7 @@ SSL_renegotiate(SSL *s)
1098 1098
1099 s->internal->new_session = 1; 1099 s->internal->new_session = 1;
1100 1100
1101 return (s->method->internal->ssl_renegotiate(s)); 1101 return (s->method->ssl_renegotiate(s));
1102} 1102}
1103 1103
1104int 1104int
@@ -1109,7 +1109,7 @@ SSL_renegotiate_abbreviated(SSL *s)
1109 1109
1110 s->internal->new_session = 0; 1110 s->internal->new_session = 0;
1111 1111
1112 return (s->method->internal->ssl_renegotiate(s)); 1112 return (s->method->ssl_renegotiate(s));
1113} 1113}
1114 1114
1115int 1115int
@@ -1825,8 +1825,8 @@ SSL_CTX_new(const SSL_METHOD *meth)
1825 } 1825 }
1826 1826
1827 ret->method = meth; 1827 ret->method = meth;
1828 ret->internal->min_tls_version = meth->internal->min_tls_version; 1828 ret->internal->min_tls_version = meth->min_tls_version;
1829 ret->internal->max_tls_version = meth->internal->max_tls_version; 1829 ret->internal->max_tls_version = meth->max_tls_version;
1830 ret->internal->min_proto_version = 0; 1830 ret->internal->min_proto_version = 0;
1831 ret->internal->max_proto_version = 0; 1831 ret->internal->max_proto_version = 0;
1832 ret->internal->mode = SSL_MODE_AUTO_RETRY; 1832 ret->internal->mode = SSL_MODE_AUTO_RETRY;
@@ -2293,17 +2293,17 @@ SSL_set_ssl_method(SSL *s, const SSL_METHOD *method)
2293 if (s->method == method) 2293 if (s->method == method)
2294 return (ret); 2294 return (ret);
2295 2295
2296 if (s->internal->handshake_func == s->method->internal->ssl_connect) 2296 if (s->internal->handshake_func == s->method->ssl_connect)
2297 handshake_func = method->internal->ssl_connect; 2297 handshake_func = method->ssl_connect;
2298 else if (s->internal->handshake_func == s->method->internal->ssl_accept) 2298 else if (s->internal->handshake_func == s->method->ssl_accept)
2299 handshake_func = method->internal->ssl_accept; 2299 handshake_func = method->ssl_accept;
2300 2300
2301 if (s->method->internal->version == method->internal->version) { 2301 if (s->method->version == method->version) {
2302 s->method = method; 2302 s->method = method;
2303 } else { 2303 } else {
2304 s->method->internal->ssl_free(s); 2304 s->method->ssl_free(s);
2305 s->method = method; 2305 s->method = method;
2306 ret = s->method->internal->ssl_new(s); 2306 ret = s->method->ssl_new(s);
2307 } 2307 }
2308 s->internal->handshake_func = handshake_func; 2308 s->internal->handshake_func = handshake_func;
2309 2309
@@ -2398,7 +2398,7 @@ SSL_do_handshake(SSL *s)
2398 return (-1); 2398 return (-1);
2399 } 2399 }
2400 2400
2401 s->method->internal->ssl_renegotiate_check(s); 2401 s->method->ssl_renegotiate_check(s);
2402 2402
2403 if (SSL_in_init(s) || SSL_in_before(s)) { 2403 if (SSL_in_init(s) || SSL_in_before(s)) {
2404 ret = s->internal->handshake_func(s); 2404 ret = s->internal->handshake_func(s);
@@ -2416,7 +2416,7 @@ SSL_set_accept_state(SSL *s)
2416 s->server = 1; 2416 s->server = 1;
2417 s->internal->shutdown = 0; 2417 s->internal->shutdown = 0;
2418 S3I(s)->hs.state = SSL_ST_ACCEPT|SSL_ST_BEFORE; 2418 S3I(s)->hs.state = SSL_ST_ACCEPT|SSL_ST_BEFORE;
2419 s->internal->handshake_func = s->method->internal->ssl_accept; 2419 s->internal->handshake_func = s->method->ssl_accept;
2420 ssl_clear_cipher_state(s); 2420 ssl_clear_cipher_state(s);
2421} 2421}
2422 2422
@@ -2426,7 +2426,7 @@ SSL_set_connect_state(SSL *s)
2426 s->server = 0; 2426 s->server = 0;
2427 s->internal->shutdown = 0; 2427 s->internal->shutdown = 0;
2428 S3I(s)->hs.state = SSL_ST_CONNECT|SSL_ST_BEFORE; 2428 S3I(s)->hs.state = SSL_ST_CONNECT|SSL_ST_BEFORE;
2429 s->internal->handshake_func = s->method->internal->ssl_connect; 2429 s->internal->handshake_func = s->method->ssl_connect;
2430 ssl_clear_cipher_state(s); 2430 ssl_clear_cipher_state(s);
2431} 2431}
2432 2432
@@ -2503,9 +2503,9 @@ SSL_dup(SSL *s)
2503 * and thus we can't use SSL_copy_session_id. 2503 * and thus we can't use SSL_copy_session_id.
2504 */ 2504 */
2505 2505
2506 ret->method->internal->ssl_free(ret); 2506 ret->method->ssl_free(ret);
2507 ret->method = s->method; 2507 ret->method = s->method;
2508 ret->method->internal->ssl_new(ret); 2508 ret->method->ssl_new(ret);
2509 2509
2510 ssl_cert_free(ret->cert); 2510 ssl_cert_free(ret->cert);
2511 if ((ret->cert = ssl_cert_dup(s->cert)) == NULL) 2511 if ((ret->cert = ssl_cert_dup(s->cert)) == NULL)