---
name: "libressl-EVP_MD_nid"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-EVP_MD_nid"
---

# libressl-EVP\_MD\_nid(3)

inspect EVP\_MD objects

## NAME

**EVP\_MD\_nid**, **EVP\_MD\_type**, **EVP\_MD\_CTX\_type**, **EVP\_MD\_name**, **EVP\_MD\_size**, **EVP\_MD\_CTX\_size**, **EVP\_MD\_block\_size**, **EVP\_MD\_CTX\_block\_size**, **EVP\_MD\_flags**, **EVP\_MD\_pkey\_type** – inspect EVP\_MD objects

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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

**EVP\_MD\_nid**() and **EVP\_MD\_type**() are identical and 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 details. 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.

**EVP\_MD\_name**() converts the NID of *md* to its short name with OBJ\_nid2sn(3).

**EVP\_MD\_size**() returns the size in bytes of the message digests (hashes) produced by *md*. **EVP\_MD\_CTX\_size**() return 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.

**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). The available flags are:

- EVP\_MD\_FLAG\_DIGALGID\_NULL

  The parameters in a *DigestAlgorithmIdentifier* are encoded using an explicit ASN.1 NULL rather than omitting them. This is the default, which means that it takes effect for *EVP\_MD* objects that do not have EVP\_MD\_FLAG\_DIGALGID\_ABSENT set.

- EVP\_MD\_FLAG\_DIGALGID\_ABSENT

  The parameters in a *DigestAlgorithmIdentifier* are omitted from the ASN.1 encoding. This is used by the *EVP\_MD* objects documented in the manual page EVP\_sha3\_224(3) and by the objects returned from EVP\_sha512(3), EVP\_sha512\_256(3), EVP\_sha512\_224(3), EVP\_sha384(3), EVP\_sha256(3), EVP\_sha224(3), EVP\_sha1(3), and EVP\_sm3(3).

- EVP\_MD\_FLAG\_DIGALGID\_CUSTOM

  This flag is reserved for user-defined *EVP\_MD* objects supporting custom *DigestAlgorithmIdentifier* handling via EVP\_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.

- EVP\_MD\_FLAG\_FIPS

  Mark the digest method as suitable for FIPS mode. This flag is ignored by both LibreSSL and OpenSSL.

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

**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.

**EVP\_MD\_nid**(), **EVP\_MD\_CTX\_type**(), **EVP\_MD\_name**(), **EVP\_MD\_CTX\_size**(), and **EVP\_MD\_CTX\_block\_size**() are implemented as macros.

## RETURN VALUES

**EVP\_MD\_nid**(), **EVP\_MD\_type**(), **EVP\_MD\_CTX\_type**(), and **EVP\_MD\_pkey\_type**() return the NID of the corresponding OBJECT IDENTIFIER or NID\_undef if none exists.

**EVP\_MD\_name**() returns a pointer to a string that is owned by an internal library object or NULL if the NID is neither built into the library nor added to the global object table by one of the functions documented in the manual page OBJ\_create(3), or if the object does not contain a short name.

**EVP\_MD\_size**(), **EVP\_MD\_CTX\_size**(), **EVP\_MD\_block\_size**(), and **EVP\_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

The behaviour of the functions taking an *EVP\_MD\_CTX* argument is undefined if they are called on a *ctx* that has no message digest configured yet, for example one freshly returned from EVP\_MD\_CTX\_new(3). In that case, the program may for example be terminated by a NULL pointer access.
