Coverage Report

Created: 2025-08-28 07:07

/src/openssl32/providers/implementations/include/prov/digestcommon.h
Line
Count
Source (jump to first uncovered line)
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.07k
static int name##_get_params(OSSL_PARAM params[])                              \
29
2.07k
{                                                                              \
30
2.07k
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
2.07k
}
blake2_prov.c:blake2s256_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_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
554M
                                 size_t outsz)                                 \
42
554M
{                                                                              \
43
554M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
554M
        *outl = dgstsize;                                                      \
45
554M
        return 1;                                                              \
46
554M
    }                                                                          \
47
554M
    return 0;                                                                  \
48
554M
}
md5_prov.c:md5_internal_final
Line
Count
Source
41
559k
                                 size_t outsz)                                 \
42
559k
{                                                                              \
43
559k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
559k
        *outl = dgstsize;                                                      \
45
559k
        return 1;                                                              \
46
559k
    }                                                                          \
47
559k
    return 0;                                                                  \
48
559k
}
md5_sha1_prov.c:md5_sha1_internal_final
Line
Count
Source
41
12.6k
                                 size_t outsz)                                 \
42
12.6k
{                                                                              \
43
12.6k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
12.6k
        *outl = dgstsize;                                                      \
45
12.6k
        return 1;                                                              \
46
12.6k
    }                                                                          \
47
12.6k
    return 0;                                                                  \
48
12.6k
}
ripemd_prov.c:ripemd160_internal_final
Line
Count
Source
41
2.11M
                                 size_t outsz)                                 \
42
2.11M
{                                                                              \
43
2.11M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
2.11M
        *outl = dgstsize;                                                      \
45
2.11M
        return 1;                                                              \
46
2.11M
    }                                                                          \
47
2.11M
    return 0;                                                                  \
48
2.11M
}
sha2_prov.c:sha1_internal_final
Line
Count
Source
41
1.29M
                                 size_t outsz)                                 \
42
1.29M
{                                                                              \
43
1.29M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.29M
        *outl = dgstsize;                                                      \
45
1.29M
        return 1;                                                              \
46
1.29M
    }                                                                          \
47
1.29M
    return 0;                                                                  \
48
1.29M
}
sha2_prov.c:sha224_internal_final
Line
Count
Source
41
229k
                                 size_t outsz)                                 \
42
229k
{                                                                              \
43
229k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
229k
        *outl = dgstsize;                                                      \
45
229k
        return 1;                                                              \
46
229k
    }                                                                          \
47
229k
    return 0;                                                                  \
48
229k
}
sha2_prov.c:sha256_internal_final
Line
Count
Source
41
518M
                                 size_t outsz)                                 \
42
518M
{                                                                              \
43
518M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
518M
        *outl = dgstsize;                                                      \
45
518M
        return 1;                                                              \
46
518M
    }                                                                          \
47
518M
    return 0;                                                                  \
48
518M
}
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_final
sha2_prov.c:sha384_internal_final
Line
Count
Source
41
1.97M
                                 size_t outsz)                                 \
42
1.97M
{                                                                              \
43
1.97M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.97M
        *outl = dgstsize;                                                      \
45
1.97M
        return 1;                                                              \
46
1.97M
    }                                                                          \
47
1.97M
    return 0;                                                                  \
48
1.97M
}
sha2_prov.c:sha512_internal_final
Line
Count
Source
41
29.7M
                                 size_t outsz)                                 \
42
29.7M
{                                                                              \
43
29.7M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
29.7M
        *outl = dgstsize;                                                      \
45
29.7M
        return 1;                                                              \
46
29.7M
    }                                                                          \
47
29.7M
    return 0;                                                                  \
48
29.7M
}
sha2_prov.c:sha512_224_internal_final
Line
Count
Source
41
118k
                                 size_t outsz)                                 \
42
118k
{                                                                              \
43
118k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
118k
        *outl = dgstsize;                                                      \
45
118k
        return 1;                                                              \
46
118k
    }                                                                          \
47
118k
    return 0;                                                                  \
48
118k
}
sha2_prov.c:sha512_256_internal_final
Line
Count
Source
41
62.7k
                                 size_t outsz)                                 \
42
62.7k
{                                                                              \
43
62.7k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
62.7k
        *outl = dgstsize;                                                      \
45
62.7k
        return 1;                                                              \
46
62.7k
    }                                                                          \
47
62.7k
    return 0;                                                                  \
48
62.7k
}
sm3_prov.c:sm3_internal_final
Line
Count
Source
41
3.59k
                                 size_t outsz)                                 \
