#ifndef FIPS_MODE
/* TODO(3.x) get rid of the need for legacy NIDs */
md->type = NID_undef;
- evp_doall_names(prov, name_id, set_legacy_nid, &md->type);
+ evp_names_do_all(prov, name_id, set_legacy_nid, &md->type);
if (md->type == -1) {
ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
EVP_MD_free(md);
#ifndef FIPS_MODE
/* TODO(3.x) get rid of the need for legacy NIDs */
cipher->nid = NID_undef;
- evp_doall_names(prov, name_id, set_legacy_nid, &cipher->nid);
+ evp_names_do_all(prov, name_id, set_legacy_nid, &cipher->nid);
if (cipher->nid == -1) {
ERR_raise(ERR_LIB_EVP, ERR_R_INTERNAL_ERROR);
EVP_CIPHER_free(cipher);
return ossl_namemap_name2num(namemap, name) == number;
}
-void evp_doall_names(OSSL_PROVIDER *prov, int number,
- void (*fn)(const char *name, void *data),
- void *data)
+void evp_names_do_all(OSSL_PROVIDER *prov, int number,
+ void (*fn)(const char *name, void *data),
+ void *data)
{
OPENSSL_CTX *libctx = ossl_provider_library_context(prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
#endif
}
+void EVP_CIPHER_names_do_all(const EVP_CIPHER *cipher,
+ void (*fn)(const char *name, void *data),
+ void *data)
+{
+ if (cipher->prov != NULL)
+ evp_names_do_all(cipher->prov, cipher->name_id, fn, data);
+}
+
const OSSL_PROVIDER *EVP_CIPHER_provider(const EVP_CIPHER *cipher)
{
return cipher->prov;
#endif
}
+void EVP_MD_names_do_all(const EVP_MD *md,
+ void (*fn)(const char *name, void *data),
+ void *data)
+{
+ if (md->prov != NULL)
+ evp_names_do_all(md->prov, md->name_id, fn, data);
+}
+
const OSSL_PROVIDER *EVP_MD_provider(const EVP_MD *md)
{
return md->prov;
/* OSSL_PROVIDER * is only used to get the library context */
const char *evp_first_name(OSSL_PROVIDER *prov, int name_id);
int evp_is_a(OSSL_PROVIDER *prov, int number, const char *name);
-void evp_doall_names(OSSL_PROVIDER *prov, int number,
- void (*fn)(const char *name, void *data),
- void *data);
+void evp_names_do_all(OSSL_PROVIDER *prov, int number,
+ void (*fn)(const char *name, void *data),
+ void *data);
evp_keyexch_from_dispatch, &keymgmt_data,
(void (*)(void *))EVP_KEYEXCH_free);
}
+
+void EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *keyexch,
+ void (*fn)(const char *name, void *data),
+ void *data)
+{
+ if (keyexch->prov != NULL)
+ evp_names_do_all(keyexch->prov, keyexch->name_id, fn, data);
+}
return dst;
}
-const char *EVP_KDF_name(const EVP_KDF *kdf)
-{
- return evp_first_name(kdf->prov, kdf->name_id);
-}
-
int EVP_KDF_is_a(const EVP_KDF *kdf, const char *name)
{
return evp_is_a(kdf->prov, kdf->name_id, name);
return ctx->meth->set_ctx_params(ctx->data, params);
return 1;
}
+
+void EVP_KDF_names_do_all(const EVP_KDF *kdf,
+ void (*fn)(const char *name, void *data),
+ void *data)
+{
+ if (kdf->prov != NULL)
+ evp_names_do_all(kdf->prov, kdf->name_id, fn, data);
+}
keymgmt_from_dispatch, NULL,
(void (*)(void *))EVP_KEYMGMT_free);
}
+
+void EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
+ void (*fn)(const char *name, void *data),
+ void *data)
+{
+ if (keymgmt->prov != NULL)
+ evp_names_do_all(keymgmt->prov, keymgmt->name_id, fn, data);
+}
{
return evp_is_a(mac->prov, mac->name_id, name);
}
+
+void EVP_MAC_names_do_all(const EVP_MAC *mac,
+ void (*fn)(const char *name, void *data),
+ void *data)
+{
+ if (mac->prov != NULL)
+ evp_names_do_all(mac->prov, mac->name_id, fn, data);
+}
evp_mac_free(mac);
}
-const char *EVP_MAC_name(const EVP_MAC *mac)
-{
- return evp_first_name(mac->prov, mac->name_id);
-}
-
const OSSL_PROVIDER *EVP_MAC_provider(const EVP_MAC *mac)
{
return mac->prov;
(void (*)(void *))EVP_SIGNATURE_free);
}
+
+void EVP_SIGNATURE_names_do_all(const EVP_SIGNATURE *signature,
+ void (*fn)(const char *name, void *data),
+ void *data)
+{
+ if (signature->prov != NULL)
+ evp_names_do_all(signature->prov, signature->name_id, fn, data);
+}
+
static int evp_pkey_signature_init(EVP_PKEY_CTX *ctx, EVP_SIGNATURE *signature,
int operation)
{
EVP_MD_CTX_set_flags, EVP_MD_CTX_clear_flags, EVP_MD_CTX_test_flags,
EVP_Digest, EVP_DigestInit_ex, EVP_DigestInit, EVP_DigestUpdate,
EVP_DigestFinal_ex, EVP_DigestFinalXOF, EVP_DigestFinal,
-EVP_MD_is_a, EVP_MD_name, EVP_MD_provider,
+EVP_MD_is_a, EVP_MD_name, EVP_MD_names_do_all, EVP_MD_provider,
EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size, EVP_MD_block_size, EVP_MD_flags,
EVP_MD_CTX_name,
EVP_MD_CTX_md, EVP_MD_CTX_type, EVP_MD_CTX_size, EVP_MD_CTX_block_size,
const char *EVP_MD_name(const EVP_MD *md);
int EVP_MD_is_a(const EVP_MD *md, const char *name);
+ void EVP_MD_names_do_all(const EVP_MD *md,
+ void (*fn)(const char *name, void *data),
+ void *data);
const OSSL_PROVIDER *EVP_MD_provider(const EVP_MD *md);
int EVP_MD_type(const EVP_MD *md);
int EVP_MD_pkey_type(const EVP_MD *md);
EVP_MD_CTX_name()
Return the name of the given message digest. For fetched message
-digests with multiple names, only one of them is returned.
+digests with multiple names, only one of them is returned; it's
+recommended to use EVP_MD_names_do_all() instead.
+
+=item EVP_MD_names_do_all()
+
+Traverses all names for the I<md>, and calls I<fn> with each name and
+I<data>. This is only useful with fetched B<EVP_MD>s.
=item EVP_MD_provider()
EVP_get_cipherbyobj,
EVP_CIPHER_is_a,
EVP_CIPHER_name,
+EVP_CIPHER_names_do_all,
EVP_CIPHER_provider,
EVP_CIPHER_nid,
EVP_CIPHER_get_params,
int EVP_CIPHER_nid(const EVP_CIPHER *e);
int EVP_CIPHER_is_a(const EVP_CIPHER *cipher, const char *name);
+ void EVP_CIPHER_names_do_all(const EVP_CIPHER *cipher,
+ void (*fn)(const char *name, void *data),
+ void *data);
const char *EVP_CIPHER_name(const EVP_CIPHER *cipher);
const OSSL_PROVIDER *EVP_CIPHER_provider(const EVP_CIPHER *cipher);
int EVP_CIPHER_block_size(const EVP_CIPHER *e);
EVP_CIPHER_name() and EVP_CIPHER_CTX_name() return the name of the passed
cipher or context. For fetched ciphers with multiple names, only one
-of them is returned.
+of them is returned; it's recommended to use EVP_CIPHER_names_do_all()
+instead.
+
+EVP_CIPHER_names_do_all() traverses all names for the I<cipher>, and
+calls I<fn> with each name and I<data>. This is only useful with
+fetched B<EVP_CIPHER>s.
EVP_CIPHER_provider() returns an B<OSSL_PROVIDER> pointer to the provider
that implements the given B<EVP_CIPHER>.
EVP_KDF_CTX, EVP_KDF_CTX_new, EVP_KDF_CTX_free, EVP_KDF_CTX_dup,
EVP_KDF_reset, EVP_KDF_derive,
EVP_KDF_size, EVP_KDF_provider, EVP_KDF_CTX_kdf, EVP_KDF_is_a,
+EVP_KDF_names_do_all,
EVP_KDF_CTX_get_params, EVP_KDF_CTX_set_params, EVP_KDF_do_all_provided,
EVP_KDF_get_params, EVP_KDF_gettable_ctx_params, EVP_KDF_settable_ctx_params,
EVP_KDF_gettable_params - EVP KDF routines
void EVP_KDF_reset(EVP_KDF_CTX *ctx);
size_t EVP_KDF_size(EVP_KDF_CTX *ctx);
int EVP_KDF_derive(EVP_KDF_CTX *ctx, unsigned char *key, size_t keylen);
- const char *EVP_KDF_name(const EVP_KDF *kdf);
int EVP_KDF_up_ref(EVP_KDF *kdf);
void EVP_KDF_free(EVP_KDF *kdf);
EVP_KDF *EVP_KDF_fetch(OPENSSL_CTX *libctx, const char *algorithm,
void EVP_KDF_do_all_provided(OPENSSL_CTX *libctx,
void (*fn)(EVP_KDF *kdf, void *arg),
void *arg);
+ void EVP_KDF_names_do_all(const EVP_KDF *kdf,
+ void (*fn)(const char *name, void *data),
+ void *data);
int EVP_KDF_get_params(EVP_KDF *kdf, OSSL_PARAM params[]);
int EVP_KDF_CTX_get_params(EVP_KDF_CTX *ctx, OSSL_PARAM params[]);
int EVP_KDF_CTX_set_params(EVP_KDF_CTX *ctx, const OSSL_PARAM params[]);
For some algorithms an error may result if input parameters necessary to
calculate a fixed output size have not yet been supplied.
-EVP_KDF_name() returns the name of the given KDF implementation.
-
EVP_KDF_is_a() returns 1 if I<kdf> is an implementation of an
algorithm that's identifiable with I<name>, otherwise 0.
implementations, calls the given function I<fn> with the implementation method
and the given I<arg> as argument.
+EVP_KDF_names_do_all() traverses all names for I<kdf>, and calls
+I<fn> with each name and I<data>.
+
=head1 PARAMETERS
The standard parameter names are:
EVP_KDF_fetch() returns a pointer to a newly fetched B<EVP_KDF>, or
NULL if allocation failed.
-EVP_KDF_name() returns the name for the given I<kdf>, if it has been
-added to the object database.
-
EVP_KDF_provider() returns a pointer to the provider for the KDF, or
NULL on error.
=head1 NAME
EVP_KEYEXCH_fetch, EVP_KEYEXCH_free, EVP_KEYEXCH_up_ref, EVP_KEYEXCH_provider,
-EVP_KEYEXCH_is_a, EVP_KEYEXCH_do_all_provided,
+EVP_KEYEXCH_is_a, EVP_KEYEXCH_do_all_provided, EVP_KEYEXCH_names_do_all
- Functions to manage EVP_KEYEXCH algorithm objects
=head1 SYNOPSIS
void EVP_KEYEXCH_do_all_provided(OPENSSL_CTX *libctx,
void (*fn)(EVP_KEYEXCH *exchange, void *arg),
void *arg);
+ void EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *exchange,
+ void (*fn)(const char *name, void *data),
+ void *data);
=head1 DESCRIPTION
EVP_KEYEXCH_is_a() checks if I<exchange> is an implementation of an
algorithm that's identifiable with I<name>.
+EVP_KEYEXCH_names_do_all() traverses all names for the I<exchange>, and
+calls I<fn> with each name and I<data>.
+
EVP_KEYEXCH_do_all_provided() traverses all key exchange implementations by
all activated providers in the library context I<libctx>, and for each
of the implementations, calls I<fn> with the implementation method and
EVP_KEYMGMT_provider,
EVP_KEYMGMT_is_a,
EVP_KEYMGMT_do_all_provided,
+EVP_KEYMGMT_names_do_all
- EVP key management routines
=head1 SYNOPSIS
void EVP_KEYMGMT_do_all_provided(OPENSSL_CTX *libctx,
void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),
void *arg);
+ void EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
+ void (*fn)(const char *name, void *data),
+ void *data);
=head1 DESCRIPTION
EVP_KEYMGMT_is_a() checks if I<keymgmt> is an implementation of an
algorithm that's identifiable with I<name>.
+EVP_KEYMGMT_names_do_all() traverses all names for the I<keymgmt>, and
+calls I<fn> with each name and I<data>.
+
EVP_KEYMGMT_do_all_provided() traverses all key keymgmt implementations by
all activated providers in the library context I<libctx>, and for each
of the implementations, calls I<fn> with the implementation method and
=head1 NAME
EVP_MAC, EVP_MAC_fetch, EVP_MAC_up_ref, EVP_MAC_free,
-EVP_MAC_is_a, EVP_MAC_name,
+EVP_MAC_is_a, EVP_MAC_names_do_all,
EVP_MAC_provider, EVP_MAC_get_params, EVP_MAC_gettable_params,
EVP_MAC_CTX, EVP_MAC_CTX_new, EVP_MAC_CTX_free, EVP_MAC_CTX_dup,
EVP_MAC_CTX_mac, EVP_MAC_CTX_get_params, EVP_MAC_CTX_set_params,
int EVP_MAC_up_ref(EVP_MAC *mac);
void EVP_MAC_free(EVP_MAC *mac);
int EVP_MAC_is_a(const EVP_MAC *mac, const char *name);
- const char *EVP_MAC_name(const EVP_MAC *mac);
+ void EVP_MAC_names_do_all(const EVP_MAC *mac,
+ void (*fn)(const char *name, void *data),
+ void *data);
const OSSL_PROVIDER *EVP_MAC_provider(const EVP_MAC *mac);
int EVP_MAC_get_params(EVP_MAC *mac, OSSL_PARAM params[]);
EVP_MAC_size() returns the MAC output size for the given context.
-EVP_MAC_name() returns the name of the given MAC implementation.
-
EVP_MAC_is_a() checks if the given I<mac> is an implementation of an
algorithm that's identifiable with I<name>.
implementations, calls the given function I<fn> with the implementation method
and the given I<arg> as argument.
+EVP_MAC_names_do_all() traverses all names for I<mac>, and calls
+I<fn> with each name and I<data>.
+
=head1 PARAMETERS
Parameters are identified by name as strings, and have an expected
EVP_MAC_free() returns nothing at all.
-EVP_MAC_name() returns the name of the MAC, or NULL if NULL was
-passed.
-
EVP_MAC_is_a() returns 1 if the given method can be identified with
the given name, otherwise 0.
=head1 NAME
EVP_SIGNATURE_fetch, EVP_SIGNATURE_free, EVP_SIGNATURE_up_ref,
-EVP_SIGNATURE_is_a, EVP_SIGNATURE_provider, EVP_SIGNATURE_do_all_provided
+EVP_SIGNATURE_is_a, EVP_SIGNATURE_provider, EVP_SIGNATURE_do_all_provided,
+EVP_SIGNATURE_names_do_all
- Functions to manage EVP_SIGNATURE algorithm objects
=head1 SYNOPSIS
void (*fn)(EVP_SIGNATURE *signature,
void *arg),
void *arg);
+ void EVP_SIGNATURE_names_do_all(const EVP_SIGNATURE *signature,
+ void (*fn)(const char *name, void *data),
+ void *data);
=head1 DESCRIPTION
implementations, calls the given function I<fn> with the implementation method
and the given I<arg> as argument.
+EVP_SIGNATURE_names_do_all() traverses all names for I<signature>, and calls
+I<fn> with each name and I<data>.
+
=head1 RETURN VALUES
EVP_SIGNATURE_fetch() returns a pointer to an B<EVP_SIGNATURE> for success
# define EVP_MD_nid(e) EVP_MD_type(e)
const char *EVP_MD_name(const EVP_MD *md);
int EVP_MD_is_a(const EVP_MD *md, const char *name);
+void EVP_MD_names_do_all(const EVP_MD *md,
+ void (*fn)(const char *name, void *data),
+ void *data);
const OSSL_PROVIDER *EVP_MD_provider(const EVP_MD *md);
int EVP_MD_pkey_type(const EVP_MD *md);
int EVP_MD_size(const EVP_MD *md);
int EVP_CIPHER_nid(const EVP_CIPHER *cipher);
const char *EVP_CIPHER_name(const EVP_CIPHER *cipher);
int EVP_CIPHER_is_a(const EVP_CIPHER *cipher, const char *name);
+void EVP_CIPHER_names_do_all(const EVP_CIPHER *cipher,
+ void (*fn)(const char *name, void *data),
+ void *data);
const OSSL_PROVIDER *EVP_CIPHER_provider(const EVP_CIPHER *cipher);
int EVP_CIPHER_block_size(const EVP_CIPHER *cipher);
int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher);
const char *properties);
int EVP_MAC_up_ref(EVP_MAC *mac);
void EVP_MAC_free(EVP_MAC *mac);
-const char *EVP_MAC_name(const EVP_MAC *mac);
int EVP_MAC_is_a(const EVP_MAC *mac, const char *name);
const OSSL_PROVIDER *EVP_MAC_provider(const EVP_MAC *mac);
int EVP_MAC_get_params(EVP_MAC *mac, OSSL_PARAM params[]);
void EVP_MAC_do_all_provided(OPENSSL_CTX *libctx,
void (*fn)(EVP_MAC *mac, void *arg),
void *arg);
+void EVP_MAC_names_do_all(const EVP_MAC *mac,
+ void (*fn)(const char *name, void *data),
+ void *data);
/* PKEY stuff */
int EVP_PKEY_decrypt_old(unsigned char *dec_key,
void EVP_KEYMGMT_do_all_provided(OPENSSL_CTX *libctx,
void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),
void *arg);
+void EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
+ void (*fn)(const char *name, void *data),
+ void *data);
EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
void (*fn)(EVP_SIGNATURE *signature,
void *data),
void *data);
+void EVP_SIGNATURE_names_do_all(const EVP_SIGNATURE *signature,
+ void (*fn)(const char *name, void *data),
+ void *data);
int EVP_PKEY_sign_init_ex(EVP_PKEY_CTX *ctx, EVP_SIGNATURE *signature);
int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
void EVP_KEYEXCH_do_all_provided(OPENSSL_CTX *libctx,
void (*fn)(EVP_KEYEXCH *keyexch, void *data),
void *data);
+void EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *keyexch,
+ void (*fn)(const char *name, void *data),
+ void *data);
void EVP_add_alg_module(void);
EVP_KDF_CTX *EVP_KDF_CTX_new(EVP_KDF *kdf);
void EVP_KDF_CTX_free(EVP_KDF_CTX *ctx);
EVP_KDF_CTX *EVP_KDF_CTX_dup(const EVP_KDF_CTX *src);
-const char *EVP_KDF_name(const EVP_KDF *kdf);
int EVP_KDF_is_a(const EVP_KDF *kdf, const char *name);
const OSSL_PROVIDER *EVP_KDF_provider(const EVP_KDF *kdf);
const EVP_KDF *EVP_KDF_CTX_kdf(EVP_KDF_CTX *ctx);
void EVP_KDF_do_all_provided(OPENSSL_CTX *libctx,
void (*fn)(EVP_KDF *kdf, void *arg),
void *arg);
+void EVP_KDF_names_do_all(const EVP_KDF *kdf,
+ void (*fn)(const char *name, void *data),
+ void *data);
# define EVP_KDF_CTRL_SET_PASS 0x01 /* unsigned char *, size_t */
# define EVP_KDF_CTRL_SET_SALT 0x02 /* unsigned char *, size_t */
typedef struct mac_data_st {
/* MAC type in one form or another */
+ char *mac_name;
EVP_MAC *mac; /* for mac_test_run_mac */
int type; /* for mac_test_run_pkey */
/* Algorithm string for this MAC */
mdat = OPENSSL_zalloc(sizeof(*mdat));
mdat->type = type;
+ mdat->mac_name = OPENSSL_strdup(alg);
mdat->mac = mac;
mdat->controls = sk_OPENSSL_STRING_new_null();
t->data = mdat;
MAC_DATA *mdat = t->data;
EVP_MAC_free(mdat->mac);
+ OPENSSL_free(mdat->mac_name);
sk_OPENSSL_STRING_pop_free(mdat->controls, openssl_free);
OPENSSL_free(mdat->alg);
OPENSSL_free(mdat->key);
EVP_MAC_settable_ctx_params(expected->mac);
if (expected->alg == NULL)
- TEST_info("Trying the EVP_MAC %s test", EVP_MAC_name(expected->mac));
+ TEST_info("Trying the EVP_MAC %s test", expected->mac_name);
else
TEST_info("Trying the EVP_MAC %s test with %s",
- EVP_MAC_name(expected->mac), expected->alg);
+ expected->mac_name, expected->alg);
#ifdef OPENSSL_NO_DES
if (expected->alg != NULL && strstr(expected->alg, "DES") != NULL) {
EVP_MAC_gettable_ctx_params 4835 3_0_0 EXIST::FUNCTION:
EVP_MAC_free 4836 3_0_0 EXIST::FUNCTION:
EVP_MAC_up_ref 4837 3_0_0 EXIST::FUNCTION:
-EVP_MAC_name 4838 3_0_0 EXIST::FUNCTION:
+EVP_MAC_name 4838 3_0_0 NOEXIST::FUNCTION:
EVP_MAC_get_params 4839 3_0_0 EXIST::FUNCTION:
EVP_MAC_gettable_params 4840 3_0_0 EXIST::FUNCTION:
EVP_MAC_provider 4841 3_0_0 EXIST::FUNCTION:
EVP_KDF_free 4846 3_0_0 EXIST::FUNCTION:
EVP_KDF_fetch 4847 3_0_0 EXIST::FUNCTION:
EVP_KDF_CTX_dup 4848 3_0_0 EXIST::FUNCTION:
-EVP_KDF_name 4849 3_0_0 EXIST::FUNCTION:
+EVP_KDF_name 4849 3_0_0 NOEXIST::FUNCTION:
EVP_KDF_provider 4850 3_0_0 EXIST::FUNCTION:
EVP_KDF_get_params 4851 3_0_0 EXIST::FUNCTION:
EVP_KDF_CTX_get_params 4852 3_0_0 EXIST::FUNCTION:
EVP_MD_is_a 4953 3_0_0 EXIST::FUNCTION:
EVP_SIGNATURE_is_a 4954 3_0_0 EXIST::FUNCTION:
EVP_SIGNATURE_do_all_provided 4955 3_0_0 EXIST::FUNCTION:
+EVP_MD_names_do_all 4956 3_0_0 EXIST::FUNCTION:
+EVP_CIPHER_names_do_all 4957 3_0_0 EXIST::FUNCTION:
+EVP_MAC_names_do_all 4958 3_0_0 EXIST::FUNCTION:
+EVP_KEYMGMT_names_do_all 4959 3_0_0 EXIST::FUNCTION:
+EVP_KEYEXCH_names_do_all 4960 3_0_0 EXIST::FUNCTION:
+EVP_KDF_names_do_all 4961 3_0_0 EXIST::FUNCTION:
+EVP_SIGNATURE_names_do_all 4962 3_0_0 EXIST::FUNCTION: