• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 #include "app_libctx.h"
10 #include "apps.h"
11 
12 static OSSL_LIB_CTX *app_libctx = NULL;
13 static const char *app_propq = NULL;
14 
app_set_propq(const char * arg)15 int app_set_propq(const char *arg)
16 {
17     app_propq = arg;
18     return 1;
19 }
20 
app_get0_propq(void)21 const char *app_get0_propq(void)
22 {
23     return app_propq;
24 }
25 
app_get0_libctx(void)26 OSSL_LIB_CTX *app_get0_libctx(void)
27 {
28     return app_libctx;
29 }
30 
app_create_libctx(void)31 OSSL_LIB_CTX *app_create_libctx(void)
32 {
33     /*
34      * Load the NULL provider into the default library context and create a
35      * library context which will then be used for any OPT_PROV options.
36      */
37     if (app_libctx == NULL) {
38         if (!app_provider_load(NULL, "null")) {
39             opt_printf_stderr( "Failed to create null provider\n");
40             return NULL;
41         }
42         app_libctx = OSSL_LIB_CTX_new();
43     }
44     if (app_libctx == NULL)
45         opt_printf_stderr("Failed to create library context\n");
46     return app_libctx;
47 }
48 
49