summaryrefslogtreecommitdiffstats
path: root/providers/implementations/include/prov/digestcommon.h
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-11-12 16:31:35 +0100
committerTomas Mraz <tomas@openssl.org>2021-11-15 09:26:03 +0100
commitcf9a84a12dc4f3b314347e44f5c51b473a504926 (patch)
treecafb60e7cbe10d6f6bd0ab8f284cbcb992907a99 /providers/implementations/include/prov/digestcommon.h
parent487934081d87a0d02bbb9afd6bd650d5d1afe8ea (diff)
Add null digest implementation to the default provider
This is necessary to keep compatibility with 1.1.1. Fixes #16660 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17016) (cherry picked from commit bef9b48e5071cdd2b41a4f486d1bcb5e14b2a5c3)
Diffstat (limited to 'providers/implementations/include/prov/digestcommon.h')
-rw-r--r--providers/implementations/include/prov/digestcommon.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/providers/implementations/include/prov/digestcommon.h b/providers/implementations/include/prov/digestcommon.h
index b0ed83648d..abdb8bb2ad 100644
--- a/providers/implementations/include/prov/digestcommon.h
+++ b/providers/implementations/include/prov/digestcommon.h
@@ -35,6 +35,18 @@ static int name##_get_params(OSSL_PARAM params[]) \
{ OSSL_FUNC_DIGEST_GETTABLE_PARAMS, \
(void (*)(void))ossl_digest_default_gettable_params }
+# define PROV_FUNC_DIGEST_FINAL(name, dgstsize, fin) \
+static OSSL_FUNC_digest_final_fn name##_internal_final; \
+static int name##_internal_final(void *ctx, unsigned char *out, size_t *outl, \
+ size_t outsz) \
+{ \
+ if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \
+ *outl = dgstsize; \
+ return 1; \
+ } \
+ return 0; \
+}
+
# define PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START( \
name, CTX, blksize, dgstsize, flags, upd, fin) \
static OSSL_FUNC_digest_newctx_fn name##_newctx; \
@@ -58,16 +70,7 @@ static void *name##_dupctx(void *ctx) \
*ret = *in; \
return ret; \
} \
-static OSSL_FUNC_digest_final_fn name##_internal_final; \
-static int name##_internal_final(void *ctx, unsigned char *out, size_t *outl, \
- size_t outsz) \
-{ \
- if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \
- *outl = dgstsize; \
- return 1; \
- } \
- return 0; \
-} \
+PROV_FUNC_DIGEST_FINAL(name, dgstsize, fin) \
PROV_FUNC_DIGEST_GET_PARAM(name, blksize, dgstsize, flags) \
const OSSL_DISPATCH ossl_##name##_functions[] = { \
{ OSSL_FUNC_DIGEST_NEWCTX, (void (*)(void))name##_newctx }, \