diff options
| author | bcook <> | 2015-09-10 06:36:45 +0000 |
|---|---|---|
| committer | bcook <> | 2015-09-10 06:36:45 +0000 |
| commit | 9a710e6b0b5925912e852285e56469139f812864 (patch) | |
| tree | d2c2a560bc3dd50c82a09168e7588faf83e87fdc /src | |
| parent | 3730b0c1d4819104fc57b53320c5a31c69a8c629 (diff) | |
| download | openbsd-9a710e6b0b5925912e852285e56469139f812864.tar.gz openbsd-9a710e6b0b5925912e852285e56469139f812864.tar.bz2 openbsd-9a710e6b0b5925912e852285e56469139f812864.zip | |
Fix shadowed verify_error in s_server by removing the unused global.
's_time -verify 1' will now actually verify the peer certificate.
ok beck@
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.bin/openssl/s_apps.h | 3 | ||||
| -rw-r--r-- | src/usr.bin/openssl/s_cb.c | 5 | ||||
| -rw-r--r-- | src/usr.bin/openssl/s_client.c | 3 | ||||
| -rw-r--r-- | src/usr.bin/openssl/s_time.c | 7 |
4 files changed, 8 insertions, 10 deletions
diff --git a/src/usr.bin/openssl/s_apps.h b/src/usr.bin/openssl/s_apps.h index 177ec87ae4..cd0a057845 100644 --- a/src/usr.bin/openssl/s_apps.h +++ b/src/usr.bin/openssl/s_apps.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s_apps.h,v 1.2 2015/04/14 12:56:36 jsing Exp $ */ | 1 | /* $OpenBSD: s_apps.h,v 1.3 2015/09/10 06:36:45 bcook 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 | * |
| @@ -116,7 +116,6 @@ | |||
| 116 | #define PROTOCOL "tcp" | 116 | #define PROTOCOL "tcp" |
| 117 | 117 | ||
| 118 | extern int verify_depth; | 118 | extern int verify_depth; |
| 119 | extern int verify_error; | ||
| 120 | extern int verify_return_error; | 119 | extern int verify_return_error; |
| 121 | 120 | ||
| 122 | int do_server(int port, int type, int *ret, | 121 | int do_server(int port, int type, int *ret, |
diff --git a/src/usr.bin/openssl/s_cb.c b/src/usr.bin/openssl/s_cb.c index 3bead8236a..596884ff16 100644 --- a/src/usr.bin/openssl/s_cb.c +++ b/src/usr.bin/openssl/s_cb.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s_cb.c,v 1.4 2015/07/20 21:52:07 doug Exp $ */ | 1 | /* $OpenBSD: s_cb.c,v 1.5 2015/09/10 06:36:45 bcook 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 | * |
| @@ -129,7 +129,6 @@ | |||
| 129 | #define COOKIE_SECRET_LENGTH 16 | 129 | #define COOKIE_SECRET_LENGTH 16 |
| 130 | 130 | ||
| 131 | int verify_depth = 0; | 131 | int verify_depth = 0; |
| 132 | int verify_error = X509_V_OK; | ||
| 133 | int verify_return_error = 0; | 132 | int verify_return_error = 0; |
| 134 | unsigned char cookie_secret[COOKIE_SECRET_LENGTH]; | 133 | unsigned char cookie_secret[COOKIE_SECRET_LENGTH]; |
| 135 | int cookie_initialized = 0; | 134 | int cookie_initialized = 0; |
| @@ -157,10 +156,8 @@ verify_callback(int ok, X509_STORE_CTX * ctx) | |||
| 157 | if (verify_depth >= depth) { | 156 | if (verify_depth >= depth) { |
| 158 | if (!verify_return_error) | 157 | if (!verify_return_error) |
| 159 | ok = 1; | 158 | ok = 1; |
| 160 | verify_error = X509_V_OK; | ||
| 161 | } else { | 159 | } else { |
| 162 | ok = 0; | 160 | ok = 0; |
| 163 | verify_error = X509_V_ERR_CERT_CHAIN_TOO_LONG; | ||
| 164 | } | 161 | } |
| 165 | } | 162 | } |
| 166 | switch (err) { | 163 | switch (err) { |
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c index dcda13f46c..14ba563409 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.16 2015/08/22 16:36:05 jsing Exp $ */ | 1 | /* $OpenBSD: s_client.c,v 1.17 2015/09/10 06:36:45 bcook 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 | * |
| @@ -390,7 +390,6 @@ s_client_main(int argc, char **argv) | |||
| 390 | goto end; | 390 | goto end; |
| 391 | } | 391 | } |
| 392 | verify_depth = 0; | 392 | verify_depth = 0; |
| 393 | verify_error = X509_V_OK; | ||
| 394 | c_nbio = 0; | 393 | c_nbio = 0; |
| 395 | 394 | ||
| 396 | argc--; | 395 | argc--; |
diff --git a/src/usr.bin/openssl/s_time.c b/src/usr.bin/openssl/s_time.c index 87a0a20382..ee4e584bd9 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.9 2015/08/22 16:36:05 jsing Exp $ */ | 1 | /* $OpenBSD: s_time.c,v 1.10 2015/09/10 06:36:45 bcook 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 | * |
| @@ -256,7 +256,6 @@ s_time_main(int argc, char **argv) | |||
| 256 | s_time_meth = SSLv23_client_method(); | 256 | s_time_meth = SSLv23_client_method(); |
| 257 | 257 | ||
| 258 | verify_depth = 0; | 258 | verify_depth = 0; |
| 259 | verify_error = X509_V_OK; | ||
| 260 | 259 | ||
| 261 | memset(&s_time_config, 0, sizeof(s_time_config)); | 260 | memset(&s_time_config, 0, sizeof(s_time_config)); |
| 262 | 261 | ||
| @@ -299,6 +298,8 @@ s_time_main(int argc, char **argv) | |||
| 299 | } | 298 | } |
| 300 | } | 299 | } |
| 301 | 300 | ||
| 301 | SSL_CTX_set_verify(tm_ctx, s_time_config.verify, NULL); | ||
| 302 | |||
| 302 | if (!set_cert_stuff(tm_ctx, s_time_config.certfile, | 303 | if (!set_cert_stuff(tm_ctx, s_time_config.certfile, |
| 303 | s_time_config.keyfile)) | 304 | s_time_config.keyfile)) |
| 304 | goto end; | 305 | goto end; |
| @@ -491,6 +492,7 @@ doConnection(SSL * scon) | |||
| 491 | struct pollfd pfd[1]; | 492 | struct pollfd pfd[1]; |
| 492 | SSL *serverCon; | 493 | SSL *serverCon; |
| 493 | BIO *conn; | 494 | BIO *conn; |
| 495 | long verify_error; | ||
| 494 | int i; | 496 | int i; |
| 495 | 497 | ||
| 496 | if ((conn = BIO_new(BIO_s_connect())) == NULL) | 498 | if ((conn = BIO_new(BIO_s_connect())) == NULL) |
| @@ -524,6 +526,7 @@ doConnection(SSL * scon) | |||
| 524 | } | 526 | } |
| 525 | if (i <= 0) { | 527 | if (i <= 0) { |
| 526 | BIO_printf(bio_err, "ERROR\n"); | 528 | BIO_printf(bio_err, "ERROR\n"); |
| 529 | verify_error = SSL_get_verify_result(serverCon); | ||
| 527 | if (verify_error != X509_V_OK) | 530 | if (verify_error != X509_V_OK) |
| 528 | BIO_printf(bio_err, "verify error:%s\n", | 531 | BIO_printf(bio_err, "verify error:%s\n", |
| 529 | X509_verify_cert_error_string(verify_error)); | 532 | X509_verify_cert_error_string(verify_error)); |
