aboutsummaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-05-01 14:29:48 -0400
committerRich Salz <rsalz@openssl.org>2015-05-01 14:29:48 -0400
commit666964780a245c14e8f0eb6e13dd854a37387ea9 (patch)
treed50fcd19525107e6c675ab342e84805da21a684e /ssl
parent190c8c60c11467424910605d8d0098ccc1168fdc (diff)
downloadopenssl-666964780a245c14e8f0eb6e13dd854a37387ea9.tar.gz
Remove goto inside an if(0) block
There were a dozen-plus instances of this construct: if (0) { label: ..... } Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'ssl')
-rw-r--r--ssl/s3_clnt.c14
-rw-r--r--ssl/s3_lib.c1
-rw-r--r--ssl/s3_srvr.c18
-rw-r--r--ssl/ssl_asn1.c4
-rw-r--r--ssl/ssl_cert.c14
-rw-r--r--ssl/ssl_lib.c8
6 files changed, 24 insertions, 35 deletions
diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c
index 52ddec1455..7915052e9a 100644
--- a/ssl/s3_clnt.c
+++ b/ssl/s3_clnt.c
@@ -1189,7 +1189,7 @@ int ssl3_get_server_certificate(SSL *s)
if ((sk = sk_X509_new_null()) == NULL) {
SSLerr(SSL_F_SSL3_GET_SERVER_CERTIFICATE, ERR_R_MALLOC_FAILURE);
- goto err;
+ goto done;
}
n2l3(p, llen);
@@ -1222,7 +1222,7 @@ int ssl3_get_server_certificate(SSL *s)
}
if (!sk_X509_push(sk, x)) {
SSLerr(SSL_F_SSL3_GET_SERVER_CERTIFICATE, ERR_R_MALLOC_FAILURE);
- goto err;
+ goto done;
}
x = NULL;
nc += l + 3;
@@ -1250,7 +1250,7 @@ int ssl3_get_server_certificate(SSL *s)
sc = ssl_sess_cert_new();
if (sc == NULL)
- goto err;
+ goto done;
ssl_sess_cert_free(s->session->sess_cert);
s->session->sess_cert = sc;
@@ -1332,11 +1332,11 @@ int ssl3_get_server_certificate(SSL *s)
x = NULL;
ret = 1;
- if (0) {
+ goto done;
+
f_err:
- ssl3_send_alert(s, SSL3_AL_FATAL, al);
- }
- err:
+ ssl3_send_alert(s, SSL3_AL_FATAL, al);
+ done:
EVP_PKEY_free(pkey);
X509_free(x);
sk_X509_pop_free(sk, X509_free);
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index 16a60c6167..4610e7fdff 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -3570,7 +3570,6 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
ptmp = EVP_PKEY_new();
if (!ptmp)
return 0;
- if (0) ;
#ifndef OPENSSL_NO_RSA
else if (sc->peer_rsa_tmp)
rv = EVP_PKEY_set1_RSA(ptmp, sc->peer_rsa_tmp);
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index 3e5c57af5e..5b83407a96 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -3184,7 +3184,7 @@ int ssl3_get_client_certificate(SSL *s)
if ((sk = sk_X509_new_null()) == NULL) {
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
- goto err;
+ goto done;
}
n2l3(p, llen);
@@ -3206,7 +3206,7 @@ int ssl3_get_client_certificate(SSL *s)
x = d2i_X509(NULL, &p, l);
if (x == NULL) {
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_ASN1_LIB);
- goto err;
+ goto done;
}
if (p != (q + l)) {
al = SSL_AD_DECODE_ERROR;
@@ -3216,7 +3216,7 @@ int ssl3_get_client_certificate(SSL *s)
}
if (!sk_X509_push(sk, x)) {
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
- goto err;
+ goto done;
}
x = NULL;
nc += l + 3;
@@ -3279,7 +3279,7 @@ int ssl3_get_client_certificate(SSL *s)
s->session->sess_cert = ssl_sess_cert_new();
if (s->session->sess_cert == NULL) {
SSLerr(SSL_F_SSL3_GET_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
- goto err;
+ goto done;
}
}
sk_X509_pop_free(s->session->sess_cert->cert_chain, X509_free);
@@ -3288,15 +3288,13 @@ int ssl3_get_client_certificate(SSL *s)
* Inconsistency alert: cert_chain does *not* include the peer's own
* certificate, while we do include it in s3_clnt.c
*/
-
sk = NULL;
-
ret = 1;
- if (0) {
+ goto done;
+
f_err:
- ssl3_send_alert(s, SSL3_AL_FATAL, al);
- }
- err:
+ ssl3_send_alert(s, SSL3_AL_FATAL, al);
+ done:
X509_free(x);
sk_X509_pop_free(sk, X509_free);
return (ret);
diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c
index 2a07a9b596..905c8cf600 100644
--- a/ssl/ssl_asn1.c
+++ b/ssl/ssl_asn1.c
@@ -325,10 +325,6 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
if (as == NULL)
goto err;
- if (0) {
- i2d_SSL_SESSION_ASN1(NULL, NULL);
- }
-
if (!a || !*a) {
ret = SSL_SESSION_new();
if (ret == NULL)
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index a15c5f9a09..5244ecb447 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -850,12 +850,12 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
sk_X509_NAME_push(ret, xn);
}
}
+ goto done;
- if (0) {
err:
- sk_X509_NAME_pop_free(ret, X509_NAME_free);
- ret = NULL;
- }
+ sk_X509_NAME_pop_free(ret, X509_NAME_free);
+ ret = NULL;
+ done:
sk_X509_NAME_free(sk);
BIO_free(in);
X509_free(x);
@@ -911,17 +911,15 @@ int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
}
ERR_clear_error();
+ goto done;
- if (0) {
err:
ret = 0;
- }
+ done:
BIO_free(in);
if (x != NULL)
X509_free(x);
-
(void)sk_X509_NAME_set_cmp_func(stack, oldcmp);
-
return ret;
}
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 8eab3e9283..63e9712c1e 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -2838,13 +2838,11 @@ SSL *SSL_dup(SSL *s)
}
}
}
+ return ret;
- if (0) {
err:
- SSL_free(ret);
- ret = NULL;
- }
- return (ret);
+ SSL_free(ret);
+ return NULL;
}
void ssl_clear_cipher_ctx(SSL *s)