diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index b81387a237..fbed5ec800 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_vfy.c,v 1.60 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: x509_vfy.c,v 1.61 2017/02/05 02:33:21 beck 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 | * |
@@ -1793,7 +1793,6 @@ internal_verify(X509_STORE_CTX *ctx) | |||
1793 | * peril). | 1793 | * peril). |
1794 | */ | 1794 | */ |
1795 | while (n >= 0) { | 1795 | while (n >= 0) { |
1796 | EVP_PKEY *pkey; | ||
1797 | 1796 | ||
1798 | /* | 1797 | /* |
1799 | * Skip signature check for self signed certificates | 1798 | * Skip signature check for self signed certificates |
@@ -1805,15 +1804,19 @@ internal_verify(X509_STORE_CTX *ctx) | |||
1805 | */ | 1804 | */ |
1806 | if (xs != xi || (ctx->param->flags & | 1805 | if (xs != xi || (ctx->param->flags & |
1807 | X509_V_FLAG_CHECK_SS_SIGNATURE)) { | 1806 | X509_V_FLAG_CHECK_SS_SIGNATURE)) { |
1807 | EVP_PKEY *pkey; | ||
1808 | if ((pkey = X509_get_pubkey(xi)) == NULL) { | 1808 | if ((pkey = X509_get_pubkey(xi)) == NULL) { |
1809 | if (!verify_cb_cert(ctx, xi, xi != xs ? n+1 : n, | 1809 | if (!verify_cb_cert(ctx, xi, xi != xs ? n+1 : n, |
1810 | X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY)) | 1810 | X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY)) |
1811 | return 0; | 1811 | return 0; |
1812 | } else if (X509_verify(xs, pkey) <= 0) { | 1812 | } else if (X509_verify(xs, pkey) <= 0) { |
1813 | if (!verify_cb_cert(ctx, xs, n, | 1813 | if (!verify_cb_cert(ctx, xs, n, |
1814 | X509_V_ERR_CERT_SIGNATURE_FAILURE)) | 1814 | X509_V_ERR_CERT_SIGNATURE_FAILURE)) { |
1815 | EVP_PKEY_free(pkey); | ||
1815 | return 0; | 1816 | return 0; |
1817 | } | ||
1816 | } | 1818 | } |
1819 | EVP_PKEY_free(pkey); | ||
1817 | } | 1820 | } |
1818 | check_cert: | 1821 | check_cert: |
1819 | /* Calls verify callback as needed */ | 1822 | /* Calls verify callback as needed */ |