X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=ssl%2Fstatem%2Fstatem.c;h=dd7a260a26ae655005489f702e0371abefb88c95;hp=f0b326082931a1da3832252c9ac53ede7bda0739;hb=5998e2903589e7b19e102ebff06521f2dcb60409;hpb=61ae935a9831d2b132e50508ccc37f879c17a5c4 diff --git a/ssl/statem/statem.c b/ssl/statem/statem.c index f0b3260829..dd7a260a26 100644 --- a/ssl/statem/statem.c +++ b/ssl/statem/statem.c @@ -110,20 +110,11 @@ static enum SUB_STATE_RETURN read_state_machine(SSL *s); static void init_write_state_machine(SSL *s); static enum SUB_STATE_RETURN write_state_machine(SSL *s); -enum HANDSHAKE_STATE SSL_state(const SSL *ssl) +OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl) { return ssl->statem.hand_state; } -void SSL_set_state(SSL *ssl, enum HANDSHAKE_STATE state) -{ - /* - * This function seems like a really bad idea. Should we remove it - * completely? - */ - ssl->statem.hand_state = state; -} - int SSL_in_init(SSL *s) { return s->statem.in_init; @@ -150,17 +141,18 @@ int SSL_in_before(SSL *s) /* * Clear the state machine state and reset back to MSG_FLOW_UNINITED */ -void statem_clear(SSL *s) +void ossl_statem_clear(SSL *s) { s->statem.state = MSG_FLOW_UNINITED; s->statem.hand_state = TLS_ST_BEFORE; s->statem.in_init = 1; + s->statem.no_cert_verify = 0; } /* * Set the state machine up ready for a renegotiation handshake */ -void statem_set_renegotiate(SSL *s) +void ossl_statem_set_renegotiate(SSL *s) { s->statem.state = MSG_FLOW_RENEGOTIATE; s->statem.in_init = 1; @@ -170,7 +162,7 @@ void statem_set_renegotiate(SSL *s) * Put the state machine into an error state. This is a permanent error for * the current connection. */ -void statem_set_error(SSL *s) +void ossl_statem_set_error(SSL *s) { s->statem.state = MSG_FLOW_ERROR; } @@ -182,7 +174,7 @@ void statem_set_error(SSL *s) * 1: Yes * 0: No */ -int statem_in_error(const SSL *s) +int ossl_statem_in_error(const SSL *s) { if (s->statem.state == MSG_FLOW_ERROR) return 1; @@ -190,16 +182,16 @@ int statem_in_error(const SSL *s) return 0; } -void statem_set_in_init(SSL *s, int init) +void ossl_statem_set_in_init(SSL *s, int init) { s->statem.in_init = init; } -int statem_connect(SSL *s) { +int ossl_statem_connect(SSL *s) { return state_machine(s, 0); } -int statem_accept(SSL *s) +int ossl_statem_accept(SSL *s) { return state_machine(s, 1); } @@ -374,11 +366,11 @@ static int state_machine(SSL *s, int server) { SSLerr(SSL_F_STATE_MACHINE, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED); ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); - statem_set_error(s); + ossl_statem_set_error(s); goto end; } else { /* - * s->state == SSL_ST_RENEGOTIATE, we will just send a + * st->state == MSG_FLOW_RENEGOTIATE, we will just send a * HelloRequest */ s->ctx->stats.sess_accept_renegotiate++; @@ -425,7 +417,7 @@ static int state_machine(SSL *s, int server) { } } else { /* Error */ - statem_set_error(s); + ossl_statem_set_error(s); goto end; } } @@ -629,7 +621,7 @@ static enum SUB_STATE_RETURN read_state_machine(SSL *s) { /* Shouldn't happen */ ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR); SSLerr(SSL_F_READ_STATE_MACHINE, ERR_R_INTERNAL_ERROR); - statem_set_error(s); + ossl_statem_set_error(s); return SUB_STATE_ERROR; } } @@ -817,7 +809,7 @@ int statem_flush(SSL *s) * 1: Yes (application data allowed) * 0: No (application data not allowed) */ -int statem_app_data_allowed(SSL *s) +int ossl_statem_app_data_allowed(SSL *s) { STATEM *st = &s->statem; @@ -851,7 +843,7 @@ int statem_app_data_allowed(SSL *s) /* * Set flag used by SCTP to determine whether we are in the read sock state */ -void statem_set_sctp_read_sock(SSL *s, int read_sock) +void ossl_statem_set_sctp_read_sock(SSL *s, int read_sock) { s->statem.in_sctp_read_sock = read_sock; }