EVP_ADD_CIPHER(3)

NAME
EVP_add_cipher, EVP_add_cipher_alias, EVP_delete_cipher_alias, EVP_add_digest, EVP_add_digest_alias, EVP_delete_digest_alias - maintain lookup tables for cipher and digest names

SYNOPSIS
#include <openssl/evp.h>
int
EVP_add_cipher(const EVP_CIPHER *cipher);
int
EVP_add_cipher_alias(const char *name, const char *alias);
int
EVP_delete_cipher_alias(const char *alias);
int
EVP_add_digest(const EVP_MD *md);
int
EVP_add_digest_alias(const char *name, const char *alias);
int
EVP_delete_digest_alias(const char *alias);

DESCRIPTION
EVP_add_cipher() adds cipher to a global lookup table so that it can be retrieved with EVP_get_cipherbyname(3) using both its long and short names, as determined by the cipher's NID via OBJ_nid2ln(3) and OBJ_nid2sn(3). It is the caller's responsibility to ensure that the long and short names are not NULL. Internally, the lookup table is the global associative array and OBJ_NAME_add(3) is used to add two key-value pairs with value pointer cipher and the keys consisting of the names and the type OBJ_NAME_TYPE_CIPHER_METH.

EVP_add_cipher_alias() and EVP_delete_cipher_alias() add and remove the alias for the cipher name. They are implemented as macros wrapping OBJ_NAME_add(3) and OBJ_NAME_remove(3) with type set to the bitwise or of OBJ_NAME_TYPE_CIPHER_METH and OBJ_NAME_ALIAS.

EVP_add_digest() adds md to a global lookup table so that it can be retrieved with EVP_get_digestbyname(3) using both its long and short names, as determined by the md's NID via OBJ_nid2ln(3) and OBJ_nid2sn(3). If the md has an associated public key signing algorithm (see EVP_MD_pkey_type(3)) distinct from the md, the signing algorithm's short and long names are added as aliases for the short name of md. It is the caller's responsibility to ensure that all long and short names are not NULL. Internally, the lookup table is the global associative array and OBJ_NAME_add(3) is used to add two key-value pairs with value pointer md and the keys consisting of the names and the type OBJ_NAME_TYPE_MD_METH. The aliases are added with EVP_add_digest_alias().

EVP_add_digest_alias() and EVP_delete_digest_alias() add and remove the alias for the digest name. They are implemented as macros wrapping OBJ_NAME_add(3) and OBJ_NAME_remove(3) with type set to the bitwise or of OBJ_NAME_TYPE_MD_METH and OBJ_NAME_ALIAS.

RETURN VALUES
EVP_add_cipher(), EVP_add_cipher_alias(), EVP_add_digest(), and EVP_add_digest_alias() return 1 on success or 0 if memory allocation fails.

EVP_delete_cipher_alias() and EVP_delete_digest_alias() return 1 if one alias was removed or 0 otherwise.

SEE ALSO
evp(3), EVP_CIPHER_meth_new(3), EVP_get_cipherbyname(3), EVP_get_digestbyname(3), EVP_MD_meth_new(3), OBJ_create(3), OBJ_NAME_add(3), OpenSSL_add_all_algorithms(3)

HISTORY
EVP_add_cipher() and EVP_add_digest() first appeared in OpenSSL 0.9.0 and have been available since OpenBSD 2.4.

EVP_add_cipher_alias(), EVP_delete_cipher_alias(), EVP_add_digest_alias(), and EVP_delete_digest_alias() first appeared in OpenSSL 0.9.4 and have been available since OpenBSD 2.6.

BUGS
Key-value pairs already added before an error occurred remain in the global associative array, leaving it in an unknown state.

While aliases can be added and removed, there is no dedicated API to remove added ciphers or digests.