]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/OSSL_DECODER.pod
Don't hold a lock when calling a callback in ossl_namemap_doall_names
[thirdparty/openssl.git] / doc / man3 / OSSL_DECODER.pod
CommitLineData
ece9304c
RL
1=pod
2
3=head1 NAME
4
5OSSL_DECODER,
6OSSL_DECODER_fetch,
7OSSL_DECODER_up_ref,
8OSSL_DECODER_free,
9OSSL_DECODER_provider,
10OSSL_DECODER_properties,
11OSSL_DECODER_is_a,
12OSSL_DECODER_number,
13OSSL_DECODER_do_all_provided,
14OSSL_DECODER_names_do_all,
15OSSL_DECODER_gettable_params,
16OSSL_DECODER_get_params
17- Decoder method routines
18
19=head1 SYNOPSIS
20
21 #include <openssl/decoder.h>
22
23 typedef struct ossl_decoder_st OSSL_DECODER;
24
b4250010 25 OSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *ctx, const char *name,
ece9304c
RL
26 const char *properties);
27 int OSSL_DECODER_up_ref(OSSL_DECODER *decoder);
28 void OSSL_DECODER_free(OSSL_DECODER *decoder);
29 const OSSL_PROVIDER *OSSL_DECODER_provider(const OSSL_DECODER *decoder);
30 const char *OSSL_DECODER_properties(const OSSL_DECODER *decoder);
31 int OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name);
32 int OSSL_DECODER_number(const OSSL_DECODER *decoder);
b4250010 33 void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,
ece9304c
RL
34 void (*fn)(OSSL_DECODER *decoder, void *arg),
35 void *arg);
d84f5515
MC
36 int OSSL_DECODER_names_do_all(const OSSL_DECODER *decoder,
37 void (*fn)(const char *name, void *data),
38 void *data);
ece9304c
RL
39 const OSSL_PARAM *OSSL_DECODER_gettable_params(OSSL_DECODER *decoder);
40 int OSSL_DECODER_get_params(OSSL_DECODER_CTX *ctx, const OSSL_PARAM params[]);
41
42=head1 DESCRIPTION
43
44B<OSSL_DECODER> is a method for decoders, which know how to
45decode encoded data into an object of some type that the rest
46of OpenSSL knows how to handle.
47
48OSSL_DECODER_fetch() looks for an algorithm within the provider that
b4250010 49has been loaded into the B<OSSL_LIB_CTX> given by I<ctx>, having the
ece9304c
RL
50name given by I<name> and the properties given by I<properties>.
51The I<name> determines what type of object the fetched decoder
52method is expected to be able to decode, and the properties are
53used to determine the expected output type.
54For known properties and the values they may have, please have a look
55in L<provider-encoder(7)/Names and properties>.
56
57OSSL_DECODER_up_ref() increments the reference count for the given
58I<decoder>.
59
60OSSL_DECODER_free() decrements the reference count for the given
61I<decoder>, and when the count reaches zero, frees it.
62
63OSSL_DECODER_provider() returns the provider of the given
64I<decoder>.
65
66OSSL_DECODER_properties() returns the property definition associated
67with the given I<decoder>.
68
69OSSL_DECODER_is_a() checks if I<decoder> is an implementation
70of an algorithm that's identifiable with I<name>.
71
72OSSL_DECODER_number() returns the internal dynamic number assigned
73to the given I<decoder>.
74
75OSSL_DECODER_names_do_all() traverses all names for the given
df785898 76I<decoder>, and calls I<fn> with each name and I<data> as arguments.
ece9304c 77
df785898 78OSSL_DECODER_do_all_provided() traverses all decoder
ece9304c
RL
79implementations by all activated providers in the library context
80I<libctx>, and for each of the implementations, calls I<fn> with the
df785898 81implementation method and I<arg> as arguments.
ece9304c
RL
82
83OSSL_DECODER_gettable_params() returns an L<OSSL_PARAM(3)>
84array of parameter descriptors.
85
86OSSL_DECODER_get_params() attempts to get parameters specified
87with an L<OSSL_PARAM(3)> array I<params>. Parameters that the
88implementation doesn't recognise should be ignored.
89
90=head1 RETURN VALUES
91
92OSSL_DECODER_fetch() returns a pointer to an OSSL_DECODER object,
93or NULL on error.
94
95OSSL_DECODER_up_ref() returns 1 on success, or 0 on error.
96
97OSSL_DECODER_free() doesn't return any value.
98
99OSSL_DECODER_provider() returns a pointer to a provider object, or
100NULL on error.
101
102OSSL_DECODER_properties() returns a pointer to a property
103definition string, or NULL on error.
104
105OSSL_DECODER_is_a() returns 1 if I<decoder> was identifiable,
106otherwise 0.
107
108OSSL_DECODER_number() returns an integer.
109
d84f5515
MC
110OSSL_DECODER_names_do_all() returns 1 if the callback was called for all
111names. A return value of 0 means that the callback was not called for any names.
112
ece9304c
RL
113=head1 NOTES
114
115OSSL_DECODER_fetch() may be called implicitly by other fetching
116functions, using the same library context and properties.
117Any other API that uses keys will typically do this.
118
119=begin comment TODO(3.0) Add examples!
120
121=head1 EXAMPLES
122
123Text, because pod2xxx doesn't like empty sections
124
125=end comment
126
127=head1 SEE ALSO
128
129L<provider(7)>, L<OSSL_DECODER_CTX(3)>, L<OSSL_DECODER_from_bio(3)>,
fe75766c 130L<OSSL_DECODER_CTX_new_for_pkey(3)>, L<OSSL_LIB_CTX(3)>
ece9304c
RL
131
132=head1 HISTORY
133
134The functions described here were added in OpenSSL 3.0.
135
136=head1 COPYRIGHT
137
4333b89f 138Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
ece9304c
RL
139
140Licensed under the Apache License 2.0 (the "License"). You may not use
141this file except in compliance with the License. You can obtain a copy
142in the file LICENSE in the source distribution or at
143L<https://www.openssl.org/source/license.html>.
144
145=cut