]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/OSSL_PROVIDER.pod
crypto/engine/eng_openssl.c: define TEST_ENG_OPENSSL_RC4_P_INIT conditionally
[thirdparty/openssl.git] / doc / man3 / OSSL_PROVIDER.pod
CommitLineData
c4532834
RL
1=pod
2
3=head1 NAME
4
5OSSL_PROVIDER, OSSL_PROVIDER_load, OSSL_PROVIDER_unload,
36f5ec55 6OSSL_PROVIDER_available,
c4532834 7OSSL_PROVIDER_get_param_types, OSSL_PROVIDER_get_params,
b37066fd 8OSSL_PROVIDER_add_builtin, OSSL_PROVIDER_name - provider routines
c4532834
RL
9
10=head1 SYNOPSIS
11
12 #include <openssl/provider.h>
13
14 typedef struct ossl_provider_st OSSL_PROVIDER;
15
36f5ec55 16 OSSL_PROVIDER *OSSL_PROVIDER_load(OPENSSL_CTX *libctx, const char *name);
c4532834 17 int OSSL_PROVIDER_unload(OSSL_PROVIDER *prov);
36f5ec55 18 int OSSL_PROVIDER_available(OPENSSL_CTX *libctx, const char *name);
c4532834 19
26175013 20 const OSSL_PARAM *OSSL_PROVIDER_get_param_types(OSSL_PROVIDER *prov);
4e7991b4 21 int OSSL_PROVIDER_get_params(OSSL_PROVIDER *prov, OSSL_PARAM params[]);
c4532834 22
36f5ec55 23 int OSSL_PROVIDER_add_builtin(OPENSSL_CTX *libctx, const char *name,
c4532834
RL
24 ossl_provider_init_fn *init_fn);
25
b37066fd
RL
26 const char *OSSL_PROVIDER_name(const OSSL_PROVIDER *prov);
27
c4532834
RL
28=head1 DESCRIPTION
29
30B<OSSL_PROVIDER> is a type that holds internal information about
31implementation providers (see L<provider(7)> for information on what a
32provider is).
33A provider can be built in to the application or the OpenSSL
34libraries, or can be a loadable module.
35The functions described here handle both forms.
36
36f5ec55
RL
37Some of these functions operate within a library context, please see
38L<OPENSSL_CTX(3)> for further details.
39
c4532834
RL
40=head2 Functions
41
42OSSL_PROVIDER_add_builtin() is used to add a built in provider to
43B<OSSL_PROVIDER> store in the given library context, by associating a
44provider name with a provider initialization function.
45This name can then be used with OSSL_PROVIDER_load().
46
47OSSL_PROVIDER_load() loads and initializes a provider.
48This may simply initialize a provider that was previously added with
49OSSL_PROVIDER_add_builtin() and run its given initialization function,
50or load a provider module with the given name and run its provider
51entry point, C<OSSL_provider_init>.
52
53OSSL_PROVIDER_unload() unloads the given provider.
54For a provider added with OSSL_PROVIDER_add_builtin(), this simply
55runs its teardown function.
56
36f5ec55
RL
57OSSL_PROVIDER_available() checks if a named provider is available
58for use.
59
c4532834 60OSSL_PROVIDER_get_param_types() is used to get a provider parameter
26175013
RL
61descriptor set as a constant B<OSSL_PARAM> array.
62See L<OSSL_PARAM(3)> for more information.
c4532834
RL
63
64OSSL_PROVIDER_get_params() is used to get provider parameter values.
65The caller must prepare the B<OSSL_PARAM> array before calling this
66function, and the variables acting as buffers for this parameter array
67should be filled with data when it returns successfully.
68
b37066fd
RL
69OSSL_PROVIDER_name() returns the name of the given provider.
70
c4532834
RL
71=head1 RETURN VALUES
72
73OSSL_PROVIDER_add() returns 1 on success, or 0 on error.
74
75OSSL_PROVIDER_load() returns a pointer to a provider object on
76success, or B<NULL> on error.
77
78OSSL_PROVIDER_unload() returns 1 on success, or 0 on error.
79
36f5ec55
RL
80OSSL_PROVIDER_available() returns 1 if the named provider is available,
81otherwise 0.
82
26175013
RL
83OSSL_PROVIDER_get_param_types() returns a pointer to an array
84of constant B<OSSL_PARAM>, or NULL if none is provided.
c4532834
RL
85
86OSSL_PROVIDER_get_params() returns 1 on success, or 0 on error.
87
88=head1 EXAMPLES
89
90This demonstrates how to load the provider module "foo" and ask for
91its build number.
92
93 OSSL_PROVIDER *prov = NULL;
94 const char *build = NULL;
95 size_t built_l = 0;
4e7991b4 96 OSSL_PARAM request[] = {
c4532834
RL
97 { "build", OSSL_PARAM_UTF8_STRING_PTR, &build, 0, &build_l },
98 { NULL, 0, NULL, 0, NULL }
99 };
100
101 if ((prov = OSSL_PROVIDER_load(NULL, "foo")) != NULL
102 && OSSL_PROVIDER_get_params(prov, request))
103 printf("Provider 'foo' build %s\n", build);
104 else
105 ERR_print_errors_fp(stderr);
106
107=head1 SEE ALSO
108
36f5ec55 109L<openssl-core.h(7)>, L<OPENSSL_CTX(3)>, L<provider(7)>
c4532834
RL
110
111=head1 HISTORY
112
113The type and functions described here were added in OpenSSL 3.0.
114
115=head1 COPYRIGHT
116
117Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
118
119Licensed under the Apache License 2.0 (the "License"). You may not use
120this file except in compliance with the License. You can obtain a copy
121in the file LICENSE in the source distribution or at
122L<https://www.openssl.org/source/license.html>.
123
124=cut