Some more tweaks to ENGINE code.
[openssl.git] / crypto / x509 / by_dir.c
index c5920cc7dd9e4c5b029ea8f05fe4e3bf47a093f5..448bd7e69cca5a17c0179b03fb13e518ea1ea270 100644 (file)
@@ -326,7 +326,9 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
                /* we have added it to the cache so now pull
                 * it out again */
                CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE);
-               tmp=(X509_OBJECT *)lh_retrieve(xl->store_ctx->certs,&stmp);
+               j = sk_X509_OBJECT_find(xl->store_ctx->objs,&stmp);
+               if(j != -1) tmp=sk_X509_OBJECT_value(xl->store_ctx->objs,j);
+               else tmp = NULL;
                CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE);
 
                if (tmp != NULL)