1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos EVP_KEYEXCH_fetch, EVP_KEYEXCH_free, EVP_KEYEXCH_up_ref, 6 1.1 christos EVP_KEYEXCH_get0_provider, EVP_KEYEXCH_is_a, EVP_KEYEXCH_do_all_provided, 7 1.1 christos EVP_KEYEXCH_names_do_all, EVP_KEYEXCH_get0_name, EVP_KEYEXCH_get0_description, 8 1.1 christos EVP_KEYEXCH_gettable_ctx_params, EVP_KEYEXCH_settable_ctx_params 9 1.1 christos - Functions to manage EVP_KEYEXCH 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_KEYEXCH *EVP_KEYEXCH_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, 16 1.1 christos const char *properties); 17 1.1 christos void EVP_KEYEXCH_free(EVP_KEYEXCH *exchange); 18 1.1 christos int EVP_KEYEXCH_up_ref(EVP_KEYEXCH *exchange); 19 1.1 christos OSSL_PROVIDER *EVP_KEYEXCH_get0_provider(const EVP_KEYEXCH *exchange); 20 1.1 christos int EVP_KEYEXCH_is_a(const EVP_KEYEXCH *exchange, const char *name); 21 1.1 christos const char *EVP_KEYEXCH_get0_name(const EVP_KEYEXCH *exchange); 22 1.1 christos void EVP_KEYEXCH_do_all_provided(OSSL_LIB_CTX *libctx, 23 1.1 christos void (*fn)(EVP_KEYEXCH *exchange, void *arg), 24 1.1 christos void *arg); 25 1.1 christos int EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *exchange, 26 1.1 christos void (*fn)(const char *name, void *data), 27 1.1 christos void *data); 28 1.1 christos const char *EVP_KEYEXCH_get0_description(const EVP_KEYEXCH *keyexch); 29 1.1 christos const OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch); 30 1.1 christos const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch); 31 1.1 christos 32 1.1 christos =head1 DESCRIPTION 33 1.1 christos 34 1.1 christos EVP_KEYEXCH_fetch() fetches the key exchange implementation for the given 35 1.1 christos I<algorithm> from any provider offering it, within the criteria given 36 1.1 christos by the I<properties>. 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_KEYEXCH_free(). 40 1.1 christos 41 1.1 christos EVP_KEYEXCH_free() decrements the reference count for the B<EVP_KEYEXCH> 42 1.1 christos structure. Typically this structure will have been obtained from an earlier call 43 1.1 christos to EVP_KEYEXCH_fetch(). If the reference count drops to 0 then the 44 1.1.1.2 christos structure is freed. If the argument is NULL, nothing is done. 45 1.1 christos 46 1.1 christos EVP_KEYEXCH_up_ref() increments the reference count for an B<EVP_KEYEXCH> 47 1.1 christos structure. 48 1.1 christos 49 1.1 christos EVP_KEYEXCH_get0_provider() returns the provider that I<exchange> was 50 1.1 christos fetched from. 51 1.1 christos 52 1.1 christos EVP_KEYEXCH_is_a() checks if I<exchange> is an implementation of an 53 1.1 christos algorithm that's identifiable with I<name>. 54 1.1 christos 55 1.1 christos EVP_KEYEXCH_get0_name() returns the algorithm name from the provided 56 1.1 christos implementation for the given I<exchange>. Note that the I<exchange> may have 57 1.1 christos multiple synonyms associated with it. In this case the first name from the 58 1.1 christos algorithm definition is returned. Ownership of the returned string is retained 59 1.1 christos by the I<exchange> object and should not be freed by the caller. 60 1.1 christos 61 1.1 christos EVP_KEYEXCH_names_do_all() traverses all names for the I<exchange>, and 62 1.1 christos calls I<fn> with each name and I<data>. 63 1.1 christos 64 1.1 christos EVP_KEYEXCH_get0_description() returns a description of the I<keyexch>, meant 65 1.1 christos for display and human consumption. The description is at the discretion of 66 1.1 christos the I<keyexch> implementation. 67 1.1 christos 68 1.1 christos EVP_KEYEXCH_do_all_provided() traverses all key exchange implementations by 69 1.1 christos all activated providers in the library context I<libctx>, and for each 70 1.1 christos of the implementations, calls I<fn> with the implementation method and 71 1.1 christos I<data> as arguments. 72 1.1 christos 73 1.1 christos EVP_KEYEXCH_gettable_ctx_params() and EVP_KEYEXCH_settable_ctx_params() return 74 1.1 christos a constant L<OSSL_PARAM(3)> array that describes the names and types of key 75 1.1 christos parameters that can be retrieved or set by a key exchange algorithm using 76 1.1 christos L<EVP_PKEY_CTX_get_params(3)> and L<EVP_PKEY_CTX_set_params(3)>. 77 1.1 christos 78 1.1 christos =head1 RETURN VALUES 79 1.1 christos 80 1.1 christos EVP_KEYEXCH_fetch() returns a pointer to a B<EVP_KEYEXCH> for success 81 1.1 christos or NULL for failure. 82 1.1 christos 83 1.1 christos EVP_KEYEXCH_up_ref() returns 1 for success or 0 otherwise. 84 1.1 christos 85 1.1 christos EVP_KEYEXCH_names_do_all() returns 1 if the callback was called for all 86 1.1 christos names. A return value of 0 means that the callback was not called for any names. 87 1.1 christos 88 1.1 christos EVP_KEYEXCH_is_a() returns 1 of I<exchange> was identifiable, 89 1.1 christos otherwise 0. 90 1.1 christos 91 1.1 christos EVP_KEYEXCH_gettable_ctx_params() and EVP_KEYEXCH_settable_ctx_params() return 92 1.1 christos a constant L<OSSL_PARAM(3)> array or NULL on error. 93 1.1 christos 94 1.1 christos =head1 SEE ALSO 95 1.1 christos 96 1.1 christos L<crypto(7)/ALGORITHM FETCHING>, L<OSSL_PROVIDER(3)> 97 1.1 christos 98 1.1 christos =head1 HISTORY 99 1.1 christos 100 1.1 christos The functions described here were added in OpenSSL 3.0. 101 1.1 christos 102 1.1 christos =head1 COPYRIGHT 103 1.1 christos 104 1.1.1.2 christos Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. 105 1.1 christos 106 1.1 christos Licensed under the Apache License 2.0 (the "License"). You may not use 107 1.1 christos this file except in compliance with the License. You can obtain a copy 108 1.1 christos in the file LICENSE in the source distribution or at 109 1.1 christos L<https://www.openssl.org/source/license.html>. 110 1.1 christos 111 1.1 christos =cut 112