]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/OSSL_STORE_LOADER.pod
Rename all getters to use get/get0 in name
[thirdparty/openssl.git] / doc / man3 / OSSL_STORE_LOADER.pod
CommitLineData
e2e603fe
RL
1=pod
2
3=head1 NAME
4
c4fc564d
RL
5OSSL_STORE_LOADER,
6OSSL_STORE_LOADER_fetch,
7OSSL_STORE_LOADER_up_ref,
8OSSL_STORE_LOADER_free,
ed576acd
TM
9OSSL_STORE_LOADER_get0_provider,
10OSSL_STORE_LOADER_get0_properties,
c4fc564d 11OSSL_STORE_LOADER_is_a,
ed576acd
TM
12OSSL_STORE_LOADER_get_number,
13OSSL_STORE_LOADER_get0_description,
c4fc564d
RL
14OSSL_STORE_LOADER_do_all_provided,
15OSSL_STORE_LOADER_names_do_all,
16OSSL_STORE_LOADER_CTX, OSSL_STORE_LOADER_new,
e2e603fe 17OSSL_STORE_LOADER_get0_engine, OSSL_STORE_LOADER_get0_scheme,
d8652be0 18OSSL_STORE_LOADER_set_open, OSSL_STORE_LOADER_set_open_ex,
faa64bca
RL
19OSSL_STORE_LOADER_set_attach, OSSL_STORE_LOADER_set_ctrl,
20OSSL_STORE_LOADER_set_expect, OSSL_STORE_LOADER_set_find,
21OSSL_STORE_LOADER_set_load, OSSL_STORE_LOADER_set_eof,
22OSSL_STORE_LOADER_set_error, OSSL_STORE_LOADER_set_close,
c4fc564d 23OSSL_STORE_register_loader, OSSL_STORE_unregister_loader,
d8652be0 24OSSL_STORE_open_fn, OSSL_STORE_open_ex_fn,
faa64bca 25OSSL_STORE_attach_fn, OSSL_STORE_ctrl_fn,
6ab6decc 26OSSL_STORE_expect_fn, OSSL_STORE_find_fn,
e2e603fe
RL
27OSSL_STORE_load_fn, OSSL_STORE_eof_fn, OSSL_STORE_error_fn,
28OSSL_STORE_close_fn - Types and functions to manipulate, register and
29unregister STORE loaders for different URI schemes
30
31=head1 SYNOPSIS
32
33 #include <openssl/store.h>
34
35 typedef struct ossl_store_loader_st OSSL_STORE_LOADER;
36
c4fc564d 37 OSSL_STORE_LOADER *OSSL_STORE_LOADER_fetch(const char *scheme,
b4250010 38 OSSL_LIB_CTX *libctx,
c4fc564d
RL
39 const char *properties);
40 int OSSL_STORE_LOADER_up_ref(OSSL_STORE_LOADER *loader);
41 void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader);
ed576acd 42 const OSSL_PROVIDER *OSSL_STORE_LOADER_get0_provider(const OSSL_STORE_LOADER *
c4fc564d 43 loader);
ed576acd
TM
44 const char *OSSL_STORE_LOADER_get0_properties(const OSSL_STORE_LOADER *loader);
45 int OSSL_STORE_LOADER_get_number(const OSSL_STORE_LOADER *loader);
46 const char *OSSL_STORE_LOADER_get0_description(const OSSL_STORE_LOADER *loader);
c4fc564d
RL
47 int OSSL_STORE_LOADER_is_a(const OSSL_STORE_LOADER *loader,
48 const char *scheme);
b4250010 49 void OSSL_STORE_LOADER_do_all_provided(OSSL_LIB_CTX *libctx,
c4fc564d
RL
50 void (*fn)(OSSL_STORE_LOADER *loader,
51 void *arg),
52 void *arg);
d84f5515
MC
53 int OSSL_STORE_LOADER_names_do_all(const OSSL_STORE_LOADER *loader,
54 void (*fn)(const char *name, void *data),
55 void *data);
c4fc564d 56
a1447076
RL
57Deprecated since OpenSSL 3.0, can be hidden entirely by defining
58B<OPENSSL_API_COMPAT> with a suitable version value, see
59L<openssl_user_macros(7)>:
c4fc564d 60
e2e603fe
RL
61 OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme);
62 const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER
63 *store_loader);
64 const char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER
65 *store_loader);
66
67 /* struct ossl_store_loader_ctx_st is defined differently by each loader */
68 typedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX;
69
6725682d
SL
70 typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(
71 const char *uri, const UI_METHOD *ui_method, void *ui_data);
e2e603fe
RL
72 int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *store_loader,
73 OSSL_STORE_open_fn store_open_function);
d8652be0 74 typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_ex_fn)(
faa64bca 75 const char *uri, const UI_METHOD *ui_method, void *ui_data);
d8652be0 76 int OSSL_STORE_LOADER_set_open_ex
faa64bca 77 (OSSL_STORE_LOADER *store_loader,
d8652be0 78 OSSL_STORE_open_ex_fn store_open_ex_function);
6725682d
SL
79 typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_attach_fn)
80 (const OSSL_STORE_LOADER *loader, BIO *bio,
b4250010 81 OSSL_LIB_CTX *libctx, const char *propq,
6725682d 82 const UI_METHOD *ui_method, void *ui_data);
6ab6ecfd
RL
83 int OSSL_STORE_LOADER_set_attach(OSSL_STORE_LOADER *loader,
84 OSSL_STORE_attach_fn attach_function);
e2e603fe
RL
85 typedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd,
86 va_list args);
87 int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *store_loader,
88 OSSL_STORE_ctrl_fn store_ctrl_function);
ce9586b9
RL
89 typedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected);
90 int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader,
91 OSSL_STORE_expect_fn expect_function);
6ab6decc
RL
92 typedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx,
93 OSSL_STORE_SEARCH *criteria);
94 int OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader,
95 OSSL_STORE_find_fn find_function);
e2e603fe
RL
96 typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx,
97 UI_METHOD *ui_method,
98 void *ui_data);
99 int OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *store_loader,
100 OSSL_STORE_load_fn store_load_function);
101 typedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx);
102 int OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *store_loader,
103 OSSL_STORE_eof_fn store_eof_function);
104 typedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx);
105 int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *store_loader,
106 OSSL_STORE_error_fn store_error_function);
107 typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx);
108 int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *store_loader,
109 OSSL_STORE_close_fn store_close_function);
110 void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *store_loader);
dae2218d 111
e2e603fe
RL
112 int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader);
113 OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme);
114
115=head1 DESCRIPTION
116
c4fc564d 117B<OSSL_STORE_LOADER> is a method for OSSL_STORE loaders, which implement
d8652be0 118OSSL_STORE_open(), OSSL_STORE_open_ex(), OSSL_STORE_load(),
c4fc564d
RL
119OSSL_STORE_eof(), OSSL_STORE_error() and OSSL_STORE_close() for specific
120storage schemes.
e2e603fe 121
c4fc564d 122OSSL_STORE_LOADER_fetch() looks for an implementation for a storage
b4250010 123I<scheme> within the providers that has been loaded into the B<OSSL_LIB_CTX>
c4fc564d 124given by I<ctx>, and with the properties given by I<properties>.
e2e603fe 125
c4fc564d
RL
126OSSL_STORE_LOADER_up_ref() increments the reference count for the given
127I<loader>.
128
129OSSL_STORE_LOADER_free() decrements the reference count for the given
130I<loader>, and when the count reaches zero, frees it.
131
ed576acd 132OSSL_STORE_LOADER_get0_provider() returns the provider of the given
c4fc564d
RL
133I<loader>.
134
ed576acd 135OSSL_STORE_LOADER_get0_properties() returns the property definition associated
c4fc564d
RL
136with the given I<loader>.
137
138OSSL_STORE_LOADER_is_a() checks if I<loader> is an implementation
139of an algorithm that's identifiable with I<scheme>.
140
ed576acd 141OSSL_STORE_LOADER_get_number() returns the internal dynamic number assigned
c4fc564d
RL
142to the given I<loader>.
143
ed576acd 144OSSL_STORE_LOADER_get0_description() returns a description of the I<loader>, meant
b638dad9
RL
145for display and human consumption. The description is at the discretion of the
146I<loader> implementation.
147
c4fc564d
RL
148OSSL_STORE_LOADER_do_all_provided() traverses all store implementations
149by all activated providers in the library context I<libctx>, and for each
150of the implementations, calls I<fn> with the implementation method and
151I<data> as arguments.
152
153OSSL_STORE_LOADER_names_do_all() traverses all names for the given
154I<loader>, and calls I<fn> with each name and I<data>.
155
a1447076 156=head2 Legacy Types and Functions (deprecated)
c4fc564d
RL
157
158These functions help applications and engines to create loaders for
a1447076
RL
159schemes they support. These are all deprecated and discouraged in favour of
160provider implementations, see L<provider-storemgmt(7)>.
e2e603fe
RL
161
162B<OSSL_STORE_LOADER_CTX> is a type template, to be defined by each loader
c4fc564d 163using C<struct ossl_store_loader_ctx_st { ... }>.
e2e603fe 164
d8652be0 165B<OSSL_STORE_open_fn>, B<OSSL_STORE_open_ex_fn>,
faa64bca
RL
166B<OSSL_STORE_ctrl_fn>, B<OSSL_STORE_expect_fn>, B<OSSL_STORE_find_fn>,
167B<OSSL_STORE_load_fn>, B<OSSL_STORE_eof_fn>, and B<OSSL_STORE_close_fn>
ce9586b9 168are the function pointer types used within a STORE loader.
e2e603fe
RL
169The functions pointed at define the functionality of the given loader.
170
171=over 4
172
d8652be0 173=item B<OSSL_STORE_open_fn> and B<OSSL_STORE_open_ex_fn>
e2e603fe 174
d8652be0 175B<OSSL_STORE_open_ex_fn> takes a URI and is expected to
faa64bca
RL
176interpret it in the best manner possible according to the scheme the
177loader implements. It also takes a B<UI_METHOD> and associated data,
178to be used any time something needs to be prompted for, as well as a
179library context I<libctx> with an associated property query I<propq>,
180to be used when fetching necessary algorithms to perform the loads.
e2e603fe 181Furthermore, this function is expected to initialize what needs to be
faa64bca
RL
182initialized, to create a private data store (B<OSSL_STORE_LOADER_CTX>,
183see above), and to return it.
e2e603fe
RL
184If something goes wrong, this function is expected to return NULL.
185
faa64bca 186B<OSSL_STORE_open_fn> does the same thing as
d8652be0 187B<OSSL_STORE_open_ex_fn> but uses NULL for the library
faa64bca
RL
188context I<libctx> and property query I<propq>.
189
190=item B<OSSL_STORE_attach_fn>
6ab6ecfd 191
faa64bca 192This function takes a B<BIO>, otherwise works like
d8652be0 193B<OSSL_STORE_open_ex_fn>.
6ab6ecfd 194
e2e603fe
RL
195=item B<OSSL_STORE_ctrl_fn>
196
197This function takes a B<OSSL_STORE_LOADER_CTX> pointer, a command number
c4fc564d 198I<cmd> and a B<va_list> I<args> and is used to manipulate loader
e2e603fe
RL
199specific parameters.
200
201=begin comment
202
203Globally known command numbers are documented in L<OSSL_STORE_ctrl(3)>,
c4fc564d 204along with what I<args> are expected with each of them.
e2e603fe
RL
205
206=end comment
207
208Loader specific command numbers must begin at B<OSSL_STORE_C_CUSTOM_START>.
209Any number below that is reserved for future globally known command
210numbers.
211
212This function is expected to return 1 on success, 0 on error.
213
ce9586b9
RL
214=item B<OSSL_STORE_expect_fn>
215
216This function takes a B<OSSL_STORE_LOADER_CTX> pointer and a B<OSSL_STORE_INFO>
c4fc564d 217identity I<expected>, and is used to tell the loader what object type is
ce9586b9 218expected.
c4fc564d 219I<expected> may be zero to signify that no specific object type is expected.
ce9586b9
RL
220
221This function is expected to return 1 on success, 0 on error.
222
6ab6decc
RL
223=item B<OSSL_STORE_find_fn>
224
225This function takes a B<OSSL_STORE_LOADER_CTX> pointer and a
226B<OSSL_STORE_SEARCH> search criterion, and is used to tell the loader what
227to search for.
228
c4fc564d 229When called with the loader context being NULL, this function is expected
6ab6decc
RL
230to return 1 if the loader supports the criterion, otherwise 0.
231
c4fc564d 232When called with the loader context being something other than NULL, this
6ab6decc
RL
233function is expected to return 1 on success, 0 on error.
234
e2e603fe
RL
235=item B<OSSL_STORE_load_fn>
236
237This function takes a B<OSSL_STORE_LOADER_CTX> pointer and a B<UI_METHOD>
238with associated data.
239It's expected to load the next available data, mold it into a data
240structure that can be wrapped in a B<OSSL_STORE_INFO> using one of the
241L<OSSL_STORE_INFO(3)> functions.
242If no more data is available or an error occurs, this function is
243expected to return NULL.
244The B<OSSL_STORE_eof_fn> and B<OSSL_STORE_error_fn> functions must indicate if
a970b14f 245it was in fact the end of data or if an error occurred.
e2e603fe 246
a970b14f 247Note that this function retrieves I<one> data item only.
e2e603fe
RL
248
249=item B<OSSL_STORE_eof_fn>
250
251This function takes a B<OSSL_STORE_LOADER_CTX> pointer and is expected to
252return 1 to indicate that the end of available data has been reached.
253It is otherwise expected to return 0.
254
255=item B<OSSL_STORE_error_fn>
256
257This function takes a B<OSSL_STORE_LOADER_CTX> pointer and is expected to
3266cf58 258return 1 to indicate that an error occurred in a previous call to the
e2e603fe
RL
259B<OSSL_STORE_load_fn> function.
260It is otherwise expected to return 0.
261
262=item B<OSSL_STORE_close_fn>
263
264This function takes a B<OSSL_STORE_LOADER_CTX> pointer and is expected to
265close or shut down what needs to be closed, and finally free the
266contents of the B<OSSL_STORE_LOADER_CTX> pointer.
267It returns 1 on success and 0 on error.
268
269=back
270
e2e603fe 271OSSL_STORE_LOADER_new() creates a new B<OSSL_STORE_LOADER>.
c4fc564d
RL
272It takes an B<ENGINE> I<e> and a string I<scheme>.
273I<scheme> must I<always> be set.
274Both I<e> and I<scheme> are used as is and must therefore be alive as
e2e603fe
RL
275long as the created loader is.
276
c4fc564d
RL
277OSSL_STORE_LOADER_get0_engine() returns the engine of the I<store_loader>.
278OSSL_STORE_LOADER_get0_scheme() returns the scheme of the I<store_loader>.
e2e603fe
RL
279
280OSSL_STORE_LOADER_set_open() sets the opener function for the
c4fc564d 281I<store_loader>.
e2e603fe 282
d8652be0 283OSSL_STORE_LOADER_set_open_ex() sets the opener with library context
faa64bca
RL
284function for the I<store_loader>.
285
6ab6ecfd 286OSSL_STORE_LOADER_set_attach() sets the attacher function for the
c4fc564d 287I<store_loader>.
6ab6ecfd 288
e2e603fe 289OSSL_STORE_LOADER_set_ctrl() sets the control function for the
c4fc564d 290I<store_loader>.
e2e603fe 291
ce9586b9 292OSSL_STORE_LOADER_set_expect() sets the expect function for the
c4fc564d 293I<store_loader>.
ce9586b9 294
e2e603fe 295OSSL_STORE_LOADER_set_load() sets the loader function for the
c4fc564d 296I<store_loader>.
e2e603fe
RL
297
298OSSL_STORE_LOADER_set_eof() sets the end of file checker function for the
c4fc564d 299I<store_loader>.
e2e603fe
RL
300
301OSSL_STORE_LOADER_set_close() sets the closing function for the
c4fc564d 302I<store_loader>.
e2e603fe 303
c4fc564d 304OSSL_STORE_LOADER_free() frees the given I<store_loader>.
e2e603fe 305
c4fc564d 306OSSL_STORE_register_loader() register the given I<store_loader> and
faa64bca 307thereby makes it available for use with OSSL_STORE_open(),
d8652be0 308OSSL_STORE_open_ex(), OSSL_STORE_load(), OSSL_STORE_eof()
faa64bca 309and OSSL_STORE_close().
e2e603fe
RL
310
311OSSL_STORE_unregister_loader() unregister the store loader for the given
c4fc564d 312I<scheme>.
e2e603fe 313
c4fc564d 314=head1 RETURN VALUES
e2e603fe 315
c4fc564d
RL
316OSSL_STORE_LOADER_fetch() returns a pointer to an OSSL_STORE_LOADER object,
317or NULL on error.
e2e603fe 318
c4fc564d
RL
319OSSL_STORE_LOADER_up_ref() returns 1 on success, or 0 on error.
320
d84f5515
MC
321OSSL_STORE_LOADER_names_do_all() returns 1 if the callback was called for all
322names. A return value of 0 means that the callback was not called for any names.
323
c4fc564d
RL
324OSSL_STORE_LOADER_free() doesn't return any value.
325
ed576acd 326OSSL_STORE_LOADER_get0_provider() returns a pointer to a provider object, or
c4fc564d
RL
327NULL on error.
328
ed576acd 329OSSL_STORE_LOADER_get0_properties() returns a pointer to a property
c4fc564d
RL
330definition string, or NULL on error.
331
332OSSL_STORE_LOADER_is_a() returns 1 if I<loader> was identifiable,
333otherwise 0.
334
ed576acd 335OSSL_STORE_LOADER_get_number() returns an integer.
e2e603fe 336
ed576acd 337OSSL_STORE_LOADER_get0_description() returns a pointer to a decription, or NULL if
b638dad9
RL
338there isn't one.
339
faa64bca 340The functions with the types B<OSSL_STORE_open_fn>,
d8652be0 341B<OSSL_STORE_open_ex_fn>, B<OSSL_STORE_ctrl_fn>,
faa64bca
RL
342B<OSSL_STORE_expect_fn>, B<OSSL_STORE_load_fn>, B<OSSL_STORE_eof_fn>
343and B<OSSL_STORE_close_fn> have the same return values as OSSL_STORE_open(),
d8652be0 344OSSL_STORE_open_ex(), OSSL_STORE_ctrl(), OSSL_STORE_expect(),
ce9586b9 345OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close(), respectively.
e2e603fe
RL
346
347OSSL_STORE_LOADER_new() returns a pointer to a B<OSSL_STORE_LOADER> on success,
c4fc564d 348or NULL on failure.
e2e603fe 349
d8652be0 350OSSL_STORE_LOADER_set_open(), OSSL_STORE_LOADER_set_open_ex(),
faa64bca
RL
351OSSL_STORE_LOADER_set_ctrl(), OSSL_STORE_LOADER_set_load(),
352OSSL_STORE_LOADER_set_eof() and OSSL_STORE_LOADER_set_close() return 1
353on success, or 0 on failure.
e2e603fe
RL
354
355OSSL_STORE_register_loader() returns 1 on success, or 0 on failure.
356
357OSSL_STORE_unregister_loader() returns the unregistered loader on success,
c4fc564d 358or NULL on failure.
e2e603fe
RL
359
360=head1 SEE ALSO
361
b4250010 362L<ossl_store(7)>, L<OSSL_STORE_open(3)>, L<OSSL_LIB_CTX(3)>,
c4fc564d 363L<provider-storemgmt(7)>
e2e603fe
RL
364
365=head1 HISTORY
366
c4fc564d 367OSSL_STORE_LOADER_fetch(), OSSL_STORE_LOADER_up_ref(),
ed576acd
TM
368OSSL_STORE_LOADER_free(), OSSL_STORE_LOADER_get0_provider(),
369OSSL_STORE_LOADER_get0_properties(), OSSL_STORE_LOADER_is_a(),
370OSSL_STORE_LOADER_get_number(), OSSL_STORE_LOADER_do_all_provided() and
c4fc564d
RL
371OSSL_STORE_LOADER_names_do_all() were added in OpenSSL 3.0.
372
d8652be0 373OSSL_STORE_open_ex_fn() was added in OpenSSL 3.0.
faa64bca
RL
374
375B<OSSL_STORE_LOADER>, B<OSSL_STORE_LOADER_CTX>, OSSL_STORE_LOADER_new(),
e52b4215
SL
376OSSL_STORE_LOADER_set0_scheme(), OSSL_STORE_LOADER_get0_scheme(),
377OSSL_STORE_LOADER_get0_engine(), OSSL_STORE_LOADER_set_expect(),
378OSSL_STORE_LOADER_set_find(), OSSL_STORE_LOADER_set_attach(),
379OSSL_STORE_LOADER_set_open_ex(), OSSL_STORE_LOADER_set_open(),
380OSSL_STORE_LOADER_set_ctrl(),
381OSSL_STORE_LOADER_set_load(), OSSL_STORE_LOADER_set_eof(),
382OSSL_STORE_LOADER_set_close(), OSSL_STORE_LOADER_free(),
383OSSL_STORE_register_loader(), OSSL_STORE_LOADER_set_error(),
e2e603fe
RL
384OSSL_STORE_unregister_loader(), OSSL_STORE_open_fn(), OSSL_STORE_ctrl_fn(),
385OSSL_STORE_load_fn(), OSSL_STORE_eof_fn() and OSSL_STORE_close_fn()
a1447076 386were added in OpenSSL 1.1.1, and became deprecated in OpenSSL 3.0.
e2e603fe
RL
387
388=head1 COPYRIGHT
389
8020d79b 390Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
e2e603fe 391
4746f25a 392Licensed under the Apache License 2.0 (the "License"). You may not use
e2e603fe
RL
393this file except in compliance with the License. You can obtain a copy
394in the file LICENSE in the source distribution or at
395L<https://www.openssl.org/source/license.html>.
396
397=cut