42
3.59k
{                                                                              \
43
3.59k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
3.59k
        *outl = dgstsize;                                                      \
45
3.59k
        return 1;                                                              \
46
3.59k
    }                                                                          \
47
3.59k
    return 0;                                                                  \
48
3.59k
}
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
3.98M
static void *name##_newctx(void *prov_ctx)                                     \
56
3.98M
{                                                                              \
57
3.98M
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
3.98M
    return ctx;                                                                \
59
3.98M
}                                                                              \
blake2_prov.c:blake2s256_newctx
Line
Count
Source
55
837
static void *name##_newctx(void *prov_ctx)                                     \
56
837
{                                                                              \
57
837
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
837
    return ctx;                                                                \
59
837
}                                                                              \
md5_prov.c:md5_newctx
Line
Count
Source
55
97.9k
static void *name##_newctx(void *prov_ctx)                                     \
56
97.9k
{                                                                              \
57
97.9k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
97.9k
    return ctx;                                                                \
59
97.9k
}                                                                              \
md5_sha1_prov.c:md5_sha1_newctx
Line
Count
Source
55
13.6k
static void *name##_newctx(void *prov_ctx)                                     \
56
13.6k
{                                                                              \
57
13.6k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
13.6k
    return ctx;                                                                \
59
13.6k
}                                                                              \
null_prov.c:nullmd_newctx
Line
Count
Source
55
16
static void *name##_newctx(void *prov_ctx)                                     \
56
16
{                                                                              \
57
16
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
16
    return ctx;                                                                \
59
16
}                                                                              \
ripemd_prov.c:ripemd160_newctx
Line
Count
Source
55
274k
static void *name##_newctx(void *prov_ctx)                                     \
56
274k
{                                                                              \
57
274k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
274k
    return ctx;                                                                \
59
274k
}                                                                              \
sha2_prov.c:sha1_newctx
Line
Count
Source
55
643k
static void *name##_newctx(void *prov_ctx)                                     \
56
643k
{                                                                              \
57
643k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
643k
    return ctx;                                                                \
59
643k
}                                                                              \
sha2_prov.c:sha224_newctx
Line
Count
Source
55
23.3k
static void *name##_newctx(void *prov_ctx)                                     \
56
23.3k
{                                                                              \
57
23.3k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
23.3k
    return ctx;                                                                \
59
23.3k
}                                                                              \
sha2_prov.c:sha256_newctx
Line
Count
Source
55
1.27M
static void *name##_newctx(void *prov_ctx)                                     \
56
1.27M
{                                                                              \
57
1.27M
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
1.27M
    return ctx;                                                                \
59
1.27M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_newctx
sha2_prov.c:sha384_newctx
Line
Count
Source
55
1.53M
static void *name##_newctx(void *prov_ctx)                                     \
56
1.53M
{                                                                              \
57
1.53M
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
1.53M
    return ctx;                                                                \
59
1.53M
}                                                                              \
sha2_prov.c:sha512_newctx
Line
Count
Source
55
94.9k
static void *name##_newctx(void *prov_ctx)                                     \
56
94.9k
{                                                                              \
57
94.9k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
94.9k
    return ctx;                                                                \
59
94.9k
}                                                                              \
sha2_prov.c:sha512_224_newctx
Line
Count
Source
55
5.29k
static void *name##_newctx(void *prov_ctx)                                     \
56
5.29k
{                                                                              \
57
5.29k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
5.29k
    return ctx;                                                                \
59
5.29k
}                                                                              \
sha2_prov.c:sha512_256_newctx
Line
Count
Source
55
10.9k
static void *name##_newctx(void *prov_ctx)                                     \
56
10.9k
{                                                                              \
57
10.9k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
10.9k
    return ctx;                                                                \
59
10.9k
}                                                                              \
sm3_prov.c:sm3_newctx
Line
Count
Source
55
1.40k
static void *name##_newctx(void *prov_ctx)                                     \
56
1.40k
{                                                                              \
57
1.40k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
1.40k
    return ctx;                                                                \
59
1.40k
}                                                                              \
60
10.1M
static void name##_freectx(void *vctx)                                         \
61
10.1M
{                                                                              \
62
10.1M
    CTX *ctx = (CTX *)vctx;                                                    \
63
10.1M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
10.1M
}                                                                              \
blake2_prov.c:blake2s256_freectx
Line
Count
Source
60
1.82k
static void name##_freectx(void *vctx)                                         \
61
1.82k
{                                                                              \
62
1.82k
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.82k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.82k
}                                                                              \
md5_prov.c:md5_freectx
Line
Count
Source
60
1.38M
static void name##_freectx(void *vctx)                                         \
61
1.38M
{                                                                              \
62
1.38M
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.38M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.38M
}                                                                              \
md5_sha1_prov.c:md5_sha1_freectx
Line
Count
Source
60
21.6k
static void name##_freectx(void *vctx)                                         \
61
21.6k
{                                                                              \
62
21.6k
    CTX *ctx = (CTX *)vctx;                                                    \
63
21.6k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
21.6k
}                                                                              \
null_prov.c:nullmd_freectx
Line
Count
Source
60
18
static void name##_freectx(void *vctx)                                         \
61
18
{                                                                              \
62
18
    CTX *ctx = (CTX *)vctx;                                                    \
63
18
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
18
}                                                                              \
ripemd_prov.c:ripemd160_freectx
Line
Count
Source
60
275k
static void name##_freectx(void *vctx)                                         \
61
275k
{                                                                              \
62
275k
    CTX *ctx = (CTX *)vctx;                                                    \
63
275k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
275k
}                                                                              \
sha2_prov.c:sha1_freectx
Line
Count
Source
60
1.97M
static void name##_freectx(void *vctx)                                         \
61
1.97M
{                                                                              \
62
1.97M
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.97M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.97M
}                                                                              \
sha2_prov.c:sha224_freectx
Line
Count
Source
60
24.7k
static void name##_freectx(void *vctx)                                         \
61
24.7k
{                                                                              \
62
24.7k
    CTX *ctx = (CTX *)vctx;                                                    \
63
24.7k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
24.7k
}                                                                              \
sha2_prov.c:sha256_freectx
Line
Count
Source
60
3.49M
static void name##_freectx(void *vctx)                                         \
61
3.49M
{                                                                              \
62
3.49M
    CTX *ctx = (CTX *)vctx;                                                    \
63
3.49M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
3.49M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_freectx
sha2_prov.c:sha384_freectx
Line
Count
Source
60
2.89M
static void name##_freectx(void *vctx)                                         \
61
2.89M
{                                                                              \
62
2.89M
    CTX *ctx = (CTX *)vctx;                                                    \
63
2.89M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
2.89M
}                                                                              \
sha2_prov.c:sha512_freectx
Line
Count
Source
60
96.6k
static void name##_freectx(void *vctx)                                         \
61
96.6k
{                                                                              \
62
96.6k
    CTX *ctx = (CTX *)vctx;                                                    \
63
96.6k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
96.6k
}                                                                              \
sha2_prov.c:sha512_224_freectx
Line
Count
Source
60
5.68k
static void name##_freectx(void *vctx)                                         \
61
5.68k
{                                                                              \
62
5.68k
    CTX *ctx = (CTX *)vctx;                                                    \
63
5.68k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
5.68k
}                                                                              \
sha2_prov.c:sha512_256_freectx
Line
Count
Source
60
11.0k
static void name##_freectx(void *vctx)                                         \
61
11.0k
{                                                                              \
62
11.0k
    CTX *ctx = (CTX *)vctx;                                                    \
63
11.0k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
11.0k
}                                                                              \
sm3_prov.c:sm3_freectx
Line
Count
Source
60
2.42k
static void name##_freectx(void *vctx)                                         \
61
2.42k
{                                                                              \
62
2.42k
    CTX *ctx = (CTX *)vctx;                                                    \
63
2.42k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
2.42k
}                                                                              \
65
6.20M
static void *name##_dupctx(void *ctx)                                          \
66
6.20M
{                                                                              \
67
6.20M
    CTX *in = (CTX *)ctx;                                                      \
68
6.20M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
6.20M
    if (ret != NULL)                                                           \
70
6.20M
        *ret = *in;                                                            \
71
6.20M
    return ret;                                                                \
72
6.20M
}                                                                              \
blake2_prov.c:blake2s256_dupctx
Line
Count
Source
65
990
static void *name##_dupctx(void *ctx)                                          \
66
990
{                                                                              \
67
990
    CTX *in = (CTX *)ctx;                                                      \
68
990
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
990
    if (ret != NULL)                                                           \
70
990
        *ret = *in;                                                            \
71
990
    return ret;                                                                \
72
990
}                                                                              \
md5_prov.c:md5_dupctx
Line
Count
Source
65
1.28M
static void *name##_dupctx(void *ctx)                                          \
66
1.28M
{                                                                              \
67
1.28M
    CTX *in = (CTX *)ctx;                                                      \
68
1.28M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.28M
    if (ret != NULL)                                                           \
70
1.28M
        *ret = *in;                                                            \
71
1.28M
    return ret;                                                                \
72
1.28M
}                                                                              \
md5_sha1_prov.c:md5_sha1_dupctx
Line
Count
Source
65
7.95k
static void *name##_dupctx(void *ctx)                                          \
66
7.95k
{                                                                              \
67
7.95k
    CTX *in = (CTX *)ctx;                                                      \
68
7.95k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
7.95k
    if (ret != NULL)                                                           \
70
7.95k
        *ret = *in;                                                            \
71
7.95k
    return ret;                                                                \
72
7.95k
}                                                                              \
null_prov.c:nullmd_dupctx
Line
Count
Source
65
2
static void *name##_dupctx(void *ctx)                                          \
66
2
{                                                                              \
67
2
    CTX *in = (CTX *)ctx;                                                      \
68
2
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
2
    if (ret != NULL)                                                           \
70
2
        *ret = *in;                                                            \
71
2
    return ret;                                                                \
72
2
}                                                                              \
ripemd_prov.c:ripemd160_dupctx
Line
Count
Source
65
1.23k
static void *name##_dupctx(void *ctx)                                          \
66
1.23k
{                                                                              \
67
1.23k
    CTX *in = (CTX *)ctx;                                                      \
68
1.23k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.23k
    if (ret != NULL)                                                           \
70
1.23k
        *ret = *in;                                                            \
71
1.23k
    return ret;                                                                \
72
1.23k
}                                                                              \
sha2_prov.c:sha1_dupctx
Line
Count
Source
65
1.32M
static void *name##_dupctx(void *ctx)                                          \
66
1.32M
{                                                                              \
67
1.32M
    CTX *in = (CTX *)ctx;                                                      \
68
1.32M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.32M
    if (ret != NULL)                                                           \
70
1.32M
        *ret = *in;                                                            \
71
1.32M
    return ret;                                                                \
72
1.32M
}                                                                              \
sha2_prov.c:sha224_dupctx
Line
Count
Source
65
1.40k
static void *name##_dupctx(void *ctx)                                          \
66
1.40k
{                                                                              \
67
1.40k
    CTX *in = (CTX *)ctx;                                                      \
68
1.40k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.40k
    if (ret != NULL)                                                           \
70
1.40k
        *ret = *in;                                                            \
71
1.40k
    return ret;                                                                \
72
1.40k
}                                                                              \
sha2_prov.c:sha256_dupctx
Line
Count
Source
65
2.21M
static void *name##_dupctx(void *ctx)                                          \
66
2.21M
{                                                                              \
67
2.21M
    CTX *in = (CTX *)ctx;                                                      \
68
2.21M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
2.21M
    if (ret != NULL)                                                           \
70
2.21M
        *ret = *in;                                                            \
71
2.21M
    return ret;                                                                \
72
2.21M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_dupctx
sha2_prov.c:sha384_dupctx
Line
Count
Source
65
1.36M
static void *name##_dupctx(void *ctx)                                          \
66
1.36M
{                                                                              \
67
1.36M
    CTX *in = (CTX *)ctx;                                                      \
68
1.36M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.36M
    if (ret != NULL)                                                           \
70
1.36M
        *ret = *in;                                                            \
71
1.36M
    return ret;                                                                \
72
1.36M
}                                                                              \
sha2_prov.c:sha512_dupctx
Line
Count
Source
65
1.72k
static void *name##_dupctx(void *ctx)                                          \
66
1.72k
{                                                                              \
67
1.72k
    CTX *in = (CTX *)ctx;                                                      \
68
1.72k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.72k
    if (ret != NULL)                                                           \
70
1.72k
        *ret = *in;                                                            \
71
1.72k
    return ret;                                                                \
72
1.72k
}                                                                              \
sha2_prov.c:sha512_224_dupctx
Line
Count
Source
65
388
static void *name##_dupctx(void *ctx)                                          \
66
388
{                                                                              \
67
388
    CTX *in = (CTX *)ctx;                                                      \
68
388
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
388
    if (ret != NULL)                                                           \
70
388
        *ret = *in;                                                            \
71
388
    return ret;                                                                \
72
388
}                                                                              \
sha2_prov.c:sha512_256_dupctx
Line
Count
Source
65
166
static void *name##_dupctx(void *ctx)                                          \
66
166
{                                                                              \
67
166
    CTX *in = (CTX *)ctx;                                                      \
68
166
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
166
    if (ret != NULL)                                                           \
70
166
        *ret = *in;                                                            \
71
166
    return ret;                                                                \
72
166
}                                                                              \
sm3_prov.c:sm3_dupctx
Line
Count
Source
65
1.02k
static void *name##_dupctx(void *ctx)                                          \
66
1.02k
{                                                                              \
67
1.02k
    CTX *in = (CTX *)ctx;                                                      \
68
1.02k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.02k
    if (ret != NULL)                                                           \
70
1.02k
        *ret = *in;                                                            \
71
1.02k
    return ret;                                                                \
72
1.02k
}                                                                              \
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
552M
                                ossl_unused const OSSL_PARAM params[])         \
92
552M
{                                                                              \
93
552M
    return ossl_prov_is_running() && init(ctx);                                \
94
552M
}                                                                              \
md5_prov.c:md5_internal_init
Line
Count
Source
91
107k
                                ossl_unused const OSSL_PARAM params[])         \
92
107k
{                                                                              \
93
107k
    return ossl_prov_is_running() && init(ctx);                                \
94
107k
}                                                                              \
null_prov.c:nullmd_internal_init
Line
Count
Source
91
36
                                ossl_unused const OSSL_PARAM params[])         \
