EVP_CIPHER_DO_ALL(3) Library Functions Manual EVP_CIPHER_DO_ALL(3)

EVP_CIPHER_do_all, EVP_CIPHER_do_all_sorted, EVP_MD_do_all, EVP_MD_do_all_sortediterate over lookup tables for ciphers and digests

#include <openssl/evp.h>

void
EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *cipher, const char *from, const char *to, void *arg), void *arg);

void
EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *cipher, const char *from, const char *to, void *arg), void *arg);

void
EVP_MD_do_all(void (*fn)(const EVP_MD *md, const char *from, const char *to, void *arg), void *arg);

void
EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *md, const char *from, const char *to, void *arg), void *arg);

typedef struct {
        int	    type;
        int	    alias;
        const char *name;
        const char *data;
} OBJ_NAME;


void
OBJ_NAME_do_all(int type, void (*fn)(const OBJ_NAME *obj_name, void *arg), void *arg);

void
OBJ_NAME_do_all_sorted(int type, void (*fn)(const OBJ_NAME *obj_name, void *arg), void *arg);

() calls fn on every entry of the global table of cipher names and aliases. For a cipher name entry, fn is called with a non-NULL cipher, its non-NULL cipher name from, a NULL to, and the arg pointer. For an alias entry, fn is called with a NULL cipher, its alias from, the cipher name that alias points to, and the arg pointer.

() is similar, except that it processes the cipher names and aliases in lexicographic order of their from names as determined by strcmp(3).

() calls fn on every entry of the global table of digest names and aliases. For a digest name entry, fn is called with a non-NULL md, its non-NULL digest name from, a NULL to, and the arg pointer. For an alias entry, fn is called with a NULL md, its alias from, the digest name that alias points to, and the arg pointer.

() is similar, except that it processes the digest names and aliases in lexicographic order of their from names as determined by strcmp(3).

OBJ_NAME is an abstraction of the types underlying the lookup tables for ciphers and their aliases, and digests and their aliases, respectively. For a cipher, type is OBJ_NAME_TYPE_CIPHER_METH, alias is 0, name is its lookup name and data is the EVP_CIPHER object it represents, cast to const char *. For a cipher alias, type is OBJ_NAME_TYPE_CIPHER_METH, alias is OBJ_NAME_ALIAS, name is its lookup name and data is the name it aliases. Digests representing an EVP_MD object and their aliases are represented similarly, except that their type is OBJ_NAME_TYPE_MD_METH.

() calls fn on every obj_name in the table that has the given type (either OBJ_NAME_TYPE_CIPHER_METH or OBJ_NAME_TYPE_MD_METH), also passing the arg pointer. () is similar except that it processes the obj_name in lexicographic order of their names as determined by strcmp(3).

evp(3), EVP_get_cipherbyname(3), EVP_get_digestbyname(3)

These functions first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9.

EVP_CIPHER_do_all_sorted(), EVP_MD_do_all_sorted(), and OBJ_NAME_do_all_sorted() cannot report errors. In some implementations they need to allocate internally and if memory allocation fails they do nothing at all, without telling the caller about the problem.

January 31, 2024 Linux 6.8.2-arch2-1