Coverage Report

Created: 2026-09-12 06:55

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl40/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
1.71k
#define PROV_DIGEST_FLAG_XOF 0x0001
20
1.75k
#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.26k
    {                                                                            \
30
2.26k
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
2.26k
    }
cshake_prov.c:cshake_128_get_params
Line
Count
Source
29
40
    {                                                                            \
30
40
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
40
    }
cshake_prov.c:cshake_256_get_params
Line
Count
Source
29
40
    {                                                                            \
30
40
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
40
    }
md5_prov.c:md5_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
md5_sha1_prov.c:md5_sha1_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
null_prov.c:nullmd_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
ripemd_prov.c:ripemd160_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha2_prov.c:sha1_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha2_prov.c:sha224_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha2_prov.c:sha256_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha2_prov.c:sha256_192_internal_get_params
Line
Count
Source
29
59
    {                                                                            \
30
59
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
59
    }
sha2_prov.c:sha384_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha2_prov.c:sha512_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha2_prov.c:sha512_224_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha2_prov.c:sha512_256_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:sha3_224_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:sha3_256_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:sha3_384_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:sha3_512_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:keccak_224_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:keccak_256_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:keccak_384_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:keccak_512_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:shake_128_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:shake_256_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
sha3_prov.c:cshake_keccak_128_get_params
Line
Count
Source
29
40
    {                                                                            \
30
40
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
40
    }
sha3_prov.c:cshake_keccak_256_get_params
Line
Count
Source
29
40
    {                                                                            \
30
40
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
40
    }
sm3_prov.c:sm3_get_params
Line
Count
Source
29
93
    {                                                                            \
30
93
        return ossl_digest_default_get_params(params, blksize, dgstsize, flags); \
31
93
    }
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
380M
    {                                                                             \
45
380M
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
380M
            *outl = dgstsize;                                                     \
47
380M
            return 1;                                                             \
48
380M
        }                                                                         \
49
380M
        return 0;                                                                 \
50
380M
    }
md5_prov.c:md5_internal_final
Line
Count
Source
44
2.51M
    {                                                                             \
45
2.51M
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
2.51M
            *outl = dgstsize;                                                     \
47
2.51M
            return 1;                                                             \
48
2.51M
        }                                                                         \
49
2.51M
        return 0;                                                                 \
50
2.51M
    }
md5_sha1_prov.c:md5_sha1_internal_final
Line
Count
Source
44
22.7k
    {                                                                             \
45
22.7k
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
22.7k
            *outl = dgstsize;                                                     \
47
22.7k
            return 1;                                                             \
48
22.7k
        }                                                                         \
49
22.7k
        return 0;                                                                 \
50
22.7k
    }
ripemd_prov.c:ripemd160_internal_final
Line
Count
Source
44
1.00M
    {                                                                             \
45
1.00M
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
1.00M
            *outl = dgstsize;                                                     \
47
1.00M
            return 1;                                                             \
48
1.00M
        }                                                                         \
49
1.00M
        return 0;                                                                 \
50
1.00M
    }
sha2_prov.c:sha1_internal_final
Line
Count
Source
44
1.99M
    {                                                                             \
45
1.99M
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
1.99M
            *outl = dgstsize;                                                     \
47
1.99M
            return 1;                                                             \
48
1.99M
        }                                                                         \
49
1.99M
        return 0;                                                                 \
50
1.99M
    }
sha2_prov.c:sha224_internal_final
Line
Count
Source
44
709k
    {                                                                             \
45
709k
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
709k
            *outl = dgstsize;                                                     \
47
709k
            return 1;                                                             \
48
709k
        }                                                                         \
49
709k
        return 0;                                                                 \
50
709k
    }
sha2_prov.c:sha256_internal_final
Line
Count
Source
44
352M
    {                                                                             \
45
352M
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
352M
            *outl = dgstsize;                                                     \
47
352M
            return 1;                                                             \
48
352M
        }                                                                         \
49
352M
        return 0;                                                                 \
50
352M
    }
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_internal_final
sha2_prov.c:sha384_internal_final
Line
Count
Source
44
2.35M
    {                                                                             \
45
2.35M
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
2.35M
            *outl = dgstsize;                                                     \
47
2.35M
            return 1;                                                             \
48
2.35M
        }                                                                         \
