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