From a59082f8bb3759d8a81effcc72004b7558ce0aed Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Sun, 7 Nov 2021 15:52:39 +0000 Subject: In X509_STORE_CTX, rename the X509_STORE store rather than ctx. ok gnezdo jsing --- lib/libcrypto/x509/x509_lcl.h | 2 +- lib/libcrypto/x509/x509_lu.c | 16 ++++++++-------- lib/libcrypto/x509/x509_vfy.c | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/libcrypto/x509/x509_lcl.h b/lib/libcrypto/x509/x509_lcl.h index c9df239c3dc..8fb1f272555 100644 --- a/lib/libcrypto/x509/x509_lcl.h +++ b/lib/libcrypto/x509/x509_lcl.h @@ -327,7 +327,7 @@ struct x509_lookup_st { * and passed around. */ struct x509_store_ctx_st { - X509_STORE *ctx; + X509_STORE *store; int current_method; /* used when looking up certs */ /* The following are set by the caller */ diff --git a/lib/libcrypto/x509/x509_lu.c b/lib/libcrypto/x509/x509_lu.c index f9feaa63496..dd048972b49 100644 --- a/lib/libcrypto/x509/x509_lu.c +++ b/lib/libcrypto/x509/x509_lu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_lu.c,v 1.51 2021/11/06 12:31:40 tb Exp $ */ +/* $OpenBSD: x509_lu.c,v 1.52 2021/11/07 15:52:38 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -315,7 +315,7 @@ int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, X509_NAME *name, X509_OBJECT *ret) { - X509_STORE *ctx = vs->ctx; + X509_STORE *ctx = vs->store; X509_LOOKUP *lu; X509_OBJECT stmp, *tmp; int i; @@ -576,7 +576,7 @@ X509_get1_certs_from_cache(X509_STORE *store, X509_NAME *name) STACK_OF(X509) * X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *name) { - X509_STORE *store = ctx->ctx; + X509_STORE *store = ctx->store; STACK_OF(X509) *sk; X509_OBJECT *obj; @@ -598,7 +598,7 @@ X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *name) STACK_OF(X509_CRL) * X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *name) { - X509_STORE *store = ctx->ctx; + X509_STORE *store = ctx->store; STACK_OF(X509_CRL) *sk = NULL; X509_CRL *x = NULL; X509_OBJECT *obj = NULL; @@ -721,16 +721,16 @@ X509_STORE_CTX_get1_issuer(X509 **out_issuer, X509_STORE_CTX *ctx, X509 *x) X509_OBJECT_free(obj); obj = NULL; - if (ctx->ctx == NULL) + if (ctx->store == NULL) return 0; /* Else find index of first cert accepted by 'check_issued' */ CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); - idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn); + idx = X509_OBJECT_idx_by_subject(ctx->store->objs, X509_LU_X509, xn); if (idx != -1) /* should be true as we've had at least one match */ { /* Look through all matching certs for suitable issuer */ - for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) { - pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); + for (i = idx; i < sk_X509_OBJECT_num(ctx->store->objs); i++) { + pobj = sk_X509_OBJECT_value(ctx->store->objs, i); /* See if we've run past the matches */ if (pobj->type != X509_LU_X509) break; diff --git a/lib/libcrypto/x509/x509_vfy.c b/lib/libcrypto/x509/x509_vfy.c index aad9cf50c43..a36cc8ef71f 100644 --- a/lib/libcrypto/x509/x509_vfy.c +++ b/lib/libcrypto/x509/x509_vfy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_vfy.c,v 1.95 2021/11/07 15:51:23 tb Exp $ */ +/* $OpenBSD: x509_vfy.c,v 1.96 2021/11/07 15:52:38 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -906,8 +906,8 @@ lookup_cert_match(X509_STORE_CTX *ctx, X509 *x) X509 * x509_vfy_lookup_cert_match(X509_STORE_CTX *ctx, X509 *x) { - if (ctx->lookup_certs == NULL || ctx->ctx == NULL || - ctx->ctx->objs == NULL) + if (ctx->lookup_certs == NULL || ctx->store == NULL || + ctx->store->objs == NULL) return NULL; return lookup_cert_match(ctx, x); } @@ -1415,7 +1415,7 @@ check_crl_path(X509_STORE_CTX *ctx, X509 *x) /* Don't allow recursive CRL path validation */ if (ctx->parent) return 0; - if (!X509_STORE_CTX_init(&crl_ctx, ctx->ctx, x, ctx->untrusted)) { + if (!X509_STORE_CTX_init(&crl_ctx, ctx->store, x, ctx->untrusted)) { ret = -1; goto err; } @@ -2212,7 +2212,7 @@ X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx) X509_STORE * X509_STORE_CTX_get0_store(X509_STORE_CTX *xs) { - return xs->ctx; + return xs->store; } void @@ -2352,7 +2352,7 @@ X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, * may fail should go last to make sure 'ctx' is as consistent as * possible even on early exits. */ - ctx->ctx = store; + ctx->store = store; ctx->cert = x509; ctx->untrusted = chain; -- cgit v1.2.3