xref: /freebsd/crypto/openssl/doc/man3/EVP_KEM_free.pod (revision a7148ab39c03abd4d1a84997c70bf96f15dd2a09)
1b077aed3SPierre Pronchery=pod
2b077aed3SPierre Pronchery
3b077aed3SPierre Pronchery=head1 NAME
4b077aed3SPierre Pronchery
5b077aed3SPierre ProncheryEVP_KEM_fetch, EVP_KEM_free, EVP_KEM_up_ref,
6b077aed3SPierre ProncheryEVP_KEM_get0_name, EVP_KEM_is_a, EVP_KEM_get0_provider,
7b077aed3SPierre ProncheryEVP_KEM_do_all_provided, EVP_KEM_names_do_all, EVP_KEM_get0_description,
8b077aed3SPierre ProncheryEVP_KEM_gettable_ctx_params, EVP_KEM_settable_ctx_params
9b077aed3SPierre Pronchery- Functions to manage EVP_KEM algorithm objects
10b077aed3SPierre Pronchery
11b077aed3SPierre Pronchery=head1 SYNOPSIS
12b077aed3SPierre Pronchery
13b077aed3SPierre Pronchery #include <openssl/evp.h>
14b077aed3SPierre Pronchery
15b077aed3SPierre Pronchery EVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
16b077aed3SPierre Pronchery                        const char *properties);
17b077aed3SPierre Pronchery void EVP_KEM_free(EVP_KEM *kem);
18b077aed3SPierre Pronchery int EVP_KEM_up_ref(EVP_KEM *kem);
19b077aed3SPierre Pronchery const char *EVP_KEM_get0_name(const EVP_KEM *kem);
20b077aed3SPierre Pronchery int EVP_KEM_is_a(const EVP_KEM *kem, const char *name);
21b077aed3SPierre Pronchery OSSL_PROVIDER *EVP_KEM_get0_provider(const EVP_KEM *kem);
22b077aed3SPierre Pronchery void EVP_KEM_do_all_provided(OSSL_LIB_CTX *libctx,
23b077aed3SPierre Pronchery                              void (*fn)(EVP_KEM *kem, void *arg), void *arg);
24b077aed3SPierre Pronchery int EVP_KEM_names_do_all(const EVP_KEM *kem,
25b077aed3SPierre Pronchery                          void (*fn)(const char *name, void *data), void *data);
26b077aed3SPierre Pronchery const char *EVP_KEM_get0_description(const EVP_KEM *kem);
27b077aed3SPierre Pronchery const OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem);
28b077aed3SPierre Pronchery const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem);
29b077aed3SPierre Pronchery
30b077aed3SPierre Pronchery=head1 DESCRIPTION
31b077aed3SPierre Pronchery
32b077aed3SPierre ProncheryEVP_KEM_fetch() fetches the implementation for the given B<algorithm> from any
33b077aed3SPierre Proncheryprovider offering it, within the criteria given by the B<properties> and in the
34b077aed3SPierre Proncheryscope of the given library context B<ctx> (see L<OSSL_LIB_CTX(3)>). The algorithm
35b077aed3SPierre Proncherywill be one offering functions for performing asymmetric kem related tasks such
36b077aed3SPierre Proncheryas key encapsulation and decapsulation.
37b077aed3SPierre ProncherySee L<crypto(7)/ALGORITHM FETCHING> for further information.
38b077aed3SPierre Pronchery
39b077aed3SPierre ProncheryThe returned value must eventually be freed with EVP_KEM_free().
40b077aed3SPierre Pronchery
41b077aed3SPierre ProncheryEVP_KEM_free() decrements the reference count for the B<EVP_KEM> structure.
42b077aed3SPierre ProncheryTypically this structure will have been obtained from an earlier call to
43b077aed3SPierre ProncheryEVP_KEM_fetch(). If the reference count drops to 0 then the structure is freed.
44*a7148ab3SEnji CooperIf the argument is NULL, nothing is done.
45b077aed3SPierre Pronchery
46b077aed3SPierre ProncheryEVP_KEM_up_ref() increments the reference count for an B<EVP_KEM> structure.
47b077aed3SPierre Pronchery
48b077aed3SPierre ProncheryEVP_KEM_is_a() returns 1 if I<kem> is an implementation of an
49b077aed3SPierre Proncheryalgorithm that's identifiable with I<name>, otherwise 0.
50b077aed3SPierre Pronchery
51b077aed3SPierre ProncheryEVP_KEM_get0_provider() returns the provider that I<kem> was fetched from.
52b077aed3SPierre Pronchery
53b077aed3SPierre ProncheryEVP_KEM_do_all_provided() traverses all EVP_KEMs implemented by all activated
54b077aed3SPierre Proncheryproviders in the given library context I<libctx>, and for each of the
55b077aed3SPierre Proncheryimplementations, calls the given function I<fn> with the implementation method
56b077aed3SPierre Proncheryand the given I<arg> as argument.
57b077aed3SPierre Pronchery
58b077aed3SPierre ProncheryEVP_KEM_get0_name() returns the algorithm name from the provided
59b077aed3SPierre Proncheryimplementation for the given I<kem>. Note that the I<kem> may have
60b077aed3SPierre Proncherymultiple synonyms associated with it. In this case the first name from the
61b077aed3SPierre Proncheryalgorithm definition is returned. Ownership of the returned string is retained
62b077aed3SPierre Proncheryby the I<kem> object and should not be freed by the caller.
63b077aed3SPierre Pronchery
64b077aed3SPierre ProncheryEVP_KEM_names_do_all() traverses all names for I<kem>, and calls I<fn> with
65b077aed3SPierre Proncheryeach name and I<data>.
66b077aed3SPierre Pronchery
67b077aed3SPierre ProncheryEVP_KEM_get0_description() returns a description of the I<kem>, meant for
68b077aed3SPierre Proncherydisplay and human consumption.  The description is at the discretion of
69b077aed3SPierre Proncherythe I<kem> implementation.
70b077aed3SPierre Pronchery
71b077aed3SPierre ProncheryEVP_KEM_gettable_ctx_params() and EVP_KEM_settable_ctx_params() return
72b077aed3SPierre Proncherya constant L<OSSL_PARAM(3)> array that describes the names and types of key
73b077aed3SPierre Proncheryparameters that can be retrieved or set by a key encapsulation algorithm using
74b077aed3SPierre ProncheryL<EVP_PKEY_CTX_get_params(3)> and L<EVP_PKEY_CTX_set_params(3)>.
75b077aed3SPierre Pronchery
76b077aed3SPierre Pronchery=head1 RETURN VALUES
77b077aed3SPierre Pronchery
78b077aed3SPierre ProncheryEVP_KEM_fetch() returns a pointer to an B<EVP_KEM> for success or B<NULL> for
79b077aed3SPierre Proncheryfailure.
80b077aed3SPierre Pronchery
81b077aed3SPierre ProncheryEVP_KEM_up_ref() returns 1 for success or 0 otherwise.
82b077aed3SPierre Pronchery
83b077aed3SPierre ProncheryEVP_KEM_names_do_all() returns 1 if the callback was called for all names. A
84b077aed3SPierre Proncheryreturn value of 0 means that the callback was not called for any names.
85b077aed3SPierre Pronchery
86b077aed3SPierre ProncheryEVP_KEM_gettable_ctx_params() and EVP_KEM_settable_ctx_params() return
87b077aed3SPierre Proncherya constant L<OSSL_PARAM(3)> array or NULL on error.
88b077aed3SPierre Pronchery
89b077aed3SPierre Pronchery=head1 SEE ALSO
90b077aed3SPierre Pronchery
91b077aed3SPierre ProncheryL<crypto(7)/ALGORITHM FETCHING>, L<OSSL_PROVIDER(3)>
92b077aed3SPierre Pronchery
93b077aed3SPierre Pronchery=head1 HISTORY
94b077aed3SPierre Pronchery
95b077aed3SPierre ProncheryThe functions described here were added in OpenSSL 3.0.
96b077aed3SPierre Pronchery
97b077aed3SPierre Pronchery=head1 COPYRIGHT
98b077aed3SPierre Pronchery
99*a7148ab3SEnji CooperCopyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
100b077aed3SPierre Pronchery
101b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
102b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
103b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
104b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
105b077aed3SPierre Pronchery
106b077aed3SPierre Pronchery=cut
107