Coverage Report

Created: 2025-11-16 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl33/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
1.66k
#define PROV_DIGEST_FLAG_XOF             0x0001
20
1.66k
#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
1.99k
static int name##_get_params(OSSL_PARAM params[])                              \
29
1.99k
{                                                                              \
30
1.99k
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
1.99k
}
md5_prov.c:md5_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
md5_sha1_prov.c:md5_sha1_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
null_prov.c:nullmd_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
ripemd_prov.c:ripemd160_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha2_prov.c:sha1_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha2_prov.c:sha224_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha2_prov.c:sha256_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha2_prov.c:sha256_192_get_params
Line
Count
Source
28
56
static int name##_get_params(OSSL_PARAM params[])                              \
29
56
{                                                                              \
30
56
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
56
}
sha2_prov.c:sha384_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha2_prov.c:sha512_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha2_prov.c:sha512_224_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha2_prov.c:sha512_256_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha3_prov.c:sha3_224_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha3_prov.c:sha3_256_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha3_prov.c:sha3_384_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha3_prov.c:sha3_512_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha3_prov.c:keccak_224_get_params
Line
Count
Source
28
75
static int name##_get_params(OSSL_PARAM params[])                              \
29
75
{                                                                              \
30
75
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
75
}
sha3_prov.c:keccak_256_get_params
Line
Count
Source
28
75
static int name##_get_params(OSSL_PARAM params[])                              \
29
75
{                                                                              \
30
75
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
75
}
sha3_prov.c:keccak_384_get_params
Line
Count
Source
28
75
static int name##_get_params(OSSL_PARAM params[])                              \
29
75
{                                                                              \
30
75
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
75
}
sha3_prov.c:keccak_512_get_params
Line
Count
Source
28
75
static int name##_get_params(OSSL_PARAM params[])                              \
29
75
{                                                                              \
30
75
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
75
}
sha3_prov.c:shake_128_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha3_prov.c:shake_256_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha3_prov.c:keccak_kmac_128_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sha3_prov.c:keccak_kmac_256_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
sm3_prov.c:sm3_get_params
Line
Count
Source
28
82
static int name##_get_params(OSSL_PARAM params[])                              \
29
82
{                                                                              \
30
82
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
82
}
32
33
#define PROV_DISPATCH_FUNC_DIGEST_GET_PARAMS(name)                             \
34
{ OSSL_FUNC_DIGEST_GET_PARAMS, (void (*)(void))name##_get_params },            \
35
{ OSSL_FUNC_DIGEST_GETTABLE_PARAMS,                                            \
36
  (void (*)(void))ossl_digest_default_gettable_params }
37
38
# define PROV_FUNC_DIGEST_FINAL(name, dgstsize, fin)                           \
39
static OSSL_FUNC_digest_final_fn name##_internal_final;                        \
40
static int name##_internal_final(void *ctx, unsigned char *out, size_t *outl,  \
41
419M
                                 size_t outsz)                                 \
42
419M
{                                                                              \
43
419M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
419M
        *outl = dgstsize;                                                      \
45
419M
        return 1;                                                              \
46
419M
    }                                                                          \
47
419M
    return 0;                                                                  \
48
419M
}
md5_prov.c:md5_internal_final
Line
Count
Source
41
587k
                                 size_t outsz)                                 \
42
587k
{                                                                              \
43
587k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
587k
        *outl = dgstsize;                                                      \
45
587k
        return 1;                                                              \
46
587k
    }                                                                          \
47
587k
    return 0;                                                                  \
48
587k
}
md5_sha1_prov.c:md5_sha1_internal_final
Line
Count
Source
41
12.8k
                                 size_t outsz)                                 \
42
12.8k
{                                                                              \
43
12.8k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
12.8k
        *outl = dgstsize;                                                      \
45
12.8k
        return 1;                                                              \
46
12.8k
    }                                                                          \
47
12.8k
    return 0;                                                                  \
48
12.8k
}
ripemd_prov.c:ripemd160_internal_final
Line
Count
Source
41
1.53M
                                 size_t outsz)                                 \
42
1.53M
{                                                                              \
43
1.53M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.53M
        *outl = dgstsize;                                                      \
45
1.53M
        return 1;                                                              \
46
1.53M
    }                                                                          \
47
1.53M
    return 0;                                                                  \
48
1.53M
}
sha2_prov.c:sha1_internal_final
Line
Count
Source
41
1.51M
                                 size_t outsz)                                 \
42
1.51M
{                                                                              \
43
1.51M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.51M
        *outl = dgstsize;                                                      \
45
1.51M
        return 1;                                                              \
46
1.51M
    }                                                                          \
