diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-11-12 16:31:35 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-11-15 09:25:42 +0100 |
commit | bef9b48e5071cdd2b41a4f486d1bcb5e14b2a5c3 (patch) | |
tree | 1c519ac26b87291506e32ecd6719f32685b230e6 /providers/implementations/include/prov | |
parent | 293e251e6f0367a9aa0d3d46037b19d1a6c91b20 (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)
Diffstat (limited to 'providers/implementations/include/prov')
-rw-r--r-- | providers/implementations/include/prov/digestcommon.h | 23 | ||||
-rw-r--r-- | providers/implementations/include/prov/implementations.h | 1 |
2 files changed, 14 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 }, \ diff --git a/providers/implementations/include/prov/implementations.h b/providers/implementations/include/prov/implementations.h index cb1b7925c5..d7b591cf72 100644 --- a/providers/implementations/include/prov/implementations.h +++ b/providers/implementations/include/prov/implementations.h @@ -40,6 +40,7 @@ extern const OSSL_DISPATCH ossl_md4_functions[]; extern const OSSL_DISPATCH ossl_mdc2_functions[]; extern const OSSL_DISPATCH ossl_wp_functions[]; extern const OSSL_DISPATCH ossl_ripemd160_functions[]; +extern const OSSL_DISPATCH ossl_nullmd_functions[]; /* Ciphers */ extern const OSSL_DISPATCH ossl_null_functions[]; |