49
2.35M
        return 0;                                                                 \
50
2.35M
    }
sha2_prov.c:sha512_internal_final
Line
Count
Source
44
15.6M
    {                                                                             \
45
15.6M
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
15.6M
            *outl = dgstsize;                                                     \
47
15.6M
            return 1;                                                             \
48
15.6M
        }                                                                         \
49
15.6M
        return 0;                                                                 \
50
15.6M
    }
sha2_prov.c:sha512_224_internal_final
Line
Count
Source
44
1.65M
    {                                                                             \
45
1.65M
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
1.65M
            *outl = dgstsize;                                                     \
47
1.65M
            return 1;                                                             \
48
1.65M
        }                                                                         \
49
1.65M
        return 0;                                                                 \
50
1.65M
    }
sha2_prov.c:sha512_256_internal_final
Line
Count
Source
44
1.37M
    {                                                                             \
45
1.37M
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
1.37M
            *outl = dgstsize;                                                     \
47
1.37M
            return 1;                                                             \
48
1.37M
        }                                                                         \
49
1.37M
        return 0;                                                                 \
50
1.37M
    }
sm3_prov.c:sm3_internal_final
Line
Count
Source
44
6.93k
    {                                                                             \
45
6.93k
        if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {       \
46
6.93k
            *outl = dgstsize;                                                     \
47
6.93k
            return 1;                                                             \
48
6.93k
        }                                                                         \
49
6.93k
        return 0;                                                                 \
50
6.93k
    }
51
52
#if defined(FIPS_MODULE)
53
#include "internal/fips.h"
54
#include "prov/provider_ctx.h"
55
#define DIGEST_PROV_CHECK(provctx, name)                  \
56
    if (!ossl_prov_is_running())                          \
57
        return NULL;                                      \
58
    if (!ossl_deferred_self_test(PROV_LIBCTX_OF(provctx), \
59
            ST_ID_DIGEST_##name))                         \
60
    return NULL
61
#else
62
#define DIGEST_PROV_CHECK(_provctx, _name) \
63
1.27M
    if (!ossl_prov_is_running())           \
64
1.27M
    return NULL
65
#endif /* FIPS_MODULE && DIGEST_IS_FIPS */
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
1.13M
    {                                                                            \
74
1.13M
        DIGEST_PROV_CHECK(prov_ctx, name);                                       \
75
1.13M
        return OPENSSL_zalloc(sizeof(CTX));                                      \
76
1.13M
    }                                                                            \
77
    static void name##_freectx(void *vctx)                                       \
78
10.3M
    {                                                                            \
79
10.3M
        CTX *ctx = (CTX *)vctx;                                                  \
80
10.3M
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
10.3M
    }                                                                            \
md5_prov.c:md5_freectx
Line
Count
Source
78
2.25M
    {                                                                            \
79
2.25M
        CTX *ctx = (CTX *)vctx;                                                  \
80
2.25M
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
2.25M
    }                                                                            \
md5_sha1_prov.c:md5_sha1_freectx
Line
Count
Source
78
21.9k
    {                                                                            \
79
21.9k
        CTX *ctx = (CTX *)vctx;                                                  \
80
21.9k
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
21.9k
    }                                                                            \
null_prov.c:nullmd_freectx
Line
Count
Source
78
132
    {                                                                            \
79
132
        CTX *ctx = (CTX *)vctx;                                                  \
80
132
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
132
    }                                                                            \
ripemd_prov.c:ripemd160_freectx
Line
Count
Source
78
6.11k
    {                                                                            \
79
6.11k
        CTX *ctx = (CTX *)vctx;                                                  \
80
6.11k
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
6.11k
    }                                                                            \
sha2_prov.c:sha1_freectx
Line
Count
Source
78
2.81M
    {                                                                            \
79
2.81M
        CTX *ctx = (CTX *)vctx;                                                  \
80
2.81M
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
2.81M
    }                                                                            \
sha2_prov.c:sha224_freectx
Line
Count
Source
78
6.47k
    {                                                                            \
79
6.47k
        CTX *ctx = (CTX *)vctx;                                                  \
80
6.47k
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
6.47k
    }                                                                            \
sha2_prov.c:sha256_freectx
Line
Count
Source
78
2.94M
    {                                                                            \
79
2.94M
        CTX *ctx = (CTX *)vctx;                                                  \
80
2.94M
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
2.94M
    }                                                                            \
sha2_prov.c:sha256_192_internal_freectx
Line
Count
Source
78
1
    {                                                                            \
79
1
        CTX *ctx = (CTX *)vctx;                                                  \
80
1
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
1
    }                                                                            \
sha2_prov.c:sha384_freectx
Line
Count
Source
78
2.31M
    {                                                                            \
79
2.31M
        CTX *ctx = (CTX *)vctx;                                                  \
80
2.31M
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
2.31M
    }                                                                            \
sha2_prov.c:sha512_freectx
Line
Count
Source
78
19.2k
    {                                                                            \
79
19.2k
        CTX *ctx = (CTX *)vctx;                                                  \
80
19.2k
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
19.2k
    }                                                                            \
sha2_prov.c:sha512_224_freectx
Line
Count
Source
78
3.15k
    {                                                                            \
79
3.15k
        CTX *ctx = (CTX *)vctx;                                                  \
80
3.15k
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
3.15k
    }                                                                            \
sha2_prov.c:sha512_256_freectx
Line
Count
Source
78
2.65k
    {                                                                            \
79
2.65k
        CTX *ctx = (CTX *)vctx;                                                  \
80
2.65k
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
2.65k
    }                                                                            \
sm3_prov.c:sm3_freectx
Line
Count
Source
78
5.07k
    {                                                                            \
79
5.07k
        CTX *ctx = (CTX *)vctx;                                                  \
80
5.07k
        OPENSSL_clear_free(ctx, sizeof(*ctx));                                   \
81
5.07k
    }                                                                            \
82
    static void *name##_dupctx(void *ctx)                                        \
83
7.32M
    {                                                                            \
84
7.32M
        CTX *in = (CTX *)ctx;                                                    \
85
7.32M
        CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL; \
86
7.32M
        if (ret != NULL)                                                         \
87
7.32M
            *ret = *in;                                                          \
88
7.32M
        return ret;                                                              \
89
7.32M
    }                                                                            \
90
    static void name##_copyctx(void *voutctx, void *vinctx)                      \
91
18.6M
    {                                                                            \
92
18.6M
        CTX *outctx = (CTX *)voutctx;                                            \
93
18.6M
        CTX *inctx = (CTX *)vinctx;                                              \
94
18.6M
        *outctx = *inctx;                                                        \
95
18.6M
    }                                                                            \
md5_prov.c:md5_copyctx
Line
Count
Source
91
3.63M
    {                                                                            \
92
3.63M
        CTX *outctx = (CTX *)voutctx;                                            \
93
3.63M
        CTX *inctx = (CTX *)vinctx;                                              \
94
3.63M
        *outctx = *inctx;                                                        \
95
3.63M
    }                                                                            \
md5_sha1_prov.c:md5_sha1_copyctx
Line
Count
Source
91
11.4k
    {                                                                            \
92
11.4k
        CTX *outctx = (CTX *)voutctx;                                            \
93
11.4k
        CTX *inctx = (CTX *)vinctx;                                              \
94
11.4k
        *outctx = *inctx;                                                        \
95
11.4k
    }                                                                            \
null_prov.c:nullmd_copyctx
Line
Count
Source
91
59
    {                                                                            \
92
59
        CTX *outctx = (CTX *)voutctx;                                            \
93
59
        CTX *inctx = (CTX *)vinctx;                                              \
94
59
        *outctx = *inctx;                                                        \
95
59
    }                                                                            \
ripemd_prov.c:ripemd160_copyctx
Line
Count
Source
91
2.82k
    {                                                                            \
92
2.82k
        CTX *outctx = (CTX *)voutctx;                                            \
93
2.82k
        CTX *inctx = (CTX *)vinctx;                                              \
94
2.82k
        *outctx = *inctx;                                                        \
95
2.82k
    }                                                                            \
sha2_prov.c:sha1_copyctx
Line
Count
Source
91
1.72M
    {                                                                            \
92
1.72M
        CTX *outctx = (CTX *)voutctx;                                            \
93
1.72M
        CTX *inctx = (CTX *)vinctx;                                              \
94
1.72M
        *outctx = *inctx;                                                        \
95
1.72M
    }                                                                            \
sha2_prov.c:sha224_copyctx
Line
Count
Source
91
1.09M
    {                                                                            \
92
1.09M
        CTX *outctx = (CTX *)voutctx;                                            \
93
1.09M
        CTX *inctx = (CTX *)vinctx;                                              \
94
1.09M
        *outctx = *inctx;                                                        \
95
1.09M
    }                                                                            \
sha2_prov.c:sha256_copyctx
Line
Count
Source
91
4.53M
    {                                                                            \
92
4.53M
        CTX *outctx = (CTX *)voutctx;                                            \
93
4.53M
        CTX *inctx = (CTX *)vinctx;                                              \
94
4.53M
        *outctx = *inctx;                                                        \
95
4.53M
    }                                                                            \
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_copyctx
sha2_prov.c:sha384_copyctx
Line
Count
Source
91
1.75M
    {                                                                            \
92
1.75M
        CTX *outctx = (CTX *)voutctx;                                            \
93
1.75M
        CTX *inctx = (CTX *)vinctx;                                              \
94
1.75M
        *outctx = *inctx;                                                        \
95
1.75M
    }                                                                            \
sha2_prov.c:sha512_copyctx
Line
Count
Source
91
467k
    {                                                                            \
92
467k
        CTX *outctx = (CTX *)voutctx;                                            \
93
467k
        CTX *inctx = (CTX *)vinctx;                                              \
94
467k
        *outctx = *inctx;                                                        \
95
467k
    }                                                                            \
sha2_prov.c:sha512_224_copyctx
Line
Count
Source
91
3.01M
    {                                                                            \
92
3.01M
        CTX *outctx = (CTX *)voutctx;                                            \
93
3.01M
        CTX *inctx = (CTX *)vinctx;                                              \
94
3.01M
        *outctx = *inctx;                                                        \
95
3.01M
    }                                                                            \
sha2_prov.c:sha512_256_copyctx
Line
Count
Source
91
2.43M
    {                                                                            \
92
2.43M
        CTX *outctx = (CTX *)voutctx;                                            \
93
2.43M
        CTX *inctx = (CTX *)vinctx;                                              \
94
2.43M
        *outctx = *inctx;                                                        \
95
2.43M
    }                                                                            \
sm3_prov.c:sm3_copyctx
Line
Count
Source
91
3.29k
    {                                                                            \
92
3.29k
        CTX *outctx = (CTX *)voutctx;                                            \
93
3.29k
        CTX *inctx = (CTX *)vinctx;                                              \
94
3.29k
        *outctx = *inctx;                                                        \
95
3.29k
    }                                                                            \
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
107
#define PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END \
108
    {                                           \
109
        0, NULL                                 \
110
    }                                           \
111
    }                                           \
112
    ;
113
114
#define IMPLEMENT_digest_functions(                                                \
115
    name, CTX, blksize, dgstsize, flags, init, upd, fin)                           \
116
    static OSSL_FUNC_digest_init_fn name##_internal_init;                          \
117
    static int name##_internal_init(void *ctx,                                     \
118
        ossl_unused const OSSL_PARAM params[])                                     \
119
1.12M
    {                                                                              \
120
1.12M
        return ossl_prov_is_running() && init(ctx);                                \
121
1.12M
    }                                                                              \
md5_prov.c:md5_internal_init
Line
Count
Source
119
112k
    {                                                                              \
120
112k
        return ossl_prov_is_running() && init(ctx);                                \
121
112k
    }                                                                              \
null_prov.c:nullmd_internal_init
Line
Count
Source
119
214
    {                                                                              \
120
214
        return ossl_prov_is_running() && init(ctx);                                \
121
214
    }                                                                              \
ripemd_prov.c:ripemd160_internal_init
Line
Count
Source
119
1.00M
    {                                                                              \
120
1.00M
        return ossl_prov_is_running() && init(ctx);                                \
121
1.00M
    }                                                                              \
sm3_prov.c:sm3_internal_init
Line
Count
Source
119
7.11k
    {                                                                              \
120
7.11k
        return ossl_prov_is_running() && init(ctx);                                \
121
7.11k
    }                                                                              \
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
        PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END
126
127
#define IMPLEMENT_digest_functions_with_settable_ctx(                                  \
128
    name, CTX, blksize, dgstsize, flags, init, upd, fin,                               \
