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