summaryrefslogtreecommitdiffstats
path: root/apps/lib/apps.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-06-10 16:58:12 +1000
committerPauli <pauli@openssl.org>2021-06-15 18:26:47 +1000
commita1fb5eb920fb156eda474f0e59d268316b6c893d (patch)
tree953573eb02ca107a7fe30b806fa9e0fce9b21c8e /apps/lib/apps.c
parentc696f4bfc303d9b43a3167f48b3661972495211c (diff)
apps: move global libctx and property query into their own file
The header has been split out so the functions should be as well. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15687)
Diffstat (limited to 'apps/lib/apps.c')
-rw-r--r--apps/lib/apps.c43
1 files changed, 2 insertions, 41 deletions
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index 79fe4f8409..dfbc3ec522 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -69,8 +69,6 @@ typedef struct {
unsigned long mask;
} NAME_EX_TBL;
-static OSSL_LIB_CTX *app_libctx = NULL;
-
static int set_table_opts(unsigned long *flags, const char *arg,
const NAME_EX_TBL * in_tbl);
static int set_multi_opts(unsigned long *flags, const char *arg,
@@ -336,50 +334,13 @@ static char *app_get_pass(const char *arg, int keepbio)
return OPENSSL_strdup(tpass);
}
-OSSL_LIB_CTX *app_get0_libctx(void)
-{
- return app_libctx;
-}
-
-static const char *app_propq = NULL;
-
-int app_set_propq(const char *arg)
-{
- app_propq = arg;
- return 1;
-}
-
-const char *app_get0_propq(void)
-{
- return app_propq;
-}
-
-OSSL_LIB_CTX *app_create_libctx(void)
-{
- /*
- * Load the NULL provider into the default library context and create a
- * library context which will then be used for any OPT_PROV options.
- */
- if (app_libctx == NULL) {
-
- if (!app_provider_load(NULL, "null")) {
- BIO_puts(bio_err, "Failed to create null provider\n");
- return NULL;
- }
- app_libctx = OSSL_LIB_CTX_new();
- }
- if (app_libctx == NULL)
- BIO_puts(bio_err, "Failed to create library context\n");
- return app_libctx;
-}
-
CONF *app_load_config_bio(BIO *in, const char *filename)
{
long errorline = -1;
CONF *conf;
int i;
- conf = NCONF_new_ex(app_libctx, NULL);
+ conf = NCONF_new_ex(app_get0_libctx(), NULL);
i = NCONF_load_bio(conf, in, &errorline);
if (i > 0)
return conf;
@@ -422,7 +383,7 @@ CONF *app_load_config_internal(const char *filename, int quiet)
BIO_free(in);
} else {
/* Return empty config if filename is empty string. */
- conf = NCONF_new_ex(app_libctx, NULL);
+ conf = NCONF_new_ex(app_get0_libctx(), NULL);
}
return conf;
}