summaryrefslogtreecommitdiffstats
path: root/crypto/evp/digest.c
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-03-02 20:20:25 +1000
committerPauli <ppzgs1@gmail.com>2021-03-12 08:27:11 +1000
commit4b58d9b41b7e43b2f6f4171df9e84bf6a0866b99 (patch)
tree642bfd940bca4bd97a7b2f6032965382b3be2020 /crypto/evp/digest.c
parent480c8ef8b5804b15ef97320290bc326adfaa0f84 (diff)
evp: add params arguments to init functions
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14383)
Diffstat (limited to 'crypto/evp/digest.c')
-rw-r--r--crypto/evp/digest.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 069eb192c1..dbbc44f046 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -124,13 +124,8 @@ void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
return;
}
-int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
-{
- EVP_MD_CTX_reset(ctx);
- return EVP_DigestInit_ex(ctx, type, NULL);
-}
-
-int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
+static int evp_md_init_internal(EVP_MD_CTX *ctx, const EVP_MD *type,
+ const OSSL_PARAM params[], ENGINE *impl)
{
#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
ENGINE *tmpimpl = NULL;
@@ -272,7 +267,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
return 0;
}
- return ctx->digest->dinit(ctx->provctx);
+ return ctx->digest->dinit(ctx->provctx, params);
/* Code below to be removed when legacy support is dropped. */
legacy:
@@ -346,6 +341,23 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
return ctx->digest->init(ctx);
}
+int EVP_DigestInit_ex2(EVP_MD_CTX *ctx, const EVP_MD *type,
+ const OSSL_PARAM params[])
+{
+ return evp_md_init_internal(ctx, type, params, NULL);
+}
+
+int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
+{
+ EVP_MD_CTX_reset(ctx);
+ return evp_md_init_internal(ctx, type, NULL, NULL);
+}
+
+int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
+{
+ return evp_md_init_internal(ctx, type, NULL, impl);
+}
+
int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count)
{
if (count == 0)