92
36
{                                                                              \
93
36
    return ossl_prov_is_running() && init(ctx);                                \
94
36
}                                                                              \
ripemd_prov.c:ripemd160_internal_init
Line
Count
Source
91
2.11M
                                ossl_unused const OSSL_PARAM params[])         \
92
2.11M
{                                                                              \
93
2.11M
    return ossl_prov_is_running() && init(ctx);                                \
94
2.11M
}                                                                              \
sha2_prov.c:sha224_internal_init
Line
Count
Source
91
231k
                                ossl_unused const OSSL_PARAM params[])         \
92
231k
{                                                                              \
93
231k
    return ossl_prov_is_running() && init(ctx);                                \
94
231k
}                                                                              \
sha2_prov.c:sha256_internal_init
Line
Count
Source
91
518M
                                ossl_unused const OSSL_PARAM params[])         \
92
518M
{                                                                              \
93
518M
    return ossl_prov_is_running() && init(ctx);                                \
94
518M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_init
sha2_prov.c:sha384_internal_init
Line
Count
Source
91
1.86M
                                ossl_unused const OSSL_PARAM params[])         \
92
1.86M
{                                                                              \
93
1.86M
    return ossl_prov_is_running() && init(ctx);                                \
94
1.86M
}                                                                              \
sha2_prov.c:sha512_internal_init
Line
Count
Source
91
29.7M
                                ossl_unused const OSSL_PARAM params[])         \