47
1.51M
    return 0;                                                                  \
48
1.51M
}
sha2_prov.c:sha224_internal_final
Line
Count
Source
41
269k
                                 size_t outsz)                                 \
42
269k
{                                                                              \
43
269k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
269k
        *outl = dgstsize;                                                      \
45
269k
        return 1;                                                              \
46
269k
    }                                                                          \
47
269k
    return 0;                                                                  \
48
269k
}
sha2_prov.c:sha256_internal_final
Line
Count
Source
41
396M
                                 size_t outsz)                                 \
42
396M
{                                                                              \
43
396M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
396M
        *outl = dgstsize;                                                      \
45
396M
        return 1;                                                              \
46
396M
    }                                                                          \
47
396M
    return 0;                                                                  \
48
396M
}
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_final
sha2_prov.c:sha384_internal_final
Line
Count
Source
41
2.07M
                                 size_t outsz)                                 \
42
2.07M
{                                                                              \
43
2.07M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
2.07M
        *outl = dgstsize;                                                      \
45
2.07M
        return 1;                                                              \
46
2.07M
    }                                                                          \
47
2.07M
    return 0;                                                                  \
48
2.07M
}
sha2_prov.c:sha512_internal_final
Line
Count
Source
41
16.1M
                                 size_t outsz)                                 \
42
16.1M
{                                                                              \
43
16.1M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
16.1M
        *outl = dgstsize;                                                      \
45
16.1M
        return 1;                                                              \
46
16.1M
    }                                                                          \
47
16.1M
    return 0;                                                                  \
48
16.1M
}
sha2_prov.c:sha512_224_internal_final
Line
Count
Source
41
250k
                                 size_t outsz)                                 \
42
250k
{                                                                              \
43
250k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
250k
        *outl = dgstsize;                                                      \
45
250k
        return 1;                                                              \
46
250k
    }                                                                          \
47
250k
    return 0;                                                                  \
48
250k
}
sha2_prov.c:sha512_256_internal_final
Line
Count
Source
41
142k
                                 size_t outsz)                                 \
42
142k
{                                                                              \
43
142k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
142k
        *outl = dgstsize;                                                      \
45
142k
        return 1;                                                              \
46
142k
    }                                                                          \
47
142k
    return 0;                                                                  \
48
142k
}
sm3_prov.c:sm3_internal_final
Line
Count
Source
41
4.25k
                                 size_t outsz)                                 \
42
4.25k
{                                                                              \
43
4.25k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
4.25k
        *outl = dgstsize;                                                      \
45
4.25k
        return 1;                                                              \
46
4.25k
    }                                                                          \
47
4.25k
    return 0;                                                                  \
48
4.25k
}
49
50
# define PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(                            \
51
    name, CTX, blksize, dgstsize, flags, upd, fin)                             \
