EVP_CIPHER_C..._ORIGINAL_IV(3ossl)
π EVP_CIPHER_C..._ORIGINAL_IV π
okay bestie, this is a page from the OpenSSL manual β section 3ossl, iykyk β and it's all about peeking at the IV data inside an EVP_CIPHER_CTX. Yes, that name up top is a little cursed and abbreviated, but we move. π
β¨ 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 β literally the routines that let you inspect EVP_CIPHER_CTX IV data. That's the whole job. π«Ά
πΈ 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);
okay so these next ones are deprecated β they've been deprecated since OpenSSL 3.0, and you can make them disappear 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);
π¦ DESCRIPTION π¦
EVP_CIPHER_CTX_get_original_iv() and EVP_CIPHER_CTX_get_updated_iv() copy initialization vector (IV) information out of the EVP_CIPHER_CTX and into the buffer you, the caller, supply. π
Pro tip straight from the page: EVP_CIPHER_CTX_get_iv_length(3) can be used to figure out an appropriate buffer size β and if your buffer is too small, an error gets returned and no data is copied. So like, size it right, bestie. π
Here's the vibe split:
EVP_CIPHER_CTX_get_original_iv()β grabs the ("original") IV, aka the one that was supplied when theEVP_CIPHER_CTXwas initialized. The before picture. πΈEVP_CIPHER_CTX_get_updated_iv()β grabs the current "IV state" of the cipher, which gets updated during cipher operation for certain cipher modes (e.g., CBC and OFB). The glow-up picture. β¨
Now for the deprecated trio β they give you similar functionality, at a conceptual level. Conceptually slay, technically old:
EVP_CIPHER_CTX_iv()returns a pointer to the beginning of the "IV state" as maintained internally in theEVP_CIPHER_CTX.EVP_CIPHER_CTX_original_iv()returns 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()is the same asEVP_CIPHER_CTX_iv()but has a different return type for the pointer. (yes, the page really saysEVP_CIPHER_CTX_get_iv_noconst()there β that's what's written, don't come for me π)
π RETURN VALUES π
EVP_CIPHER_CTX_get_original_iv()andEVP_CIPHER_CTX_get_updated_iv()return1on success and0on failure. Classic. π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. New kids, freshest fits. β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 their era, we respect it. π
π 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>.
fr fr, read the license before you go copying stuff. it's giving "respect the authors" energy. π
and that's the whole page, bestie β no cap, every last NULL and 1-on-success accounted for. πΈ
k bye, this page was brought to you by OpenSSL 3.5.0, dated 2026-09-25, and the letter EVP_CIPHER_C..._ORIGINAL_IV(3ossl) π
π¦π§
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms