Add EVP_MD_provider() and EVP_CIPHER_provider()

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9356)
This commit is contained in:
Richard Levitte 2019-07-10 22:59:07 +02:00
parent c750bc0851
commit 1d2622d4f3
5 changed files with 26 additions and 1 deletions

View file

@ -426,6 +426,11 @@ const char *EVP_CIPHER_name(const EVP_CIPHER *cipher)
#endif
}
const OSSL_PROVIDER *EVP_CIPHER_provider(const EVP_CIPHER *cipher)
{
return cipher->prov;
}
int EVP_CIPHER_mode(const EVP_CIPHER *cipher)
{
int ok, v = EVP_CIPHER_flags(cipher) & EVP_CIPH_MODE;
@ -448,6 +453,11 @@ const char *EVP_MD_name(const EVP_MD *md)
#endif
}
const OSSL_PROVIDER *EVP_MD_provider(const EVP_MD *md)
{
return md->prov;
}
int EVP_MD_block_size(const EVP_MD *md)
{
if (md == NULL) {

View file

@ -8,7 +8,7 @@ EVP_MD_CTX_copy_ex, EVP_MD_CTX_ctrl, EVP_MD_CTX_set_params, EVP_MD_CTX_get_param
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_name,
EVP_MD_name, 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,
@ -48,6 +48,7 @@ EVP_MD_CTX_pkey_ctx, EVP_MD_CTX_set_pkey_ctx - EVP digest routines
int EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in);
const char *EVP_MD_name(const EVP_MD *md);
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);
int EVP_MD_size(const EVP_MD *md);
@ -193,6 +194,11 @@ EVP_MD_CTX_name()
Return the name of the given message digest.
=item EVP_MD_provider()
Returns an B<OSSL_PROVIDER> pointer to the provider that implements the given
B<EVP_MD>.
=item EVP_MD_size(),
EVP_MD_CTX_size()

View file

@ -27,6 +27,7 @@ EVP_get_cipherbyname,
EVP_get_cipherbynid,
EVP_get_cipherbyobj,
EVP_CIPHER_name,
EVP_CIPHER_provider,
EVP_CIPHER_nid,
EVP_CIPHER_block_size,
EVP_CIPHER_key_length,
@ -104,6 +105,7 @@ EVP_enc_null
int EVP_CIPHER_nid(const EVP_CIPHER *e);
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);
int EVP_CIPHER_key_length(const EVP_CIPHER *e);
int EVP_CIPHER_iv_length(const EVP_CIPHER *e);
@ -262,6 +264,9 @@ B<NID_undef>.
EVP_CIPHER_name() and EVP_CIPHER_CTX_name() return the name of the passed
cipher or context.
EVP_CIPHER_provider() returns an B<OSSL_PROVIDER> pointer to the provider
that implements the given B<EVP_CIPHER>.
EVP_CIPHER_CTX_cipher() returns the B<EVP_CIPHER> structure when passed
an B<EVP_CIPHER_CTX> structure.

View file

@ -450,6 +450,7 @@ typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass,
int EVP_MD_type(const EVP_MD *md);
# define EVP_MD_nid(e) EVP_MD_type(e)
const char *EVP_MD_name(const EVP_MD *md);
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_MD_block_size(const EVP_MD *md);
@ -471,6 +472,7 @@ void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx);
int EVP_CIPHER_nid(const EVP_CIPHER *cipher);
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 *cipher);
int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher);
int EVP_CIPHER_key_length(const EVP_CIPHER *cipher);

View file

@ -4693,3 +4693,5 @@ X509_PUBKEY_dup 4798 3_0_0 EXIST::FUNCTION:
ERR_put_func_error 4799 3_0_0 EXIST::FUNCTION:
EVP_MD_name 4800 3_0_0 EXIST::FUNCTION:
EVP_CIPHER_name 4801 3_0_0 EXIST::FUNCTION:
EVP_MD_provider 4802 3_0_0 EXIST::FUNCTION:
EVP_CIPHER_provider 4803 3_0_0 EXIST::FUNCTION: