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