summaryrefslogtreecommitdiff
path: root/crypto/x509/x509_vfy.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/x509/x509_vfy.c')
-rw-r--r--crypto/x509/x509_vfy.c348
1 files changed, 171 insertions, 177 deletions
diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
index d19efeaa9919..1f1fe26b98c7 100644
--- a/crypto/x509/x509_vfy.c
+++ b/crypto/x509/x509_vfy.c
@@ -30,16 +30,16 @@
/* CRL score values */
-#define CRL_SCORE_NOCRITICAL 0x100 /* No unhandled critical extensions */
-#define CRL_SCORE_SCOPE 0x080 /* certificate is within CRL scope */
-#define CRL_SCORE_TIME 0x040 /* CRL times valid */
-#define CRL_SCORE_ISSUER_NAME 0x020 /* Issuer name matches certificate */
+#define CRL_SCORE_NOCRITICAL 0x100 /* No unhandled critical extensions */
+#define CRL_SCORE_SCOPE 0x080 /* certificate is within CRL scope */
+#define CRL_SCORE_TIME 0x040 /* CRL times valid */
+#define CRL_SCORE_ISSUER_NAME 0x020 /* Issuer name matches certificate */
#define CRL_SCORE_VALID /* If this score or above CRL is probably valid */ \
(CRL_SCORE_NOCRITICAL | CRL_SCORE_TIME | CRL_SCORE_SCOPE)
-#define CRL_SCORE_ISSUER_CERT 0x018 /* CRL issuer is certificate issuer */
-#define CRL_SCORE_SAME_PATH 0x008 /* CRL issuer is on certificate path */
-#define CRL_SCORE_AKID 0x004 /* CRL issuer matches CRL AKID */
-#define CRL_SCORE_TIME_DELTA 0x002 /* Have a delta CRL with valid times */
+#define CRL_SCORE_ISSUER_CERT 0x018 /* CRL issuer is certificate issuer */
+#define CRL_SCORE_SAME_PATH 0x008 /* CRL issuer is on certificate path */
+#define CRL_SCORE_AKID 0x004 /* CRL issuer matches CRL AKID */
+#define CRL_SCORE_TIME_DELTA 0x002 /* Have a delta CRL with valid times */
static int build_chain(X509_STORE_CTX *ctx);
static int verify_chain(X509_STORE_CTX *ctx);
@@ -61,20 +61,20 @@ static int check_sig_level(X509_STORE_CTX *ctx, X509 *cert);
static int check_curve(X509 *cert);
static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer,
- unsigned int *preasons, X509_CRL *crl, X509 *x);
+ unsigned int *preasons, X509_CRL *crl, X509 *x);
static int get_crl_delta(X509_STORE_CTX *ctx,
- X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x);
+ X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x);
static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl,
- int *pcrl_score, X509_CRL *base,
- STACK_OF(X509_CRL) *crls);
+ int *pcrl_score, X509_CRL *base,
+ STACK_OF(X509_CRL) *crls);
static void crl_akid_check(X509_STORE_CTX *ctx, X509_CRL *crl, X509 **pissuer,
- int *pcrl_score);
+ int *pcrl_score);
static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
- unsigned int *preasons);
+ unsigned int *preasons);
static int check_crl_path(X509_STORE_CTX *ctx, X509 *x);
static int check_crl_chain(X509_STORE_CTX *ctx,
- STACK_OF(X509) *cert_path,
- STACK_OF(X509) *crl_path);
+ STACK_OF(X509) *cert_path,
+ STACK_OF(X509) *crl_path);
static int internal_verify(X509_STORE_CTX *ctx);
@@ -163,9 +163,9 @@ static int verify_cb_cert(X509_STORE_CTX *ctx, X509 *x, int depth, int err)
return ctx->verify_cb(0, ctx);
}
-#define CB_FAIL_IF(cond, ctx, cert, depth, err) \
+#define CB_FAIL_IF(cond, ctx, cert, depth, err) \
if ((cond) && verify_cb_cert(ctx, cert, depth, err) == 0) \
- return 0
+ return 0
/*-
* Inform the verify callback of an error, CRL-specific variant. Here, the
@@ -196,13 +196,13 @@ static int check_auth_level(X509_STORE_CTX *ctx)
* check the security of issuer keys.
*/
CB_FAIL_IF(i > 0 && !check_key_level(ctx, cert),
- ctx, cert, i, X509_V_ERR_CA_KEY_TOO_SMALL);
+ ctx, cert, i, X509_V_ERR_CA_KEY_TOO_SMALL);
/*
* We also check the signature algorithm security of all certificates
* except those of the trust anchor at index num-1.
*/
CB_FAIL_IF(i < num - 1 && !check_sig_level(ctx, cert),
- ctx, cert, i, X509_V_ERR_CA_MD_TOO_WEAK);
+ ctx, cert, i, X509_V_ERR_CA_MD_TOO_WEAK);
}
return 1;
}
@@ -222,7 +222,7 @@ static int verify_chain(X509_STORE_CTX *ctx)
return ok;
err = X509_chain_check_suiteb(&ctx->error_depth, NULL, ctx->chain,
- ctx->param->flags);
+ ctx->param->flags);
CB_FAIL_IF(err != X509_V_OK, ctx, NULL, ctx->error_depth, err);
/* Verify chain signatures and expiration times */
@@ -290,7 +290,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
/* If the peer's public key is too weak, we can stop early. */
CB_FAIL_IF(!check_key_level(ctx, ctx->cert),
- ctx, ctx->cert, 0, X509_V_ERR_EE_KEY_TOO_SMALL);
+ ctx, ctx->cert, 0, X509_V_ERR_EE_KEY_TOO_SMALL);
ret = DANETLS_ENABLED(ctx->dane) ? dane_verify(ctx) : verify_chain(ctx);
@@ -332,8 +332,7 @@ static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x)
|| !sk_X509_contains(ctx->chain, issuer))) {
if (ossl_x509_check_cert_time(ctx, issuer, -1))
return issuer;
- if (rv == NULL || ASN1_TIME_compare(X509_get0_notAfter(issuer),
- X509_get0_notAfter(rv)) > 0)
+ if (rv == NULL || ASN1_TIME_compare(X509_get0_notAfter(issuer), X509_get0_notAfter(rv)) > 0)
rv = issuer;
}
}
@@ -371,7 +370,7 @@ static int get_issuer_sk(X509 **issuer, X509_STORE_CTX *ctx, X509 *x)
* Returns NULL on internal error (such as out of memory).
*/
static STACK_OF(X509) *lookup_certs_sk(X509_STORE_CTX *ctx,
- const X509_NAME *nm)
+ const X509_NAME *nm)
{
STACK_OF(X509) *sk = sk_X509_new_null();
X509 *x;
@@ -398,7 +397,7 @@ static STACK_OF(X509) *lookup_certs_sk(X509_STORE_CTX *ctx,
* Sadly, returns 0 also on internal error.
*/
static int check_purpose(X509_STORE_CTX *ctx, X509 *x, int purpose, int depth,
- int must_be_ca)
+ int must_be_ca)
{
int tr_ok = X509_TRUST_UNTRUSTED;
@@ -471,24 +470,23 @@ static int check_extensions(X509_STORE_CTX *ctx)
allow_proxy_certs = 0;
purpose = X509_PURPOSE_CRL_SIGN;
} else {
- allow_proxy_certs =
- (ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS) != 0;
+ allow_proxy_certs = (ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS) != 0;
purpose = ctx->param->purpose;
}
for (i = 0; i < num; i++) {
x = sk_X509_value(ctx->chain, i);
CB_FAIL_IF((ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) == 0
- && (x->ex_flags & EXFLAG_CRITICAL) != 0,
- ctx, x, i, X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION);
+ && (x->ex_flags & EXFLAG_CRITICAL) != 0,
+ ctx, x, i, X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION);
CB_FAIL_IF(!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY) != 0,
- ctx, x, i, X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED);
+ ctx, x, i, X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED);
ret = X509_check_ca(x);
switch (must_be_ca) {
case -1:
CB_FAIL_IF((ctx->param->flags & X509_V_FLAG_X509_STRICT) != 0
- && ret != 1 && ret != 0,
- ctx, x, i, X509_V_ERR_INVALID_CA);
+ && ret != 1 && ret != 0,
+ ctx, x, i, X509_V_ERR_INVALID_CA);
break;
case 0:
CB_FAIL_IF(ret != 0, ctx, x, i, X509_V_ERR_INVALID_NON_CA);
@@ -496,9 +494,10 @@ static int check_extensions(X509_STORE_CTX *ctx)
default:
/* X509_V_FLAG_X509_STRICT is implicit for intermediate CAs */
CB_FAIL_IF(ret == 0
- || ((i + 1 < num
+ || ((i + 1 < num
|| (ctx->param->flags & X509_V_FLAG_X509_STRICT) != 0)
- && ret != 1), ctx, x, i, X509_V_ERR_INVALID_CA);
+ && ret != 1),
+ ctx, x, i, X509_V_ERR_INVALID_CA);
break;
}
if (num > 1) {
@@ -521,62 +520,63 @@ static int check_extensions(X509_STORE_CTX *ctx)
/* Check Basic Constraints according to RFC 5280 section 4.2.1.9 */
if (x->ex_pathlen != -1) {
CB_FAIL_IF((x->ex_flags & EXFLAG_CA) == 0,
- ctx, x, i, X509_V_ERR_PATHLEN_INVALID_FOR_NON_CA);
+ ctx, x, i, X509_V_ERR_PATHLEN_INVALID_FOR_NON_CA);
CB_FAIL_IF((x->ex_kusage & KU_KEY_CERT_SIGN) == 0, ctx,
- x, i, X509_V_ERR_PATHLEN_WITHOUT_KU_KEY_CERT_SIGN);
+ x, i, X509_V_ERR_PATHLEN_WITHOUT_KU_KEY_CERT_SIGN);
}
CB_FAIL_IF((x->ex_flags & EXFLAG_CA) != 0
- && (x->ex_flags & EXFLAG_BCONS) != 0
- && (x->ex_flags & EXFLAG_BCONS_CRITICAL) == 0,
- ctx, x, i, X509_V_ERR_CA_BCONS_NOT_CRITICAL);
+ && (x->ex_flags & EXFLAG_BCONS) != 0
+ && (x->ex_flags & EXFLAG_BCONS_CRITICAL) == 0,
+ ctx, x, i, X509_V_ERR_CA_BCONS_NOT_CRITICAL);
/* Check Key Usage according to RFC 5280 section 4.2.1.3 */
if ((x->ex_flags & EXFLAG_CA) != 0) {
CB_FAIL_IF((x->ex_flags & EXFLAG_KUSAGE) == 0,
- ctx, x, i, X509_V_ERR_CA_CERT_MISSING_KEY_USAGE);
+ ctx, x, i, X509_V_ERR_CA_CERT_MISSING_KEY_USAGE);
} else {
CB_FAIL_IF((x->ex_kusage & KU_KEY_CERT_SIGN) != 0, ctx, x, i,
- X509_V_ERR_KU_KEY_CERT_SIGN_INVALID_FOR_NON_CA);
+ X509_V_ERR_KU_KEY_CERT_SIGN_INVALID_FOR_NON_CA);
}
/* Check issuer is non-empty acc. to RFC 5280 section 4.1.2.4 */
CB_FAIL_IF(X509_NAME_entry_count(X509_get_issuer_name(x)) == 0,
- ctx, x, i, X509_V_ERR_ISSUER_NAME_EMPTY);
+ ctx, x, i, X509_V_ERR_ISSUER_NAME_EMPTY);
/* Check subject is non-empty acc. to RFC 5280 section 4.1.2.6 */
CB_FAIL_IF(((x->ex_flags & EXFLAG_CA) != 0
- || (x->ex_kusage & KU_CRL_SIGN) != 0
- || x->altname == NULL)
- && X509_NAME_entry_count(X509_get_subject_name(x)) == 0,
- ctx, x, i, X509_V_ERR_SUBJECT_NAME_EMPTY);
+ || (x->ex_kusage & KU_CRL_SIGN) != 0
+ || x->altname == NULL)
+ && X509_NAME_entry_count(X509_get_subject_name(x)) == 0,
+ ctx, x, i, X509_V_ERR_SUBJECT_NAME_EMPTY);
CB_FAIL_IF(X509_NAME_entry_count(X509_get_subject_name(x)) == 0
- && x->altname != NULL
- && (x->ex_flags & EXFLAG_SAN_CRITICAL) == 0,
- ctx, x, i, X509_V_ERR_EMPTY_SUBJECT_SAN_NOT_CRITICAL);
+ && x->altname != NULL
+ && (x->ex_flags & EXFLAG_SAN_CRITICAL) == 0,
+ ctx, x, i, X509_V_ERR_EMPTY_SUBJECT_SAN_NOT_CRITICAL);
/* Check SAN is non-empty according to RFC 5280 section 4.2.1.6 */
CB_FAIL_IF(x->altname != NULL
- && sk_GENERAL_NAME_num(x->altname) <= 0,
- ctx, x, i, X509_V_ERR_EMPTY_SUBJECT_ALT_NAME);
+ && sk_GENERAL_NAME_num(x->altname) <= 0,
+ ctx, x, i, X509_V_ERR_EMPTY_SUBJECT_ALT_NAME);
/* Check sig alg consistency acc. to RFC 5280 section 4.1.1.2 */
CB_FAIL_IF(X509_ALGOR_cmp(&x->sig_alg, &x->cert_info.signature) != 0,
- ctx, x, i, X509_V_ERR_SIGNATURE_ALGORITHM_INCONSISTENCY);
+ ctx, x, i, X509_V_ERR_SIGNATURE_ALGORITHM_INCONSISTENCY);
CB_FAIL_IF(x->akid != NULL
- && (x->ex_flags & EXFLAG_AKID_CRITICAL) != 0,
- ctx, x, i, X509_V_ERR_AUTHORITY_KEY_IDENTIFIER_CRITICAL);
+ && (x->ex_flags & EXFLAG_AKID_CRITICAL) != 0,
+ ctx, x, i, X509_V_ERR_AUTHORITY_KEY_IDENTIFIER_CRITICAL);
CB_FAIL_IF(x->skid != NULL
- && (x->ex_flags & EXFLAG_SKID_CRITICAL) != 0,
- ctx, x, i, X509_V_ERR_SUBJECT_KEY_IDENTIFIER_CRITICAL);
+ && (x->ex_flags & EXFLAG_SKID_CRITICAL) != 0,
+ ctx, x, i, X509_V_ERR_SUBJECT_KEY_IDENTIFIER_CRITICAL);
if (X509_get_version(x) >= X509_VERSION_3) {
/* Check AKID presence acc. to RFC 5280 section 4.2.1.1 */
CB_FAIL_IF(i + 1 < num /*
* this means not last cert in chain,
* taken as "generated by conforming CAs"
*/
- && (x->akid == NULL || x->akid->keyid == NULL), ctx,
- x, i, X509_V_ERR_MISSING_AUTHORITY_KEY_IDENTIFIER);
+ && (x->akid == NULL || x->akid->keyid == NULL),
+ ctx,
+ x, i, X509_V_ERR_MISSING_AUTHORITY_KEY_IDENTIFIER);
/* Check SKID presence acc. to RFC 5280 section 4.2.1.2 */
CB_FAIL_IF((x->ex_flags & EXFLAG_CA) != 0 && x->skid == NULL,
- ctx, x, i, X509_V_ERR_MISSING_SUBJECT_KEY_IDENTIFIER);
+ ctx, x, i, X509_V_ERR_MISSING_SUBJECT_KEY_IDENTIFIER);
} else {
CB_FAIL_IF(sk_X509_EXTENSION_num(X509_get0_extensions(x)) > 0,
- ctx, x, i, X509_V_ERR_EXTENSIONS_REQUIRE_VERSION_3);
+ ctx, x, i, X509_V_ERR_EXTENSIONS_REQUIRE_VERSION_3);
}
}
@@ -585,8 +585,8 @@ static int check_extensions(X509_STORE_CTX *ctx)
return 0;
/* Check path length */
CB_FAIL_IF(i > 1 && x->ex_pathlen != -1
- && plen > x->ex_pathlen + proxy_path_length,
- ctx, x, i, X509_V_ERR_PATH_LENGTH_EXCEEDED);
+ && plen > x->ex_pathlen + proxy_path_length,
+ ctx, x, i, X509_V_ERR_PATH_LENGTH_EXCEEDED);
/* Increment path length if not a self-issued intermediate CA */
if (i > 0 && (x->ex_flags & EXFLAG_SI) == 0)
plen++;
@@ -609,7 +609,7 @@ static int check_extensions(X509_STORE_CTX *ctx)
*/
if (x->ex_pcpathlen != -1) {
CB_FAIL_IF(proxy_path_length > x->ex_pcpathlen,
- ctx, x, i, X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED);
+ ctx, x, i, X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED);
proxy_path_length = x->ex_pcpathlen;
}
proxy_path_length++;
@@ -692,7 +692,7 @@ static int check_name_constraints(X509_STORE_CTX *ctx)
*/
if (X509_NAME_ENTRY_set(X509_NAME_get_entry(tmpsubject, last_loc))
== X509_NAME_ENTRY_set(X509_NAME_get_entry(tmpsubject,
- last_loc - 1))) {
+ last_loc - 1))) {
err = X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION;
goto proxy_name_done;
}
@@ -739,9 +739,11 @@ static int check_name_constraints(X509_STORE_CTX *ctx)
/* If EE certificate check commonName too */
if (rv == X509_V_OK && i == 0
&& (ctx->param->hostflags
- & X509_CHECK_FLAG_NEVER_CHECK_SUBJECT) == 0
+ & X509_CHECK_FLAG_NEVER_CHECK_SUBJECT)
+ == 0
&& ((ctx->param->hostflags
- & X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT) != 0
+ & X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT)
+ != 0
|| (ret = has_san_id(x, GEN_DNS)) == 0))
rv = NAME_CONSTRAINTS_check_CN(x, nc);
if (ret < 0)
@@ -795,7 +797,7 @@ static int check_id(X509_STORE_CTX *ctx)
return 0;
}
if (vpm->email != NULL
- && X509_check_email(x, vpm->email, vpm->emaillen, 0) <= 0) {
+ && X509_check_email(x, vpm->email, vpm->emaillen, 0) <= 0) {
if (!check_id_error(ctx, X509_V_ERR_EMAIL_MISMATCH))
return 0;
}
@@ -853,7 +855,7 @@ static int check_trust(X509_STORE_CTX *ctx, int num_untrusted)
}
if (num_untrusted == num
- && (ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN) != 0) {
+ && (ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN) != 0) {
/*
* Last-resort call with no new trusted certificates, check the leaf
* for a direct trust store match.
@@ -889,11 +891,12 @@ static int check_trust(X509_STORE_CTX *ctx, int num_untrusted)
*/
return X509_TRUST_UNTRUSTED;
- rejected:
+rejected:
return verify_cb_cert(ctx, x, i, X509_V_ERR_CERT_REJECTED) == 0
- ? X509_TRUST_REJECTED : X509_TRUST_UNTRUSTED;
+ ? X509_TRUST_REJECTED
+ : X509_TRUST_UNTRUSTED;
- trusted:
+trusted:
if (!DANETLS_ENABLED(dane))
return X509_TRUST_TRUSTED;
if (dane->pdpth < 0)
@@ -948,10 +951,20 @@ static int check_cert(X509_STORE_CTX *ctx)
unsigned int last_reasons = ctx->current_reasons;
/* Try to retrieve relevant CRL */
- if (ctx->get_crl != NULL)
+ if (ctx->get_crl != NULL) {
+ X509 *crl_issuer = NULL;
+ unsigned int reasons = 0;
+
ok = ctx->get_crl(ctx, &crl, x);
- else
+ if (crl != NULL) {
+ ctx->current_crl_score = get_crl_score(ctx, &crl_issuer,
+ &reasons, crl, x);
+ ctx->current_issuer = crl_issuer;
+ ctx->current_reasons = reasons;
+ }
+ } else {
ok = get_crl_delta(ctx, &crl, &dcrl, x);
+ }
/* If error looking up CRL, nothing we can do except notify callback */
if (!ok) {
ok = verify_cb_crl(ctx, X509_V_ERR_UNABLE_TO_GET_CRL);
@@ -993,7 +1006,7 @@ static int check_cert(X509_STORE_CTX *ctx)
goto done;
}
}
- done:
+done:
X509_CRL_free(crl);
X509_CRL_free(dcrl);
@@ -1054,8 +1067,8 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify)
}
static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl,
- X509 **pissuer, int *pscore, unsigned int *preasons,
- STACK_OF(X509_CRL) *crls)
+ X509 **pissuer, int *pscore, unsigned int *preasons,
+ STACK_OF(X509_CRL) *crls)
{
int i, crl_score, best_score = *pscore;
unsigned int reasons, best_reasons = 0;
@@ -1074,7 +1087,8 @@ static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl,
int day, sec;
if (ASN1_TIME_diff(&day, &sec, X509_CRL_get0_lastUpdate(best_crl),
- X509_CRL_get0_lastUpdate(crl)) == 0)
+ X509_CRL_get0_lastUpdate(crl))
+ == 0)
continue;
/*
* ASN1_TIME_diff never returns inconsistent signs for |day|
@@ -1150,7 +1164,8 @@ static int check_delta_base(X509_CRL *delta, X509_CRL *base)
return 0;
/* Issuer names must match */
if (X509_NAME_cmp(X509_CRL_get_issuer(base),
- X509_CRL_get_issuer(delta)) != 0)
+ X509_CRL_get_issuer(delta))
+ != 0)
return 0;
/* AKID and IDP must match */
if (!crl_extension_match(delta, base, NID_authority_key_identifier))
@@ -1169,7 +1184,7 @@ static int check_delta_base(X509_CRL *delta, X509_CRL *base)
* retrieve a chain of deltas...
*/
static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl, int *pscore,
- X509_CRL *base, STACK_OF(X509_CRL) *crls)
+ X509_CRL *base, STACK_OF(X509_CRL) *crls)
{
X509_CRL *delta;
int i;
@@ -1199,7 +1214,7 @@ static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl, int *pscore,
* is rejected, otherwise reasons is updated.
*/
static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer,
- unsigned int *preasons, X509_CRL *crl, X509 *x)
+ unsigned int *preasons, X509_CRL *crl, X509 *x)
{
int crl_score = 0;
unsigned int tmp_reasons = *preasons, crl_reasons;
@@ -1255,11 +1270,10 @@ static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer,
*preasons = tmp_reasons;
return crl_score;
-
}
static void crl_akid_check(X509_STORE_CTX *ctx, X509_CRL *crl,
- X509 **pissuer, int *pcrl_score)
+ X509 **pissuer, int *pcrl_score)
{
X509 *crl_issuer = NULL;
const X509_NAME *cnm = X509_CRL_get_issuer(crl);
@@ -1318,7 +1332,7 @@ static void crl_akid_check(X509_STORE_CTX *ctx, X509_CRL *crl,
*/
static int check_crl_path(X509_STORE_CTX *ctx, X509 *x)
{
- X509_STORE_CTX crl_ctx = {0};
+ X509_STORE_CTX crl_ctx = { 0 };
int ret;
/* Don't allow recursive CRL path validation */
@@ -1341,7 +1355,7 @@ static int check_crl_path(X509_STORE_CTX *ctx, X509 *x)
/* Check chain is acceptable */
ret = check_crl_chain(ctx, ctx->chain, crl_ctx.chain);
- err:
+err:
X509_STORE_CTX_cleanup(&crl_ctx);
return ret;
}
@@ -1355,8 +1369,8 @@ static int check_crl_path(X509_STORE_CTX *ctx, X509 *x)
* RFC5280 version
*/
static int check_crl_chain(X509_STORE_CTX *ctx,
- STACK_OF(X509) *cert_path,
- STACK_OF(X509) *crl_path)
+ STACK_OF(X509) *cert_path,
+ STACK_OF(X509) *crl_path)
{
X509 *cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1);
X509 *crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1);
@@ -1424,7 +1438,6 @@ static int idp_check_dp(DIST_POINT_NAME *a, DIST_POINT_NAME *b)
}
return 0;
-
}
static int crldp_check_crlissuer(DIST_POINT *dp, X509_CRL *crl, int crl_score)
@@ -1448,7 +1461,7 @@ static int crldp_check_crlissuer(DIST_POINT *dp, X509_CRL *crl, int crl_score)
/* Check CRLDP and IDP */
static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
- unsigned int *preasons)
+ unsigned int *preasons)
{
int i;
@@ -1467,14 +1480,14 @@ static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
if (crldp_check_crlissuer(dp, crl, crl_score)) {
if (crl->idp == NULL
- || idp_check_dp(dp->distpoint, crl->idp->distpoint)) {
+ || idp_check_dp(dp->distpoint, crl->idp->distpoint)) {
*preasons &= dp->dp_reasons;
return 1;
}
}
}
return (crl->idp == NULL || crl->idp->distpoint == NULL)
- && (crl_score & CRL_SCORE_ISSUER_NAME) != 0;
+ && (crl_score & CRL_SCORE_ISSUER_NAME) != 0;
}
/*
@@ -1482,7 +1495,7 @@ static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score,
* to find a delta CRL too
*/
static int get_crl_delta(X509_STORE_CTX *ctx,
- X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
+ X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
{
int ok;
X509 *issuer = NULL;
@@ -1494,7 +1507,7 @@ static int get_crl_delta(X509_STORE_CTX *ctx,
reasons = ctx->current_reasons;
ok = get_crl_sk(ctx, &crl, &dcrl,
- &issuer, &crl_score, &reasons, ctx->crls);
+ &issuer, &crl_score, &reasons, ctx->crls);
if (ok)
goto done;
@@ -1509,7 +1522,7 @@ static int get_crl_delta(X509_STORE_CTX *ctx,
sk_X509_CRL_pop_free(skcrl, X509_CRL_free);
- done:
+done:
/* If we got any kind of CRL use it and return success */
if (crl != NULL) {
ctx->current_issuer = issuer;
@@ -1533,17 +1546,16 @@ static int check_crl(X509_STORE_CTX *ctx, X509_CRL *crl)
/* If we have an alternative CRL issuer cert use that */
if (ctx->current_issuer != NULL) {
issuer = ctx->current_issuer;
- /*
- * Else find CRL issuer: if not last certificate then issuer is next
- * certificate in chain.
- */
+ /*
+ * Else find CRL issuer: if not last certificate then issuer is next
+ * certificate in chain.
+ */
} else if (cnum < chnum) {
issuer = sk_X509_value(ctx->chain, cnum + 1);
} else {
issuer = sk_X509_value(ctx->chain, chnum);
/* If not self-issued, can't check signature */
- if (!ctx->check_issued(ctx, issuer, issuer) &&
- !verify_cb_crl(ctx, X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER))
+ if (!ctx->check_issued(ctx, issuer, issuer) && !verify_cb_crl(ctx, X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER))
return 0;
}
@@ -1555,33 +1567,25 @@ static int check_crl(X509_STORE_CTX *ctx, X509_CRL *crl)
*/
if (crl->base_crl_number == NULL) {
/* Check for cRLSign bit if keyUsage present */
- if ((issuer->ex_flags & EXFLAG_KUSAGE) != 0 &&
- (issuer->ex_kusage & KU_CRL_SIGN) == 0 &&
- !verify_cb_crl(ctx, X509_V_ERR_KEYUSAGE_NO_CRL_SIGN))
+ if ((issuer->ex_flags & EXFLAG_KUSAGE) != 0 && (issuer->ex_kusage & KU_CRL_SIGN) == 0 && !verify_cb_crl(ctx, X509_V_ERR_KEYUSAGE_NO_CRL_SIGN))
return 0;
- if ((ctx->current_crl_score & CRL_SCORE_SCOPE) == 0 &&
- !verify_cb_crl(ctx, X509_V_ERR_DIFFERENT_CRL_SCOPE))
+ if ((ctx->current_crl_score & CRL_SCORE_SCOPE) == 0 && !verify_cb_crl(ctx, X509_V_ERR_DIFFERENT_CRL_SCOPE))
return 0;
- if ((ctx->current_crl_score & CRL_SCORE_SAME_PATH) == 0 &&
- check_crl_path(ctx, ctx->current_issuer) <= 0 &&
- !verify_cb_crl(ctx, X509_V_ERR_CRL_PATH_VALIDATION_ERROR))
+ if ((ctx->current_crl_score & CRL_SCORE_SAME_PATH) == 0 && check_crl_path(ctx, ctx->current_issuer) <= 0 && !verify_cb_crl(ctx, X509_V_ERR_CRL_PATH_VALIDATION_ERROR))
return 0;
- if ((crl->idp_flags & IDP_INVALID) != 0 &&
- !verify_cb_crl(ctx, X509_V_ERR_INVALID_EXTENSION))
+ if ((crl->idp_flags & IDP_INVALID) != 0 && !verify_cb_crl(ctx, X509_V_ERR_INVALID_EXTENSION))
return 0;
}
- if ((ctx->current_crl_score & CRL_SCORE_TIME) == 0 &&
- !check_crl_time(ctx, crl, 1))
+ if ((ctx->current_crl_score & CRL_SCORE_TIME) == 0 && !check_crl_time(ctx, crl, 1))
return 0;
/* Attempt to get issuer certificate public key */
ikey = X509_get0_pubkey(issuer);
- if (ikey == NULL &&
- !verify_cb_crl(ctx, X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY))
+ if (ikey == NULL && !verify_cb_crl(ctx, X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY))
return 0;
if (ikey != NULL) {
@@ -1590,8 +1594,7 @@ static int check_crl(X509_STORE_CTX *ctx, X509_CRL *crl)
if (rv != X509_V_OK && !verify_cb_crl(ctx, rv))
return 0;
/* Verify CRL signature */
- if (X509_CRL_verify(crl, ikey) <= 0 &&
- !verify_cb_crl(ctx, X509_V_ERR_CRL_SIGNATURE_FAILURE))
+ if (X509_CRL_verify(crl, ikey) <= 0 && !verify_cb_crl(ctx, X509_V_ERR_CRL_SIGNATURE_FAILURE))
return 0;
}
return 1;
@@ -1609,8 +1612,7 @@ static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x)
* change the meaning of CRL entries.
*/
if ((ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) == 0
- && (crl->flags & EXFLAG_CRITICAL) != 0 &&
- !verify_cb_crl(ctx, X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION))
+ && (crl->flags & EXFLAG_CRITICAL) != 0 && !verify_cb_crl(ctx, X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION))
return 0;
/*
* Look for serial number of certificate in CRL. If found, make sure
@@ -1646,7 +1648,7 @@ static int check_policy(X509_STORE_CTX *ctx)
if (ctx->bare_ta_signed && !sk_X509_push(ctx->chain, NULL))
goto memerr;
ret = X509_policy_check(&ctx->tree, &ctx->explicit_policy, ctx->chain,
- ctx->param->policies, ctx->param->flags);
+ ctx->param->policies, ctx->param->flags);
if (ctx->bare_ta_signed)
(void)sk_X509_pop(ctx->chain);
@@ -1663,7 +1665,7 @@ static int check_policy(X509_STORE_CTX *ctx)
if ((x->ex_flags & EXFLAG_INVALID_POLICY) != 0)
cbcalled = 1;
CB_FAIL_IF((x->ex_flags & EXFLAG_INVALID_POLICY) != 0,
- ctx, x, i, X509_V_ERR_INVALID_POLICY_EXTENSION);
+ ctx, x, i, X509_V_ERR_INVALID_POLICY_EXTENSION);
}
if (!cbcalled) {
/* Should not be able to get here */
@@ -1697,7 +1699,7 @@ static int check_policy(X509_STORE_CTX *ctx)
return 1;
- memerr:
+memerr:
ERR_raise(ERR_LIB_X509, ERR_R_MALLOC_FAILURE);
ctx->error = X509_V_ERR_OUT_OF_MEM;
return -1;
@@ -1755,15 +1757,15 @@ static int internal_verify(X509_STORE_CTX *ctx)
*/
xi = NULL;
} else if (ossl_x509_likely_issued(xi, xi) != X509_V_OK
- /* exceptional case: last cert in the chain is not self-issued */
- && ((ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN) == 0)) {
+ /* exceptional case: last cert in the chain is not self-issued */
+ && ((ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN) == 0)) {
if (n > 0) {
n--;
ctx->error_depth = n;
xs = sk_X509_value(ctx->chain, n);
} else {
CB_FAIL_IF(1, ctx, xi, 0,
- X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE);
+ X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE);
}
/*
* The below code will certainly not do a
@@ -1813,15 +1815,16 @@ static int internal_verify(X509_STORE_CTX *ctx)
* we are free to ignore any key usage restrictions on such certs.
*/
int ret = xs == xi && (xi->ex_flags & EXFLAG_CA) == 0
- ? X509_V_OK : ossl_x509_signing_allowed(xi, xs);
+ ? X509_V_OK
+ : ossl_x509_signing_allowed(xi, xs);
CB_FAIL_IF(ret != X509_V_OK, ctx, xi, issuer_depth, ret);
if ((pkey = X509_get0_pubkey(xi)) == NULL) {
CB_FAIL_IF(1, ctx, xi, issuer_depth,
- X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY);
+ X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY);
} else {
CB_FAIL_IF(X509_verify(xs, pkey) <= 0,
- ctx, xs, n, X509_V_ERR_CERT_SIGNATURE_FAILURE);
+ ctx, xs, n, X509_V_ERR_CERT_SIGNATURE_FAILURE);
}
}
@@ -1918,7 +1921,7 @@ int X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time)
*/
ret = (day >= 0 && sec >= 0) ? -1 : 1;
- err:
+err:
ASN1_TIME_free(asn1_cmp_time);
return ret;
}
@@ -1928,7 +1931,7 @@ int X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time)
* or else 1 if it is past the end, or -1 if it is before the start
*/
int X509_cmp_timeframe(const X509_VERIFY_PARAM *vpm,
- const ASN1_TIME *start, const ASN1_TIME *end)
+ const ASN1_TIME *start, const ASN1_TIME *end)
{
time_t ref_time;
time_t *time = NULL;
@@ -1959,7 +1962,7 @@ ASN1_TIME *X509_time_adj(ASN1_TIME *s, long offset_sec, time_t *in_tm)
}
ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s,
- int offset_day, long offset_sec, time_t *in_tm)
+ int offset_day, long offset_sec, time_t *in_tm)
{
time_t t;
@@ -2018,7 +2021,7 @@ int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain)
* Sadly, returns NULL also on internal error.
*/
X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
- EVP_PKEY *skey, const EVP_MD *md, unsigned int flags)
+ EVP_PKEY *skey, const EVP_MD *md, unsigned int flags)
{
X509_CRL *crl = NULL;
int i;
@@ -2036,7 +2039,8 @@ X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
}
/* Issuer names must match */
if (X509_NAME_cmp(X509_CRL_get_issuer(base),
- X509_CRL_get_issuer(newer)) != 0) {
+ X509_CRL_get_issuer(newer))
+ != 0) {
ERR_raise(ERR_LIB_X509, X509_R_ISSUER_MISMATCH);
return NULL;
}
@@ -2055,8 +2059,7 @@ X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
return NULL;
}
/* CRLs must verify */
- if (skey != NULL && (X509_CRL_verify(base, skey) <= 0 ||
- X509_CRL_verify(newer, skey) <= 0)) {
+ if (skey != NULL && (X509_CRL_verify(base, skey) <= 0 || X509_CRL_verify(newer, skey) <= 0)) {
ERR_raise(ERR_LIB_X509, X509_R_CRL_VERIFY_FAILURE);
return NULL;
}
@@ -2116,7 +2119,7 @@ X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
return crl;
- memerr:
+memerr:
ERR_raise(ERR_LIB_X509, ERR_R_MALLOC_FAILURE);
X509_CRL_free(crl);
return NULL;
@@ -2229,7 +2232,7 @@ int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust)
* client/server.
*/
int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
- int purpose, int trust)
+ int purpose, int trust)
{
int idx;
@@ -2319,7 +2322,7 @@ void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
}
int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
- STACK_OF(X509) *chain)
+ STACK_OF(X509) *chain)
{
if (ctx == NULL) {
ERR_raise(ERR_LIB_X509, ERR_R_PASSED_NULL_PARAMETER);
@@ -2439,11 +2442,11 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
}
if (CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx,
- &ctx->ex_data))
+ &ctx->ex_data))
return 1;
ERR_raise(ERR_LIB_X509, ERR_R_MALLOC_FAILURE);
- err:
+err:
/*
* On error clean up allocated storage, if the store context was not
* allocated with X509_STORE_CTX_new() this is our last chance to do so.
@@ -2500,7 +2503,7 @@ void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags)
}
void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
- time_t t)
+ time_t t)
{
X509_VERIFY_PARAM_set_time(ctx->param, t);
}
@@ -2527,7 +2530,7 @@ void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *sk)
}
void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
- X509_STORE_CTX_verify_cb verify_cb)
+ X509_STORE_CTX_verify_cb verify_cb)
{
ctx->verify_cb = verify_cb;
}
@@ -2538,7 +2541,7 @@ X509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(const X509_STORE_CTX *ctx)
}
void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx,
- X509_STORE_CTX_verify_fn verify)
+ X509_STORE_CTX_verify_fn verify)
{
ctx->verify = verify;
}
@@ -2650,7 +2653,7 @@ void X509_STORE_CTX_set0_dane(X509_STORE_CTX *ctx, SSL_DANE *dane)
}
static unsigned char *dane_i2d(X509 *cert, uint8_t selector,
- unsigned int *i2dlen)
+ unsigned int *i2dlen)
{
unsigned char *buf = NULL;
int len;
@@ -2804,8 +2807,7 @@ static int dane_match(X509_STORE_CTX *ctx, X509 *cert, int depth)
* DANE match is dispositive, but with PKIX we still need to build a
* full chain.
*/
- if (cmplen == t->dlen &&
- memcmp(cmpbuf, t->data, cmplen) == 0) {
+ if (cmplen == t->dlen && memcmp(cmpbuf, t->data, cmplen) == 0) {
if (DANETLS_USAGE_BIT(usage) & DANETLS_DANE_MASK)
matched = 1;
if (matched || dane->mdpth < 0) {
@@ -2861,10 +2863,7 @@ static int check_dane_pkeys(X509_STORE_CTX *ctx)
for (i = 0; i < recnum; ++i) {
t = sk_danetls_record_value(dane->trecs, i);
- if (t->usage != DANETLS_USAGE_DANE_TA ||
- t->selector != DANETLS_SELECTOR_SPKI ||
- t->mtype != DANETLS_MATCHING_FULL ||
- X509_verify(cert, t->spki) <= 0)
+ if (t->usage != DANETLS_USAGE_DANE_TA || t->selector != DANETLS_SELECTOR_SPKI || t->mtype != DANETLS_MATCHING_FULL || X509_verify(cert, t->spki) <= 0)
continue;
/* Clear any PKIX-?? matches that failed to extend to a full chain */
@@ -2938,8 +2937,7 @@ static int dane_verify(X509_STORE_CTX *ctx)
if (!check_leaf_suiteb(ctx, cert))
return 0;
/* Callback invoked as needed */
- if ((dane->flags & DANE_FLAG_NO_DANE_EE_NAMECHECKS) == 0 &&
- !check_id(ctx))
+ if ((dane->flags & DANE_FLAG_NO_DANE_EE_NAMECHECKS) == 0 && !check_id(ctx))
return 0;
/* Bypass internal_verify(), issue depth 0 success callback */
ctx->error_depth = 0;
@@ -3004,7 +3002,7 @@ static int build_chain(X509_STORE_CTX *ctx)
goto int_err;
#define S_DOUNTRUSTED (1 << 0) /* Search untrusted chain */
-#define S_DOTRUSTED (1 << 1) /* Search trusted store */
+#define S_DOTRUSTED (1 << 1) /* Search trusted store */
#define S_DOALTERNATE (1 << 2) /* Retry with pruned alternate chain */
/*
* Set up search policy, untrusted if possible, trusted-first if enabled,
@@ -3138,14 +3136,12 @@ static int build_chain(X509_STORE_CTX *ctx)
X509_free(sk_X509_pop(ctx->chain));
ctx->num_untrusted = num;
- if (DANETLS_ENABLED(dane) &&
- dane->mdpth >= ctx->num_untrusted) {
+ if (DANETLS_ENABLED(dane) && dane->mdpth >= ctx->num_untrusted) {
dane->mdpth = -1;
X509_free(dane->mcert);
dane->mcert = NULL;
}
- if (DANETLS_ENABLED(dane) &&
- dane->pdpth >= ctx->num_untrusted)
+ if (DANETLS_ENABLED(dane) && dane->pdpth >= ctx->num_untrusted)
dane->pdpth = -1;
}
@@ -3214,8 +3210,7 @@ static int build_chain(X509_STORE_CTX *ctx)
if ((search & S_DOALTERNATE) != 0 && --alt_untrusted > 0)
continue;
/* Still no luck and no fallbacks left? */
- if (!may_alternate || (search & S_DOALTERNATE) != 0 ||
- ctx->num_untrusted < 2)
+ if (!may_alternate || (search & S_DOALTERNATE) != 0 || ctx->num_untrusted < 2)
break;
/* Search for a trusted issuer of a shorter chain */
search |= S_DOALTERNATE;
@@ -3231,8 +3226,7 @@ static int build_chain(X509_STORE_CTX *ctx)
if (!ossl_assert(num == ctx->num_untrusted))
goto int_err;
curr = sk_X509_value(ctx->chain, num - 1);
- issuer = (X509_self_signed(curr, 0) > 0 || num > max_depth) ?
- NULL : find_issuer(ctx, sk_untrusted, curr);
+ issuer = (X509_self_signed(curr, 0) > 0 || num > max_depth) ? NULL : find_issuer(ctx, sk_untrusted, curr);
if (issuer == NULL) {
/*
* Once we have reached a self-signed cert or num > max_depth
@@ -3284,7 +3278,7 @@ static int build_chain(X509_STORE_CTX *ctx)
return 0;
case X509_TRUST_UNTRUSTED:
default:
- switch(ctx->error) {
+ switch (ctx->error) {
case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
case X509_V_ERR_CERT_NOT_YET_VALID:
case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
@@ -3296,28 +3290,28 @@ static int build_chain(X509_STORE_CTX *ctx)
break;
}
CB_FAIL_IF(num > max_depth,
- ctx, NULL, num - 1, X509_V_ERR_CERT_CHAIN_TOO_LONG);
+ ctx, NULL, num - 1, X509_V_ERR_CERT_CHAIN_TOO_LONG);
CB_FAIL_IF(DANETLS_ENABLED(dane)
- && (!DANETLS_HAS_PKIX(dane) || dane->pdpth >= 0),
- ctx, NULL, num - 1, X509_V_ERR_DANE_NO_MATCH);
+ && (!DANETLS_HAS_PKIX(dane) || dane->pdpth >= 0),
+ ctx, NULL, num - 1, X509_V_ERR_DANE_NO_MATCH);
if (X509_self_signed(sk_X509_value(ctx->chain, num - 1), 0) > 0)
return verify_cb_cert(ctx, NULL, num - 1,
- num == 1
- ? X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
- : X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN);
+ num == 1
+ ? X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
+ : X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN);
return verify_cb_cert(ctx, NULL, num - 1,
- ctx->num_untrusted < num
- ? X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
- : X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY);
+ ctx->num_untrusted < num
+ ? X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
+ : X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY);
}
- int_err:
+int_err:
ERR_raise(ERR_LIB_X509, ERR_R_INTERNAL_ERROR);
ctx->error = X509_V_ERR_UNSPECIFIED;
sk_X509_free(sk_untrusted);
return -1;
- memerr:
+memerr:
ERR_raise(ERR_LIB_X509, ERR_R_MALLOC_FAILURE);
ctx->error = X509_V_ERR_OUT_OF_MEM;
sk_X509_free(sk_untrusted);
@@ -3325,8 +3319,8 @@ static int build_chain(X509_STORE_CTX *ctx)
}
STACK_OF(X509) *X509_build_chain(X509 *target, STACK_OF(X509) *certs,
- X509_STORE *store, int with_self_signed,
- OSSL_LIB_CTX *libctx, const char *propq)
+ X509_STORE *store, int with_self_signed,
+ OSSL_LIB_CTX *libctx, const char *propq)
{
int finish_chain = store != NULL;
X509_STORE_CTX *ctx;
@@ -3361,7 +3355,7 @@ STACK_OF(X509) *X509_build_chain(X509 *target, STACK_OF(X509) *certs,
result = NULL;
}
- err:
+err:
X509_STORE_CTX_free(ctx);
return result;
}
@@ -3419,8 +3413,8 @@ static int check_curve(X509 *cert)
int ret, val;
ret = EVP_PKEY_get_int_param(pkey,
- OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS,
- &val);
+ OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS,
+ &val);
return ret == 1 ? !val : -1;
}