summaryrefslogtreecommitdiff
path: root/providers/implementations/include
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-03-02 22:42:41 +1000
committerPauli <ppzgs1@gmail.com>2021-03-12 08:27:11 +1000
commitd7ec1dda2ec543153a7a1602aa8421849d33f9b5 (patch)
treeec65ad16e3aeaaba818b8abbfd55a118d5a1cd28 /providers/implementations/include
parent408def8b30756469c1b657b9271832f7c1bdce12 (diff)
downloadopenssl-new-d7ec1dda2ec543153a7a1602aa8421849d33f9b5.tar.gz
prov: support param argument to digest init calls
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14383)
Diffstat (limited to 'providers/implementations/include')
-rw-r--r--providers/implementations/include/prov/digestcommon.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/providers/implementations/include/prov/digestcommon.h b/providers/implementations/include/prov/digestcommon.h
index 638fe3d4a4..b0ed83648d 100644
--- a/providers/implementations/include/prov/digestcommon.h
+++ b/providers/implementations/include/prov/digestcommon.h
@@ -36,7 +36,7 @@ static int name##_get_params(OSSL_PARAM params[]) \
(void (*)(void))ossl_digest_default_gettable_params }
# define PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START( \
- name, CTX, blksize, dgstsize, flags, init, upd, fin) \
+ name, CTX, blksize, dgstsize, flags, upd, fin) \
static OSSL_FUNC_digest_newctx_fn name##_newctx; \
static OSSL_FUNC_digest_freectx_fn name##_freectx; \
static OSSL_FUNC_digest_dupctx_fn name##_dupctx; \
@@ -58,11 +58,6 @@ static void *name##_dupctx(void *ctx) \
*ret = *in; \
return ret; \
} \
-static OSSL_FUNC_digest_init_fn name##_internal_init; \
-static int name##_internal_init(void *ctx) \
-{ \
- return ossl_prov_is_running() ? init(ctx) : 0; \
-} \
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) \
@@ -76,7 +71,6 @@ static int name##_internal_final(void *ctx, unsigned char *out, size_t *outl, \
PROV_FUNC_DIGEST_GET_PARAM(name, blksize, dgstsize, flags) \
const OSSL_DISPATCH ossl_##name##_functions[] = { \
{ OSSL_FUNC_DIGEST_NEWCTX, (void (*)(void))name##_newctx }, \
- { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init }, \
{ OSSL_FUNC_DIGEST_UPDATE, (void (*)(void))upd }, \
{ OSSL_FUNC_DIGEST_FINAL, (void (*)(void))name##_internal_final }, \
{ OSSL_FUNC_DIGEST_FREECTX, (void (*)(void))name##_freectx }, \
@@ -89,17 +83,32 @@ const OSSL_DISPATCH ossl_##name##_functions[] = { \
# define IMPLEMENT_digest_functions( \
name, CTX, blksize, dgstsize, flags, init, upd, fin) \
+static OSSL_FUNC_digest_init_fn name##_internal_init; \
+static int name##_internal_init(void *ctx, \
+ ossl_unused const OSSL_PARAM params[]) \
+{ \
+ return ossl_prov_is_running() && init(ctx); \
+} \
PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \
- init, upd, fin), \
+ upd, fin), \
+ { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init }, \
PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END
# define IMPLEMENT_digest_functions_with_settable_ctx( \
name, CTX, blksize, dgstsize, flags, init, upd, fin, \
settable_ctx_params, set_ctx_params) \
+static OSSL_FUNC_digest_init_fn name##_internal_init; \
+static int name##_internal_init(void *ctx, const OSSL_PARAM params[]) \
+{ \
+ return ossl_prov_is_running() \
+ && init(ctx) \
+ && set_ctx_params(ctx, params); \
+} \
PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \
- init, upd, fin), \
-{ OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS, (void (*)(void))settable_ctx_params }, \
-{ OSSL_FUNC_DIGEST_SET_CTX_PARAMS, (void (*)(void))set_ctx_params }, \
+ upd, fin), \
+ { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init }, \
+ { OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS, (void (*)(void))settable_ctx_params }, \
+ { OSSL_FUNC_DIGEST_SET_CTX_PARAMS, (void (*)(void))set_ctx_params }, \
PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END