diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509_vfy.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index a161b330ae..2f69017e96 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.88 2021/08/28 15:22:42 beck Exp $ */ | 1 | /* $OpenBSD: x509_vfy.c,v 1.89 2021/09/03 08:58:53 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 | * |
@@ -1879,7 +1879,7 @@ x509_check_cert_time(X509_STORE_CTX *ctx, X509 *x, int depth) | |||
1879 | } | 1879 | } |
1880 | 1880 | ||
1881 | static int | 1881 | static int |
1882 | internal_verify(X509_STORE_CTX *ctx) | 1882 | x509_vfy_internal_verify(X509_STORE_CTX *ctx, int chain_verified) |
1883 | { | 1883 | { |
1884 | int n = sk_X509_num(ctx->chain) - 1; | 1884 | int n = sk_X509_num(ctx->chain) - 1; |
1885 | X509 *xi = sk_X509_value(ctx->chain, n); | 1885 | X509 *xi = sk_X509_value(ctx->chain, n); |
@@ -1915,8 +1915,8 @@ internal_verify(X509_STORE_CTX *ctx) | |||
1915 | * certificate and its depth (rather than the depth of | 1915 | * certificate and its depth (rather than the depth of |
1916 | * the subject). | 1916 | * the subject). |
1917 | */ | 1917 | */ |
1918 | if (xs != xi || | 1918 | if (!chain_verified && ( xs != xi || |
1919 | (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE)) { | 1919 | (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE))) { |
1920 | EVP_PKEY *pkey; | 1920 | EVP_PKEY *pkey; |
1921 | if ((pkey = X509_get_pubkey(xi)) == NULL) { | 1921 | if ((pkey = X509_get_pubkey(xi)) == NULL) { |
1922 | if (!verify_cb_cert(ctx, xi, xi != xs ? n+1 : n, | 1922 | if (!verify_cb_cert(ctx, xi, xi != xs ? n+1 : n, |
@@ -1933,7 +1933,7 @@ internal_verify(X509_STORE_CTX *ctx) | |||
1933 | } | 1933 | } |
1934 | check_cert: | 1934 | check_cert: |
1935 | /* Calls verify callback as needed */ | 1935 | /* Calls verify callback as needed */ |
1936 | if (!x509_check_cert_time(ctx, xs, n)) | 1936 | if (!chain_verified && !x509_check_cert_time(ctx, xs, n)) |
1937 | return 0; | 1937 | return 0; |
1938 | 1938 | ||
1939 | /* | 1939 | /* |
@@ -1954,6 +1954,18 @@ check_cert: | |||
1954 | return 1; | 1954 | return 1; |
1955 | } | 1955 | } |
1956 | 1956 | ||
1957 | static int | ||
1958 | internal_verify(X509_STORE_CTX *ctx) | ||
1959 | { | ||
1960 | return x509_vfy_internal_verify(ctx, 0); | ||
1961 | } | ||
1962 | |||
1963 | int | ||
1964 | x509_vfy_callback_indicate_success(X509_STORE_CTX *ctx) | ||
1965 | { | ||
1966 | return x509_vfy_internal_verify(ctx, 1); | ||
1967 | } | ||
1968 | |||
1957 | int | 1969 | int |
1958 | X509_cmp_current_time(const ASN1_TIME *ctm) | 1970 | X509_cmp_current_time(const ASN1_TIME *ctm) |
1959 | { | 1971 | { |