129
    settable_ctx_params, set_ctx_params)                                               \
130
    static OSSL_FUNC_digest_init_fn name##_internal_init;                              \
131
    static int name##_internal_init(void *ctx, const OSSL_PARAM params[])              \
132
792k
    {                                                                                  \
133
792k
        return ossl_prov_is_running()                                                  \
134
792k
            && init(ctx)                                                               \
135
792k
            && set_ctx_params(ctx, params);                                            \
136
792k
    }                                                                                  \
md5_sha1_prov.c:md5_sha1_internal_init
Line
Count
Source
132
25.4k
    {                                                                                  \
133
25.4k
        return ossl_prov_is_running()                                                  \
134
25.4k
            && init(ctx)                                                               \
135
25.4k
            && set_ctx_params(ctx, params);                                            \
136
25.4k
    }                                                                                  \
sha2_prov.c:sha1_internal_init
Line
Count
Source
132
767k
    {                                                                                  \
133
767k
        return ossl_prov_is_running()                                                  \
134
767k
            && init(ctx)                                                               \
135
767k
            && set_ctx_params(ctx, params);                                            \
136
767k
    }                                                                                  \
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_SETTABLE_CTX_PARAMS, (void (*)(void))settable_ctx_params }, \
141
        { OSSL_FUNC_DIGEST_SET_CTX_PARAMS, (void (*)(void))set_ctx_params },           \
142
        PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END
143
144
#define IMPLEMENT_digest_functions_with_serialize(                                 \
145
    name, CTX, blksize, dgstsize, flags, init, upd, fin,                           \
146
    serialize, deserialize)                                                        \
147
    static OSSL_FUNC_digest_init_fn name##_internal_init;                          \
148
    static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
149
367M
    {                                                                              \
150
367M
        return ossl_prov_is_running() && init(ctx);                                \
151
367M
    }                                                                              \
sha2_prov.c:sha224_internal_init
Line
Count
Source
149
166k
    {                                                                              \
150
166k
        return ossl_prov_is_running() && init(ctx);                                \
151
166k
    }                                                                              \
sha2_prov.c:sha256_internal_init
Line
Count
Source
149
350M
    {                                                                              \
150
350M
        return ossl_prov_is_running() && init(ctx);                                \
151
350M
    }                                                                              \
sha2_prov.c:sha256_192_internal_internal_init
Line
Count
Source
149
1
    {                                                                              \
150
1
        return ossl_prov_is_running() && init(ctx);                                \
151
1
    }                                                                              \
sha2_prov.c:sha384_internal_init
Line
Count
Source
149
1.63M
    {                                                                              \
150
1.63M
        return ossl_prov_is_running() && init(ctx);                                \
151
1.63M
    }                                                                              \
sha2_prov.c:sha512_internal_init
Line
Count
Source
149
15.4M
    {                                                                              \
150
15.4M
        return ossl_prov_is_running() && init(ctx);                                \
151
15.4M
    }                                                                              \
sha2_prov.c:sha512_224_internal_init
Line
Count
Source
149
143k
    {                                                                              \
150
143k
        return ossl_prov_is_running() && init(ctx);                                \
151
143k
    }                                                                              \
sha2_prov.c:sha512_256_internal_init
Line
Count
Source
149
155k
    {                                                                              \
150
155k
        return ossl_prov_is_running() && init(ctx);                                \
151
155k
    }                                                                              \
152
    PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \
153
        upd, fin),                                                                 \
154
        { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init },           \
155
        { OSSL_FUNC_DIGEST_SERIALIZE, (void (*)(void))serialize },                 \
156
        { OSSL_FUNC_DIGEST_DESERIALIZE, (void (*)(void))deserialize },             \
157
        PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END
158
159
const OSSL_PARAM *ossl_digest_default_gettable_params(void *provctx);
160
int ossl_digest_default_get_params(OSSL_PARAM params[], size_t blksz,
161
    size_t paramsz, unsigned long flags);
162
163
#ifdef __cplusplus
164
}
165
#endif
166
167
#endif /* OSSL_PROVIDERS_DIGESTCOMMON_H */