From 4cc968df403ed9321d0df722aba33323ae575ce0 Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Wed, 30 May 2018 09:28:03 -0500 Subject: [PATCH] const-ify some input SSL * arguments These tiny functions only read from the input SSL, and we are about to use them from functions that only have a const SSL* available, so propagate const a bit further. Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/6378) --- doc/man3/SSL_in_init.pod | 6 +++--- include/openssl/ssl.h | 6 +++--- ssl/statem/statem.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/man3/SSL_in_init.pod b/doc/man3/SSL_in_init.pod index 37ebff6048..d8467a974c 100644 --- a/doc/man3/SSL_in_init.pod +++ b/doc/man3/SSL_in_init.pod @@ -14,9 +14,9 @@ SSL_get_state #include - int SSL_in_init(SSL *s); - int SSL_in_before(SSL *s); - int SSL_is_init_finished(SSL *s); + int SSL_in_init(const SSL *s); + int SSL_in_before(const SSL *s); + int SSL_is_init_finished(const SSL *s); int SSL_in_connect_init(SSL *s); int SSL_in_accept_init(SSL *s); diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index 2376828e70..155d6515e1 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -1058,9 +1058,9 @@ typedef enum { /* Is the SSL_connection established? */ # define SSL_in_connect_init(a) (SSL_in_init(a) && !SSL_is_server(a)) # define SSL_in_accept_init(a) (SSL_in_init(a) && SSL_is_server(a)) -int SSL_in_init(SSL *s); -int SSL_in_before(SSL *s); -int SSL_is_init_finished(SSL *s); +int SSL_in_init(const SSL *s); +int SSL_in_before(const SSL *s); +int SSL_is_init_finished(const SSL *s); /* * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you diff --git a/ssl/statem/statem.c b/ssl/statem/statem.c index cf6472c757..7f1017d8f5 100644 --- a/ssl/statem/statem.c +++ b/ssl/statem/statem.c @@ -68,17 +68,17 @@ OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl) return ssl->statem.hand_state; } -int SSL_in_init(SSL *s) +int SSL_in_init(const SSL *s) { return s->statem.in_init; } -int SSL_is_init_finished(SSL *s) +int SSL_is_init_finished(const SSL *s) { return !(s->statem.in_init) && (s->statem.hand_state == TLS_ST_OK); } -int SSL_in_before(SSL *s) +int SSL_in_before(const SSL *s) { /* * Historically being "in before" meant before anything had happened. In the -- GitLab