| EVP_MD_NID(3) | Library Functions Manual | EVP_MD_NID(3) |
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
#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);
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_NULLNULL 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_ABSENTEVP_MD_FLAG_DIGALGID_CUSTOMEVP_MD_FLAG_FIPSEVP_MD_FLAG_ONESHOTEVP_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.
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.
evp(3), EVP_DigestInit(3), EVP_MD_CTX_ctrl(3), OBJ_nid2obj(3)
RFC 5754: Using SHA2 Algorithms with Cryptographic Message Syntax
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.
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.
| March 5, 2024 | openbsd |