return app_libctx;
}
+/* TODO(3.0): Make this an environment variable if required */
+const char *app_get0_propq(void)
+{
+ return NULL;
+}
+
OPENSSL_CTX *app_create_libctx(void)
{
/*
if (bio == NULL)
return 0;
- xis = PEM_X509_INFO_read_bio(bio, NULL,
- (pem_password_cb *)password_callback,
- &cb_data);
+ xis = PEM_X509_INFO_read_bio_with_libctx(bio, NULL,
+ (pem_password_cb *)password_callback,
+ &cb_data,
+ app_get0_libctx(),
+ app_get0_propq());
BIO_free(bio);
{
PW_CB_DATA uidata;
OSSL_STORE_CTX *ctx = NULL;
+ OPENSSL_CTX *libctx = app_get0_libctx();
+ const char *propq = app_get0_propq();
int ret = 0;
/* TODO make use of the engine reference 'eng' when loading pkeys */
unbuffer(stdin);
bio = BIO_new_fp(stdin, 0);
if (bio != NULL)
- ctx = OSSL_STORE_attach(bio, NULL, "file", NULL,
+ ctx = OSSL_STORE_attach(bio, "file", libctx, propq,
get_ui_method(), &uidata, NULL, NULL);
uri = "<stdin>";
} else {
- ctx = OSSL_STORE_open(uri, get_ui_method(), &uidata, NULL, NULL);
+ ctx = OSSL_STORE_open_with_libctx(uri, libctx, propq, get_ui_method(),
+ &uidata, NULL, NULL);
}
if (ctx == NULL) {
BIO_printf(bio_err, "Could not open file or uri %s for loading %s\n",
{
X509_STORE *store = X509_STORE_new();
X509_LOOKUP *lookup;
+ OPENSSL_CTX *libctx = app_get0_libctx();
+ const char *propq = app_get0_propq();
if (store == NULL)
goto end;
if (lookup == NULL)
goto end;
if (CAfile != NULL) {
- if (!X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM)) {
+ if (!X509_LOOKUP_load_file_with_libctx(lookup, CAfile,
+ X509_FILETYPE_PEM,
+ libctx, propq)) {
BIO_printf(bio_err, "Error loading file %s\n", CAfile);
goto end;
}
} else {
- X509_LOOKUP_load_file(lookup, NULL, X509_FILETYPE_DEFAULT);
+ X509_LOOKUP_load_file_with_libctx(lookup, NULL,
+ X509_FILETYPE_DEFAULT,
+ libctx, propq);
}
}
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_store());
if (lookup == NULL)
goto end;
- if (!X509_LOOKUP_add_store(lookup, CAstore)) {
+ if (!X509_LOOKUP_add_store_with_libctx(lookup, CAstore, libctx, propq)) {
if (CAstore != NULL)
BIO_printf(bio_err, "Error loading store URI %s\n", CAstore);
goto end;