EVP_CIPHER_CTX_GET_CIPHER_DATA(3)

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
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. The format and content of this data is specific to the algorithm and to the particular implementation of the cipher. 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).

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).

RETURN VALUES
EVP_CIPHER_CTX_get_cipher_data() returns an internal pointer owned by ctx.

EVP_CIPHER_CTX_set_cipher_data() returns a pointer to the old cipher data of ctx and transfers ownership to the caller.

EVP_CIPHER_CTX_buf_noconst() returns a pointer to an internal buffer owned by ctx.

SEE ALSO
evp(3), EVP_CIPHER_meth_new(3), EVP_EncryptInit(3)

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.