mirror of
https://github.com/openssl/openssl.git
synced 2025-02-17 14:32:04 +08:00
EVP: Add internal functions to fetch type specific EVP methods from provider
Added functions: evp_signature_fetch_from_prov(), evp_asym_cipher_fetch_from_prov(), evp_keyexch_fetch_from_prov(), evp_kem_fetch_from_prov() These are all like the public conterparts, except they all take a provider instead of a library context as first argument. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16725)
This commit is contained in:
parent
5246183e7a
commit
ff7781462d
@ -425,6 +425,17 @@ EVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
|
||||
(void (*)(void *))EVP_ASYM_CIPHER_free);
|
||||
}
|
||||
|
||||
EVP_ASYM_CIPHER *evp_asym_cipher_fetch_from_prov(OSSL_PROVIDER *prov,
|
||||
const char *algorithm,
|
||||
const char *properties)
|
||||
{
|
||||
return evp_generic_fetch_from_prov(prov, OSSL_OP_ASYM_CIPHER,
|
||||
algorithm, properties,
|
||||
evp_asym_cipher_from_algorithm,
|
||||
(int (*)(void *))EVP_ASYM_CIPHER_up_ref,
|
||||
(void (*)(void *))EVP_ASYM_CIPHER_free);
|
||||
}
|
||||
|
||||
int EVP_ASYM_CIPHER_is_a(const EVP_ASYM_CIPHER *cipher, const char *name)
|
||||
{
|
||||
return evp_is_a(cipher->prov, cipher->name_id, NULL, name);
|
||||
|
@ -301,6 +301,18 @@ EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OSSL_LIB_CTX *ctx, int name_id,
|
||||
EVP_KEYMGMT *evp_keymgmt_fetch_from_prov(OSSL_PROVIDER *prov,
|
||||
const char *name,
|
||||
const char *properties);
|
||||
EVP_SIGNATURE *evp_signature_fetch_from_prov(OSSL_PROVIDER *prov,
|
||||
const char *name,
|
||||
const char *properties);
|
||||
EVP_ASYM_CIPHER *evp_asym_cipher_fetch_from_prov(OSSL_PROVIDER *prov,
|
||||
const char *name,
|
||||
const char *properties);
|
||||
EVP_KEYEXCH *evp_keyexch_fetch_from_prov(OSSL_PROVIDER *prov,
|
||||
const char *name,
|
||||
const char *properties);
|
||||
EVP_KEM *evp_kem_fetch_from_prov(OSSL_PROVIDER *prov,
|
||||
const char *name,
|
||||
const char *properties);
|
||||
|
||||
/* Internal structure constructors for fetched methods */
|
||||
EVP_MD *evp_md_new(void);
|
||||
|
@ -181,6 +181,17 @@ EVP_KEYEXCH *EVP_KEYEXCH_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
|
||||
(void (*)(void *))EVP_KEYEXCH_free);
|
||||
}
|
||||
|
||||
EVP_KEYEXCH *evp_keyexch_fetch_from_prov(OSSL_PROVIDER *prov,
|
||||
const char *algorithm,
|
||||
const char *properties)
|
||||
{
|
||||
return evp_generic_fetch_from_prov(prov, OSSL_OP_KEYEXCH,
|
||||
algorithm, properties,
|
||||
evp_keyexch_from_algorithm,
|
||||
(int (*)(void *))EVP_KEYEXCH_up_ref,
|
||||
(void (*)(void *))EVP_KEYEXCH_free);
|
||||
}
|
||||
|
||||
int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx)
|
||||
{
|
||||
return EVP_PKEY_derive_init_ex(ctx, NULL);
|
||||
|
@ -354,6 +354,15 @@ EVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
|
||||
(void (*)(void *))EVP_KEM_free);
|
||||
}
|
||||
|
||||
EVP_KEM *evp_kem_fetch_from_prov(OSSL_PROVIDER *prov, const char *algorithm,
|
||||
const char *properties)
|
||||
{
|
||||
return evp_generic_fetch_from_prov(prov, OSSL_OP_KEM, algorithm, properties,
|
||||
evp_kem_from_algorithm,
|
||||
(int (*)(void *))EVP_KEM_up_ref,
|
||||
(void (*)(void *))EVP_KEM_free);
|
||||
}
|
||||
|
||||
int EVP_KEM_is_a(const EVP_KEM *kem, const char *name)
|
||||
{
|
||||
return evp_is_a(kem->prov, kem->name_id, NULL, name);
|
||||
|
@ -314,6 +314,17 @@ EVP_SIGNATURE *EVP_SIGNATURE_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
|
||||
(void (*)(void *))EVP_SIGNATURE_free);
|
||||
}
|
||||
|
||||
EVP_SIGNATURE *evp_signature_fetch_from_prov(OSSL_PROVIDER *prov,
|
||||
const char *algorithm,
|
||||
const char *properties)
|
||||
{
|
||||
return evp_generic_fetch_from_prov(prov, OSSL_OP_SIGNATURE,
|
||||
algorithm, properties,
|
||||
evp_signature_from_algorithm,
|
||||
(int (*)(void *))EVP_SIGNATURE_up_ref,
|
||||
(void (*)(void *))EVP_SIGNATURE_free);
|
||||
}
|
||||
|
||||
int EVP_SIGNATURE_is_a(const EVP_SIGNATURE *signature, const char *name)
|
||||
{
|
||||
return evp_is_a(signature->prov, signature->name_id, NULL, name);
|
||||
|
Loading…
Reference in New Issue
Block a user