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>
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
index 57b3a83..2f483ea 100644
--- a/crypto/x509/by_dir.c
+++ b/crypto/x509/by_dir.c
@@ -93,11 +93,8 @@
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
};
diff --git a/crypto/x509/by_file.c b/crypto/x509/by_file.c
index 2c83137..a461246 100644
--- a/crypto/x509/by_file.c
+++ b/crypto/x509/by_file.c
@@ -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
};
diff --git a/crypto/x509/internal.h b/crypto/x509/internal.h
index 0f3f554..574c560 100644
--- a/crypto/x509/internal.h
+++ b/crypto/x509/internal.h
@@ -313,11 +313,8 @@
// 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 @@
// 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
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index 2f5ba58..4b59fc8 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -77,7 +77,6 @@
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 @@
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 @@
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 @@
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);