EVP_CIPHER_CTX_GET_APP_DATA(3ossl)

✨ NAME ✨

EVP_CIPHER_CTX_get_app_data, EVP_CIPHER_CTX_set_app_data β€” the little routines that let you peek at and poke at the application data hanging off an EVP_CIPHER_CTX πŸŽ€

Okay so this is from the OpenSSL manual, section 3ossl, and bestie it is genuinely the shortest little bop β€” two functions, one pointer, zero drama. Let's get into it πŸ’…


🌸 SYNOPSIS 🌸

#include <openssl/evp.h>

void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);

Like. Two lines. That's the whole API. Iconic behaviour honestly πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

So EVP_CIPHER_CTX_set_app_data() and EVP_CIPHER_CTX_get_app_data() are the duo that associate an opaque, application-defined pointer with an EVP_CIPHER_CTX object. That's it, that's the job 🫢

And the key thing β€” the part you actually need to internalise β€” is that this pointer is not interpreted by the library at all. OpenSSL does not look at it, does not dereference it, does not have opinions about it. It is reserved entirely for use by your application. It's your little locker. OpenSSL just holds the key πŸ—οΈ

So what's it for? Storing arbitrary context or state that needs to be accessible wherever the corresponding EVP_CIPHER_CTX is available. Your callback gets handed a ctx, and you need to get back to your own struct β€” this is how. Chef's kiss. No cap 🀌

Think of it as a coat check for your own stuff. OpenSSL never opens the coat, never checks the pockets, never asks what's inside. It just holds the ticket until you come back for it πŸ§₯

πŸ’– RETURN VALUES πŸ’–

EVP_CIPHER_CTX_get_app_data() returns an opaque pointer to the current application data for the EVP_CIPHER_CTX. That's the whole return-value section, bestie. Short and sweet πŸ“


Copyright 2026 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>.


And that's the page, fr fr 🌈 β€” this was EVP_CIPHER_CTX_GET_APP_DATA(3ossl) from OpenSSL 3.5.9, dated 2026-09-29. Go forth and store your state, main character πŸ’œβœ¨

πŸ“¦ where this page comes from