Add the provider function signatures for DigestSign*
[openssl.git] / crypto / evp / digest.c
index 92012f917e00dcc03ec479202e90d97b0d0e18ed..4b9395d58bf6ae37c1652f969c84900bd2c8aac5 100644 (file)
@@ -14,9 +14,9 @@
 #include <openssl/params.h>
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
-#include "internal/evp_int.h"
+#include "crypto/evp.h"
 #include "internal/provider.h"
-#include "evp_locl.h"
+#include "evp_local.h"
 
 /* This call frees resources associated with the context */
 int EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
@@ -81,9 +81,6 @@ void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
     if (ctx == NULL)
         return;
 
-    if (ctx->digest == NULL || ctx->digest->prov == NULL)
-        goto legacy;
-
     EVP_MD_CTX_reset(ctx);
 
     EVP_MD_free(ctx->fetched_digest);
@@ -93,11 +90,6 @@ void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
 
     OPENSSL_free(ctx);
     return;
-
-    /* TODO(3.0): Remove legacy code below */
- legacy:
-    EVP_MD_CTX_reset(ctx);
-    OPENSSL_free(ctx);
 }
 
 int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
@@ -550,10 +542,20 @@ int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[])
     return 0;
 }
 
-const OSSL_PARAM *EVP_MD_CTX_settable_params(const EVP_MD *digest)
+const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md)
+{
+    if (md != NULL && md->settable_ctx_params != NULL)
+        return md->settable_ctx_params();
+    return NULL;
+}
+
+const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx)
 {
-    if (digest != NULL && digest->settable_ctx_params != NULL)
-        return digest->settable_ctx_params();
+    if (ctx != NULL
+            && ctx->digest != NULL
+            && ctx->digest->settable_ctx_params != NULL)
+        return ctx->digest->settable_ctx_params();
+
     return NULL;
 }
 
@@ -564,10 +566,20 @@ int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[])
     return 0;
 }
 
-const OSSL_PARAM *EVP_MD_CTX_gettable_params(const EVP_MD *digest)
+const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md)
 {
-    if (digest != NULL && digest->gettable_ctx_params != NULL)
-        return digest->gettable_ctx_params();
+    if (md != NULL && md->gettable_ctx_params != NULL)
+        return md->gettable_ctx_params();
+    return NULL;
+}
+
+const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx)
+{
+    if (ctx != NULL
+            && ctx->digest != NULL
+            && ctx->digest->gettable_ctx_params != NULL)
+        return ctx->digest->gettable_ctx_params();
+
     return NULL;
 }