summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-09-10 09:19:53 +0100
committerMatt Caswell <matt@openssl.org>2015-10-30 08:38:18 +0000
commit23a635c0ec895f9876d4d7633e7e2923b5bbfc17 (patch)
treefaf3ec2a456cf4993a7ba6bddca3ce0d7d7a607a
parent5e41ba031edd91bfbac6a614664f83b22fb48207 (diff)
Remove the type variable
The SSL structure contained a "type" variable that was set to either SSL_ST_ACCEPT or SSL_ST_CONNECT depending on whether we are the server or the client. This duplicates the capability of the "server" variable and was actually rarely used. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
-rw-r--r--ssl/s3_both.c4
-rw-r--r--ssl/ssl_cert.c2
-rw-r--r--ssl/ssl_lib.c3
-rw-r--r--ssl/ssl_locl.h5
-rw-r--r--ssl/statem.c5
5 files changed, 5 insertions, 14 deletions
diff --git a/ssl/s3_both.c b/ssl/s3_both.c
index db0197d60b..6c5147421e 100644
--- a/ssl/s3_both.c
+++ b/ssl/s3_both.c
@@ -176,7 +176,7 @@ int tls_construct_finished(SSL *s, const char *sender, int slen)
/*
* Copy the finished so we can use it for renegotiation checks
*/
- if (s->type == SSL_ST_CONNECT) {
+ if (!s->server) {
OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
memcpy(s->s3->previous_client_finished, s->s3->tmp.finish_md, i);
s->s3->previous_client_finished_len = i;
@@ -319,7 +319,7 @@ enum MSG_PROCESS_RETURN tls_process_finished(SSL *s, unsigned long n)
/*
* Copy the finished so we can use it for renegotiation checks
*/
- if (s->type == SSL_ST_ACCEPT) {
+ if (s->server) {
OPENSSL_assert(i <= EVP_MAX_MD_SIZE);
memcpy(s->s3->previous_client_finished, s->s3->tmp.peer_finish_md, i);
s->s3->previous_client_finished_len = i;
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index 1caa3c85e3..3304a1d164 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -625,7 +625,7 @@ STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *ctx)
STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s)
{
- if (s->type == SSL_ST_CONNECT) { /* we are in the client */
+ if (!s->server) { /* we are in the client */
if (((s->version >> 8) == SSL3_VERSION_MAJOR) && (s->s3 != NULL))
return (s->s3->tmp.ca_names);
else
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 0aef51f361..cb303c419d 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -215,8 +215,6 @@ int SSL_clear(SSL *s)
return 0;
}
- s->type = 0;
-
statem_clear(s);
s->version = s->method->version;
@@ -2469,7 +2467,6 @@ SSL *SSL_dup(SSL *s)
return (NULL);
ret->version = s->version;
- ret->type = s->type;
ret->method = s->method;
if (s->session != NULL) {
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h
index aebd3af8dd..e7d28622c0 100644
--- a/ssl/ssl_locl.h
+++ b/ssl/ssl_locl.h
@@ -1050,8 +1050,7 @@ struct ssl_st {
* DTLS1_VERSION)
*/
int version;
- /* SSL_ST_CONNECT or SSL_ST_ACCEPT */
- int type;
+
/* SSLv3 */
const SSL_METHOD *method;
/*
@@ -1080,7 +1079,7 @@ struct ssl_st {
* handshake_func is == 0 until then, we use this test instead of an
* "init" member.
*/
- /* are we the server side? - mostly used by SSL_clear */
+ /* are we the server side? */
int server;
/*
* Generate a new session or reuse an old one.
diff --git a/ssl/statem.c b/ssl/statem.c
index 34d55cb11b..ad44c5f86d 100644
--- a/ssl/statem.c
+++ b/ssl/statem.c
@@ -356,11 +356,6 @@ static int state_machine(SSL *s, int server) {
}
}
- if (server)
- s->type = SSL_ST_ACCEPT;
- else
- s->type = SSL_ST_CONNECT;
-
if (s->init_buf == NULL) {
if ((buf = BUF_MEM_new()) == NULL) {
goto end;