LIBRESSL-EVP_CIPHER_CTX_GET_CIPHER_DATA(3)
π EVP_CIPHER_CTX_GET_CIPHER_DATA β like, the whole glow-up
okay so bestie, this is a page from the Library Functions Manual for libcrypto, and it's all about poking around inside EVP_CIPHER_CTX objects β inspecting them, messing with them, the whole vibe. Three functions, one page, let's go π
β¨ NAME β¨
EVP_CIPHER_CTX_get_cipher_data, EVP_CIPHER_CTX_set_cipher_data, EVP_CIPHER_CTX_buf_noconst β inspect and modify EVP_CIPHER_CTX objects π«Ά
πΈ SYNOPSIS πΈ
library βlibcryptoβ
#include <openssl/evp.h>
void *
EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx);
void *
EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data);
unsigned char *
EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx);
π¦ DESCRIPTION π¦
π EVP_CIPHER_CTX_get_cipher_data()
Returns a pointer to the cipher data of ctx. and likeβ¦ the format and content of this data is specific to the algorithm and to the particular implementation of the cipher. no cap, it's giving very "you had to be there" energy β every cipher does its own thing β¨
For example, this data can be used by engines to store engine specific information π The data is automatically allocated and freed by OpenSSL, so applications and engines should not normally free this directly (but see below π).
π EVP_CIPHER_CTX_set_cipher_data()
Allows an application or engine to replace the existing cipher data with new data, transferring ownership of cipher_data to the ctx object π₯ A pointer to any existing cipher data is returned from this function. If the old data is no longer required, it should be freed through a call to free(3) β yes bestie, you have to clean that up yourself π
π EVP_CIPHER_CTX_buf_noconst()
Provides engines and custom cipher implementations with access to the internal buffer that EVP_EncryptUpdate(3) copies input data into before encrypting it π§ This function can for example be used inside callback functions installed with EVP_CIPHER_meth_set_do_cipher(3). lowkey iconic access right there β
π RETURN VALUES π
EVP_CIPHER_CTX_get_cipher_data()β returns an internal pointer owned byctxπEVP_CIPHER_CTX_set_cipher_data()β returns a pointer to the old cipher data ofctxand transfers ownership to the caller π«ΆEVP_CIPHER_CTX_buf_noconst()β returns a pointer to an internal buffer owned byctxπ
bestie note: notice the "owned by" energy on those first and last ones β those pointers are not yours to free, periodt π
π SEE ALSO π
evp(3), EVP_CIPHER_meth_new(3), EVP_EncryptInit(3) β go read these next, iykyk π
π HISTORY π
EVP_CIPHER_CTX_get_cipher_data(), EVP_CIPHER_CTX_set_cipher_data(), and EVP_CIPHER_CTX_buf_noconst() first appeared in OpenSSL 1.1.0 and have been available since OpenBSD 7.1 π
aaand that's the page, bestie π mwah. this Debian build is dated June 8, 2025 β so yeah, freshly served, go forth and inspect those cipher contexts responsibly πβ¨
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2023 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2016 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms