/src/openssl35/providers/implementations/include/prov/digestcommon.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
4 | | * Licensed under the Apache License 2.0 (the "License"). You may not use |
5 | | * this file except in compliance with the License. You can obtain a copy |
6 | | * in the file LICENSE in the source distribution or at |
7 | | * https://www.openssl.org/source/license.html |
8 | | */ |
9 | | |
10 | | #ifndef OSSL_PROVIDERS_DIGESTCOMMON_H |
11 | | #define OSSL_PROVIDERS_DIGESTCOMMON_H |
12 | | |
13 | | #include <openssl/core_dispatch.h> |
14 | | #include <openssl/core_names.h> |
15 | | #include <openssl/params.h> |
16 | | #include "prov/providercommon.h" |
17 | | |
18 | | /* Internal flags that can be queried */ |
19 | 918 | #define PROV_DIGEST_FLAG_XOF 0x0001 |
20 | 918 | #define PROV_DIGEST_FLAG_ALGID_ABSENT 0x0002 |
21 | | |
22 | | #ifdef __cplusplus |
23 | | extern "C" { |
24 | | #endif |
25 | | |
26 | | #define PROV_FUNC_DIGEST_GET_PARAM(name, blksize, dgstsize, flags) \ |
27 | | static OSSL_FUNC_digest_get_params_fn name##_get_params; \ |
28 | | static int name##_get_params(OSSL_PARAM params[]) \ |
29 | 2.62k | { \ |
30 | 2.62k | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ |
31 | 2.62k | } md5_prov.c:md5_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
md5_sha1_prov.c:md5_sha1_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
null_prov.c:nullmd_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
ripemd_prov.c:ripemd160_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha2_prov.c:sha1_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha2_prov.c:sha224_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha2_prov.c:sha256_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha2_prov.c:sha256_192_get_params Line | Count | Source | 29 | 34 | { \ | 30 | 34 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 34 | } |
sha2_prov.c:sha384_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha2_prov.c:sha512_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha2_prov.c:sha512_224_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha2_prov.c:sha512_256_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:sha3_224_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:sha3_256_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:sha3_384_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:sha3_512_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:keccak_224_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:keccak_256_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:keccak_384_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:keccak_512_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:shake_128_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:shake_256_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
sha3_prov.c:keccak_kmac_128_get_params Line | Count | Source | 29 | 53 | { \ | 30 | 53 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 53 | } |
sha3_prov.c:keccak_kmac_256_get_params Line | Count | Source | 29 | 53 | { \ | 30 | 53 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 53 | } |
sm3_prov.c:sm3_get_params Line | Count | Source | 29 | 113 | { \ | 30 | 113 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 113 | } |
|
32 | | |
33 | | #define PROV_DISPATCH_FUNC_DIGEST_GET_PARAMS(name) \ |
34 | | { OSSL_FUNC_DIGEST_GET_PARAMS, (void (*)(void))name##_get_params }, \ |
35 | | { \ |
36 | | OSSL_FUNC_DIGEST_GETTABLE_PARAMS, \ |
37 | | (void (*)(void))ossl_digest_default_gettable_params \ |
38 | | } |
39 | | |
40 | | #ifdef FIPS_MODULE |
41 | | #define PROV_DISPATCH_FUNC_DIGEST_GET_CTX_PARAMS \ |
42 | | { OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS, \ |
43 | | (void (*)(void))ossl_digest_default_gettable_ctx_params }, \ |
44 | | { \ |
45 | | OSSL_FUNC_DIGEST_GET_CTX_PARAMS, \ |
46 | | (void (*)(void))ossl_digest_default_get_ctx_params \ |
47 | | } |
48 | | #define PROV_DISPATCH_FUNC_DIGEST_GET_CTX_PARAMS_APPEND \ |
49 | | , PROV_DISPATCH_FUNC_DIGEST_GET_CTX_PARAMS |
50 | | #else |
51 | | #define PROV_DISPATCH_FUNC_DIGEST_GET_CTX_PARAMS |
52 | | #define PROV_DISPATCH_FUNC_DIGEST_GET_CTX_PARAMS_APPEND |
53 | | #endif |
54 | | |
55 | | #define PROV_FUNC_DIGEST_FINAL(name, dgstsize, fin) \ |
56 | | static OSSL_FUNC_digest_final_fn name##_internal_final; \ |
57 | | static int name##_internal_final(void *ctx, unsigned char *out, size_t *outl, \ |
58 | | size_t outsz) \ |
59 | 461M | { \ |
60 | 461M | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ |
61 | 461M | *outl = dgstsize; \ |
62 | 461M | return 1; \ |
63 | 461M | } \ |
64 | 461M | return 0; \ |
65 | 461M | } md5_prov.c:md5_internal_final Line | Count | Source | 59 | 2.33M | { \ | 60 | 2.33M | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 2.33M | *outl = dgstsize; \ | 62 | 2.33M | return 1; \ | 63 | 2.33M | } \ | 64 | 2.33M | return 0; \ | 65 | 2.33M | } |
md5_sha1_prov.c:md5_sha1_internal_final Line | Count | Source | 59 | 28.0k | { \ | 60 | 28.0k | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 28.0k | *outl = dgstsize; \ | 62 | 28.0k | return 1; \ | 63 | 28.0k | } \ | 64 | 28.0k | return 0; \ | 65 | 28.0k | } |
ripemd_prov.c:ripemd160_internal_final Line | Count | Source | 59 | 1.59M | { \ | 60 | 1.59M | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 1.59M | *outl = dgstsize; \ | 62 | 1.59M | return 1; \ | 63 | 1.59M | } \ | 64 | 1.59M | return 0; \ | 65 | 1.59M | } |
sha2_prov.c:sha1_internal_final Line | Count | Source | 59 | 3.83M | { \ | 60 | 3.83M | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 3.83M | *outl = dgstsize; \ | 62 | 3.83M | return 1; \ | 63 | 3.83M | } \ | 64 | 3.83M | return 0; \ | 65 | 3.83M | } |
sha2_prov.c:sha224_internal_final Line | Count | Source | 59 | 1.09M | { \ | 60 | 1.09M | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 1.09M | *outl = dgstsize; \ | 62 | 1.09M | return 1; \ | 63 | 1.09M | } \ | 64 | 1.09M | return 0; \ | 65 | 1.09M | } |
sha2_prov.c:sha256_internal_final Line | Count | Source | 59 | 423M | { \ | 60 | 423M | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 423M | *outl = dgstsize; \ | 62 | 423M | return 1; \ | 63 | 423M | } \ | 64 | 423M | return 0; \ | 65 | 423M | } |
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_final sha2_prov.c:sha384_internal_final Line | Count | Source | 59 | 2.74M | { \ | 60 | 2.74M | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 2.74M | *outl = dgstsize; \ | 62 | 2.74M | return 1; \ | 63 | 2.74M | } \ | 64 | 2.74M | return 0; \ | 65 | 2.74M | } |
sha2_prov.c:sha512_internal_final Line | Count | Source | 59 | 24.0M | { \ | 60 | 24.0M | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 24.0M | *outl = dgstsize; \ | 62 | 24.0M | return 1; \ | 63 | 24.0M | } \ | 64 | 24.0M | return 0; \ | 65 | 24.0M | } |
sha2_prov.c:sha512_224_internal_final Line | Count | Source | 59 | 703k | { \ | 60 | 703k | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 703k | *outl = dgstsize; \ | 62 | 703k | return 1; \ | 63 | 703k | } \ | 64 | 703k | return 0; \ | 65 | 703k | } |
sha2_prov.c:sha512_256_internal_final Line | Count | Source | 59 | 1.51M | { \ | 60 | 1.51M | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 1.51M | *outl = dgstsize; \ | 62 | 1.51M | return 1; \ | 63 | 1.51M | } \ | 64 | 1.51M | return 0; \ | 65 | 1.51M | } |
sm3_prov.c:sm3_internal_final Line | Count | Source | 59 | 8.78k | { \ | 60 | 8.78k | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 61 | 8.78k | *outl = dgstsize; \ | 62 | 8.78k | return 1; \ | 63 | 8.78k | } \ | 64 | 8.78k | return 0; \ | 65 | 8.78k | } |
|
66 | | |
67 | | #define PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START( \ |
68 | | name, CTX, blksize, dgstsize, flags, upd, fin) \ |
69 | | static OSSL_FUNC_digest_newctx_fn name##_newctx; \ |
70 | | static OSSL_FUNC_digest_freectx_fn name##_freectx; \ |
71 | | static OSSL_FUNC_digest_dupctx_fn name##_dupctx; \ |
72 | | static void *name##_newctx(void *prov_ctx) \ |
73 | 2.17M | { \ |
74 | 2.17M | CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL; \ |
75 | 2.17M | return ctx; \ |
76 | 2.17M | } \ |
77 | | static void name##_freectx(void *vctx) \ |
78 | 12.9M | { \ |
79 | 12.9M | CTX *ctx = (CTX *)vctx; \ |
80 | 12.9M | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ |
81 | 12.9M | } \ Line | Count | Source | 78 | 2.84M | { \ | 79 | 2.84M | CTX *ctx = (CTX *)vctx; \ | 80 | 2.84M | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 2.84M | } \ |
md5_sha1_prov.c:md5_sha1_freectx Line | Count | Source | 78 | 28.8k | { \ | 79 | 28.8k | CTX *ctx = (CTX *)vctx; \ | 80 | 28.8k | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 28.8k | } \ |
null_prov.c:nullmd_freectx Line | Count | Source | 78 | 163 | { \ | 79 | 163 | CTX *ctx = (CTX *)vctx; \ | 80 | 163 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 163 | } \ |
ripemd_prov.c:ripemd160_freectx Line | Count | Source | 78 | 8.40k | { \ | 79 | 8.40k | CTX *ctx = (CTX *)vctx; \ | 80 | 8.40k | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 8.40k | } \ |
Line | Count | Source | 78 | 3.45M | { \ | 79 | 3.45M | CTX *ctx = (CTX *)vctx; \ | 80 | 3.45M | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 3.45M | } \ |
sha2_prov.c:sha224_freectx Line | Count | Source | 78 | 8.43k | { \ | 79 | 8.43k | CTX *ctx = (CTX *)vctx; \ | 80 | 8.43k | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 8.43k | } \ |
sha2_prov.c:sha256_freectx Line | Count | Source | 78 | 3.57M | { \ | 79 | 3.57M | CTX *ctx = (CTX *)vctx; \ | 80 | 3.57M | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 3.57M | } \ |
Unexecuted instantiation: sha2_prov.c:sha256_192_freectx sha2_prov.c:sha384_freectx Line | Count | Source | 78 | 2.98M | { \ | 79 | 2.98M | CTX *ctx = (CTX *)vctx; \ | 80 | 2.98M | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 2.98M | } \ |
sha2_prov.c:sha512_freectx Line | Count | Source | 78 | 27.2k | { \ | 79 | 27.2k | CTX *ctx = (CTX *)vctx; \ | 80 | 27.2k | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 27.2k | } \ |
sha2_prov.c:sha512_224_freectx Line | Count | Source | 78 | 4.85k | { \ | 79 | 4.85k | CTX *ctx = (CTX *)vctx; \ | 80 | 4.85k | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 4.85k | } \ |
sha2_prov.c:sha512_256_freectx Line | Count | Source | 78 | 3.35k | { \ | 79 | 3.35k | CTX *ctx = (CTX *)vctx; \ | 80 | 3.35k | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 3.35k | } \ |
Line | Count | Source | 78 | 6.97k | { \ | 79 | 6.97k | CTX *ctx = (CTX *)vctx; \ | 80 | 6.97k | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 81 | 6.97k | } \ |
|
82 | | static void *name##_dupctx(void *ctx) \ |
83 | 9.05M | { \ |
84 | 9.05M | CTX *in = (CTX *)ctx; \ |
85 | 9.05M | CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL; \ |
86 | 9.05M | if (ret != NULL) \ |
87 | 9.05M | *ret = *in; \ |
88 | 9.05M | return ret; \ |
89 | 9.05M | } \ |
90 | | static void name##_copyctx(void *voutctx, void *vinctx) \ |
91 | 19.1M | { \ |
92 | 19.1M | CTX *outctx = (CTX *)voutctx; \ |
93 | 19.1M | CTX *inctx = (CTX *)vinctx; \ |
94 | 19.1M | *outctx = *inctx; \ |
95 | 19.1M | } \ Line | Count | Source | 91 | 2.89M | { \ | 92 | 2.89M | CTX *outctx = (CTX *)voutctx; \ | 93 | 2.89M | CTX *inctx = (CTX *)vinctx; \ | 94 | 2.89M | *outctx = *inctx; \ | 95 | 2.89M | } \ |
md5_sha1_prov.c:md5_sha1_copyctx Line | Count | Source | 91 | 13.5k | { \ | 92 | 13.5k | CTX *outctx = (CTX *)voutctx; \ | 93 | 13.5k | CTX *inctx = (CTX *)vinctx; \ | 94 | 13.5k | *outctx = *inctx; \ | 95 | 13.5k | } \ |
null_prov.c:nullmd_copyctx Line | Count | Source | 91 | 74 | { \ | 92 | 74 | CTX *outctx = (CTX *)voutctx; \ | 93 | 74 | CTX *inctx = (CTX *)vinctx; \ | 94 | 74 | *outctx = *inctx; \ | 95 | 74 | } \ |
ripemd_prov.c:ripemd160_copyctx Line | Count | Source | 91 | 3.65k | { \ | 92 | 3.65k | CTX *outctx = (CTX *)voutctx; \ | 93 | 3.65k | CTX *inctx = (CTX *)vinctx; \ | 94 | 3.65k | *outctx = *inctx; \ | 95 | 3.65k | } \ |
Line | Count | Source | 91 | 4.81M | { \ | 92 | 4.81M | CTX *outctx = (CTX *)voutctx; \ | 93 | 4.81M | CTX *inctx = (CTX *)vinctx; \ | 94 | 4.81M | *outctx = *inctx; \ | 95 | 4.81M | } \ |
sha2_prov.c:sha224_copyctx Line | Count | Source | 91 | 1.84M | { \ | 92 | 1.84M | CTX *outctx = (CTX *)voutctx; \ | 93 | 1.84M | CTX *inctx = (CTX *)vinctx; \ | 94 | 1.84M | *outctx = *inctx; \ | 95 | 1.84M | } \ |
sha2_prov.c:sha256_copyctx Line | Count | Source | 91 | 3.26M | { \ | 92 | 3.26M | CTX *outctx = (CTX *)voutctx; \ | 93 | 3.26M | CTX *inctx = (CTX *)vinctx; \ | 94 | 3.26M | *outctx = *inctx; \ | 95 | 3.26M | } \ |
Unexecuted instantiation: sha2_prov.c:sha256_192_copyctx sha2_prov.c:sha384_copyctx Line | Count | Source | 91 | 1.78M | { \ | 92 | 1.78M | CTX *outctx = (CTX *)voutctx; \ | 93 | 1.78M | CTX *inctx = (CTX *)vinctx; \ | 94 | 1.78M | *outctx = *inctx; \ | 95 | 1.78M | } \ |
sha2_prov.c:sha512_copyctx Line | Count | Source | 91 | 943k | { \ | 92 | 943k | CTX *outctx = (CTX *)voutctx; \ | 93 | 943k | CTX *inctx = (CTX *)vinctx; \ | 94 | 943k | *outctx = *inctx; \ | 95 | 943k | } \ |
sha2_prov.c:sha512_224_copyctx Line | Count | Source | 91 | 905k | { \ | 92 | 905k | CTX *outctx = (CTX *)voutctx; \ | 93 | 905k | CTX *inctx = (CTX *)vinctx; \ | 94 | 905k | *outctx = *inctx; \ | 95 | 905k | } \ |
sha2_prov.c:sha512_256_copyctx Line | Count | Source | 91 | 2.70M | { \ | 92 | 2.70M | CTX *outctx = (CTX *)voutctx; \ | 93 | 2.70M | CTX *inctx = (CTX *)vinctx; \ | 94 | 2.70M | *outctx = *inctx; \ | 95 | 2.70M | } \ |
Line | Count | Source | 91 | 4.09k | { \ | 92 | 4.09k | CTX *outctx = (CTX *)voutctx; \ | 93 | 4.09k | CTX *inctx = (CTX *)vinctx; \ | 94 | 4.09k | *outctx = *inctx; \ | 95 | 4.09k | } \ |
|
96 | | PROV_FUNC_DIGEST_FINAL(name, dgstsize, fin) \ |
97 | | PROV_FUNC_DIGEST_GET_PARAM(name, blksize, dgstsize, flags) \ |
98 | | const OSSL_DISPATCH ossl_##name##_functions[] = { \ |
99 | | { OSSL_FUNC_DIGEST_NEWCTX, (void (*)(void))name##_newctx }, \ |
100 | | { OSSL_FUNC_DIGEST_UPDATE, (void (*)(void))upd }, \ |
101 | | { OSSL_FUNC_DIGEST_FINAL, (void (*)(void))name##_internal_final }, \ |
102 | | { OSSL_FUNC_DIGEST_FREECTX, (void (*)(void))name##_freectx }, \ |
103 | | { OSSL_FUNC_DIGEST_DUPCTX, (void (*)(void))name##_dupctx }, \ |
104 | | { OSSL_FUNC_DIGEST_COPYCTX, (void (*)(void))name##_copyctx }, \ |
105 | | PROV_DISPATCH_FUNC_DIGEST_GET_PARAMS(name) \ |
106 | | PROV_DISPATCH_FUNC_DIGEST_GET_CTX_PARAMS_APPEND |
107 | | |
108 | | #define PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END \ |
109 | | { \ |
110 | | 0, NULL \ |
111 | | } \ |
112 | | } \ |
113 | | ; |
114 | | |
115 | | #define IMPLEMENT_digest_functions( \ |
116 | | name, CTX, blksize, dgstsize, flags, init, upd, fin) \ |
117 | | static OSSL_FUNC_digest_init_fn name##_internal_init; \ |
118 | | static int name##_internal_init(void *ctx, \ |
119 | | ossl_unused const OSSL_PARAM params[]) \ |
120 | 449M | { \ |
121 | 449M | return ossl_prov_is_running() && init(ctx); \ |
122 | 449M | } \ md5_prov.c:md5_internal_init Line | Count | Source | 120 | 145k | { \ | 121 | 145k | return ossl_prov_is_running() && init(ctx); \ | 122 | 145k | } \ |
null_prov.c:nullmd_internal_init Line | Count | Source | 120 | 262 | { \ | 121 | 262 | return ossl_prov_is_running() && init(ctx); \ | 122 | 262 | } \ |
ripemd_prov.c:ripemd160_internal_init Line | Count | Source | 120 | 1.59M | { \ | 121 | 1.59M | return ossl_prov_is_running() && init(ctx); \ | 122 | 1.59M | } \ |
sha2_prov.c:sha224_internal_init Line | Count | Source | 120 | 178k | { \ | 121 | 178k | return ossl_prov_is_running() && init(ctx); \ | 122 | 178k | } \ |
sha2_prov.c:sha256_internal_init Line | Count | Source | 120 | 421M | { \ | 121 | 421M | return ossl_prov_is_running() && init(ctx); \ | 122 | 421M | } \ |
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_init sha2_prov.c:sha384_internal_init Line | Count | Source | 120 | 2.04M | { \ | 121 | 2.04M | return ossl_prov_is_running() && init(ctx); \ | 122 | 2.04M | } \ |
sha2_prov.c:sha512_internal_init Line | Count | Source | 120 | 23.5M | { \ | 121 | 23.5M | return ossl_prov_is_running() && init(ctx); \ | 122 | 23.5M | } \ |
sha2_prov.c:sha512_224_internal_init Line | Count | Source | 120 | 252k | { \ | 121 | 252k | return ossl_prov_is_running() && init(ctx); \ | 122 | 252k | } \ |
sha2_prov.c:sha512_256_internal_init Line | Count | Source | 120 | 157k | { \ | 121 | 157k | return ossl_prov_is_running() && init(ctx); \ | 122 | 157k | } \ |
sm3_prov.c:sm3_internal_init Line | Count | Source | 120 | 8.98k | { \ | 121 | 8.98k | return ossl_prov_is_running() && init(ctx); \ | 122 | 8.98k | } \ |
|
123 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \ |
124 | | upd, fin), \ |
125 | | { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init }, \ |
126 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END |
127 | | |
128 | | #define IMPLEMENT_digest_functions_with_settable_ctx( \ |
129 | | name, CTX, blksize, dgstsize, flags, init, upd, fin, \ |
130 | | settable_ctx_params, set_ctx_params) \ |
131 | | static OSSL_FUNC_digest_init_fn name##_internal_init; \ |
132 | | static int name##_internal_init(void *ctx, const OSSL_PARAM params[]) \ |
133 | 1.01M | { \ |
134 | 1.01M | return ossl_prov_is_running() \ |
135 | 1.01M | && init(ctx) \ |
136 | 1.01M | && set_ctx_params(ctx, params); \ |
137 | 1.01M | } \ md5_sha1_prov.c:md5_sha1_internal_init Line | Count | Source | 133 | 30.9k | { \ | 134 | 30.9k | return ossl_prov_is_running() \ | 135 | 30.9k | && init(ctx) \ | 136 | 30.9k | && set_ctx_params(ctx, params); \ | 137 | 30.9k | } \ |
sha2_prov.c:sha1_internal_init Line | Count | Source | 133 | 984k | { \ | 134 | 984k | return ossl_prov_is_running() \ | 135 | 984k | && init(ctx) \ | 136 | 984k | && set_ctx_params(ctx, params); \ | 137 | 984k | } \ |
|
138 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \ |
139 | | upd, fin), \ |
140 | | { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init }, \ |
141 | | { OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS, (void (*)(void))settable_ctx_params }, \ |
142 | | { OSSL_FUNC_DIGEST_SET_CTX_PARAMS, (void (*)(void))set_ctx_params }, \ |
143 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END |
144 | | |
145 | | const OSSL_PARAM *ossl_digest_default_gettable_params(void *provctx); |
146 | | int ossl_digest_default_get_params(OSSL_PARAM params[], size_t blksz, |
147 | | size_t paramsz, unsigned long flags); |
148 | | const OSSL_PARAM *ossl_digest_default_gettable_ctx_params(void *ctx, |
149 | | void *provctx); |
150 | | int ossl_digest_default_get_ctx_params(void *ctx, OSSL_PARAM params[]); |
151 | | |
152 | | #ifdef __cplusplus |
153 | | } |
154 | | #endif |
155 | | |
156 | | #endif /* OSSL_PROVIDERS_DIGESTCOMMON_H */ |