Import OpenSSL1.1.1k
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -323,9 +323,10 @@ static int sk_X509_contains(STACK_OF(X509) *sk, X509 *cert)
|
||||
}
|
||||
|
||||
/*
|
||||
* Find in given STACK_OF(X509) sk a non-expired issuer cert (if any) of given cert x.
|
||||
* The issuer must not be the same as x and must not yet be in ctx->chain, where the
|
||||
* exceptional case x is self-issued and ctx->chain has just one element is allowed.
|
||||
* Find in given STACK_OF(X509) sk an issuer cert of given cert x.
|
||||
* The issuer must not yet be in ctx->chain, where the exceptional case
|
||||
* that x is self-issued and ctx->chain has just one element is allowed.
|
||||
* Prefer the first one that is not expired, else take the last expired one.
|
||||
*/
|
||||
static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x)
|
||||
{
|
||||
@@ -334,11 +335,7 @@ static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x)
|
||||
|
||||
for (i = 0; i < sk_X509_num(sk); i++) {
|
||||
issuer = sk_X509_value(sk, i);
|
||||
/*
|
||||
* Below check 'issuer != x' is an optimization and safety precaution:
|
||||
* Candidate issuer cert cannot be the same as the subject cert 'x'.
|
||||
*/
|
||||
if (issuer != x && ctx->check_issued(ctx, x, issuer)
|
||||
if (ctx->check_issued(ctx, x, issuer)
|
||||
&& (((x->ex_flags & EXFLAG_SI) != 0 && sk_X509_num(ctx->chain) == 1)
|
||||
|| !sk_X509_contains(ctx->chain, issuer))) {
|
||||
rv = issuer;
|
||||
@@ -527,15 +524,19 @@ static int check_chain_extensions(X509_STORE_CTX *ctx)
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
if ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && num > 1) {
|
||||
if (ret > 0
|
||||
&& (ctx->param->flags & X509_V_FLAG_X509_STRICT) && num > 1) {
|
||||
/* Check for presence of explicit elliptic curve parameters */
|
||||
ret = check_curve(x);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
ctx->error = X509_V_ERR_UNSPECIFIED;
|
||||
else if (ret == 0)
|
||||
ret = 0;
|
||||
} else if (ret == 0) {
|
||||
ctx->error = X509_V_ERR_EC_KEY_EXPLICIT_PARAMS;
|
||||
}
|
||||
}
|
||||
if ((x->ex_flags & EXFLAG_CA) == 0
|
||||
if (ret > 0
|
||||
&& (x->ex_flags & EXFLAG_CA) == 0
|
||||
&& x->ex_pathlen != -1
|
||||
&& (ctx->param->flags & X509_V_FLAG_X509_STRICT)) {
|
||||
ctx->error = X509_V_ERR_INVALID_EXTENSION;
|
||||
|
||||
Reference in New Issue
Block a user