EVP_CIPHER_C..._ORIGINAL_IV(3ossl)
π NAME π
EVP_CIPHER_CTX_get_original_iv, EVP_CIPHER_CTX_get_updated_iv, EVP_CIPHER_CTX_iv, EVP_CIPHER_CTX_original_iv, EVP_CIPHER_CTX_iv_noconst β the little routines that let you peek at the IV data chillin' inside an EVP_CIPHER_CTX.
okay so this is from the OpenSSL manual, third section, and bestie we are about to get so cozy with initialization vectors. π¦
β¨ SYNOPSIS β¨
#include <openssl/evp.h>
int EVP_CIPHER_CTX_get_original_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);
int EVP_CIPHER_CTX_get_updated_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);
The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):
const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx);
const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx);
unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx);
bestie listen. Those last three? Deprecated. Since OpenSSL 3.0. They're giving "my mom's old flip phone" energy. Still around, still works, but the new ones are the moment. π
πΈ DESCRIPTION πΈ
So EVP_CIPHER_CTX_get_original_iv() and EVP_CIPHER_CTX_get_updated_iv() do the thing where they copy initialization vector (IV) info out of the EVP_CIPHER_CTX and into the buffer you brought from home. Very generous of them.
Wanna know how big that buffer should be? That's EVP_CIPHER_CTX_get_iv_length(3), your bestie for sizing. And if your buffer is too small? error, no data copied, no vibes, nothing. π So measure twice, okay?
EVP_CIPHER_CTX_get_original_iv()β grabs the ("original") IV, aka the one you supplied way back when theEVP_CIPHER_CTXgot initialized. The untouched, first-day-of-school IV. πEVP_CIPHER_CTX_get_updated_iv()β grabs the current "IV state" of the cipher, which gets updated as the cipher operates for certain cipher modes (e.g.,CBCandOFB). She's been through things. She's evolved. π
And now for the deprecated trio β EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and EVP_CIPHER_CTX_iv_noconst(). They do conceptually similar stuff, just... the old way. Not me being shady, that's literally what the docs say. π
EVP_CIPHER_CTX_iv()β hands you a pointer to the beginning of the "IV state" as maintained internally in theEVP_CIPHER_CTX. πEVP_CIPHER_CTX_original_iv()β hands you a pointer to the beginning of the ("original") IV, as maintained by theEVP_CIPHER_CTX, that was provided when theEVP_CIPHER_CTXwas initialized. πΌEVP_CIPHER_CTX_get_iv_noconst()β same asEVP_CIPHER_CTX_iv()but with a different return type for the pointer. That's it. That's the whole difference. π
π RETURN VALUES π
EVP_CIPHER_CTX_get_original_iv()andEVP_CIPHER_CTX_get_updated_iv()β return1on success and0on failure. Classic. Slay or flop, no in-between. β¨EVP_CIPHER_CTX_iv(),EVP_CIPHER_CTX_original_iv(), andEVP_CIPHER_CTX_iv_noconst()β return a pointer to an IV as an array of bytes on success, andNULLon failure. π«Ά
π§ HISTORY π§
EVP_CIPHER_CTX_get_original_iv()andEVP_CIPHER_CTX_get_updated_iv()were added in OpenSSL 3.0.0. Fresh. New. Iconic. π₯EVP_CIPHER_CTX_iv(),EVP_CIPHER_CTX_original_iv(), andEVP_CIPHER_CTX_iv_noconst()were added in OpenSSL 1.1.0, and were deprecated in OpenSSL 3.0.0. They had a good run, honestly. π―οΈ
π COPYRIGHT π
Copyright 2020-2021 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 whole page bestie, no cap, every single flag and pointer accounted for π β¨
This was brought to you by OpenSSL 3.5.9, dated 2026-09-29 β go forth and check your IVs responsibly, mwah ππ¦π
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms