Coverage Report

Created: 2025-12-04 06:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl34/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
2.45k
static int name##_get_params(OSSL_PARAM params[])                              \
29
2.45k
{                                                                              \
30
2.45k
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
2.45k
}
md5_prov.c:md5_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
md5_sha1_prov.c:md5_sha1_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
null_prov.c:nullmd_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
ripemd_prov.c:ripemd160_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha2_prov.c:sha1_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha2_prov.c:sha224_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha2_prov.c:sha256_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
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
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha2_prov.c:sha512_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha2_prov.c:sha512_224_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha2_prov.c:sha512_256_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha3_prov.c:sha3_224_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha3_prov.c:sha3_256_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha3_prov.c:sha3_384_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha3_prov.c:sha3_512_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha3_prov.c:keccak_224_get_params
Line
Count
Source
28
94
static int name##_get_params(OSSL_PARAM params[])                              \
29
94
{                                                                              \
30
94
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
94
}
sha3_prov.c:keccak_256_get_params
Line
Count
Source
28
94
static int name##_get_params(OSSL_PARAM params[])                              \
29
94
{                                                                              \
30
94
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
94
}
sha3_prov.c:keccak_384_get_params
Line
Count
Source
28
94
static int name##_get_params(OSSL_PARAM params[])                              \
29
94
{                                                                              \
30
94
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
94
}
sha3_prov.c:keccak_512_get_params
Line
Count
Source
28
94
static int name##_get_params(OSSL_PARAM params[])                              \
29
94
{                                                                              \
30
94
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
94
}
sha3_prov.c:shake_128_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha3_prov.c:shake_256_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha3_prov.c:keccak_kmac_128_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sha3_prov.c:keccak_kmac_256_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
sm3_prov.c:sm3_get_params
Line
Count
Source
28
101
static int name##_get_params(OSSL_PARAM params[])                              \
29
101
{                                                                              \
30
101
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
101
}
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
716M
                                 size_t outsz)                                 \
42
716M
{                                                                              \
43
716M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
716M
        *outl = dgstsize;                                                      \
45
716M
        return 1;                                                              \
46
716M
    }                                                                          \
47
716M
    return 0;                                                                  \
48
716M
}
md5_prov.c:md5_internal_final
Line
Count
Source
41
619k
                                 size_t outsz)                                 \
42
619k
{                                                                              \
43
619k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
619k
        *outl = dgstsize;                                                      \
45
619k
        return 1;                                                              \
46
619k
    }                                                                          \
47
619k
    return 0;                                                                  \
48
619k
}
md5_sha1_prov.c:md5_sha1_internal_final
Line
Count
Source
41
14.7k
                                 size_t outsz)                                 \
42
14.7k
{                                                                              \
43
14.7k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
14.7k
        *outl = dgstsize;                                                      \
45
14.7k
        return 1;                                                              \
46
14.7k
    }                                                                          \
47
14.7k
    return 0;                                                                  \
48
14.7k
}
ripemd_prov.c:ripemd160_internal_final
Line
Count
Source
41
1.54M
                                 size_t outsz)                                 \
42
1.54M
{                                                                              \
43
1.54M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.54M
        *outl = dgstsize;                                                      \
45
1.54M
        return 1;                                                              \
46
1.54M
    }                                                                          \
47
1.54M
    return 0;                                                                  \
48
1.54M
}
sha2_prov.c:sha1_internal_final
Line
Count
Source
41
1.74M
                                 size_t outsz)                                 \
42
1.74M
{                                                                              \
43
1.74M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.74M
        *outl = dgstsize;                                                      \
45
1.74M
        return 1;                                                              \
46
1.74M
    }                                                                          \
47
1.74M
    return 0;                                                                  \
48
1.74M
}
sha2_prov.c:sha224_internal_final
Line
Count
Source
41
294k
                                 size_t outsz)                                 \
42
294k
{                                                                              \
43
294k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
294k
        *outl = dgstsize;                                                      \
45
294k
        return 1;                                                              \
46
294k
    }                                                                          \
47
294k
    return 0;                                                                  \
48
294k
}
sha2_prov.c:sha256_internal_final
Line
Count
Source
41
676M
                                 size_t outsz)                                 \
42
676M
{                                                                              \
43
676M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
676M
        *outl = dgstsize;                                                      \
45
676M
        return 1;                                                              \
46
676M
    }                                                                          \
47
676M
    return 0;                                                                  \
48
676M
}
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_final
sha2_prov.c:sha384_internal_final
Line
Count
Source
41
2.38M
                                 size_t outsz)                                 \
42
2.38M
{                                                                              \
43
2.38M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
2.38M
        *outl = dgstsize;                                                      \
45
2.38M
        return 1;                                                              \
46
2.38M
    }                                                                          \
