]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/OSSL_ENCODER.pod
Don't hold a lock when calling a callback in ossl_namemap_doall_names
[thirdparty/openssl.git] / doc / man3 / OSSL_ENCODER.pod
CommitLineData
ece9304c
RL
1=pod
2
3=head1 NAME
4
5OSSL_ENCODER,
6OSSL_ENCODER_fetch,
7OSSL_ENCODER_up_ref,
8OSSL_ENCODER_free,
9OSSL_ENCODER_provider,
10OSSL_ENCODER_properties,
11OSSL_ENCODER_is_a,
12OSSL_ENCODER_number,
13OSSL_ENCODER_do_all_provided,
b8975c68
RL
14OSSL_ENCODER_names_do_all,
15OSSL_ENCODER_gettable_params,
16OSSL_ENCODER_get_params
ece9304c
RL
17- Encoder method routines
18
19=head1 SYNOPSIS
20
21 #include <openssl/encoder.h>
22
23 typedef struct ossl_encoder_st OSSL_ENCODER;
24
b4250010 25 OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *ctx, const char *name,
ece9304c
RL
26 const char *properties);
27 int OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder);
28 void OSSL_ENCODER_free(OSSL_ENCODER *encoder);
29 const OSSL_PROVIDER *OSSL_ENCODER_provider(const OSSL_ENCODER *encoder);
30 const char *OSSL_ENCODER_properties(const OSSL_ENCODER *encoder);
31 int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);
32 int OSSL_ENCODER_number(const OSSL_ENCODER *encoder);
b4250010 33 void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,
ece9304c
RL
34 void (*fn)(OSSL_ENCODER *encoder, void *arg),
35 void *arg);
d84f5515
MC
36 int OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,
37 void (*fn)(const char *name, void *data),
38 void *data);
b8975c68
RL
39 const OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder);
40 int OSSL_ENCODER_get_params(OSSL_ENCODER_CTX *ctx, const OSSL_PARAM params[]);
ece9304c
RL
41
42=head1 DESCRIPTION
43
ece9304c
RL
44B<OSSL_ENCODER> is a method for encoders, which know how to
45encode an object of some kind to a encoded form, such as PEM,
46DER, or even human readable text.
47
48OSSL_ENCODER_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 encoder
52method is expected to be able to encode, 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_ENCODER_up_ref() increments the reference count for the given
58I<encoder>.
59
60OSSL_ENCODER_free() decrements the reference count for the given
61I<encoder>, and when the count reaches zero, frees it.
62
63OSSL_ENCODER_provider() returns the provider of the given
64I<encoder>.
65
851b06b7 66OSSL_ENCODER_properties() returns the property definition associated
ece9304c
RL
67with the given I<encoder>.
68
69OSSL_ENCODER_is_a() checks if I<encoder> is an implementation of an
70algorithm that's identifiable with I<name>.
71
72OSSL_ENCODER_number() returns the internal dynamic number assigned to
73the given I<encoder>.
74
75OSSL_ENCODER_names_do_all() traverses all names for the given
df785898 76I<encoder>, and calls I<fn> with each name and I<data> as arguments.
ece9304c
RL
77
78OSSL_ENCODER_do_all_provided() traverses all encoder
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 82
b8975c68
RL
83OSSL_ENCODER_gettable_params() returns an L<OSSL_PARAM(3)>
84array of parameter descriptors.
85
86OSSL_ENCODER_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
ece9304c
RL
90=head1 RETURN VALUES
91
92OSSL_ENCODER_fetch() returns a pointer to the key management
93implementation represented by an OSSL_ENCODER object, or NULL on
94error.
95
96OSSL_ENCODER_up_ref() returns 1 on success, or 0 on error.
97
98OSSL_ENCODER_free() doesn't return any value.
99
100OSSL_ENCODER_provider() returns a pointer to a provider object, or
101NULL on error.
102
103OSSL_ENCODER_properties() returns a pointer to a property
104definition string, or NULL on error.
105
106OSSL_ENCODER_is_a() returns 1 of I<encoder> was identifiable,
107otherwise 0.
108
109OSSL_ENCODER_number() returns an integer.
110
d84f5515
MC
111OSSL_ENCODER_names_do_all() returns 1 if the callback was called for all
112names. A return value of 0 means that the callback was not called for any names.
113
ece9304c
RL
114=head1 SEE ALSO
115
116L<provider(7)>, L<OSSL_ENCODER_CTX(3)>, L<OSSL_ENCODER_to_bio(3)>,
fe75766c 117L<OSSL_ENCODER_CTX_new_for_pkey(3)>, L<OSSL_LIB_CTX(3)>
ece9304c
RL
118
119=head1 HISTORY
120
121The functions described here were added in OpenSSL 3.0.
122
123=head1 COPYRIGHT
124
4333b89f 125Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
ece9304c
RL
126
127Licensed under the Apache License 2.0 (the "License"). You may not use
128this file except in compliance with the License. You can obtain a copy
129in the file LICENSE in the source distribution or at
130L<https://www.openssl.org/source/license.html>.
131
132=cut