EVP_CIPHER_NID(3)
π
EVP_CIPHER_NID(3) β inspect EVP_CIPHER objects
okay so bestie, welcome to the Library Functions Manual β¨ this page is all about peeking inside EVP_CIPHER objects and their EVP_CIPHER_CTX besties β very βlet me find out what cipher you actually areβ energy. π
πΈ NAME πΈ
EVP_CIPHER_nid, EVP_CIPHER_CTX_nid, EVP_CIPHER_name, EVP_CIPHER_type, EVP_CIPHER_CTX_type, EVP_CIPHER_block_size, EVP_CIPHER_CTX_block_size, EVP_CIPHER_flags, EVP_CIPHER_CTX_flags, EVP_CIPHER_mode, EVP_CIPHER_CTX_mode β inspect EVP_CIPHER objects πβ¨
β¨ SYNOPSIS β¨
library βlibcryptoβ #include <openssl/evp.h>
int
EVP_CIPHER_nid(const EVP_CIPHER *cipher);
int
EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx);
const char *
EVP_CIPHER_name(const EVP_CIPHER *cipher);
int
EVP_CIPHER_type(const EVP_CIPHER *ctx);
int
EVP_CIPHER_CTX_type(const EVP_CIPHER_CTX *ctx);
int
EVP_CIPHER_block_size(const EVP_CIPHER *cipher);
int
EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx);
unsigned long
EVP_CIPHER_flags(const EVP_CIPHER *cipher);
unsigned long
EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx);
unsigned long
EVP_CIPHER_mode(const EVP_CIPHER *cipher);
unsigned long
EVP_CIPHER_CTX_mode(const EVP_CIPHER_CTX *ctx);
π DESCRIPTION π
So like, these functions are the βwhatβs your vibeβ check for ciphers and cipher contexts. Letβs go one by one, bestie:
EVP_CIPHER_nid()β returns the numerical identifier (NID) of the cipher. The NID is an internal value which may or may not have a corresponding ASN.1 OBJECT IDENTIFIER; seeOBJ_nid2obj(3)for details. π§EVP_CIPHER_CTX_nid()β returns the NID of the cipher thatctxis configured to use. iykyk. πEVP_CIPHER_name()β converts the NID of the cipher to its short name withOBJ_nid2sn(3). cute little name reveal moment. πEVP_CIPHER_type()β returns the NID associated with the ASN.1 OBJECT IDENTIFIER of the cipher, ignoring the cipher parameters. For example,EVP_aes_256_cfb1(3),EVP_aes_256_cfb8(3), andEVP_aes_256_cfb128(3)all return the same NID,NID_aes_256_cfb128. they said same NID, periodt. π₯EVP_CIPHER_CTX_type()β returns the NID associated with the ASN.1 OBJECT IDENTIFIER of the cipher thatctxis configured to use. πEVP_CIPHER_block_size()β returns the block size of the cipher in bytes.EVP_CIPHER_CTX_block_size()returns the block size of the cipher thatctxis configured to use. Block sizes are guaranteed to be less than or equal to the constantEVP_MAX_BLOCK_LENGTH. Currently,EVP_CipherInit_ex(3)and the other functions documented in the same manual page only support block sizes of1,8, and16bytes. block size besties, stay in your lane. π«ΆEVP_CIPHER_flags()β returns the cipher flags used by the cipher. The meaning of the flags is described in theEVP_CIPHER_meth_set_flags(3)manual page. πEVP_CIPHER_CTX_flags()β returns the cipher flags of the cipher thatctxis configured to use. Be careful to not confuse these with the unrelated cipher context flags that can be inspected withEVP_CIPHER_CTX_test_flags(3). not me warning you about lookalike flags πEVP_CIPHER_mode()β returns the cipher mode, which is the logical AND of the constantEVP_CIPH_MODEand the return value ofEVP_CIPHER_flags(). math but make it cipher. β¨EVP_CIPHER_CTX_mode()β returns the cipher mode of the cipher thatctxis configured to use. π- also important, bestie:
EVP_CIPHER_name(),EVP_CIPHER_CTX_type(),EVP_CIPHER_mode(), andEVP_CIPHER_CTX_mode()are implemented as macros. π§
π RETURN VALUES π
EVP_CIPHER_nid()andEVP_CIPHER_CTX_nid()return an NID. πEVP_CIPHER_name()returns a pointer to a string that is owned by an internal library object orNULLif the NID is neither built into the library nor added to the global object table by one of the functions documented in the manual pageOBJ_create(3), or if the object does not contain a short name. π«ΆEVP_CIPHER_type()andEVP_CIPHER_CTX_type()return the NID of the cipherβs OBJECT IDENTIFIER orNID_undefif it is not associated with an OBJECT IDENTIFIER. π¦EVP_CIPHER_block_size()andEVP_CIPHER_CTX_block_size()return the block size in bytes. πEVP_CIPHER_flags()andEVP_CIPHER_CTX_flags()return one or moreEVP_CIPH_*flag bits ORβed together. π₯EVP_CIPHER_mode()andEVP_CIPHER_CTX_mode()return one of the constantsEVP_CIPH_ECB_MODE,EVP_CIPH_CBC_MODE,EVP_CIPH_CFB_MODE,EVP_CIPH_OFB_MODE,EVP_CIPH_CTR_MODE,EVP_CIPH_GCM_MODE,EVP_CIPH_CCM_MODE,EVP_CIPH_XTS_MODE, orEVP_CIPH_WRAP_MODEto indicate a block cipher orEVP_CIPH_STREAM_CIPHERto indicate a stream cipher. iconic mode reveal. π
π¦ SEE ALSO π¦
β HISTORY β
okay so lore time, bestie:
EVP_CIPHER_type(),EVP_CIPHER_CTX_type(),EVP_CIPHER_block_size(), andEVP_CIPHER_CTX_block_size()first appeared in SSLeay 0.6.5.EVP_CIPHER_nid()andEVP_CIPHER_CTX_nid()first appeared in SSLeay 0.8.0.- All these functions have been available since OpenBSD 2.4. π
EVP_CIPHER_flags(),EVP_CIPHER_CTX_flags(),EVP_CIPHER_mode(), andEVP_CIPHER_CTX_mode()first appeared in OpenSSL 0.9.6 and have been available since OpenBSD 2.9. β¨EVP_CIPHER_name()first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.2. π
π CAVEATS π
The behaviour of the functions taking an EVP_CIPHER_CTX argument is undefined if they are called on a ctx that has no cipher configured yet, for example one freshly returned from EVP_CIPHER_CTX_new(3). In that case, the program may for example be terminated by a NULL pointer access. not a drill, bestie β do not vibe-check a ctx before it has a cipher configured. ππ
π cute sign-off: this page is from Debian, dated June 8, 2025, and itβs the EVP_CIPHER_NID(3) manual page. byeee, go inspect those cipher objects responsibly! πβ¨
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2018, 2023 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2000 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms