Remove unused fields in X509_LOOKUP and X509_LOOKUP_METHOD

Change-Id: I8d1d3578e0e05757744b905689939708a9353e8d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/64131
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
chromium-stable
David Benjamin 1 year ago committed by Boringssl LUCI CQ
parent 09febb3c3e
commit df67e20de6
  1. 3
      crypto/x509/by_dir.c
  2. 3
      crypto/x509/by_file.c
  3. 5
      crypto/x509/internal.h
  4. 20
      crypto/x509/x509_lu.c

@ -93,11 +93,8 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type);
static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
X509_OBJECT *ret);
static X509_LOOKUP_METHOD x509_dir_lookup = {
"Load certs from files in a directory",
new_dir, // new
free_dir, // free
NULL, // init
NULL, // shutdown
dir_ctrl, // ctrl
get_cert_by_subject, // get_by_subject
};

@ -66,11 +66,8 @@
static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
char **ret);
static X509_LOOKUP_METHOD x509_file_lookup = {
"Load file into cache",
NULL, // new
NULL, // free
NULL, // init
NULL, // shutdown
by_file_ctrl, // ctrl
NULL, // get_by_subject
};

@ -313,11 +313,8 @@ DECLARE_ASN1_ITEM(NETSCAPE_SPKAC)
// This is a static that defines the function interface
struct x509_lookup_method_st {
const char *name;
int (*new_item)(X509_LOOKUP *ctx);
void (*free)(X509_LOOKUP *ctx);
int (*init)(X509_LOOKUP *ctx);
int (*shutdown)(X509_LOOKUP *ctx);
int (*ctrl)(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
char **ret);
int (*get_by_subject)(X509_LOOKUP *ctx, int type, X509_NAME *name,
@ -357,8 +354,6 @@ struct x509_store_st {
// This is the functions plus an instance of the local variables.
struct x509_lookup_st {
int init; // have we been started
int skip; // don't use us.
X509_LOOKUP_METHOD *method; // the functions
void *method_data; // method data

@ -77,7 +77,6 @@ static int X509_OBJECT_up_ref_count(X509_OBJECT *a);
static X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);
static int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
X509_OBJECT *ret);
static int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
static X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method) {
X509_LOOKUP *ret = OPENSSL_zalloc(sizeof(X509_LOOKUP));
@ -97,23 +96,12 @@ void X509_LOOKUP_free(X509_LOOKUP *ctx) {
if (ctx == NULL) {
return;
}
if ((ctx->method != NULL) && (ctx->method->free != NULL)) {
if (ctx->method != NULL && ctx->method->free != NULL) {
(*ctx->method->free)(ctx);
}
OPENSSL_free(ctx);
}
static int X509_LOOKUP_shutdown(X509_LOOKUP *ctx) {
if (ctx->method == NULL) {
return 0;
}
if (ctx->method->shutdown != NULL) {
return ctx->method->shutdown(ctx);
} else {
return 1;
}
}
int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
char **ret) {
if (ctx->method == NULL) {
@ -128,10 +116,7 @@ int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
static int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
X509_OBJECT *ret) {
if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL)) {
return 0;
}
if (ctx->skip) {
if (ctx->method == NULL || ctx->method->get_by_subject == NULL) {
return 0;
}
// Note |get_by_subject| leaves |ret| in an inconsistent state. It has
@ -224,7 +209,6 @@ void X509_STORE_free(X509_STORE *vfy) {
sk = vfy->get_cert_methods;
for (j = 0; j < sk_X509_LOOKUP_num(sk); j++) {
lu = sk_X509_LOOKUP_value(sk, j);
X509_LOOKUP_shutdown(lu);
X509_LOOKUP_free(lu);
}
sk_X509_LOOKUP_free(sk);

Loading…
Cancel
Save