---
name: "libressl-EVP_CIPHER_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_CIPHER_nid"
---

# libressl-EVP\_CIPHER\_nid(3)

inspect EVP\_CIPHER objects

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

Crypto Library (libcrypto, -lcrypto)

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

**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; see OBJ\_nid2obj(3) for details.

**EVP\_CIPHER\_CTX\_nid**() returns the NID of the cipher that *ctx* is configured to use.

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

**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), and EVP\_aes\_256\_cfb128(3) all return the same NID, NID\_aes\_256\_cfb128.

**EVP\_CIPHER\_CTX\_type**() returns the NID associated with the ASN.1 OBJECT IDENTIFIER of the cipher that *ctx* is 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 that *ctx* is configured to use. Block sizes are guaranteed to be less than or equal to the constant EVP\_MAX\_BLOCK\_LENGTH. Currently, EVP\_CipherInit\_ex(3) and the other functions documented in the same manual page only support block sizes of 1, 8, and 16 bytes.

**EVP\_CIPHER\_flags**() returns the cipher flags used by the *cipher*. The meaning of the flags is described in the EVP\_CIPHER\_meth\_set\_flags(3) manual page.

**EVP\_CIPHER\_CTX\_flags**() returns the cipher flags of the cipher that *ctx* is configured to use. Be careful to not confuse these with the unrelated cipher context flags that can be inspected with EVP\_CIPHER\_CTX\_test\_flags(3).

**EVP\_CIPHER\_mode**() returns the *cipher* mode, which is the logical AND of the constant EVP\_CIPH\_MODE and the return value of **EVP\_CIPHER\_flags**().

**EVP\_CIPHER\_CTX\_mode**() returns the cipher mode of the cipher that *ctx* is configured to use.

**EVP\_CIPHER\_name**(), **EVP\_CIPHER\_CTX\_type**(), **EVP\_CIPHER\_mode**(), and **EVP\_CIPHER\_CTX\_mode**() are implemented as macros.

## RETURN VALUES

**EVP\_CIPHER\_nid**() and **EVP\_CIPHER\_CTX\_nid**() return an NID.

**EVP\_CIPHER\_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), of if the object does not contain a short name.

**EVP\_CIPHER\_type**() and **EVP\_CIPHER\_CTX\_type**() return the NID of the cipher's OBJECT IDENTIFIER or NID\_undef if it is not associated with an OBJECT IDENTIFIER.

**EVP\_CIPHER\_block\_size**() and **EVP\_CIPHER\_CTX\_block\_size**() return the block size in bytes.

**EVP\_CIPHER\_flags**() and **EVP\_CIPHER\_CTX\_flags**() return one or more EVP\_CIPH\_\* flag bits OR'ed together.

**EVP\_CIPHER\_mode**() and **EVP\_CIPHER\_CTX\_mode**() return one of the constants EVP\_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, or EVP\_CIPH\_WRAP\_MODE to indicate a block cipher or EVP\_CIPH\_STREAM\_CIPHER to indicate a stream cipher.

## SEE ALSO

evp(3), EVP\_CIPHER\_CTX\_ctrl(3), EVP\_EncryptInit(3), OBJ\_nid2obj(3)

## HISTORY

**EVP\_CIPHER\_type**(), **EVP\_CIPHER\_CTX\_type**(), **EVP\_CIPHER\_block\_size**(), and **EVP\_CIPHER\_CTX\_block\_size**() first appeared in SSLeay 0.6.5. **EVP\_CIPHER\_nid**() and **EVP\_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**(), and **EVP\_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.