47
2.38M
    return 0;                                                                  \
48
2.38M
}
sha2_prov.c:sha512_internal_final
Line
Count
Source
41
32.9M
                                 size_t outsz)                                 \
42
32.9M
{                                                                              \
43
32.9M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
32.9M
        *outl = dgstsize;                                                      \
45
32.9M
        return 1;                                                              \
46
32.9M
    }                                                                          \
47
32.9M
    return 0;                                                                  \
48
32.9M
}
sha2_prov.c:sha512_224_internal_final
Line
Count
Source
41
200k
                                 size_t outsz)                                 \
42
200k
{                                                                              \
43
200k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
200k
        *outl = dgstsize;                                                      \
45
200k
        return 1;                                                              \
46
200k
    }                                                                          \
47
200k
    return 0;                                                                  \
48
200k
}
sha2_prov.c:sha512_256_internal_final
Line
Count
Source
41
132k
                                 size_t outsz)                                 \
42
132k
{                                                                              \
43
132k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
132k
        *outl = dgstsize;                                                      \
45
132k
        return 1;                                                              \
46
132k
    }                                                                          \
47
132k
    return 0;                                                                  \
48
132k
}
sm3_prov.c:sm3_internal_final
Line
Count
Source
41
4.82k
                                 size_t outsz)                                 \
42
4.82k
{                                                                              \
43
4.82k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
4.82k
        *outl = dgstsize;                                                      \
45
4.82k
        return 1;                                                              \
46
4.82k
    }                                                                          \
47
4.82k
    return 0;                                                                  \
48
4.82k
}
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.48M
static void *name##_newctx(void *prov_ctx)                                     \
56
4.48M
{                                                                              \
57
4.48M
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
4.48M
    return ctx;                                                                \
59
4.48M
}                                                                              \
60
11.7M
static void name##_freectx(void *vctx)                                         \
61
11.7M
{                                                                              \
62
11.7M
    CTX *ctx = (CTX *)vctx;                                                    \
63
11.7M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
11.7M
}                                                                              \
md5_prov.c:md5_freectx
Line
Count
Source
60
1.49M
static void name##_freectx(void *vctx)                                         \
61
1.49M
{                                                                              \
62
1.49M
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.49M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.49M
}                                                                              \
md5_sha1_prov.c:md5_sha1_freectx
Line
Count
Source
60
23.8k
static void name##_freectx(void *vctx)                                         \
61
23.8k
{                                                                              \
62
23.8k
    CTX *ctx = (CTX *)vctx;                                                    \
63
23.8k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
23.8k
}                                                                              \
null_prov.c:nullmd_freectx
Line
Count
Source
60
92
static void name##_freectx(void *vctx)                                         \
61
92
{                                                                              \
62
92
    CTX *ctx = (CTX *)vctx;                                                    \
63
92
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
92
}                                                                              \
ripemd_prov.c:ripemd160_freectx
Line
Count
Source
60
178k
static void name##_freectx(void *vctx)                                         \
61
178k
{                                                                              \
62
178k
    CTX *ctx = (CTX *)vctx;                                                    \
63
178k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
178k
}                                                                              \
sha2_prov.c:sha1_freectx
Line
Count
Source
60
2.53M
static void name##_freectx(void *vctx)                                         \
61
2.53M
{                                                                              \
62
2.53M
    CTX *ctx = (CTX *)vctx;                                                    \
63
2.53M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
2.53M
}                                                                              \
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.98M
static void name##_freectx(void *vctx)                                         \
61
3.98M
{                                                                              \
62
3.98M
    CTX *ctx = (CTX *)vctx;                                                    \
63
3.98M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
3.98M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_freectx
sha2_prov.c:sha384_freectx
Line
Count
Source
60
3.37M
static void name##_freectx(void *vctx)                                         \
61
3.37M
{                                                                              \
62
3.37M
    CTX *ctx = (CTX *)vctx;                                                    \
63
3.37M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
3.37M
}                                                                              \
sha2_prov.c:sha512_freectx
Line
Count
Source
60
144k
static void name##_freectx(void *vctx)                                         \
61
144k
{                                                                              \
62
144k
    CTX *ctx = (CTX *)vctx;                                                    \
63
144k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
144k
}                                                                              \
sha2_prov.c:sha512_224_freectx
Line
Count
Source
60
5.35k
static void name##_freectx(void *vctx)                                         \
61
5.35k
{                                                                              \
62
5.35k
    CTX *ctx = (CTX *)vctx;                                                    \
63
5.35k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
5.35k
}                                                                              \
sha2_prov.c:sha512_256_freectx
Line
Count
Source
60
9.95k
static void name##_freectx(void *vctx)                                         \
61
9.95k
{                                                                              \
62
9.95k
    CTX *ctx = (CTX *)vctx;                                                    \
63
9.95k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
9.95k
}                                                                              \
sm3_prov.c:sm3_freectx
Line
Count
Source
60
3.53k
static void name##_freectx(void *vctx)                                         \
61
3.53k
{                                                                              \
62
3.53k
    CTX *ctx = (CTX *)vctx;                                                    \
63
3.53k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
3.53k
}                                                                              \
65
7.30M
static void *name##_dupctx(void *ctx)                                          \
66
7.30M
{                                                                              \
67
7.30M
    CTX *in = (CTX *)ctx;                                                      \
68
7.30M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
7.30M
    if (ret != NULL)                                                           \
70
7.30M
        *ret = *in;                                                            \
71
7.30M
    return ret;                                                                \
72
7.30M
}                                                                              \
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
713M
                                ossl_unused const OSSL_PARAM params[])         \
