Remove unused X509_LOOKUP_by_* functions.

None of the built-in X509_LOOKUP functions support
X509_LOOKUP_by_fingerprint, X509_LOOKUP_by_issuer_serial, or
X509_LOOKUP_by_alias. We also made X509_LOOKUP_METHOD opaque and haven't
added the corresponding X509_LOOKUP_meth_set_* functions[*], so it is
currently impossible to usefully use these.

I found no callers which use or implement these, which makes sense. The
reason to implement X509_LOOKUP is to plug it into the X509_STORE, which
only cares about lookup by subject.

So just remove them. We can put it back later if it comes up.

[*] Actually it looks like we haven't added any way to make a custom
X509_LOOKUP_METHOD at all yet. I guess it hasn't come up yet.

Update-Note: Some unused functions were removed.
Change-Id: Ief8ba8ae9e5b339beeb59a7156e0258a7a9e70db
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/54385
Commit-Queue: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
index 9e3290d..47ccd6b 100644
--- a/crypto/x509/by_dir.c
+++ b/crypto/x509/by_dir.c
@@ -104,9 +104,6 @@
     NULL,                 // shutdown
     dir_ctrl,             // ctrl
     get_cert_by_subject,  // get_by_subject
-    NULL,                 // get_by_issuer_serial
-    NULL,                 // get_by_fingerprint
-    NULL,                 // get_by_alias
 };
 
 X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void) { return &x509_dir_lookup; }
diff --git a/crypto/x509/by_file.c b/crypto/x509/by_file.c
index 3435fc2..4c388eb 100644
--- a/crypto/x509/by_file.c
+++ b/crypto/x509/by_file.c
@@ -75,9 +75,6 @@
     NULL,          // shutdown
     by_file_ctrl,  // ctrl
     NULL,          // get_by_subject
-    NULL,          // get_by_issuer_serial
-    NULL,          // get_by_fingerprint
-    NULL,          // get_by_alias
 };
 
 X509_LOOKUP_METHOD *X509_LOOKUP_file(void) { return &x509_file_lookup; }
diff --git a/crypto/x509/internal.h b/crypto/x509/internal.h
index 7904356..edba75c 100644
--- a/crypto/x509/internal.h
+++ b/crypto/x509/internal.h
@@ -273,12 +273,6 @@
               char **ret);
   int (*get_by_subject)(X509_LOOKUP *ctx, int type, X509_NAME *name,
                         X509_OBJECT *ret);
-  int (*get_by_issuer_serial)(X509_LOOKUP *ctx, int type, X509_NAME *name,
-                              ASN1_INTEGER *serial, X509_OBJECT *ret);
-  int (*get_by_fingerprint)(X509_LOOKUP *ctx, int type, unsigned char *bytes,
-                            int len, X509_OBJECT *ret);
-  int (*get_by_alias)(X509_LOOKUP *ctx, int type, char *str, int len,
-                      X509_OBJECT *ret);
 } /* X509_LOOKUP_METHOD */;
 
 // This is used to hold everything.  It is used for all certificate
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index ea32e7b..d02aef8 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -141,33 +141,6 @@
   return ctx->method->get_by_subject(ctx, type, name, ret) > 0;
 }
 
-int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
-                                 ASN1_INTEGER *serial, X509_OBJECT *ret) {
-  if ((ctx->method == NULL) || (ctx->method->get_by_issuer_serial == NULL)) {
-    return 0;
-  }
-  if (serial->type != V_ASN1_INTEGER) {
-    return 0;
-  }
-  return ctx->method->get_by_issuer_serial(ctx, type, name, serial, ret) > 0;
-}
-
-int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, unsigned char *bytes,
-                               int len, X509_OBJECT *ret) {
-  if ((ctx->method == NULL) || (ctx->method->get_by_fingerprint == NULL)) {
-    return 0;
-  }
-  return ctx->method->get_by_fingerprint(ctx, type, bytes, len, ret) > 0;
-}
-
-int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, int len,
-                         X509_OBJECT *ret) {
-  if ((ctx->method == NULL) || (ctx->method->get_by_alias == NULL)) {
-    return 0;
-  }
-  return ctx->method->get_by_alias(ctx, type, str, len, ret) > 0;
-}
-
 static int x509_object_cmp(const X509_OBJECT **a, const X509_OBJECT **b) {
   int ret;
 
diff --git a/include/openssl/x509.h b/include/openssl/x509.h
index 441e64c..a193138 100644
--- a/include/openssl/x509.h
+++ b/include/openssl/x509.h
@@ -2733,15 +2733,6 @@
 OPENSSL_EXPORT int X509_LOOKUP_init(X509_LOOKUP *ctx);
 OPENSSL_EXPORT int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type,
                                           X509_NAME *name, X509_OBJECT *ret);
-OPENSSL_EXPORT int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type,
-                                                X509_NAME *name,
-                                                ASN1_INTEGER *serial,
-                                                X509_OBJECT *ret);
-OPENSSL_EXPORT int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
-                                              unsigned char *bytes, int len,
-                                              X509_OBJECT *ret);
-OPENSSL_EXPORT int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str,
-                                        int len, X509_OBJECT *ret);
 OPENSSL_EXPORT int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
 
 #ifndef OPENSSL_NO_STDIO