summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2014-09-01 20:54:38 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2014-09-01 20:54:38 +0000
commite38c40c4f1c1fd949396b075c16bb4b478d32c8c (patch)
treedef76626474756da332ed6008cc22bccaed01753
parent7adcb729e714850518c2b5606cc38fb1fa1c414c (diff)
Enable -Wshadow in openssl(1) and fix a few shadow warnings.
ok jsing@
-rw-r--r--usr.bin/openssl/Makefile4
-rw-r--r--usr.bin/openssl/ca.c14
-rw-r--r--usr.bin/openssl/enc.c8
-rw-r--r--usr.bin/openssl/s_client.c4
-rw-r--r--usr.bin/openssl/s_time.c16
5 files changed, 21 insertions, 25 deletions
diff --git a/usr.bin/openssl/Makefile b/usr.bin/openssl/Makefile
index f4c9ed4f2b2..88b9511edfa 100644
--- a/usr.bin/openssl/Makefile
+++ b/usr.bin/openssl/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.1 2014/08/26 17:47:24 jsing Exp $
+# $OpenBSD: Makefile,v 1.2 2014/09/01 20:54:37 doug Exp $
PROG= openssl
LDADD= -lssl -lcrypto
@@ -10,7 +10,7 @@ CFLAGS+= -Wformat
CFLAGS+= -Wformat-security
CFLAGS+= -Wimplicit
CFLAGS+= -Wreturn-type
-#CFLAGS+= -Wshadow
+CFLAGS+= -Wshadow
CFLAGS+= -Wtrigraphs
CFLAGS+= -Wuninitialized
CFLAGS+= -Wunused
diff --git a/usr.bin/openssl/ca.c b/usr.bin/openssl/ca.c
index e895eab9e09..0e2e1c64505 100644
--- a/usr.bin/openssl/ca.c
+++ b/usr.bin/openssl/ca.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ca.c,v 1.2 2014/08/28 14:23:52 jsing Exp $ */
+/* $OpenBSD: ca.c,v 1.3 2014/09/01 20:54:37 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1125,7 +1125,7 @@ bad:
BIO_printf(bio_err, "writing new certificates\n");
for (i = 0; i < sk_X509_num(cert_sk); i++) {
int k;
- char *serial;
+ char *serialstr;
unsigned char *data;
x = sk_X509_value(cert_sk, i);
@@ -1133,13 +1133,13 @@ bad:
j = x->cert_info->serialNumber->length;
data = (unsigned char *)x->cert_info->serialNumber->data;
if (j > 0)
- serial = bin2hex(data, j);
+ serialstr = bin2hex(data, j);
else
- serial = strdup("00");
- if (serial) {
+ serialstr = strdup("00");
+ if (serialstr) {
k = snprintf(buf[2], sizeof(buf[2]),
- "%s/%s.pem", outdir, serial);
- free(serial);
+ "%s/%s.pem", outdir, serialstr);
+ free(serialstr);
if (k == -1 || k >= sizeof(buf[2])) {
BIO_printf(bio_err,
"certificate file name too long\n");
diff --git a/usr.bin/openssl/enc.c b/usr.bin/openssl/enc.c
index eff49818f9a..1a3b8f21b33 100644
--- a/usr.bin/openssl/enc.c
+++ b/usr.bin/openssl/enc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: enc.c,v 1.1 2014/08/26 17:47:24 jsing Exp $ */
+/* $OpenBSD: enc.c,v 1.2 2014/09/01 20:54:37 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -374,12 +374,12 @@ enc_main(int argc, char **argv)
if ((str == NULL) && (cipher != NULL) && (hkey == NULL)) {
for (;;) {
char buf[200];
- int ret;
+ int retval;
- ret = snprintf(buf, sizeof buf, "enter %s %s password:",
+ retval = snprintf(buf, sizeof buf, "enter %s %s password:",
OBJ_nid2ln(EVP_CIPHER_nid(cipher)),
(enc) ? "encryption" : "decryption");
- if (ret == -1 || ret >= sizeof buf) {
+ if ((size_t)retval >= sizeof buf) {
BIO_printf(bio_err, "Password prompt too long\n");
goto end;
}
diff --git a/usr.bin/openssl/s_client.c b/usr.bin/openssl/s_client.c
index f35624bacac..1ba399a4ae3 100644
--- a/usr.bin/openssl/s_client.c
+++ b/usr.bin/openssl/s_client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_client.c,v 1.1 2014/08/26 17:47:25 jsing Exp $ */
+/* $OpenBSD: s_client.c,v 1.2 2014/09/01 20:54:37 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -632,8 +632,6 @@ s_client_main(int argc, char **argv)
goto bad;
keymatexportlabel = *(++argv);
} else if (strcmp(*argv, "-keymatexportlen") == 0) {
- const char *errstr;
-
if (--argc < 1)
goto bad;
keymatexportlen = strtonum(*(++argv), 1, INT_MAX, &errstr);
diff --git a/usr.bin/openssl/s_time.c b/usr.bin/openssl/s_time.c
index f8c104b7d7d..7279883c870 100644
--- a/usr.bin/openssl/s_time.c
+++ b/usr.bin/openssl/s_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_time.c,v 1.1 2014/08/26 17:47:25 jsing Exp $ */
+/* $OpenBSD: s_time.c,v 1.2 2014/09/01 20:54:37 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -213,8 +213,6 @@ parseArgs(int argc, char **argv)
else if (strcmp(*argv, "-new") == 0)
perform = 1;
else if (strcmp(*argv, "-verify") == 0) {
- const char *errstr;
-
tm_verify = SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE;
if (--argc < 1)
goto bad;
@@ -375,9 +373,9 @@ s_time_main(int argc, char **argv)
goto end;
if (s_www_path != NULL) {
- int ret = snprintf(buf, sizeof buf,
+ int retval = snprintf(buf, sizeof buf,
"GET %s HTTP/1.0\r\n\r\n", s_www_path);
- if (ret == -1 || ret >= sizeof buf) {
+ if ((size_t)retval >= sizeof buf) {
fprintf(stderr, "URL too long\n");
goto end;
}
@@ -435,9 +433,9 @@ next:
goto end;
}
if (s_www_path != NULL) {
- int ret = snprintf(buf, sizeof buf,
+ int retval = snprintf(buf, sizeof buf,
"GET %s HTTP/1.0\r\n\r\n", s_www_path);
- if (ret == -1 || ret >= sizeof buf) {
+ if ((size_t)retval >= sizeof buf) {
fprintf(stderr, "URL too long\n");
goto end;
}
@@ -468,9 +466,9 @@ next:
goto end;
if (s_www_path) {
- int ret = snprintf(buf, sizeof buf,
+ int retval = snprintf(buf, sizeof buf,
"GET %s HTTP/1.0\r\n\r\n", s_www_path);
- if (ret == -1 || ret >= sizeof buf) {
+ if ((size_t)retval >= sizeof buf) {
fprintf(stderr, "URL too long\n");
goto end;
}