92
713M
{                                                                              \
93
713M
    return ossl_prov_is_running() && init(ctx);                                \
94
713M
}                                                                              \
md5_prov.c:md5_internal_init
Line
Count
Source
91
113k
                                ossl_unused const OSSL_PARAM params[])         \
92
113k
{                                                                              \
93
113k
    return ossl_prov_is_running() && init(ctx);                                \
94
113k
}                                                                              \
null_prov.c:nullmd_internal_init
Line
Count
Source
91
162
                                ossl_unused const OSSL_PARAM params[])         \
92
162
{                                                                              \
93
162
    return ossl_prov_is_running() && init(ctx);                                \
94
162
}                                                                              \
ripemd_prov.c:ripemd160_internal_init
Line
Count
Source
91
1.54M
                                ossl_unused const OSSL_PARAM params[])         \
92
1.54M
{                                                                              \
93
1.54M
    return ossl_prov_is_running() && init(ctx);                                \
94
1.54M
}                                                                              \
sha2_prov.c:sha224_internal_init
Line
Count
Source
91
296k
                                ossl_unused const OSSL_PARAM params[])         \
92
296k
{                                                                              \
93
296k
    return ossl_prov_is_running() && init(ctx);                                \
94
296k
}                                                                              \
sha2_prov.c:sha256_internal_init
Line
Count
Source
91
675M
                                ossl_unused const OSSL_PARAM params[])         \
92
675M
{                                                                              \
93
675M
    return ossl_prov_is_running() && init(ctx);                                \
94
675M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_init
sha2_prov.c:sha384_internal_init
Line
Count
Source
91
2.26M
                                ossl_unused const OSSL_PARAM params[])         \
92
2.26M
{                                                                              \
93
2.26M
    return ossl_prov_is_running() && init(ctx);                                \
94
2.26M
}                                                                              \
sha2_prov.c:sha512_internal_init
Line
Count
Source
91
32.9M
                                ossl_unused const OSSL_PARAM params[])         \
92
32.9M
{                                                                              \
93
32.9M
    return ossl_prov_is_running() && init(ctx);                                \
94
32.9M
}                                                                              \
sha2_prov.c:sha512_224_internal_init
Line
Count
Source
91
200k
                                ossl_unused const OSSL_PARAM params[])         \
92
200k
{                                                                              \
93
200k
    return ossl_prov_is_running() && init(ctx);                                \
94
200k
}                                                                              \
sha2_prov.c:sha512_256_internal_init
Line
Count
Source
91
132k
                                ossl_unused const OSSL_PARAM params[])         \
92
132k
{                                                                              \
93
132k
    return ossl_prov_is_running() && init(ctx);                                \
94
132k
}                                                                              \
sm3_prov.c:sm3_internal_init
Line
Count
Source
91
4.96k
                                ossl_unused const OSSL_PARAM params[])         \
92
4.96k
{                                                                              \
93
4.96k
    return ossl_prov_is_running() && init(ctx);                                \
94
4.96k
}                                                                              \
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.37M
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
1.37M
{                                                                              \
106
1.37M
    return ossl_prov_is_running()                                              \
107
1.37M
           && init(ctx)                                                        \
108
1.37M
           && set_ctx_params(ctx, params);                                     \
109
1.37M
}                                                                              \
md5_sha1_prov.c:md5_sha1_internal_init
Line
Count
Source
104
16.8k
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
16.8k
{                                                                              \
106
16.8k
    return ossl_prov_is_running()                                              \
107
16.8k
           && init(ctx)                                                        \
108
16.8k
           && set_ctx_params(ctx, params);                                     \
109
16.8k
}                                                                              \
sha2_prov.c:sha1_internal_init
Line
Count
Source
104
1.35M
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
1.35M
{                                                                              \
106
1.35M
    return ossl_prov_is_running()                                              \
107
1.35M
           && init(ctx)                                                        \
108
1.35M
           && set_ctx_params(ctx, params);                                     \
109
1.35M
}                                                                              \
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 */