summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortedu <>2017-01-02 22:03:56 +0000
committertedu <>2017-01-02 22:03:56 +0000
commit76bc9d5fdc23892df18c905a250602f93843ddbc (patch)
tree0f4a229042d1cc1d44fcb121b1fbac991f49be7b /src
parent6aa05405d0f9fa9421ab0d6566ad1a33c4722163 (diff)
downloadopenbsd-76bc9d5fdc23892df18c905a250602f93843ddbc.tar.gz
openbsd-76bc9d5fdc23892df18c905a250602f93843ddbc.tar.bz2
openbsd-76bc9d5fdc23892df18c905a250602f93843ddbc.zip
fix cert verify. a cert with an alt chain may verify but leave an error
in the context. don't look for errors in case of success. fixes spurious verify errors. guilty change tracked and fix tested by sthen
Diffstat (limited to 'src')
-rw-r--r--src/lib/libtls/tls.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libtls/tls.c b/src/lib/libtls/tls.c
index 6937afe3b8..53a8506622 100644
--- a/src/lib/libtls/tls.c
+++ b/src/lib/libtls/tls.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls.c,v 1.53 2016/12/26 16:20:58 jsing Exp $ */ 1/* $OpenBSD: tls.c,v 1.54 2017/01/02 22:03:56 tedu Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -369,19 +369,19 @@ static int
369tls_ssl_cert_verify_cb(X509_STORE_CTX *x509_ctx, void *arg) 369tls_ssl_cert_verify_cb(X509_STORE_CTX *x509_ctx, void *arg)
370{ 370{
371 struct tls *ctx = arg; 371 struct tls *ctx = arg;
372 int x509_err; 372 int x509_err, rv;
373 373
374 if (ctx->config->verify_cert == 0) 374 if (ctx->config->verify_cert == 0)
375 return (1); 375 return (1);
376 376
377 if ((X509_verify_cert(x509_ctx)) < 0) { 377 if ((rv = X509_verify_cert(x509_ctx)) < 0) {
378 tls_set_errorx(ctx, "X509 verify cert failed"); 378 tls_set_errorx(ctx, "X509 verify cert failed");
379 return (0); 379 return (0);
380 } 380 }
381 if (rv == 1)
382 return 1;
381 383
382 x509_err = X509_STORE_CTX_get_error(x509_ctx); 384 x509_err = X509_STORE_CTX_get_error(x509_ctx);
383 if (x509_err == X509_V_OK)
384 return (1);
385 385
386 tls_set_errorx(ctx, "certificate verification failed: %s", 386 tls_set_errorx(ctx, "certificate verification failed: %s",
387 X509_verify_cert_error_string(x509_err)); 387 X509_verify_cert_error_string(x509_err));