Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/crypto/openssl/include/internal/provider.h
34879 views
1
/*
2
* Copyright 2019-2025 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
10
#ifndef OSSL_INTERNAL_PROVIDER_H
11
# define OSSL_INTERNAL_PROVIDER_H
12
# pragma once
13
14
# include <openssl/core.h>
15
# include <openssl/core_dispatch.h>
16
# include "internal/dso.h"
17
# include "internal/symhacks.h"
18
19
# ifdef __cplusplus
20
extern "C" {
21
# endif
22
23
/*
24
* namespaces:
25
*
26
* ossl_provider_ Provider Object internal API
27
* OSSL_PROVIDER Provider Object
28
*/
29
30
/* Provider Object finder, constructor and destructor */
31
OSSL_PROVIDER *ossl_provider_find(OSSL_LIB_CTX *libctx, const char *name,
32
int noconfig);
33
OSSL_PROVIDER *ossl_provider_new(OSSL_LIB_CTX *libctx, const char *name,
34
OSSL_provider_init_fn *init_function,
35
OSSL_PARAM *params, int noconfig);
36
int ossl_provider_up_ref(OSSL_PROVIDER *prov);
37
void ossl_provider_free(OSSL_PROVIDER *prov);
38
39
/* Setters */
40
int ossl_provider_set_module_path(OSSL_PROVIDER *prov, const char *module_path);
41
42
int ossl_provider_is_child(const OSSL_PROVIDER *prov);
43
int ossl_provider_set_child(OSSL_PROVIDER *prov, const OSSL_CORE_HANDLE *handle);
44
const OSSL_CORE_HANDLE *ossl_provider_get_parent(OSSL_PROVIDER *prov);
45
int ossl_provider_up_ref_parent(OSSL_PROVIDER *prov, int activate);
46
int ossl_provider_free_parent(OSSL_PROVIDER *prov, int deactivate);
47
int ossl_provider_default_props_update(OSSL_LIB_CTX *libctx, const char *props);
48
49
/* Disable fallback loading */
50
int ossl_provider_disable_fallback_loading(OSSL_LIB_CTX *libctx);
51
52
/*
53
* Activate the Provider
54
* If the Provider is a module, the module will be loaded
55
*/
56
int ossl_provider_activate(OSSL_PROVIDER *prov, int upcalls, int aschild);
57
int ossl_provider_deactivate(OSSL_PROVIDER *prov, int removechildren);
58
int ossl_provider_add_to_store(OSSL_PROVIDER *prov, OSSL_PROVIDER **actualprov,
59
int retain_fallbacks);
60
61
/* Return pointer to the provider's context */
62
void *ossl_provider_ctx(const OSSL_PROVIDER *prov);
63
64
/* Force loading of fallback providers if necessary */
65
int ossl_provider_activate_fallbacks(OSSL_LIB_CTX *ctx);
66
67
/* Iterate over all loaded providers */
68
int ossl_provider_doall_activated(OSSL_LIB_CTX *,
69
int (*cb)(OSSL_PROVIDER *provider,
70
void *cbdata),
71
void *cbdata);
72
73
/* Getters for other library functions */
74
const char *ossl_provider_name(const OSSL_PROVIDER *prov);
75
const DSO *ossl_provider_dso(const OSSL_PROVIDER *prov);
76
const char *ossl_provider_module_name(const OSSL_PROVIDER *prov);
77
const char *ossl_provider_module_path(const OSSL_PROVIDER *prov);
78
const OSSL_DISPATCH *ossl_provider_get0_dispatch(const OSSL_PROVIDER *prov);
79
OSSL_LIB_CTX *ossl_provider_libctx(const OSSL_PROVIDER *prov);
80
81
/* Thin wrappers around calls to the provider */
82
void ossl_provider_teardown(const OSSL_PROVIDER *prov);
83
const OSSL_PARAM *ossl_provider_gettable_params(const OSSL_PROVIDER *prov);
84
int ossl_provider_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]);
85
int ossl_provider_get_capabilities(const OSSL_PROVIDER *prov,
86
const char *capability,
87
OSSL_CALLBACK *cb,
88
void *arg);
89
int ossl_provider_self_test(const OSSL_PROVIDER *prov);
90
int ossl_provider_random_bytes(const OSSL_PROVIDER *prov, int which,
91
void *buf, size_t n, unsigned int strength);
92
const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov,
93
int operation_id,
94
int *no_cache);
95
void ossl_provider_unquery_operation(const OSSL_PROVIDER *prov,
96
int operation_id,
97
const OSSL_ALGORITHM *algs);
98
99
/*
100
* Cache of bits to see if we already added methods for an operation in
101
* the "permanent" method store.
102
* They should never be called for temporary method stores!
103
*/
104
int ossl_provider_set_operation_bit(OSSL_PROVIDER *provider, size_t bitnum);
105
int ossl_provider_test_operation_bit(OSSL_PROVIDER *provider, size_t bitnum,
106
int *result);
107
108
/* Configuration */
109
void ossl_provider_add_conf_module(void);
110
111
/* Child providers */
112
int ossl_provider_init_as_child(OSSL_LIB_CTX *ctx,
113
const OSSL_CORE_HANDLE *handle,
114
const OSSL_DISPATCH *in);
115
void ossl_provider_deinit_child(OSSL_LIB_CTX *ctx);
116
117
# ifdef __cplusplus
118
}
119
# endif
120
121
#endif
122
123