EVP_ASYM_CIPHER_FREE(3ossl)
π
EVP_ASYM_CIPHER_FREE β like, all the functions you need to manage EVP_ASYM_CIPHER algorithm objects (OpenSSL 3ossl, bestie)
Okay so real talk: this whole page is about one little object called EVP_ASYM_CIPHER, and all the ways you can fetch it, keep it alive, poke at it, and let it go. It's the thing that does asymmetric cipher stuff β you know, asymmetric encryption and decryption. Public key nonsense. Iconic behavior, honestly. πβ¨
Let's go through it together, no cap.
β¨ SYNOPSIS β¨
#include <openssl/evp.h>
EVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
const char *properties);
void EVP_ASYM_CIPHER_free(EVP_ASYM_CIPHER *cipher);
int EVP_ASYM_CIPHER_up_ref(EVP_ASYM_CIPHER *cipher);
const char *EVP_ASYM_CIPHER_get0_name(const EVP_ASYM_CIPHER *cipher);
int EVP_ASYM_CIPHER_is_a(const EVP_ASYM_CIPHER *cipher, const char *name);
OSSL_PROVIDER *EVP_ASYM_CIPHER_get0_provider(const EVP_ASYM_CIPHER *cipher);
void EVP_ASYM_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_ASYM_CIPHER *cipher,
void *arg),
void *arg);
int EVP_ASYM_CIPHER_names_do_all(const EVP_ASYM_CIPHER *cipher,
void (*fn)(const char *name, void *data),
void *data);
const char *EVP_ASYM_CIPHER_get0_description(const EVP_ASYM_CIPHER *cipher);
const OSSL_PARAM *EVP_ASYM_CIPHER_gettable_ctx_params(const EVP_ASYM_CIPHER *cip);
const OSSL_PARAM *EVP_ASYM_CIPHER_settable_ctx_params(const EVP_ASYM_CIPHER *cip);
Like, look at all those. So many besties. π«Ά
πΈ DESCRIPTION πΈ
π Fetching β the main character moment
EVP_ASYM_CIPHER_fetch() goes and fetches the implementation for whatever algorithm you asked for, from any provider that's willing to offer it. It does this inside the criteria you gave it via properties, and scoped to the library context ctx (peep OSSL_LIB_CTX(3) for the deets on that one).
The algorithm it hands you back is gonna be one that offers functions for doing asymmetric cipher tasks β stuff like asymmetric encryption and decryption. That's its whole vibe.
For way more on this, go look at "ALGORITHM FETCHING" in crypto(7). It's giving required reading.
And the important part, bestie: the returned value must eventually be freed with EVP_ASYM_CIPHER_free(). Don't just leave it there. That's a leak. Not cute. π
π Freeing β the respectful goodbye
EVP_ASYM_CIPHER_free() decrements the reference count on the EVP_ASYM_CIPHER structure. Usually you got that structure from a previous EVP_ASYM_CIPHER_fetch() call. When the reference count drops all the way to 0, the structure gets freed. And if the argument is NULL? Absolutely nothing happens. Nothing. Chill. π
π Up-ref β keeping it alive
EVP_ASYM_CIPHER_up_ref() increments the reference count for an EVP_ASYM_CIPHER structure. Gotta keep your faves around, y'know? π
π is_a β the identity check
EVP_ASYM_CIPHER_is_a() returns 1 if cipher is an implementation of an algorithm that's identifiable with name, and 0 otherwise. Simple as that. Yes/no. Slay or don't. π¦
π get0_provider β where did you come from
EVP_ASYM_CIPHER_get0_provider() returns the provider that cipher was fetched from. Origin story unlocked. π₯
π do_all_provided β the full tour
EVP_ASYM_CIPHER_do_all_provided() traverses all the EVP_ASYM_CIPHERs implemented by all activated providers in the given library context libctx, and for each of those implementations, it calls the given function fn with the implementation method and the given arg as argument. Like a little meet-and-greet for every single one. β¨
π get0_name β what's your name, girl
EVP_ASYM_CIPHER_get0_name() returns the algorithm name from the provided implementation for the given cipher.
Heads up though: cipher might have multiple synonyms associated with it. In that case, the first name from the algorithm definition is what gets returned. So it's the first one, not necessarily the one.
Ownership of the returned string stays with the cipher object β so do not free it yourself. Not yours. Hands off. π
π names_do_all β every alias, one by one
EVP_ASYM_CIPHER_names_do_all() traverses all names for cipher, and calls fn with each name and data. All the nicknames, all the versions of her. π
π get0_description β the little bio
EVP_ASYM_CIPHER_get0_description() returns a description of the cipher, and it's meant for display and human consumption. Basically its little profile caption. And the description itself is at the discretion of the cipher implementation β so whatever the cipher feels like saying. π
π gettable_ctx_params / settable_ctx_params β the param lists
EVP_ASYM_CIPHER_gettable_ctx_params() and EVP_ASYM_CIPHER_settable_ctx_params() 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 encryption algorithm using EVP_PKEY_CTX_get_params(3) and EVP_PKEY_CTX_set_params(3). So like, a menu of what's gettable and what's settable. π
β RETURN VALUES β
EVP_ASYM_CIPHER_fetch()β returns a pointer to anEVP_ASYM_CIPHERfor success, orNULLfor failure. πEVP_ASYM_CIPHER_up_ref()β returns1for success, or0otherwise.EVP_ASYM_CIPHER_names_do_all()β returns1if the callback was called for all names. A return value of0means the callback was not called for any names. πEVP_ASYM_CIPHER_gettable_ctx_params()andEVP_ASYM_CIPHER_settable_ctx_params()β return a constantOSSL_PARAM(3)array, orNULLon error.
π¦ SEE ALSO π¦
- "ALGORITHM FETCHING" in
crypto(7) OSSL_PROVIDER(3)
π§ HISTORY π§
The functions described here were added in OpenSSL 3.0. So yes, they're giving modern. π
π COPYRIGHT π
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>.
Okay that's the whole page, bestie β go forth and manage your EVP_ASYM_CIPHER objects responsibly. This was OpenSSL 3.5.0, dated 2026-09-25, and the manual page is EVP_ASYM_CIPHER_FREE(3ossl). Mwah. ππβ¨
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms