2 * Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
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
11 #include <openssl/err.h>
12 #include <openssl/provider.h>
15 * See comments in opt_verify for explanation of this.
17 enum prov_range { OPT_PROV_ENUM };
19 static int opt_provider_load(const char *provider)
23 prov = OSSL_PROVIDER_load(NULL, provider);
25 opt_printf_stderr("%s: unable to load provider %s\n",
26 opt_getprog(), provider);
32 static int opt_provider_path(const char *path)
34 if (path != NULL && *path == '\0')
36 return OSSL_PROVIDER_set_default_search_path(NULL, path);
39 int opt_provider(int opt)
41 switch ((enum prov_range)opt) {
45 case OPT_PROV_PROVIDER:
46 return opt_provider_load(opt_arg());
47 case OPT_PROV_PROVIDER_PATH:
48 return opt_provider_path(opt_arg());