Path: blob/main/crypto/openssl/apps/lib/app_libctx.c
34869 views
/*1* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.2*3* Licensed under the Apache License 2.0 (the "License"). You may not use4* this file except in compliance with the License. You can obtain a copy5* in the file LICENSE in the source distribution or at6* https://www.openssl.org/source/license.html7*/8#include "app_libctx.h"9#include "apps.h"1011static OSSL_LIB_CTX *app_libctx = NULL;12static const char *app_propq = NULL;1314int app_set_propq(const char *arg)15{16app_propq = arg;17return 1;18}1920const char *app_get0_propq(void)21{22return app_propq;23}2425OSSL_LIB_CTX *app_get0_libctx(void)26{27return app_libctx;28}2930OSSL_LIB_CTX *app_create_libctx(void)31{32/*33* Load the NULL provider into the default library context and create a34* library context which will then be used for any OPT_PROV options.35*/36if (app_libctx == NULL) {37if (!app_provider_load(NULL, "null")) {38opt_printf_stderr("Failed to create null provider\n");39return NULL;40}41app_libctx = OSSL_LIB_CTX_new();42}43if (app_libctx == NULL)44opt_printf_stderr("Failed to create library context\n");45return app_libctx;46}47484950