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