92
29.7M
{                                                                              \
93
29.7M
    return ossl_prov_is_running() && init(ctx);                                \
94
29.7M
}                                                                              \
sha2_prov.c:sha512_224_internal_init
Line
Count
Source
91
118k
                                ossl_unused const OSSL_PARAM params[])         \
92
118k
{                                                                              \
93
118k
    return ossl_prov_is_running() && init(ctx);                                \
94
118k
}                                                                              \
sha2_prov.c:sha512_256_internal_init
Line
Count
Source
91
62.7k
                                ossl_unused const OSSL_PARAM params[])         \
92
62.7k
{                                                                              \
93
62.7k
    return ossl_prov_is_running() && init(ctx);                                \
94
62.7k
}                                                                              \
sm3_prov.c:sm3_internal_init
Line
Count
Source
91
3.71k
                                ossl_unused const OSSL_PARAM params[])         \
92
3.71k
{                                                                              \
93
3.71k
    return ossl_prov_is_running() && init(ctx);                                \
94
3.71k
}                                                                              \
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.04M
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
1.04M
{                                                                              \
106
1.04M
    return ossl_prov_is_running()                                              \
107
1.04M
           && init(ctx)                                                        \
108
1.04M
           && set_ctx_params(ctx, params);                                     \
109
1.04M
}                                                                              \
md5_sha1_prov.c:md5_sha1_internal_init
Line
Count
Source
104
17.3k
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
17.3k
{                                                                              \
106
17.3k
    return ossl_prov_is_running()                                              \
107
17.3k
           && init(ctx)                                                        \
108
17.3k
           && set_ctx_params(ctx, params);                                     \
109
17.3k
}                                                                              \
sha2_prov.c:sha1_internal_init
Line
Count
Source
104
1.02M
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
1.02M
{                                                                              \
106
1.02M
    return ossl_prov_is_running()                                              \
107
1.02M
           && init(ctx)                                                        \
108
1.02M
           && set_ctx_params(ctx, params);                                     \
109
1.02M
}                                                                              \
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 */