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
12 #include <openssl/core.h>
13 #include <openssl/core_numbers.h>
14 #include <openssl/core_names.h>
15 #include <openssl/params.h>
16 #include "prov/implementations.h"
18 OSSL_provider_init_fn ossl_null_provider_init;
20 /* Parameters we provide to the core */
21 static const OSSL_ITEM null_param_types[] = {
22 { OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_NAME },
23 { OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_VERSION },
24 { OSSL_PARAM_UTF8_PTR, OSSL_PROV_PARAM_BUILDINFO },
28 static const OSSL_ITEM *null_gettable_params(const OSSL_PROVIDER *prov)
30 return null_param_types;
33 static int null_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[])
37 p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_NAME);
38 if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "OpenSSL Null Provider"))
40 p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_VERSION);
41 if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, OPENSSL_VERSION_STR))
43 p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_BUILDINFO);
44 if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, OPENSSL_FULL_VERSION_STR))
50 static const OSSL_ALGORITHM *null_query(OSSL_PROVIDER *prov,
58 /* Functions we provide to the core */
59 static const OSSL_DISPATCH null_dispatch_table[] = {
60 { OSSL_FUNC_PROVIDER_GETTABLE_PARAMS, (void (*)(void))null_gettable_params },
61 { OSSL_FUNC_PROVIDER_GET_PARAMS, (void (*)(void))null_get_params },
62 { OSSL_FUNC_PROVIDER_QUERY_OPERATION, (void (*)(void))null_query },
66 int ossl_null_provider_init(const OSSL_CORE_HANDLE *handle,
67 const OSSL_DISPATCH *in,
68 const OSSL_DISPATCH **out,
71 *out = null_dispatch_table;
73 /* Could be anything - we don't use it */
74 *provctx = (void *)handle;