/src/openssl/providers/implementations/include/prov/digestcommon.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2019-2021 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 | 120 | #define PROV_DIGEST_FLAG_XOF 0x0001 |
20 | 120 | #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 | 112 | { \ |
30 | 112 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ |
31 | 112 | } md5_prov.c:md5_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
md5_sha1_prov.c:md5_sha1_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
null_prov.c:nullmd_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
ripemd_prov.c:ripemd160_get_params Line | Count | Source | 29 | 7 | { \ | 30 | 7 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 7 | } |
sha2_prov.c:sha1_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha2_prov.c:sha224_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha2_prov.c:sha256_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha2_prov.c:sha256_192_internal_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha2_prov.c:sha384_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha2_prov.c:sha512_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha2_prov.c:sha512_224_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha2_prov.c:sha512_256_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:sha3_224_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:sha3_256_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:sha3_384_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:sha3_512_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:keccak_224_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:keccak_256_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:keccak_384_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:keccak_512_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:shake_128_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:shake_256_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:keccak_kmac_128_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sha3_prov.c:keccak_kmac_256_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
sm3_prov.c:sm3_get_params Line | Count | Source | 29 | 4 | { \ | 30 | 4 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 4 | } |
md4_prov.c:md4_get_params Line | Count | Source | 29 | 3 | { \ | 30 | 3 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 3 | } |
mdc2_prov.c:mdc2_get_params Line | Count | Source | 29 | 3 | { \ | 30 | 3 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 3 | } |
Line | Count | Source | 29 | 3 | { \ | 30 | 3 | return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \ | 31 | 3 | } |
|
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 | | #define PROV_FUNC_DIGEST_FINAL(name, dgstsize, fin) \ |
41 | | static OSSL_FUNC_digest_final_fn name##_internal_final; \ |
42 | | static int name##_internal_final(void *ctx, unsigned char *out, size_t *outl, \ |
43 | | size_t outsz) \ |
44 | 17.5k | { \ |
45 | 17.5k | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ |
46 | 17.5k | *outl = dgstsize; \ |
47 | 17.5k | return 1; \ |
48 | 17.5k | } \ |
49 | 17.5k | return 0; \ |
50 | 17.5k | } md5_prov.c:md5_internal_final Line | Count | Source | 44 | 84 | { \ | 45 | 84 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 84 | *outl = dgstsize; \ | 47 | 84 | return 1; \ | 48 | 84 | } \ | 49 | 84 | return 0; \ | 50 | 84 | } |
md5_sha1_prov.c:md5_sha1_internal_final Line | Count | Source | 44 | 31 | { \ | 45 | 31 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 31 | *outl = dgstsize; \ | 47 | 31 | return 1; \ | 48 | 31 | } \ | 49 | 31 | return 0; \ | 50 | 31 | } |
ripemd_prov.c:ripemd160_internal_final Line | Count | Source | 44 | 64 | { \ | 45 | 64 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 64 | *outl = dgstsize; \ | 47 | 64 | return 1; \ | 48 | 64 | } \ | 49 | 64 | return 0; \ | 50 | 64 | } |
sha2_prov.c:sha1_internal_final Line | Count | Source | 44 | 53 | { \ | 45 | 53 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 53 | *outl = dgstsize; \ | 47 | 53 | return 1; \ | 48 | 53 | } \ | 49 | 53 | return 0; \ | 50 | 53 | } |
sha2_prov.c:sha224_internal_final Line | Count | Source | 44 | 27 | { \ | 45 | 27 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 27 | *outl = dgstsize; \ | 47 | 27 | return 1; \ | 48 | 27 | } \ | 49 | 27 | return 0; \ | 50 | 27 | } |
sha2_prov.c:sha256_internal_final Line | Count | Source | 44 | 13.8k | { \ | 45 | 13.8k | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 13.8k | *outl = dgstsize; \ | 47 | 13.8k | return 1; \ | 48 | 13.8k | } \ | 49 | 13.8k | return 0; \ | 50 | 13.8k | } |
sha2_prov.c:sha256_192_internal_internal_final Line | Count | Source | 44 | 1 | { \ | 45 | 1 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 1 | *outl = dgstsize; \ | 47 | 1 | return 1; \ | 48 | 1 | } \ | 49 | 1 | return 0; \ | 50 | 1 | } |
sha2_prov.c:sha384_internal_final Line | Count | Source | 44 | 13 | { \ | 45 | 13 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 13 | *outl = dgstsize; \ | 47 | 13 | return 1; \ | 48 | 13 | } \ | 49 | 13 | return 0; \ | 50 | 13 | } |
sha2_prov.c:sha512_internal_final Line | Count | Source | 44 | 3.26k | { \ | 45 | 3.26k | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 3.26k | *outl = dgstsize; \ | 47 | 3.26k | return 1; \ | 48 | 3.26k | } \ | 49 | 3.26k | return 0; \ | 50 | 3.26k | } |
sha2_prov.c:sha512_224_internal_final Line | Count | Source | 44 | 1 | { \ | 45 | 1 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 1 | *outl = dgstsize; \ | 47 | 1 | return 1; \ | 48 | 1 | } \ | 49 | 1 | return 0; \ | 50 | 1 | } |
sha2_prov.c:sha512_256_internal_final Line | Count | Source | 44 | 1 | { \ | 45 | 1 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 1 | *outl = dgstsize; \ | 47 | 1 | return 1; \ | 48 | 1 | } \ | 49 | 1 | return 0; \ | 50 | 1 | } |
sm3_prov.c:sm3_internal_final Line | Count | Source | 44 | 87 | { \ | 45 | 87 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 87 | *outl = dgstsize; \ | 47 | 87 | return 1; \ | 48 | 87 | } \ | 49 | 87 | return 0; \ | 50 | 87 | } |
md4_prov.c:md4_internal_final Line | Count | Source | 44 | 51 | { \ | 45 | 51 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 51 | *outl = dgstsize; \ | 47 | 51 | return 1; \ | 48 | 51 | } \ | 49 | 51 | return 0; \ | 50 | 51 | } |
mdc2_prov.c:mdc2_internal_final Line | Count | Source | 44 | 32 | { \ | 45 | 32 | if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) { \ | 46 | 32 | *outl = dgstsize; \ | 47 | 32 | return 1; \ | 48 | 32 | } \ | 49 | 32 | return 0; \ | 50 | 32 | } |
Unexecuted instantiation: wp_prov.c:wp_internal_final |
51 | | |
52 | | #define PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START( \ |
53 | | name, CTX, blksize, dgstsize, flags, upd, fin) \ |
54 | | static OSSL_FUNC_digest_newctx_fn name##_newctx; \ |
55 | | static OSSL_FUNC_digest_freectx_fn name##_freectx; \ |
56 | | static OSSL_FUNC_digest_dupctx_fn name##_dupctx; \ |
57 | | static void *name##_newctx(void *prov_ctx) \ |
58 | 17.9k | { \ |
59 | 17.9k | CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL; \ |
60 | 17.9k | return ctx; \ |
61 | 17.9k | } \ |
62 | | static void name##_freectx(void *vctx) \ |
63 | 17.9k | { \ |
64 | 17.9k | CTX *ctx = (CTX *)vctx; \ |
65 | 17.9k | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ |
66 | 17.9k | } \ Line | Count | Source | 63 | 84 | { \ | 64 | 84 | CTX *ctx = (CTX *)vctx; \ | 65 | 84 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 84 | } \ |
md5_sha1_prov.c:md5_sha1_freectx Line | Count | Source | 63 | 31 | { \ | 64 | 31 | CTX *ctx = (CTX *)vctx; \ | 65 | 31 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 31 | } \ |
Unexecuted instantiation: null_prov.c:nullmd_freectx ripemd_prov.c:ripemd160_freectx Line | Count | Source | 63 | 64 | { \ | 64 | 64 | CTX *ctx = (CTX *)vctx; \ | 65 | 64 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 64 | } \ |
Line | Count | Source | 63 | 53 | { \ | 64 | 53 | CTX *ctx = (CTX *)vctx; \ | 65 | 53 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 53 | } \ |
sha2_prov.c:sha224_freectx Line | Count | Source | 63 | 27 | { \ | 64 | 27 | CTX *ctx = (CTX *)vctx; \ | 65 | 27 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 27 | } \ |
sha2_prov.c:sha256_freectx Line | Count | Source | 63 | 14.2k | { \ | 64 | 14.2k | CTX *ctx = (CTX *)vctx; \ | 65 | 14.2k | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 14.2k | } \ |
sha2_prov.c:sha256_192_internal_freectx Line | Count | Source | 63 | 1 | { \ | 64 | 1 | CTX *ctx = (CTX *)vctx; \ | 65 | 1 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 1 | } \ |
sha2_prov.c:sha384_freectx Line | Count | Source | 63 | 13 | { \ | 64 | 13 | CTX *ctx = (CTX *)vctx; \ | 65 | 13 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 13 | } \ |
sha2_prov.c:sha512_freectx Line | Count | Source | 63 | 3.26k | { \ | 64 | 3.26k | CTX *ctx = (CTX *)vctx; \ | 65 | 3.26k | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 3.26k | } \ |
sha2_prov.c:sha512_224_freectx Line | Count | Source | 63 | 1 | { \ | 64 | 1 | CTX *ctx = (CTX *)vctx; \ | 65 | 1 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 1 | } \ |
sha2_prov.c:sha512_256_freectx Line | Count | Source | 63 | 1 | { \ | 64 | 1 | CTX *ctx = (CTX *)vctx; \ | 65 | 1 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 1 | } \ |
Line | Count | Source | 63 | 87 | { \ | 64 | 87 | CTX *ctx = (CTX *)vctx; \ | 65 | 87 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 87 | } \ |
Line | Count | Source | 63 | 51 | { \ | 64 | 51 | CTX *ctx = (CTX *)vctx; \ | 65 | 51 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 51 | } \ |
Line | Count | Source | 63 | 32 | { \ | 64 | 32 | CTX *ctx = (CTX *)vctx; \ | 65 | 32 | OPENSSL_clear_free(ctx, sizeof(*ctx)); \ | 66 | 32 | } \ |
Unexecuted instantiation: wp_prov.c:wp_freectx |
67 | | static void *name##_dupctx(void *ctx) \ |
68 | 0 | { \ |
69 | 0 | CTX *in = (CTX *)ctx; \ |
70 | 0 | CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL; \ |
71 | 0 | if (ret != NULL) \ |
72 | 0 | *ret = *in; \ |
73 | 0 | return ret; \ |
74 | 0 | } \ |
75 | | static void name##_copyctx(void *voutctx, void *vinctx) \ |
76 | 0 | { \ |
77 | 0 | CTX *outctx = (CTX *)voutctx; \ |
78 | 0 | CTX *inctx = (CTX *)vinctx; \ |
79 | 0 | *outctx = *inctx; \ |
80 | 0 | } \ Unexecuted instantiation: md5_prov.c:md5_copyctx Unexecuted instantiation: md5_sha1_prov.c:md5_sha1_copyctx Unexecuted instantiation: null_prov.c:nullmd_copyctx Unexecuted instantiation: ripemd_prov.c:ripemd160_copyctx Unexecuted instantiation: sha2_prov.c:sha1_copyctx Unexecuted instantiation: sha2_prov.c:sha224_copyctx Unexecuted instantiation: sha2_prov.c:sha256_copyctx Unexecuted instantiation: sha2_prov.c:sha256_192_internal_copyctx Unexecuted instantiation: sha2_prov.c:sha384_copyctx Unexecuted instantiation: sha2_prov.c:sha512_copyctx Unexecuted instantiation: sha2_prov.c:sha512_224_copyctx Unexecuted instantiation: sha2_prov.c:sha512_256_copyctx Unexecuted instantiation: sm3_prov.c:sm3_copyctx Unexecuted instantiation: md4_prov.c:md4_copyctx Unexecuted instantiation: mdc2_prov.c:mdc2_copyctx Unexecuted instantiation: wp_prov.c:wp_copyctx |
81 | | PROV_FUNC_DIGEST_FINAL(name, dgstsize, fin) \ |
82 | | PROV_FUNC_DIGEST_GET_PARAM(name, blksize, dgstsize, flags) \ |
83 | | const OSSL_DISPATCH ossl_##name##_functions[] = { \ |
84 | | { OSSL_FUNC_DIGEST_NEWCTX, (void (*)(void))name##_newctx }, \ |
85 | | { OSSL_FUNC_DIGEST_UPDATE, (void (*)(void))upd }, \ |
86 | | { OSSL_FUNC_DIGEST_FINAL, (void (*)(void))name##_internal_final }, \ |
87 | | { OSSL_FUNC_DIGEST_FREECTX, (void (*)(void))name##_freectx }, \ |
88 | | { OSSL_FUNC_DIGEST_DUPCTX, (void (*)(void))name##_dupctx }, \ |
89 | | { OSSL_FUNC_DIGEST_COPYCTX, (void (*)(void))name##_copyctx }, \ |
90 | | PROV_DISPATCH_FUNC_DIGEST_GET_PARAMS(name) |
91 | | |
92 | | #define PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END \ |
93 | | { \ |
94 | | 0, NULL \ |
95 | | } \ |
96 | | } \ |
97 | | ; |
98 | | |
99 | | #define IMPLEMENT_digest_functions( \ |
100 | | name, CTX, blksize, dgstsize, flags, init, upd, fin) \ |
101 | | static OSSL_FUNC_digest_init_fn name##_internal_init; \ |
102 | | static int name##_internal_init(void *ctx, \ |
103 | | ossl_unused const OSSL_PARAM params[]) \ |
104 | 572 | { \ |
105 | 572 | return ossl_prov_is_running() && init(ctx); \ |
106 | 572 | } \ md5_prov.c:md5_internal_init Line | Count | Source | 104 | 168 | { \ | 105 | 168 | return ossl_prov_is_running() && init(ctx); \ | 106 | 168 | } \ |
Unexecuted instantiation: null_prov.c:nullmd_internal_init ripemd_prov.c:ripemd160_internal_init Line | Count | Source | 104 | 128 | { \ | 105 | 128 | return ossl_prov_is_running() && init(ctx); \ | 106 | 128 | } \ |
sm3_prov.c:sm3_internal_init Line | Count | Source | 104 | 174 | { \ | 105 | 174 | return ossl_prov_is_running() && init(ctx); \ | 106 | 174 | } \ |
md4_prov.c:md4_internal_init Line | Count | Source | 104 | 102 | { \ | 105 | 102 | return ossl_prov_is_running() && init(ctx); \ | 106 | 102 | } \ |
Unexecuted instantiation: wp_prov.c:wp_internal_init |
107 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \ |
108 | | upd, fin), \ |
109 | | { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init }, \ |
110 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END |
111 | | |
112 | | #define IMPLEMENT_digest_functions_with_settable_ctx( \ |
113 | | name, CTX, blksize, dgstsize, flags, init, upd, fin, \ |
114 | | settable_ctx_params, set_ctx_params) \ |
115 | | static OSSL_FUNC_digest_init_fn name##_internal_init; \ |
116 | | static int name##_internal_init(void *ctx, const OSSL_PARAM params[]) \ |
117 | 232 | { \ |
118 | 232 | return ossl_prov_is_running() \ |
119 | 232 | && init(ctx) \ |
120 | 232 | && set_ctx_params(ctx, params); \ |
121 | 232 | } \ md5_sha1_prov.c:md5_sha1_internal_init Line | Count | Source | 117 | 62 | { \ | 118 | 62 | return ossl_prov_is_running() \ | 119 | 62 | && init(ctx) \ | 120 | 62 | && set_ctx_params(ctx, params); \ | 121 | 62 | } \ |
sha2_prov.c:sha1_internal_init Line | Count | Source | 117 | 106 | { \ | 118 | 106 | return ossl_prov_is_running() \ | 119 | 106 | && init(ctx) \ | 120 | 106 | && set_ctx_params(ctx, params); \ | 121 | 106 | } \ |
mdc2_prov.c:mdc2_internal_init Line | Count | Source | 117 | 64 | { \ | 118 | 64 | return ossl_prov_is_running() \ | 119 | 64 | && init(ctx) \ | 120 | 64 | && set_ctx_params(ctx, params); \ | 121 | 64 | } \ |
|
122 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \ |
123 | | upd, fin), \ |
124 | | { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init }, \ |
125 | | { OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS, (void (*)(void))settable_ctx_params }, \ |
126 | | { OSSL_FUNC_DIGEST_SET_CTX_PARAMS, (void (*)(void))set_ctx_params }, \ |
127 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END |
128 | | |
129 | | #define IMPLEMENT_digest_functions_with_serialize( \ |
130 | | name, CTX, blksize, dgstsize, flags, init, upd, fin, \ |
131 | | serialize, deserialize) \ |
132 | | static OSSL_FUNC_digest_init_fn name##_internal_init; \ |
133 | | static int name##_internal_init(void *ctx, const OSSL_PARAM params[]) \ |
134 | 34.6k | { \ |
135 | 34.6k | return ossl_prov_is_running() && init(ctx); \ |
136 | 34.6k | } \ sha2_prov.c:sha224_internal_init Line | Count | Source | 134 | 54 | { \ | 135 | 54 | return ossl_prov_is_running() && init(ctx); \ | 136 | 54 | } \ |
sha2_prov.c:sha256_internal_init Line | Count | Source | 134 | 28.0k | { \ | 135 | 28.0k | return ossl_prov_is_running() && init(ctx); \ | 136 | 28.0k | } \ |
sha2_prov.c:sha256_192_internal_internal_init Line | Count | Source | 134 | 2 | { \ | 135 | 2 | return ossl_prov_is_running() && init(ctx); \ | 136 | 2 | } \ |
sha2_prov.c:sha384_internal_init Line | Count | Source | 134 | 26 | { \ | 135 | 26 | return ossl_prov_is_running() && init(ctx); \ | 136 | 26 | } \ |
sha2_prov.c:sha512_internal_init Line | Count | Source | 134 | 6.53k | { \ | 135 | 6.53k | return ossl_prov_is_running() && init(ctx); \ | 136 | 6.53k | } \ |
sha2_prov.c:sha512_224_internal_init Line | Count | Source | 134 | 2 | { \ | 135 | 2 | return ossl_prov_is_running() && init(ctx); \ | 136 | 2 | } \ |
sha2_prov.c:sha512_256_internal_init Line | Count | Source | 134 | 2 | { \ | 135 | 2 | return ossl_prov_is_running() && init(ctx); \ | 136 | 2 | } \ |
|
137 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \ |
138 | | upd, fin), \ |
139 | | { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init }, \ |
140 | | { OSSL_FUNC_DIGEST_SERIALIZE, (void (*)(void))serialize }, \ |
141 | | { OSSL_FUNC_DIGEST_DESERIALIZE, (void (*)(void))deserialize }, \ |
142 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END |
143 | | |
144 | | const OSSL_PARAM *ossl_digest_default_gettable_params(void *provctx); |
145 | | int ossl_digest_default_get_params(OSSL_PARAM params[], size_t blksz, |
146 | | size_t paramsz, unsigned long flags); |
147 | | |
148 | | #ifdef __cplusplus |
149 | | } |
150 | | #endif |
151 | | |
152 | | #endif /* OSSL_PROVIDERS_DIGESTCOMMON_H */ |