diff options
author | beck <> | 2017-05-07 04:22:24 +0000 |
---|---|---|
committer | beck <> | 2017-05-07 04:22:24 +0000 |
commit | 3b455600d14ddcf2be0dcd2d4765d1b7854cd1c5 (patch) | |
tree | 9f980ffff8490ca0af628971a6d8ceb4a23d3b99 /src/lib/libssl/ssl_lib.c | |
parent | 2145114fc4f04a6a75134ef92bc551a976292150 (diff) | |
download | openbsd-3b455600d14ddcf2be0dcd2d4765d1b7854cd1c5.tar.gz openbsd-3b455600d14ddcf2be0dcd2d4765d1b7854cd1c5.tar.bz2 openbsd-3b455600d14ddcf2be0dcd2d4765d1b7854cd1c5.zip |
Move state from ssl->internal to the handshake structure.
while we are at it, convert SSLerror to use a function
internally, so that we may later allocate the handshake
structure and check for it
ok jsing@
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index 76b2f8a8c4..c593e7b42b 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.160 2017/05/06 22:24:57 beck Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.161 2017/05/07 04:22:24 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 | * |
@@ -183,8 +183,6 @@ SSL_clear(SSL *s) | |||
183 | 183 | ||
184 | s->internal->type = 0; | 184 | s->internal->type = 0; |
185 | 185 | ||
186 | s->internal->state = SSL_ST_BEFORE|((s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT); | ||
187 | |||
188 | s->version = s->method->internal->version; | 186 | s->version = s->method->internal->version; |
189 | s->client_version = s->version; | 187 | s->client_version = s->version; |
190 | s->internal->rwstate = SSL_NOTHING; | 188 | s->internal->rwstate = SSL_NOTHING; |
@@ -212,6 +210,8 @@ SSL_clear(SSL *s) | |||
212 | } else | 210 | } else |
213 | s->method->internal->ssl_clear(s); | 211 | s->method->internal->ssl_clear(s); |
214 | 212 | ||
213 | S3I(s)->hs.state = SSL_ST_BEFORE|((s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT); | ||
214 | |||
215 | return (1); | 215 | return (1); |
216 | } | 216 | } |
217 | 217 | ||
@@ -2397,7 +2397,7 @@ SSL_set_accept_state(SSL *s) | |||
2397 | { | 2397 | { |
2398 | s->server = 1; | 2398 | s->server = 1; |
2399 | s->internal->shutdown = 0; | 2399 | s->internal->shutdown = 0; |
2400 | s->internal->state = SSL_ST_ACCEPT|SSL_ST_BEFORE; | 2400 | S3I(s)->hs.state = SSL_ST_ACCEPT|SSL_ST_BEFORE; |
2401 | s->internal->handshake_func = s->method->internal->ssl_accept; | 2401 | s->internal->handshake_func = s->method->internal->ssl_accept; |
2402 | /* clear the current cipher */ | 2402 | /* clear the current cipher */ |
2403 | ssl_clear_cipher_ctx(s); | 2403 | ssl_clear_cipher_ctx(s); |
@@ -2410,7 +2410,7 @@ SSL_set_connect_state(SSL *s) | |||
2410 | { | 2410 | { |
2411 | s->server = 0; | 2411 | s->server = 0; |
2412 | s->internal->shutdown = 0; | 2412 | s->internal->shutdown = 0; |
2413 | s->internal->state = SSL_ST_CONNECT|SSL_ST_BEFORE; | 2413 | S3I(s)->hs.state = SSL_ST_CONNECT|SSL_ST_BEFORE; |
2414 | s->internal->handshake_func = s->method->internal->ssl_connect; | 2414 | s->internal->handshake_func = s->method->internal->ssl_connect; |
2415 | /* clear the current cipher */ | 2415 | /* clear the current cipher */ |
2416 | ssl_clear_cipher_ctx(s); | 2416 | ssl_clear_cipher_ctx(s); |
@@ -2544,7 +2544,7 @@ SSL_dup(SSL *s) | |||
2544 | ret->internal->quiet_shutdown = s->internal->quiet_shutdown; | 2544 | ret->internal->quiet_shutdown = s->internal->quiet_shutdown; |
2545 | ret->internal->shutdown = s->internal->shutdown; | 2545 | ret->internal->shutdown = s->internal->shutdown; |
2546 | /* SSL_dup does not really work at any state, though */ | 2546 | /* SSL_dup does not really work at any state, though */ |
2547 | ret->internal->state = s->internal->state; | 2547 | S3I(ret)->hs.state = S3I(s)->hs.state; |
2548 | ret->internal->rstate = s->internal->rstate; | 2548 | ret->internal->rstate = s->internal->rstate; |
2549 | 2549 | ||
2550 | /* | 2550 | /* |
@@ -2804,13 +2804,13 @@ void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, int type, int val) | |||
2804 | int | 2804 | int |
2805 | SSL_state(const SSL *ssl) | 2805 | SSL_state(const SSL *ssl) |
2806 | { | 2806 | { |
2807 | return (ssl->internal->state); | 2807 | return (S3I(ssl)->hs.state); |
2808 | } | 2808 | } |
2809 | 2809 | ||
2810 | void | 2810 | void |
2811 | SSL_set_state(SSL *ssl, int state) | 2811 | SSL_set_state(SSL *ssl, int state) |
2812 | { | 2812 | { |
2813 | ssl->internal->state = state; | 2813 | S3I(ssl)->hs.state = state; |
2814 | } | 2814 | } |
2815 | 2815 | ||
2816 | void | 2816 | void |