diff options
author | doug <> | 2014-09-01 20:54:37 +0000 |
---|---|---|
committer | doug <> | 2014-09-01 20:54:37 +0000 |
commit | a7ac30e7ed8aea1757edfca3d7d31bbca2d3e006 (patch) | |
tree | 97288f64885dc93f5729da15f1f84bf81947bf85 /src | |
parent | 3a73303a1e6380909be747996eb639ebc395fab6 (diff) | |
download | openbsd-a7ac30e7ed8aea1757edfca3d7d31bbca2d3e006.tar.gz openbsd-a7ac30e7ed8aea1757edfca3d7d31bbca2d3e006.tar.bz2 openbsd-a7ac30e7ed8aea1757edfca3d7d31bbca2d3e006.zip |
Enable -Wshadow in openssl(1) and fix a few shadow warnings.
ok jsing@
Diffstat (limited to 'src')
-rw-r--r-- | src/usr.bin/openssl/Makefile | 4 | ||||
-rw-r--r-- | src/usr.bin/openssl/ca.c | 14 | ||||
-rw-r--r-- | src/usr.bin/openssl/enc.c | 8 | ||||
-rw-r--r-- | src/usr.bin/openssl/s_client.c | 4 | ||||
-rw-r--r-- | src/usr.bin/openssl/s_time.c | 16 |
5 files changed, 21 insertions, 25 deletions
diff --git a/src/usr.bin/openssl/Makefile b/src/usr.bin/openssl/Makefile index f4c9ed4f2b..88b9511edf 100644 --- a/src/usr.bin/openssl/Makefile +++ b/src/usr.bin/openssl/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.1 2014/08/26 17:47:24 jsing Exp $ | 1 | # $OpenBSD: Makefile,v 1.2 2014/09/01 20:54:37 doug Exp $ |
2 | 2 | ||
3 | PROG= openssl | 3 | PROG= openssl |
4 | LDADD= -lssl -lcrypto | 4 | LDADD= -lssl -lcrypto |
@@ -10,7 +10,7 @@ CFLAGS+= -Wformat | |||
10 | CFLAGS+= -Wformat-security | 10 | CFLAGS+= -Wformat-security |
11 | CFLAGS+= -Wimplicit | 11 | CFLAGS+= -Wimplicit |
12 | CFLAGS+= -Wreturn-type | 12 | CFLAGS+= -Wreturn-type |
13 | #CFLAGS+= -Wshadow | 13 | CFLAGS+= -Wshadow |
14 | CFLAGS+= -Wtrigraphs | 14 | CFLAGS+= -Wtrigraphs |
15 | CFLAGS+= -Wuninitialized | 15 | CFLAGS+= -Wuninitialized |
16 | CFLAGS+= -Wunused | 16 | CFLAGS+= -Wunused |
diff --git a/src/usr.bin/openssl/ca.c b/src/usr.bin/openssl/ca.c index e895eab9e0..0e2e1c6450 100644 --- a/src/usr.bin/openssl/ca.c +++ b/src/usr.bin/openssl/ca.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ca.c,v 1.2 2014/08/28 14:23:52 jsing Exp $ */ | 1 | /* $OpenBSD: ca.c,v 1.3 2014/09/01 20:54:37 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -1125,7 +1125,7 @@ bad: | |||
1125 | BIO_printf(bio_err, "writing new certificates\n"); | 1125 | BIO_printf(bio_err, "writing new certificates\n"); |
1126 | for (i = 0; i < sk_X509_num(cert_sk); i++) { | 1126 | for (i = 0; i < sk_X509_num(cert_sk); i++) { |
1127 | int k; | 1127 | int k; |
1128 | char *serial; | 1128 | char *serialstr; |
1129 | unsigned char *data; | 1129 | unsigned char *data; |
1130 | 1130 | ||
1131 | x = sk_X509_value(cert_sk, i); | 1131 | x = sk_X509_value(cert_sk, i); |
@@ -1133,13 +1133,13 @@ bad: | |||
1133 | j = x->cert_info->serialNumber->length; | 1133 | j = x->cert_info->serialNumber->length; |
1134 | data = (unsigned char *)x->cert_info->serialNumber->data; | 1134 | data = (unsigned char *)x->cert_info->serialNumber->data; |
1135 | if (j > 0) | 1135 | if (j > 0) |
1136 | serial = bin2hex(data, j); | 1136 | serialstr = bin2hex(data, j); |
1137 | else | 1137 | else |
1138 | serial = strdup("00"); | 1138 | serialstr = strdup("00"); |
1139 | if (serial) { | 1139 | if (serialstr) { |
1140 | k = snprintf(buf[2], sizeof(buf[2]), | 1140 | k = snprintf(buf[2], sizeof(buf[2]), |
1141 | "%s/%s.pem", outdir, serial); | 1141 | "%s/%s.pem", outdir, serialstr); |
1142 | free(serial); | 1142 | free(serialstr); |
1143 | if (k == -1 || k >= sizeof(buf[2])) { | 1143 | if (k == -1 || k >= sizeof(buf[2])) { |
1144 | BIO_printf(bio_err, | 1144 | BIO_printf(bio_err, |
1145 | "certificate file name too long\n"); | 1145 | "certificate file name too long\n"); |
diff --git a/src/usr.bin/openssl/enc.c b/src/usr.bin/openssl/enc.c index eff49818f9..1a3b8f21b3 100644 --- a/src/usr.bin/openssl/enc.c +++ b/src/usr.bin/openssl/enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: enc.c,v 1.1 2014/08/26 17:47:24 jsing Exp $ */ | 1 | /* $OpenBSD: enc.c,v 1.2 2014/09/01 20:54:37 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -374,12 +374,12 @@ enc_main(int argc, char **argv) | |||
374 | if ((str == NULL) && (cipher != NULL) && (hkey == NULL)) { | 374 | if ((str == NULL) && (cipher != NULL) && (hkey == NULL)) { |
375 | for (;;) { | 375 | for (;;) { |
376 | char buf[200]; | 376 | char buf[200]; |
377 | int ret; | 377 | int retval; |
378 | 378 | ||
379 | ret = snprintf(buf, sizeof buf, "enter %s %s password:", | 379 | retval = snprintf(buf, sizeof buf, "enter %s %s password:", |
380 | OBJ_nid2ln(EVP_CIPHER_nid(cipher)), | 380 | OBJ_nid2ln(EVP_CIPHER_nid(cipher)), |
381 | (enc) ? "encryption" : "decryption"); | 381 | (enc) ? "encryption" : "decryption"); |
382 | if (ret == -1 || ret >= sizeof buf) { | 382 | if ((size_t)retval >= sizeof buf) { |
383 | BIO_printf(bio_err, "Password prompt too long\n"); | 383 | BIO_printf(bio_err, "Password prompt too long\n"); |
384 | goto end; | 384 | goto end; |
385 | } | 385 | } |
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c index f35624baca..1ba399a4ae 100644 --- a/src/usr.bin/openssl/s_client.c +++ b/src/usr.bin/openssl/s_client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_client.c,v 1.1 2014/08/26 17:47:25 jsing Exp $ */ | 1 | /* $OpenBSD: s_client.c,v 1.2 2014/09/01 20:54:37 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -632,8 +632,6 @@ s_client_main(int argc, char **argv) | |||
632 | goto bad; | 632 | goto bad; |
633 | keymatexportlabel = *(++argv); | 633 | keymatexportlabel = *(++argv); |
634 | } else if (strcmp(*argv, "-keymatexportlen") == 0) { | 634 | } else if (strcmp(*argv, "-keymatexportlen") == 0) { |
635 | const char *errstr; | ||
636 | |||
637 | if (--argc < 1) | 635 | if (--argc < 1) |
638 | goto bad; | 636 | goto bad; |
639 | keymatexportlen = strtonum(*(++argv), 1, INT_MAX, &errstr); | 637 | keymatexportlen = strtonum(*(++argv), 1, INT_MAX, &errstr); |
diff --git a/src/usr.bin/openssl/s_time.c b/src/usr.bin/openssl/s_time.c index f8c104b7d7..7279883c87 100644 --- a/src/usr.bin/openssl/s_time.c +++ b/src/usr.bin/openssl/s_time.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_time.c,v 1.1 2014/08/26 17:47:25 jsing Exp $ */ | 1 | /* $OpenBSD: s_time.c,v 1.2 2014/09/01 20:54:37 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -213,8 +213,6 @@ parseArgs(int argc, char **argv) | |||
213 | else if (strcmp(*argv, "-new") == 0) | 213 | else if (strcmp(*argv, "-new") == 0) |
214 | perform = 1; | 214 | perform = 1; |
215 | else if (strcmp(*argv, "-verify") == 0) { | 215 | else if (strcmp(*argv, "-verify") == 0) { |
216 | const char *errstr; | ||
217 | |||
218 | tm_verify = SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE; | 216 | tm_verify = SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE; |
219 | if (--argc < 1) | 217 | if (--argc < 1) |
220 | goto bad; | 218 | goto bad; |
@@ -375,9 +373,9 @@ s_time_main(int argc, char **argv) | |||
375 | goto end; | 373 | goto end; |
376 | 374 | ||
377 | if (s_www_path != NULL) { | 375 | if (s_www_path != NULL) { |
378 | int ret = snprintf(buf, sizeof buf, | 376 | int retval = snprintf(buf, sizeof buf, |
379 | "GET %s HTTP/1.0\r\n\r\n", s_www_path); | 377 | "GET %s HTTP/1.0\r\n\r\n", s_www_path); |
380 | if (ret == -1 || ret >= sizeof buf) { | 378 | if ((size_t)retval >= sizeof buf) { |
381 | fprintf(stderr, "URL too long\n"); | 379 | fprintf(stderr, "URL too long\n"); |
382 | goto end; | 380 | goto end; |
383 | } | 381 | } |
@@ -435,9 +433,9 @@ next: | |||
435 | goto end; | 433 | goto end; |
436 | } | 434 | } |
437 | if (s_www_path != NULL) { | 435 | if (s_www_path != NULL) { |
438 | int ret = snprintf(buf, sizeof buf, | 436 | int retval = snprintf(buf, sizeof buf, |
439 | "GET %s HTTP/1.0\r\n\r\n", s_www_path); | 437 | "GET %s HTTP/1.0\r\n\r\n", s_www_path); |
440 | if (ret == -1 || ret >= sizeof buf) { | 438 | if ((size_t)retval >= sizeof buf) { |
441 | fprintf(stderr, "URL too long\n"); | 439 | fprintf(stderr, "URL too long\n"); |
442 | goto end; | 440 | goto end; |
443 | } | 441 | } |
@@ -468,9 +466,9 @@ next: | |||
468 | goto end; | 466 | goto end; |
469 | 467 | ||
470 | if (s_www_path) { | 468 | if (s_www_path) { |
471 | int ret = snprintf(buf, sizeof buf, | 469 | int retval = snprintf(buf, sizeof buf, |
472 | "GET %s HTTP/1.0\r\n\r\n", s_www_path); | 470 | "GET %s HTTP/1.0\r\n\r\n", s_www_path); |
473 | if (ret == -1 || ret >= sizeof buf) { | 471 | if ((size_t)retval >= sizeof buf) { |
474 | fprintf(stderr, "URL too long\n"); | 472 | fprintf(stderr, "URL too long\n"); |
475 | goto end; | 473 | goto end; |
476 | } | 474 | } |