---
name: "libressl-EVP_CIPHER_CTX_get_cipher_data"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-EVP_CIPHER_CTX_get_cipher_data"
---

# libressl-EVP\_CIPHER\_CTX\_get\_cipher\_data(3)

inspect and modify EVP\_CIPHER\_CTX objects

## 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

Crypto Library (libcrypto, -lcrypto)

**#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)](/free/3.md).

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