EVP_KEYEXCH_FREE(3ossl)

πŸ’– EVP_KEYEXCH_FREE(3ossl) β€” the OpenSSL keyexch management glow-up πŸ’–

okay bestie, sit down, hydrate, and let me tell you about the EVP_KEYEXCH family of functions. this is the EVP_KEYEXCH_FREE page from the OpenSSL 3ossl manuals, and it's basically the whole "manage your key exchange algorithm objects" friend group. no cap, every single one of them is here.


✨ NAME ✨

EVP_KEYEXCH_fetch, EVP_KEYEXCH_free, EVP_KEYEXCH_up_ref, EVP_KEYEXCH_get0_provider, EVP_KEYEXCH_is_a, EVP_KEYEXCH_do_all_provided, EVP_KEYEXCH_names_do_all, EVP_KEYEXCH_get0_name, EVP_KEYEXCH_get0_description, EVP_KEYEXCH_gettable_ctx_params, EVP_KEYEXCH_settable_ctx_params β€” these are the functions to manage EVP_KEYEXCH algorithm objects. πŸ’…


🌸 SYNOPSIS 🌸

#include <openssl/evp.h>

EVP_KEYEXCH *EVP_KEYEXCH_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
                               const char *properties);
void EVP_KEYEXCH_free(EVP_KEYEXCH *exchange);
int EVP_KEYEXCH_up_ref(EVP_KEYEXCH *exchange);
OSSL_PROVIDER *EVP_KEYEXCH_get0_provider(const EVP_KEYEXCH *exchange);
int EVP_KEYEXCH_is_a(const EVP_KEYEXCH *exchange, const char *name);
const char *EVP_KEYEXCH_get0_name(const EVP_KEYEXCH *exchange);
void EVP_KEYEXCH_do_all_provided(OSSL_LIB_CTX *libctx,
                                 void (*fn)(EVP_KEYEXCH *exchange, void *arg),
                                 void *arg);
int EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *exchange,
                             void (*fn)(const char *name, void *data),
                             void *data);
const char *EVP_KEYEXCH_get0_description(const EVP_KEYEXCH *keyexch);
const OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch);
const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch);

πŸ¦‹ DESCRIPTION πŸ¦‹

  • EVP_KEYEXCH_fetch() β€” bestie, this one fetches the key exchange implementation for the given algorithm from any provider offering it, filtered by the criteria in properties. wanna know more? go read "ALGORITHM FETCHING" in crypto(7). πŸ”
⚠️ the value it hands you back must eventually be freed with EVP_KEYEXCH_free(). that's not a suggestion, that's the law. πŸ™ˆ
  • EVP_KEYEXCH_free() β€” decrements the reference count on that EVP_KEYEXCH structure. usually you got this thing from an earlier EVP_KEYEXCH_fetch() call. the second the ref count hits 0, the structure gets freed. and if the argument is NULL? nothing happens. we love a low-stakes no-op. πŸ’…
  • EVP_KEYEXCH_up_ref() β€” increments the reference count for an EVP_KEYEXCH structure. glow up, stay a while. ✨
  • EVP_KEYEXCH_get0_provider() β€” returns the provider that exchange was fetched from. it's giving "where do you come from, king?" πŸ‘‘
  • EVP_KEYEXCH_is_a() β€” checks whether exchange is an implementation of an algorithm that's identifiable with name. vibe check: algorithm edition. 🌈
  • EVP_KEYEXCH_get0_name() β€” returns the algorithm name from the provided implementation for the given exchange. heads up though: the exchange may have multiple synonyms attached to it, and in that case you get the first name from the algorithm definition. also β€” ownership of the returned string stays with the exchange object, so do NOT free it yourself. it's not yours, bestie, don't touch it. πŸ™…β€β™€οΈ
  • EVP_KEYEXCH_names_do_all() β€” traverses all names for the exchange, and calls fn with each name and data. a whole little roll call. πŸ“‹
  • EVP_KEYEXCH_get0_description() β€” returns a description of the keyexch, and it's meant for display and human consumption (yes, actual humans 🫢). the description itself is at the discretion of the keyexch implementation, so it's giving whatever it feels like giving.
  • EVP_KEYEXCH_do_all_provided() β€” traverses all key exchange implementations by all activated providers in the library context libctx, and for each of those implementations it calls fn with the implementation method and data as arguments. full sweep. no one gets left out. 🧹✨
  • EVP_KEYEXCH_gettable_ctx_params() and EVP_KEYEXCH_settable_ctx_params() β€” both return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set by a key exchange algorithm using EVP_PKEY_CTX_get_params(3) and EVP_PKEY_CTX_set_params(3). gettable = can get, settable = can set. iconic symmetry, periodt. ⭐

πŸ’€ RETURN VALUES πŸ’€

  • EVP_KEYEXCH_fetch() β€” returns a pointer to a EVP_KEYEXCH on success, or NULL on failure. 😭
  • EVP_KEYEXCH_up_ref() β€” returns 1 for success or 0 otherwise.
  • EVP_KEYEXCH_names_do_all() β€” returns 1 if the callback was called for all names. a return value of 0 means the callback was not called for any names.
  • EVP_KEYEXCH_is_a() β€” returns 1 if exchange was identifiable, otherwise 0. (yes the original says "1 of exchange was identifiable", we're being nice about it πŸ’œ)
  • EVP_KEYEXCH_gettable_ctx_params() and EVP_KEYEXCH_settable_ctx_params() β€” return a constant OSSL_PARAM(3) array, or NULL on error.

πŸ‘€ SEE ALSO πŸ‘€

"ALGORITHM FETCHING" in crypto(7), OSSL_PROVIDER(3). go read them, iykyk. πŸ“š


πŸŽ€ HISTORY πŸŽ€

the functions described here were added in OpenSSL 3.0. glow-up era. ✨


Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html.

fr fr, read the license, bestie. it's literally right there. 🫢

and that's the whole page, no crumbs left. πŸ’– this was OpenSSL 3.5.9, dated 2026-09-29, straight from the EVP_KEYEXCH_FREE(3ossl) manual. slay, hydrate, and always up_ref responsibly. πŸ’…βœ¨

πŸ“¦ where this page comes from