[openssl-users] Same dir with different type in X509_LOOKUP_hash_dir

Jan Burgmeier jan.burgmeier at unicon-software.com
Fri Sep 28 11:11:25 UTC 2018


during setup of my X509_STORE I use X509_LOOKUP_hash_dir with same dir
but different type X509_FILETYPE_PEM and X509_FILETYPE_ASN1. But only
certificates of the first type are looked up.
I dig into the code and made a little change to fix my problem, see
attached patched. Is this behavior by design and I am doing anything
wrong or is this a bug?

Jan Burgmeier

--- a/crypto/x509/by_dir.c
+++ b/crypto/x509/by_dir.c
@@ -217,7 +217,8 @@
             for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
                 ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
-                if (strlen(ent->dir) == (size_t)len &&
+                if (type == ent->dir_type &&
+                    strlen(ent->dir) == (size_t)len &&
                     strncmp(ent->dir, ss, (unsigned int)len) == 0)

More information about the openssl-users mailing list