/* Generic object loader, given expected type and criterion */
static int cache_objects(X509_LOOKUP *lctx, const char *uri,
const OSSL_STORE_SEARCH *criterion,
- int depth)
+ int depth, OPENSSL_CTX *libctx, const char *propq)
{
int ok = 0;
OSSL_STORE_CTX *ctx = NULL;
X509_STORE *xstore = X509_LOOKUP_get_store(lctx);
- if ((ctx = OSSL_STORE_open(uri, NULL, NULL, NULL, NULL)) == NULL)
+ if ((ctx = OSSL_STORE_open_with_libctx(uri, libctx, propq,
+ NULL, NULL, NULL, NULL)) == NULL)
return 0;
/*
*/
if (depth > 0)
ok = cache_objects(lctx, OSSL_STORE_INFO_get0_NAME(info),
- criterion, depth - 1);
+ criterion, depth - 1, libctx, propq);
} else {
/*
* We know that X509_STORE_add_{cert|crl} increments the object's
sk_OPENSSL_STRING_pop_free(uris, free_uri);
}
-static int by_store_ctrl(X509_LOOKUP *ctx, int cmd,
- const char *argp, long argl,
- char **retp)
+static int by_store_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd,
+ const char *argp, long argl,
+ char **retp,
+ OPENSSL_CTX *libctx, const char *propq)
{
switch (cmd) {
case X509_L_ADD_STORE:
}
case X509_L_LOAD_STORE:
/* This is a shortcut for quick loading of specific containers */
- return cache_objects(ctx, argp, NULL, 0);
+ return cache_objects(ctx, argp, NULL, 0, libctx, propq);
}
return 0;
}
+static int by_store_ctrl(X509_LOOKUP *ctx, int cmd,
+ const char *argp, long argl, char **retp)
+{
+ return by_store_ctrl_with_libctx(ctx, cmd, argp, argl, retp, NULL, NULL);
+}
+
static int by_store(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
- const OSSL_STORE_SEARCH *criterion, X509_OBJECT *ret)
+ const OSSL_STORE_SEARCH *criterion, X509_OBJECT *ret,
+ OPENSSL_CTX *libctx, const char *propq)
{
STACK_OF(OPENSSL_STRING) *uris = X509_LOOKUP_get_method_data(ctx);
int i;
for (i = 0; i < sk_OPENSSL_STRING_num(uris); i++) {
ok = cache_objects(ctx, sk_OPENSSL_STRING_value(uris, i), criterion,
- 1 /* depth */);
+ 1 /* depth */, libctx, propq);
if (ok)
break;
return ok;
}
-static int by_store_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
- const X509_NAME *name, X509_OBJECT *ret)
+static int by_store_subject_with_libctx(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
+ const X509_NAME *name, X509_OBJECT *ret,
+ OPENSSL_CTX *libctx, const char *propq)
{
OSSL_STORE_SEARCH *criterion =
OSSL_STORE_SEARCH_by_name((X509_NAME *)name); /* won't modify it */
- int ok = by_store(ctx, type, criterion, ret);
+ int ok = by_store(ctx, type, criterion, ret, libctx, propq);
STACK_OF(X509_OBJECT) *store_objects =
X509_STORE_get0_objects(X509_LOOKUP_get_store(ctx));
X509_OBJECT *tmp = NULL;
return ok;
}
+static int by_store_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
+ const X509_NAME *name, X509_OBJECT *ret)
+{
+ return by_store_subject_with_libctx(ctx, type, name, ret, NULL, NULL);
+}
+
/*
* We lack the implementations for get_by_issuer_serial, get_by_fingerprint
* and get_by_alias. There's simply not enough support in the X509_LOOKUP
NULL, /* get_by_issuer_serial */
NULL, /* get_by_fingerprint */
NULL, /* get_by_alias */
+ by_store_subject_with_libctx,
+ by_store_ctrl_with_libctx
};
X509_LOOKUP_METHOD *X509_LOOKUP_store(void)