diff options
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index 6e3e042fe6..c9af96e48e 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.132 2017/01/23 04:15:28 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.133 2017/01/23 04:55:27 beck 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 | * |
@@ -230,7 +230,7 @@ SSL_clear(SSL *s) | |||
230 | * Check to see if we were changed into a different method, if | 230 | * Check to see if we were changed into a different method, if |
231 | * so, revert back if we are not doing session-id reuse. | 231 | * so, revert back if we are not doing session-id reuse. |
232 | */ | 232 | */ |
233 | if (!s->in_handshake && (s->session == NULL) && | 233 | if (!s->internal->in_handshake && (s->session == NULL) && |
234 | (s->method != s->ctx->method)) { | 234 | (s->method != s->ctx->method)) { |
235 | s->method->ssl_free(s); | 235 | s->method->ssl_free(s); |
236 | s->method = s->ctx->method; | 236 | s->method = s->ctx->method; |
@@ -307,14 +307,14 @@ SSL_new(SSL_CTX *ctx) | |||
307 | s->cert=NULL; /* Cannot really happen (see SSL_CTX_new) */ | 307 | s->cert=NULL; /* Cannot really happen (see SSL_CTX_new) */ |
308 | 308 | ||
309 | s->read_ahead = ctx->read_ahead; | 309 | s->read_ahead = ctx->read_ahead; |
310 | s->msg_callback = ctx->internal->msg_callback; | 310 | s->internal->msg_callback = ctx->internal->msg_callback; |
311 | s->msg_callback_arg = ctx->internal->msg_callback_arg; | 311 | s->internal->msg_callback_arg = ctx->internal->msg_callback_arg; |
312 | s->verify_mode = ctx->verify_mode; | 312 | s->verify_mode = ctx->verify_mode; |
313 | s->sid_ctx_length = ctx->sid_ctx_length; | 313 | s->sid_ctx_length = ctx->sid_ctx_length; |
314 | OPENSSL_assert(s->sid_ctx_length <= sizeof s->sid_ctx); | 314 | OPENSSL_assert(s->sid_ctx_length <= sizeof s->sid_ctx); |
315 | memcpy(&s->sid_ctx, &ctx->sid_ctx, sizeof(s->sid_ctx)); | 315 | memcpy(&s->sid_ctx, &ctx->sid_ctx, sizeof(s->sid_ctx)); |
316 | s->verify_callback = ctx->internal->default_verify_callback; | 316 | s->internal->verify_callback = ctx->internal->default_verify_callback; |
317 | s->generate_session_id = ctx->internal->generate_session_id; | 317 | s->internal->generate_session_id = ctx->internal->generate_session_id; |
318 | 318 | ||
319 | s->param = X509_VERIFY_PARAM_new(); | 319 | s->param = X509_VERIFY_PARAM_new(); |
320 | if (!s->param) | 320 | if (!s->param) |
@@ -325,8 +325,8 @@ SSL_new(SSL_CTX *ctx) | |||
325 | 325 | ||
326 | CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX); | 326 | CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX); |
327 | s->ctx = ctx; | 327 | s->ctx = ctx; |
328 | s->tlsext_debug_cb = 0; | 328 | s->internal->tlsext_debug_cb = 0; |
329 | s->tlsext_debug_arg = NULL; | 329 | s->internal->tlsext_debug_arg = NULL; |
330 | s->tlsext_ticket_expected = 0; | 330 | s->tlsext_ticket_expected = 0; |
331 | s->tlsext_status_type = -1; | 331 | s->tlsext_status_type = -1; |
332 | s->tlsext_status_expected = 0; | 332 | s->tlsext_status_expected = 0; |
@@ -415,7 +415,7 @@ int | |||
415 | SSL_set_generate_session_id(SSL *ssl, GEN_SESSION_CB cb) | 415 | SSL_set_generate_session_id(SSL *ssl, GEN_SESSION_CB cb) |
416 | { | 416 | { |
417 | CRYPTO_w_lock(CRYPTO_LOCK_SSL); | 417 | CRYPTO_w_lock(CRYPTO_LOCK_SSL); |
418 | ssl->generate_session_id = cb; | 418 | ssl->internal->generate_session_id = cb; |
419 | CRYPTO_w_unlock(CRYPTO_LOCK_SSL); | 419 | CRYPTO_w_unlock(CRYPTO_LOCK_SSL); |
420 | return (1); | 420 | return (1); |
421 | } | 421 | } |
@@ -741,7 +741,7 @@ SSL_get_verify_depth(const SSL *s) | |||
741 | int | 741 | int |
742 | (*SSL_get_verify_callback(const SSL *s))(int, X509_STORE_CTX *) | 742 | (*SSL_get_verify_callback(const SSL *s))(int, X509_STORE_CTX *) |
743 | { | 743 | { |
744 | return (s->verify_callback); | 744 | return (s->internal->verify_callback); |
745 | } | 745 | } |
746 | 746 | ||
747 | int | 747 | int |
@@ -767,7 +767,7 @@ SSL_set_verify(SSL *s, int mode, | |||
767 | { | 767 | { |
768 | s->verify_mode = mode; | 768 | s->verify_mode = mode; |
769 | if (callback != NULL) | 769 | if (callback != NULL) |
770 | s->verify_callback = callback; | 770 | s->internal->verify_callback = callback; |
771 | } | 771 | } |
772 | 772 | ||
773 | void | 773 | void |
@@ -922,7 +922,7 @@ SSL_check_private_key(const SSL *ssl) | |||
922 | int | 922 | int |
923 | SSL_accept(SSL *s) | 923 | SSL_accept(SSL *s) |
924 | { | 924 | { |
925 | if (s->handshake_func == NULL) | 925 | if (s->internal->handshake_func == NULL) |
926 | SSL_set_accept_state(s); /* Not properly initialized yet */ | 926 | SSL_set_accept_state(s); /* Not properly initialized yet */ |
927 | 927 | ||
928 | return (s->method->ssl_accept(s)); | 928 | return (s->method->ssl_accept(s)); |
@@ -931,7 +931,7 @@ SSL_accept(SSL *s) | |||
931 | int | 931 | int |
932 | SSL_connect(SSL *s) | 932 | SSL_connect(SSL *s) |
933 | { | 933 | { |
934 | if (s->handshake_func == NULL) | 934 | if (s->internal->handshake_func == NULL) |
935 | SSL_set_connect_state(s); /* Not properly initialized yet */ | 935 | SSL_set_connect_state(s); /* Not properly initialized yet */ |
936 | 936 | ||
937 | return (s->method->ssl_connect(s)); | 937 | return (s->method->ssl_connect(s)); |
@@ -946,7 +946,7 @@ SSL_get_default_timeout(const SSL *s) | |||
946 | int | 946 | int |
947 | SSL_read(SSL *s, void *buf, int num) | 947 | SSL_read(SSL *s, void *buf, int num) |
948 | { | 948 | { |
949 | if (s->handshake_func == NULL) { | 949 | if (s->internal->handshake_func == NULL) { |
950 | SSLerr(SSL_F_SSL_READ, SSL_R_UNINITIALIZED); | 950 | SSLerr(SSL_F_SSL_READ, SSL_R_UNINITIALIZED); |
951 | return (-1); | 951 | return (-1); |
952 | } | 952 | } |
@@ -961,7 +961,7 @@ SSL_read(SSL *s, void *buf, int num) | |||
961 | int | 961 | int |
962 | SSL_peek(SSL *s, void *buf, int num) | 962 | SSL_peek(SSL *s, void *buf, int num) |
963 | { | 963 | { |
964 | if (s->handshake_func == NULL) { | 964 | if (s->internal->handshake_func == NULL) { |
965 | SSLerr(SSL_F_SSL_PEEK, SSL_R_UNINITIALIZED); | 965 | SSLerr(SSL_F_SSL_PEEK, SSL_R_UNINITIALIZED); |
966 | return (-1); | 966 | return (-1); |
967 | } | 967 | } |
@@ -975,7 +975,7 @@ SSL_peek(SSL *s, void *buf, int num) | |||
975 | int | 975 | int |
976 | SSL_write(SSL *s, const void *buf, int num) | 976 | SSL_write(SSL *s, const void *buf, int num) |
977 | { | 977 | { |
978 | if (s->handshake_func == NULL) { | 978 | if (s->internal->handshake_func == NULL) { |
979 | SSLerr(SSL_F_SSL_WRITE, SSL_R_UNINITIALIZED); | 979 | SSLerr(SSL_F_SSL_WRITE, SSL_R_UNINITIALIZED); |
980 | return (-1); | 980 | return (-1); |
981 | } | 981 | } |
@@ -998,7 +998,7 @@ SSL_shutdown(SSL *s) | |||
998 | * even if blocking I/O is used (see ssl3_shutdown). | 998 | * even if blocking I/O is used (see ssl3_shutdown). |
999 | */ | 999 | */ |
1000 | 1000 | ||
1001 | if (s->handshake_func == NULL) { | 1001 | if (s->internal->handshake_func == NULL) { |
1002 | SSLerr(SSL_F_SSL_SHUTDOWN, SSL_R_UNINITIALIZED); | 1002 | SSLerr(SSL_F_SSL_SHUTDOWN, SSL_R_UNINITIALIZED); |
1003 | return (-1); | 1003 | return (-1); |
1004 | } | 1004 | } |
@@ -1055,7 +1055,7 @@ SSL_ctrl(SSL *s, int cmd, long larg, void *parg) | |||
1055 | return (l); | 1055 | return (l); |
1056 | 1056 | ||
1057 | case SSL_CTRL_SET_MSG_CALLBACK_ARG: | 1057 | case SSL_CTRL_SET_MSG_CALLBACK_ARG: |
1058 | s->msg_callback_arg = parg; | 1058 | s->internal->msg_callback_arg = parg; |
1059 | return (1); | 1059 | return (1); |
1060 | 1060 | ||
1061 | case SSL_CTRL_OPTIONS: | 1061 | case SSL_CTRL_OPTIONS: |
@@ -1101,7 +1101,7 @@ SSL_callback_ctrl(SSL *s, int cmd, void (*fp)(void)) | |||
1101 | { | 1101 | { |
1102 | switch (cmd) { | 1102 | switch (cmd) { |
1103 | case SSL_CTRL_SET_MSG_CALLBACK: | 1103 | case SSL_CTRL_SET_MSG_CALLBACK: |
1104 | s->msg_callback = (void (*)(int write_p, int version, | 1104 | s->internal->msg_callback = (void (*)(int write_p, int version, |
1105 | int content_type, const void *buf, size_t len, | 1105 | int content_type, const void *buf, size_t len, |
1106 | SSL *ssl, void *arg))(fp); | 1106 | SSL *ssl, void *arg))(fp); |
1107 | return (1); | 1107 | return (1); |
@@ -2305,8 +2305,8 @@ SSL_set_ssl_method(SSL *s, const SSL_METHOD *meth) | |||
2305 | int ret = 1; | 2305 | int ret = 1; |
2306 | 2306 | ||
2307 | if (s->method != meth) { | 2307 | if (s->method != meth) { |
2308 | if (s->handshake_func != NULL) | 2308 | if (s->internal->handshake_func != NULL) |
2309 | conn = (s->handshake_func == s->method->ssl_connect); | 2309 | conn = (s->internal->handshake_func == s->method->ssl_connect); |
2310 | 2310 | ||
2311 | if (s->method->version == meth->version) | 2311 | if (s->method->version == meth->version) |
2312 | s->method = meth; | 2312 | s->method = meth; |
@@ -2317,9 +2317,9 @@ SSL_set_ssl_method(SSL *s, const SSL_METHOD *meth) | |||
2317 | } | 2317 | } |
2318 | 2318 | ||
2319 | if (conn == 1) | 2319 | if (conn == 1) |
2320 | s->handshake_func = meth->ssl_connect; | 2320 | s->internal->handshake_func = meth->ssl_connect; |
2321 | else if (conn == 0) | 2321 | else if (conn == 0) |
2322 | s->handshake_func = meth->ssl_accept; | 2322 | s->internal->handshake_func = meth->ssl_accept; |
2323 | } | 2323 | } |
2324 | return (ret); | 2324 | return (ret); |
2325 | } | 2325 | } |
@@ -2407,7 +2407,7 @@ SSL_do_handshake(SSL *s) | |||
2407 | { | 2407 | { |
2408 | int ret = 1; | 2408 | int ret = 1; |
2409 | 2409 | ||
2410 | if (s->handshake_func == NULL) { | 2410 | if (s->internal->handshake_func == NULL) { |
2411 | SSLerr(SSL_F_SSL_DO_HANDSHAKE, SSL_R_CONNECTION_TYPE_NOT_SET); | 2411 | SSLerr(SSL_F_SSL_DO_HANDSHAKE, SSL_R_CONNECTION_TYPE_NOT_SET); |
2412 | return (-1); | 2412 | return (-1); |
2413 | } | 2413 | } |
@@ -2415,7 +2415,7 @@ SSL_do_handshake(SSL *s) | |||
2415 | s->method->ssl_renegotiate_check(s); | 2415 | s->method->ssl_renegotiate_check(s); |
2416 | 2416 | ||
2417 | if (SSL_in_init(s) || SSL_in_before(s)) { | 2417 | if (SSL_in_init(s) || SSL_in_before(s)) { |
2418 | ret = s->handshake_func(s); | 2418 | ret = s->internal->handshake_func(s); |
2419 | } | 2419 | } |
2420 | return (ret); | 2420 | return (ret); |
2421 | } | 2421 | } |
@@ -2430,7 +2430,7 @@ SSL_set_accept_state(SSL *s) | |||
2430 | s->server = 1; | 2430 | s->server = 1; |
2431 | s->shutdown = 0; | 2431 | s->shutdown = 0; |
2432 | s->state = SSL_ST_ACCEPT|SSL_ST_BEFORE; | 2432 | s->state = SSL_ST_ACCEPT|SSL_ST_BEFORE; |
2433 | s->handshake_func = s->method->ssl_accept; | 2433 | s->internal->handshake_func = s->method->ssl_accept; |
2434 | /* clear the current cipher */ | 2434 | /* clear the current cipher */ |
2435 | ssl_clear_cipher_ctx(s); | 2435 | ssl_clear_cipher_ctx(s); |
2436 | ssl_clear_hash_ctx(&s->read_hash); | 2436 | ssl_clear_hash_ctx(&s->read_hash); |
@@ -2443,7 +2443,7 @@ SSL_set_connect_state(SSL *s) | |||
2443 | s->server = 0; | 2443 | s->server = 0; |
2444 | s->shutdown = 0; | 2444 | s->shutdown = 0; |
2445 | s->state = SSL_ST_CONNECT|SSL_ST_BEFORE; | 2445 | s->state = SSL_ST_CONNECT|SSL_ST_BEFORE; |
2446 | s->handshake_func = s->method->ssl_connect; | 2446 | s->internal->handshake_func = s->method->ssl_connect; |
2447 | /* clear the current cipher */ | 2447 | /* clear the current cipher */ |
2448 | ssl_clear_cipher_ctx(s); | 2448 | ssl_clear_cipher_ctx(s); |
2449 | ssl_clear_hash_ctx(&s->read_hash); | 2449 | ssl_clear_hash_ctx(&s->read_hash); |
@@ -2643,12 +2643,12 @@ SSL_dup(SSL *s) | |||
2643 | ret->mode = s->mode; | 2643 | ret->mode = s->mode; |
2644 | SSL_set_max_cert_list(ret, SSL_get_max_cert_list(s)); | 2644 | SSL_set_max_cert_list(ret, SSL_get_max_cert_list(s)); |
2645 | SSL_set_read_ahead(ret, SSL_get_read_ahead(s)); | 2645 | SSL_set_read_ahead(ret, SSL_get_read_ahead(s)); |
2646 | ret->msg_callback = s->msg_callback; | 2646 | ret->internal->msg_callback = s->internal->msg_callback; |
2647 | ret->msg_callback_arg = s->msg_callback_arg; | 2647 | ret->internal->msg_callback_arg = s->internal->msg_callback_arg; |
2648 | SSL_set_verify(ret, SSL_get_verify_mode(s), | 2648 | SSL_set_verify(ret, SSL_get_verify_mode(s), |
2649 | SSL_get_verify_callback(s)); | 2649 | SSL_get_verify_callback(s)); |
2650 | SSL_set_verify_depth(ret, SSL_get_verify_depth(s)); | 2650 | SSL_set_verify_depth(ret, SSL_get_verify_depth(s)); |
2651 | ret->generate_session_id = s->generate_session_id; | 2651 | ret->internal->generate_session_id = s->internal->generate_session_id; |
2652 | 2652 | ||
2653 | SSL_set_info_callback(ret, SSL_get_info_callback(s)); | 2653 | SSL_set_info_callback(ret, SSL_get_info_callback(s)); |
2654 | 2654 | ||
@@ -2672,8 +2672,8 @@ SSL_dup(SSL *s) | |||
2672 | ret->wbio = ret->rbio; | 2672 | ret->wbio = ret->rbio; |
2673 | } | 2673 | } |
2674 | ret->rwstate = s->rwstate; | 2674 | ret->rwstate = s->rwstate; |
2675 | ret->in_handshake = s->in_handshake; | 2675 | ret->internal->in_handshake = s->internal->in_handshake; |
2676 | ret->handshake_func = s->handshake_func; | 2676 | ret->internal->handshake_func = s->internal->handshake_func; |
2677 | ret->server = s->server; | 2677 | ret->server = s->server; |
2678 | ret->renegotiate = s->renegotiate; | 2678 | ret->renegotiate = s->renegotiate; |
2679 | ret->new_session = s->new_session; | 2679 | ret->new_session = s->new_session; |
@@ -2929,12 +2929,12 @@ SSL_CTX_load_verify_mem(SSL_CTX *ctx, void *buf, int len) | |||
2929 | void | 2929 | void |
2930 | SSL_set_info_callback(SSL *ssl, void (*cb)(const SSL *ssl, int type, int val)) | 2930 | SSL_set_info_callback(SSL *ssl, void (*cb)(const SSL *ssl, int type, int val)) |
2931 | { | 2931 | { |
2932 | ssl->info_callback = cb; | 2932 | ssl->internal->info_callback = cb; |
2933 | } | 2933 | } |
2934 | 2934 | ||
2935 | void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type, int val) | 2935 | void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type, int val) |
2936 | { | 2936 | { |
2937 | return (ssl->info_callback); | 2937 | return (ssl->internal->info_callback); |
2938 | } | 2938 | } |
2939 | 2939 | ||
2940 | int | 2940 | int |