52
static OSSL_FUNC_digest_newctx_fn name##_newctx;                               \
53
static OSSL_FUNC_digest_freectx_fn name##_freectx;                             \
54
static OSSL_FUNC_digest_dupctx_fn name##_dupctx;                               \
55
4.18M
static void *name##_newctx(void *prov_ctx)                                     \
56
4.18M
{                                                                              \
57
4.18M
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
4.18M
    return ctx;                                                                \
59
4.18M
}                                                                              \
60
11.0M
static void name##_freectx(void *vctx)                                         \
61
11.0M
{                                                                              \
62
11.0M
    CTX *ctx = (CTX *)vctx;                                                    \
63
11.0M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
11.0M
}                                                                              \
md5_prov.c:md5_freectx
Line
Count
Source
60
1.45M
static void name##_freectx(void *vctx)                                         \
61
1.45M
{                                                                              \
62
1.45M
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.45M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.45M
}                                                                              \
md5_sha1_prov.c:md5_sha1_freectx
Line
Count
Source
60
20.5k
static void name##_freectx(void *vctx)                                         \
61
20.5k
{                                                                              \
62
20.5k
    CTX *ctx = (CTX *)vctx;                                                    \
63
20.5k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
20.5k
}                                                                              \
null_prov.c:nullmd_freectx
Line
Count
Source
60
71
static void name##_freectx(void *vctx)                                         \
61
71
{                                                                              \
62
71
    CTX *ctx = (CTX *)vctx;                                                    \
63
71
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
71
}                                                                              \
ripemd_prov.c:ripemd160_freectx
Line
Count
Source
60
210k
static void name##_freectx(void *vctx)                                         \
61
210k
{                                                                              \
62
210k
    CTX *ctx = (CTX *)vctx;                                                    \
63
210k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
210k
}                                                                              \
sha2_prov.c:sha1_freectx
Line
Count
Source
60
2.37M
static void name##_freectx(void *vctx)                                         \
61
2.37M
{                                                                              \
62
2.37M
    CTX *ctx = (CTX *)vctx;                                                    \
63
2.37M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
2.37M
}                                                                              \
sha2_prov.c:sha224_freectx
Line
Count
Source
60
25.8k
static void name##_freectx(void *vctx)                                         \
61
25.8k
{                                                                              \
62
25.8k
    CTX *ctx = (CTX *)vctx;                                                    \
63
25.8k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
25.8k
}                                                                              \
sha2_prov.c:sha256_freectx
Line
Count
Source
60
3.66M
static void name##_freectx(void *vctx)                                         \
61
3.66M
{                                                                              \
62
3.66M
    CTX *ctx = (CTX *)vctx;                                                    \
63
3.66M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
3.66M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_freectx
sha2_prov.c:sha384_freectx
Line
Count
Source
60
3.11M
static void name##_freectx(void *vctx)                                         \
61
3.11M
{                                                                              \
62
3.11M
    CTX *ctx = (CTX *)vctx;                                                    \
63
3.11M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
3.11M
}                                                                              \
sha2_prov.c:sha512_freectx
Line
Count
Source
60
156k
static void name##_freectx(void *vctx)                                         \
61
156k
{                                                                              \
62
156k
    CTX *ctx = (CTX *)vctx;                                                    \
63
156k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
156k
}                                                                              \
sha2_prov.c:sha512_224_freectx
Line
Count
Source
60
5.38k
static void name##_freectx(void *vctx)                                         \
61
5.38k
{                                                                              \
62
5.38k
    CTX *ctx = (CTX *)vctx;                                                    \
63
5.38k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
5.38k
}                                                                              \
sha2_prov.c:sha512_256_freectx
Line
Count
Source
60
9.72k
static void name##_freectx(void *vctx)                                         \
61
9.72k
{                                                                              \
62
9.72k
    CTX *ctx = (CTX *)vctx;                                                    \
63
9.72k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
9.72k
}                                                                              \
sm3_prov.c:sm3_freectx
Line
Count
Source
60
3.03k
static void name##_freectx(void *vctx)                                         \
61
3.03k
{                                                                              \
62
3.03k
    CTX *ctx = (CTX *)vctx;                                                    \
63
3.03k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
3.03k
}                                                                              \
65
6.86M
static void *name##_dupctx(void *ctx)                                          \
66
6.86M
{                                                                              \
67
6.86M
    CTX *in = (CTX *)ctx;                                                      \
68
6.86M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
6.86M
    if (ret != NULL)                                                           \
70
6.86M
        *ret = *in;                                                            \
71
6.86M
    return ret;                                                                \
72
6.86M
}                                                                              \
73
PROV_FUNC_DIGEST_FINAL(name, dgstsize, fin)                                    \
74
PROV_FUNC_DIGEST_GET_PARAM(name, blksize, dgstsize, flags)                     \
75
const OSSL_DISPATCH ossl_##name##_functions[] = {                              \
76
    { OSSL_FUNC_DIGEST_NEWCTX, (void (*)(void))name##_newctx },                \
77
    { OSSL_FUNC_DIGEST_UPDATE, (void (*)(void))upd },                          \
78
    { OSSL_FUNC_DIGEST_FINAL, (void (*)(void))name##_internal_final },         \
79
    { OSSL_FUNC_DIGEST_FREECTX, (void (*)(void))name##_freectx },              \
80
    { OSSL_FUNC_DIGEST_DUPCTX, (void (*)(void))name##_dupctx },                \
81
    PROV_DISPATCH_FUNC_DIGEST_GET_PARAMS(name)
82
83
# define PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END                               \
84
    { 0, NULL }                                                                \
85
};
86
87
# define IMPLEMENT_digest_functions(                                           \
88
    name, CTX, blksize, dgstsize, flags, init, upd, fin)                       \
89
static OSSL_FUNC_digest_init_fn name##_internal_init;                          \
90
static int name##_internal_init(void *ctx,                                     \
91
416M
                                ossl_unused const OSSL_PARAM params[])         \
92
416M
{                                                                              \
93
416M
    return ossl_prov_is_running() && init(ctx);                                \
94
416M
}                                                                              \
md5_prov.c:md5_internal_init
Line
Count
Source
91
102k
                                ossl_unused const OSSL_PARAM params[])         \
92
102k
{                                                                              \
93
102k
    return ossl_prov_is_running() && init(ctx);                                \
94
102k
}                                                                              \
null_prov.c:nullmd_internal_init
Line
Count
Source
91
124
                                ossl_unused const OSSL_PARAM params[])         \
92
124
{                                                                              \
93
124
    return ossl_prov_is_running() && init(ctx);                                \
94
124
}                                                                              \
ripemd_prov.c:ripemd160_internal_init
Line
Count
Source
91
1.53M
                                ossl_unused const OSSL_PARAM params[])         \
92
1.53M
{                                                                              \
93
1.53M
    return ossl_prov_is_running() && init(ctx);                                \
94
1.53M
}                                                                              \
sha2_prov.c:sha224_internal_init
Line
Count
Source
91
271k
                                ossl_unused const OSSL_PARAM params[])         \
92
271k
{                                                                              \
93
271k
    return ossl_prov_is_running() && init(ctx);                                \
94
271k
}                                                                              \
sha2_prov.c:sha256_internal_init
Line
Count
Source
91
396M
                                ossl_unused const OSSL_PARAM params[])         \
92
396M
{                                                                              \
93
396M
    return ossl_prov_is_running() && init(ctx);                                \
94
396M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_init
sha2_prov.c:sha384_internal_init
Line
Count
Source
91
1.96M
                                ossl_unused const OSSL_PARAM params[])         \
92
1.96M
{                                                                              \
93
1.96M
    return ossl_prov_is_running() && init(ctx);                                \
94
1.96M
}                                                                              \
sha2_prov.c:sha512_internal_init
Line
Count
Source
91
16.1M
                                ossl_unused const OSSL_PARAM params[])         \
92
16.1M
{                                                                              \
93
16.1M
    return ossl_prov_is_running() && init(ctx);                                \
94
16.1M
}                                                                              \
sha2_prov.c:sha512_224_internal_init
Line
Count
Source
91
250k
                                ossl_unused const OSSL_PARAM params[])         \
92
250k
{                                                                              \
93
250k
    return ossl_prov_is_running() && init(ctx);                                \
94
250k
}                                                                              \
sha2_prov.c:sha512_256_internal_init
Line
Count
Source
91
142k
                                ossl_unused const OSSL_PARAM params[])         \
92
142k
{                                                                              \
93
142k
    return ossl_prov_is_running() && init(ctx);                                \
94
142k
}                                                                              \
sm3_prov.c:sm3_internal_init
Line
Count
Source
91
4.34k
                                ossl_unused const OSSL_PARAM params[])         \
92
4.34k
{                                                                              \
93
4.34k
    return ossl_prov_is_running() && init(ctx);                                \
94
4.34k
}                                                                              \
95
PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \
96
                                          upd, fin),                           \
97
    { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init },           \
98
PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END
99
100
# define IMPLEMENT_digest_functions_with_settable_ctx(                         \
101
    name, CTX, blksize, dgstsize, flags, init, upd, fin,                       \
102
    settable_ctx_params, set_ctx_params)                                       \
103
static OSSL_FUNC_digest_init_fn name##_internal_init;                          \
104
1.17M
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
1.17M
{                                                                              \
106
1.17M
    return ossl_prov_is_running()                                              \
107
1.17M
           && init(ctx)                                                        \
108
1.17M
           && set_ctx_params(ctx, params);                                     \
109
1.17M
}                                                                              \
md5_sha1_prov.c:md5_sha1_internal_init
Line
Count
Source
104
15.1k
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
15.1k
{                                                                              \
106
15.1k
    return ossl_prov_is_running()                                              \
107
15.1k
           && init(ctx)                                                        \
108
15.1k
           && set_ctx_params(ctx, params);                                     \
109
15.1k
}                                                                              \
sha2_prov.c:sha1_internal_init
Line
Count
Source
104
1.16M
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
1.16M
{                                                                              \
106
1.16M
    return ossl_prov_is_running()                                              \
107
1.16M
           && init(ctx)                                                        \
108
1.16M
           && set_ctx_params(ctx, params);                                     \
109
1.16M
}                                                                              \
110
PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_START(name, CTX, blksize, dgstsize, flags, \
111
                                          upd, fin),                           \
112
    { OSSL_FUNC_DIGEST_INIT, (void (*)(void))name##_internal_init },           \
113
    { OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS, (void (*)(void))settable_ctx_params }, \
114
    { OSSL_FUNC_DIGEST_SET_CTX_PARAMS, (void (*)(void))set_ctx_params },       \
115
PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END
116
117
118
const OSSL_PARAM *ossl_digest_default_gettable_params(void *provctx);
119
int ossl_digest_default_get_params(OSSL_PARAM params[], size_t blksz,
120
                                   size_t paramsz, unsigned long flags);
121
122
# ifdef __cplusplus
123
}
124
# endif
125
126
#endif /* OSSL_PROVIDERS_DIGESTCOMMON_H */