EVP_MD_NID(3)
π EVP_MD_NID β inspect EVP_MD objects
okay so bestie, welcome to the Library Functions Manual page for the whole little family of EVP_MD inspector functions β¨ This is your group chat for peeking inside EVP_MD objects (the digest algorithm descriptors) and EVP_MD_CTX objects (the actual running digest state) β NIDs, names, sizes, block sizes, flags, the whole vibe check. π¦
πΈ SYNOPSIS
library βlibcryptoβ #include <openssl/evp.h>
int
EVP_MD_nid(const EVP_MD *md);
int
EVP_MD_type(const EVP_MD *md);
int
EVP_MD_CTX_type(const EVP_MD_CTX *ctx);
const char *
EVP_MD_name(const EVP_MD *md);
int
EVP_MD_size(const EVP_MD *md);
int
EVP_MD_CTX_size(const EVP_MD_CTX *ctx);
int
EVP_MD_block_size(const EVP_MD *md);
int
EVP_MD_CTX_block_size(const EVP_MD_CTX *ctx);
unsigned long
EVP_MD_flags(const EVP_MD *md);
int
EVP_MD_pkey_type(const EVP_MD *md);
π DESCRIPTION
the NID situation π
EVP_MD_nid() and EVP_MD_type() are literally identical twins β they return the numerical identifier (NID) of md. The NID is an internal value which may or may not have a corresponding ASN.1 OBJECT IDENTIFIER; see OBJ_nid2obj(3) for the deets. For example, EVP_MD_type(EVP_sha512()) returns NID_sha512. π«
EVP_MD_CTX_type() returns the NID of the message digest algorithm that ctx is configured to use. These functions are normally used when setting ASN.1 OIDs, iykyk.
the name drop π«Ά
EVP_MD_name() converts the NID of md to its short name with OBJ_nid2sn(3). slay.
sizes, both kinds π
EVP_MD_size() returns the size in bytes of the message digests (hashes) produced by md. EVP_MD_CTX_size() return[s] the size of the hashes produced by the message digest algorithm that ctx is configured to use.
EVP_MD_block_size() returns the block size in bytes of md. EVP_MD_CTX_block_size() returns the block size of the message digest algorithm that ctx is configured to use.
flags, and a warning bestie β οΈ
EVP_MD_flags() returns the message digest flags used by md. Be careful to not confuse these flags with the unrelated message digest context flags that can be inspected with EVP_MD_CTX_test_flags(3). Two completely different flag situations, do not mix them up. π The available flags are:
EVP_MD_FLAG_DIGALGID_NULLβ The parameters in aDigestAlgorithmIdentifierare encoded using an explicit ASN.1 NULL rather than omitting them. This is the default, which means that it takes effect forEVP_MDobjects that do not haveEVP_MD_FLAG_DIGALGID_ABSENTset.EVP_MD_FLAG_DIGALGID_ABSENTβ The parameters in aDigestAlgorithmIdentifierare omitted from the ASN.1 encoding. This is used by theEVP_MDobjects documented in the manual pageEVP_sha3_224(3)and by the objects returned fromEVP_sha512(3),EVP_sha512_256(3),EVP_sha512_224(3),EVP_sha384(3),EVP_sha256(3),EVP_sha224(3),EVP_sha1(3), andEVP_sm3(3).EVP_MD_FLAG_DIGALGID_CUSTOMβ This flag is reserved for user-definedEVP_MDobjects supporting customDigestAlgorithmIdentifierhandling viaEVP_MD_CTX_ctrl(3), but actually, it is ignored by both LibreSSL and OpenSSL and such user-defined behaviour is not supported by the libraries. π reserved but not really reserved, okurrr.EVP_MD_FLAG_FIPSβ Mark the digest method as suitable for FIPS mode. This flag is ignored by both LibreSSL and OpenSSL. gone girl, she does nothing πEVP_MD_FLAG_ONESHOTβ Intended to indicate that the digest method can only handle one block of input, but actually, this flag is ignored by both LibreSSL and OpenSSL. also doing absolutely nothing, iconic behaviour honestly π
pkey type, a legacy moment π
EVP_MD_pkey_type() returns the NID of the public key signing algorithm associated with this digest. For example, EVP_sha512(3) is associated with RSA, so this returns NID_sha512WithRSAEncryption. Since digests and signature algorithms are no longer linked, this function is only retained for compatibility reasons. old money, kept around for the vibes.
macro tea π§
EVP_MD_nid(), EVP_MD_CTX_type(), EVP_MD_name(), EVP_MD_CTX_size(), and EVP_MD_CTX_block_size() are implemented as macros. no cap.
β RETURN VALUES
EVP_MD_nid(),EVP_MD_type(),EVP_MD_CTX_type(), andEVP_MD_pkey_type()return the NID of the corresponding OBJECT IDENTIFIER orNID_undefif none exists.EVP_MD_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_MD_size(),EVP_MD_CTX_size(),EVP_MD_block_size(), andEVP_MD_CTX_block_size()return the digest or block size in bytes.
π¦ SEE ALSO
evp(3), EVP_DigestInit(3), EVP_MD_CTX_ctrl(3), OBJ_nid2obj(3)
π STANDARDS
RFC 5754: Using SHA2 Algorithms with Cryptographic Message Syntax
- section 2: Message Digest Algorithms
π HISTORY
EVP_MD_size() first appeared in SSLeay 0.6.6, EVP_MD_CTX_size() and EVP_MD_CTX_type() in SSLeay 0.8.0, EVP_MD_type() and EVP_MD_pkey_type() in SSLeay 0.8.1, and EVP_MD_block_size() and EVP_MD_CTX_block_size() in SSLeay 0.9.0. All these functions have been available since OpenBSD 2.4. π«Ά
EVP_MD_nid() and EVP_MD_name() first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2.
EVP_MD_flags() first appeared in OpenSSL 1.0.0 and has been available since OpenBSD 4.9.
π₯ CAVEATS
bestie please read this one β The behaviour of the functions taking anEVP_MD_CTXargument is undefined if they are called on actxthat has no message digest configured yet, for example one freshly returned fromEVP_MD_CTX_new(3). In that case, the program may for example be terminated by a NULL pointer access. π So configure your digest first, fr fr. Don't be that girl.
that's the whole page, mwah π β this cutie came from Debian, dated June 8, 2025, and it lives at EVP_MD_NID(3) in the Library Functions Manual. go forth and inspect those EVP_MD objects, queen ππΈ
π¦ 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) 2023 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2000, 2012, 2019 The OpenSSL Project
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms