hkdf: when HMAC key is all zeros, still set a valid key length
[openssl.git] / doc / man3 / OSSL_ENCODER.pod
1 =pod
2
3 =head1 NAME
4
5 OSSL_ENCODER,
6 OSSL_ENCODER_fetch,
7 OSSL_ENCODER_up_ref,
8 OSSL_ENCODER_free,
9 OSSL_ENCODER_provider,
10 OSSL_ENCODER_properties,
11 OSSL_ENCODER_is_a,
12 OSSL_ENCODER_number,
13 OSSL_ENCODER_name,
14 OSSL_ENCODER_description,
15 OSSL_ENCODER_do_all_provided,
16 OSSL_ENCODER_names_do_all,
17 OSSL_ENCODER_gettable_params,
18 OSSL_ENCODER_get_params
19 - Encoder method routines
20
21 =head1 SYNOPSIS
22
23  #include <openssl/encoder.h>
24
25  typedef struct ossl_encoder_st OSSL_ENCODER;
26
27  OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *ctx, const char *name,
28                                   const char *properties);
29  int OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder);
30  void OSSL_ENCODER_free(OSSL_ENCODER *encoder);
31  const OSSL_PROVIDER *OSSL_ENCODER_provider(const OSSL_ENCODER *encoder);
32  const char *OSSL_ENCODER_properties(const OSSL_ENCODER *encoder);
33  int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);
34  int OSSL_ENCODER_number(const OSSL_ENCODER *encoder);
35  const char *OSSL_ENCODER_name(const OSSL_ENCODER *encoder);
36  const char *OSSL_ENCODER_description(const OSSL_ENCODER *encoder);
37  void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,
38                                    void (*fn)(OSSL_ENCODER *encoder, void *arg),
39                                    void *arg);
40  int OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,
41                                void (*fn)(const char *name, void *data),
42                                void *data);
43  const OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder);
44  int OSSL_ENCODER_get_params(OSSL_ENCODER_CTX *ctx, const OSSL_PARAM params[]);
45
46 =head1 DESCRIPTION
47
48 B<OSSL_ENCODER> is a method for encoders, which know how to
49 encode an object of some kind to a encoded form, such as PEM,
50 DER, or even human readable text.
51
52 OSSL_ENCODER_fetch() looks for an algorithm within the provider that
53 has been loaded into the B<OSSL_LIB_CTX> given by I<ctx>, having the
54 name given by I<name> and the properties given by I<properties>.
55 The I<name> determines what type of object the fetched encoder
56 method is expected to be able to encode, and the properties are
57 used to determine the expected output type.
58 For known properties and the values they may have, please have a look
59 in L<provider-encoder(7)/Names and properties>.
60
61 OSSL_ENCODER_up_ref() increments the reference count for the given
62 I<encoder>.
63
64 OSSL_ENCODER_free() decrements the reference count for the given
65 I<encoder>, and when the count reaches zero, frees it.
66
67 OSSL_ENCODER_provider() returns the provider of the given
68 I<encoder>.
69
70 OSSL_ENCODER_properties() returns the property definition associated
71 with the given I<encoder>.
72
73 OSSL_ENCODER_is_a() checks if I<encoder> is an implementation of an
74 algorithm that's identifiable with I<name>.
75
76 OSSL_ENCODER_number() returns the internal dynamic number assigned to
77 the given I<encoder>.
78
79 OSSL_ENCODER_number() returns the name used to fetch the given I<encoder>.
80
81 OSSL_ENCODER_description() returns a description of the I<loader>, meant
82 for display and human consumption.  The description is at the discretion of the
83 I<loader> implementation.
84
85 OSSL_ENCODER_names_do_all() traverses all names for the given
86 I<encoder>, and calls I<fn> with each name and I<data> as arguments.
87
88 OSSL_ENCODER_do_all_provided() traverses all encoder
89 implementations by all activated providers in the library context
90 I<libctx>, and for each of the implementations, calls I<fn> with the
91 implementation method and I<arg> as arguments.
92
93 OSSL_ENCODER_gettable_params() returns an L<OSSL_PARAM(3)>
94 array of parameter descriptors.
95
96 OSSL_ENCODER_get_params() attempts to get parameters specified
97 with an L<OSSL_PARAM(3)> array I<params>.  Parameters that the
98 implementation doesn't recognise should be ignored.
99
100 =head1 RETURN VALUES
101
102 OSSL_ENCODER_fetch() returns a pointer to the key management
103 implementation represented by an OSSL_ENCODER object, or NULL on
104 error.
105
106 OSSL_ENCODER_up_ref() returns 1 on success, or 0 on error.
107
108 OSSL_ENCODER_free() doesn't return any value.
109
110 OSSL_ENCODER_provider() returns a pointer to a provider object, or
111 NULL on error.
112
113 OSSL_ENCODER_properties() returns a pointer to a property
114 definition string, or NULL on error.
115
116 OSSL_ENCODER_is_a() returns 1 of I<encoder> was identifiable,
117 otherwise 0.
118
119 OSSL_ENCODER_number() returns an integer.
120
121 OSSL_ENCODER_name() returns the algorithm name from the provided
122 implementation for the given I<encoder>. Note that the I<encoder> may have
123 multiple synonyms associated with it. In this case the first name from the
124 algorithm definition is returned. Ownership of the returned string is retained
125 by the I<encoder> object and should not be freed by the caller.
126
127 OSSL_ENCODER_description() returns a pointer to a decription, or NULL if
128 there isn't one.
129
130 OSSL_ENCODER_names_do_all() returns 1 if the callback was called for all
131 names. A return value of 0 means that the callback was not called for any names.
132
133 =head1 SEE ALSO
134
135 L<provider(7)>, L<OSSL_ENCODER_CTX(3)>, L<OSSL_ENCODER_to_bio(3)>,
136 L<OSSL_ENCODER_CTX_new_for_pkey(3)>, L<OSSL_LIB_CTX(3)>
137
138 =head1 HISTORY
139
140 The functions described here were added in OpenSSL 3.0.
141
142 =head1 COPYRIGHT
143
144 Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
145
146 Licensed under the Apache License 2.0 (the "License").  You may not use
147 this file except in compliance with the License.  You can obtain a copy
148 in the file LICENSE in the source distribution or at
149 L<https://www.openssl.org/source/license.html>.
150
151 =cut