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