Coverage Report

Created: 2025-08-11 07:04

/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
436M
                                 size_t outsz)                                 \
42
436M
{                                                                              \
43
436M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
436M
        *outl = dgstsize;                                                      \
45
436M
        return 1;                                                              \
46
436M
    }                                                                          \
47
436M
    return 0;                                                                  \
48
436M
}
md5_prov.c:md5_internal_final
Line
Count
Source
41
522k
                                 size_t outsz)                                 \
42
522k
{                                                                              \
43
522k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
522k
        *outl = dgstsize;                                                      \
45
522k
        return 1;                                                              \
46
522k
    }                                                                          \
47
522k
    return 0;                                                                  \
48
522k
}
md5_sha1_prov.c:md5_sha1_internal_final
Line
Count
Source
41
12.4k
                                 size_t outsz)                                 \
42
12.4k
{                                                                              \
43
12.4k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
12.4k
        *outl = dgstsize;                                                      \
45
12.4k
        return 1;                                                              \
46
12.4k
    }                                                                          \
47
12.4k
    return 0;                                                                  \
48
12.4k
}
ripemd_prov.c:ripemd160_internal_final
Line
Count
Source
41
1.40M
                                 size_t outsz)                                 \
42
1.40M
{                                                                              \
43
1.40M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.40M
        *outl = dgstsize;                                                      \
45
1.40M
        return 1;                                                              \
46
1.40M
    }                                                                          \
47
1.40M
    return 0;                                                                  \
48
1.40M
}
sha2_prov.c:sha1_internal_final
Line
Count
Source
41
1.25M
                                 size_t outsz)                                 \
42
1.25M
{                                                                              \
43
1.25M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.25M
        *outl = dgstsize;                                                      \
45
1.25M
        return 1;                                                              \
46
1.25M
    }                                                                          \
47
1.25M
    return 0;                                                                  \
48
1.25M
}
sha2_prov.c:sha224_internal_final
Line
Count
Source
41
292k
                                 size_t outsz)                                 \
42
292k
{                                                                              \
43
292k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
292k
        *outl = dgstsize;                                                      \
45
292k
        return 1;                                                              \
46
292k
    }                                                                          \
47
292k
    return 0;                                                                  \
48
292k
}
sha2_prov.c:sha256_internal_final
Line
Count
Source
41
410M
                                 size_t outsz)                                 \
42
410M
{                                                                              \
43
410M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
410M
        *outl = dgstsize;                                                      \
45
410M
        return 1;                                                              \
46
410M
    }                                                                          \
47
410M
    return 0;                                                                  \
48
410M
}
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_final
sha2_prov.c:sha384_internal_final
Line
Count
Source
41
1.93M
                                 size_t outsz)                                 \
42
1.93M
{                                                                              \
43
1.93M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.93M
        *outl = dgstsize;                                                      \
45
1.93M
        return 1;                                                              \
46
1.93M
    }                                                                          \
47
1.93M
    return 0;                                                                  \
48
1.93M
}
sha2_prov.c:sha512_internal_final
Line
Count
Source
41
20.1M
                                 size_t outsz)                                 \
42
20.1M
{                                                                              \
43
20.1M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
20.1M
        *outl = dgstsize;                                                      \
45
20.1M
        return 1;                                                              \
46
20.1M
    }                                                                          \
47
20.1M
    return 0;                                                                  \
48
20.1M
}
sha2_prov.c:sha512_224_internal_final
Line
Count
Source
41
164k
                                 size_t outsz)                                 \
42
164k
{                                                                              \
43
164k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
164k
        *outl = dgstsize;                                                      \
45
164k
        return 1;                                                              \
46
164k
    }                                                                          \
47
164k
    return 0;                                                                  \
48
164k
}
sha2_prov.c:sha512_256_internal_final
Line
Count
Source
41
63.2k
                                 size_t outsz)                                 \
42
63.2k
{                                                                              \
43
63.2k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
63.2k
        *outl = dgstsize;                                                      \
45
63.2k
        return 1;                                                              \
46
63.2k
    }                                                                          \
47
63.2k
    return 0;                                                                  \
48
63.2k
}
sm3_prov.c:sm3_internal_final
Line
Count
Source
41
3.36k
                                 size_t outsz)                                 \
42
3.36k
{                                                                              \
43
3.36k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
3.36k
        *outl = dgstsize;                                                      \
45
3.36k
        return 1;                                                              \
46
3.36k
    }                                                                          \
47
3.36k
    return 0;                                                                  \
48
3.36k
}
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.80M
static void *name##_newctx(void *prov_ctx)                                     \
56
3.80M
{                                                                              \
57
3.80M
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
3.80M
    return ctx;                                                                \
59
3.80M
}                                                                              \
blake2_prov.c:blake2s256_newctx
Line
Count
Source
55
651
static void *name##_newctx(void *prov_ctx)                                     \
56
651
{                                                                              \
57
651
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
651
    return ctx;                                                                \
59
651
}                                                                              \
md5_prov.c:md5_newctx
Line
Count
Source
55
94.6k
static void *name##_newctx(void *prov_ctx)                                     \
56
94.6k
{                                                                              \
57
94.6k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
94.6k
    return ctx;                                                                \
59
94.6k
}                                                                              \
md5_sha1_prov.c:md5_sha1_newctx
Line
Count
Source
55
13.9k
static void *name##_newctx(void *prov_ctx)                                     \
56
13.9k
{                                                                              \
57
13.9k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
13.9k
    return ctx;                                                                \
59
13.9k
}                                                                              \
null_prov.c:nullmd_newctx
Line
Count
Source
55
18
static void *name##_newctx(void *prov_ctx)                                     \
56
18
{                                                                              \
57
18
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
18
    return ctx;                                                                \
59
18
}                                                                              \
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
590k
static void *name##_newctx(void *prov_ctx)                                     \
56
590k
{                                                                              \
57
590k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
590k
    return ctx;                                                                \
59
590k
}                                                                              \
sha2_prov.c:sha224_newctx
Line
Count
Source
55
22.6k
static void *name##_newctx(void *prov_ctx)                                     \
56
22.6k
{                                                                              \
57
22.6k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
22.6k
    return ctx;                                                                \
59
22.6k
}                                                                              \
sha2_prov.c:sha256_newctx
Line
Count
Source
55
1.21M
static void *name##_newctx(void *prov_ctx)                                     \
56
1.21M
{                                                                              \
57
1.21M
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
1.21M
    return ctx;                                                                \
59
1.21M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_newctx
sha2_prov.c:sha384_newctx
Line
Count
Source
55
1.49M
static void *name##_newctx(void *prov_ctx)                                     \
56
1.49M
{                                                                              \
57
1.49M
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
1.49M
    return ctx;                                                                \
59
1.49M
}                                                                              \
sha2_prov.c:sha512_newctx
Line
Count
Source
55
80.0k
static void *name##_newctx(void *prov_ctx)                                     \
56
80.0k
{                                                                              \
57
80.0k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
80.0k
    return ctx;                                                                \
59
80.0k
}                                                                              \
sha2_prov.c:sha512_224_newctx
Line
Count
Source
55
5.28k
static void *name##_newctx(void *prov_ctx)                                     \
56
5.28k
{                                                                              \
57
5.28k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
5.28k
    return ctx;                                                                \
59
5.28k
}                                                                              \
sha2_prov.c:sha512_256_newctx
Line
Count
Source
55
11.0k
static void *name##_newctx(void *prov_ctx)                                     \
56
11.0k
{                                                                              \
57
11.0k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
11.0k
    return ctx;                                                                \
59
11.0k
}                                                                              \
sm3_prov.c:sm3_newctx
Line
Count
Source
55
1.22k
static void *name##_newctx(void *prov_ctx)                                     \
56
1.22k
{                                                                              \
57
1.22k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
1.22k
    return ctx;                                                                \
59
1.22k
}                                                                              \
60
9.56M
static void name##_freectx(void *vctx)                                         \
61
9.56M
{                                                                              \
62
9.56M
    CTX *ctx = (CTX *)vctx;                                                    \
63
9.56M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
9.56M
}                                                                              \
blake2_prov.c:blake2s256_freectx
Line
Count
Source
60
1.58k
static void name##_freectx(void *vctx)                                         \
61
1.58k
{                                                                              \
62
1.58k
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.58k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.58k
}                                                                              \
md5_prov.c:md5_freectx
Line
Count
Source
60
1.27M
static void name##_freectx(void *vctx)                                         \
61
1.27M
{                                                                              \
62
1.27M
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.27M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.27M
}                                                                              \
md5_sha1_prov.c:md5_sha1_freectx
Line
Count
Source
60
22.0k
static void name##_freectx(void *vctx)                                         \
61
22.0k
{                                                                              \
62
22.0k
    CTX *ctx = (CTX *)vctx;                                                    \
63
22.0k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
22.0k
}                                                                              \
null_prov.c:nullmd_freectx
Line
Count
Source
60
21
static void name##_freectx(void *vctx)                                         \
61
21
{                                                                              \
62
21
    CTX *ctx = (CTX *)vctx;                                                    \
63
21
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
21
}                                                                              \
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.82M
static void name##_freectx(void *vctx)                                         \
61
1.82M
{                                                                              \
62
1.82M
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.82M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.82M
}                                                                              \
sha2_prov.c:sha224_freectx
Line
Count
Source
60
23.9k
static void name##_freectx(void *vctx)                                         \
61
23.9k
{                                                                              \
62
23.9k
    CTX *ctx = (CTX *)vctx;                                                    \
63
23.9k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
23.9k
}                                                                              \
sha2_prov.c:sha256_freectx
Line
Count
Source
60
3.20M
static void name##_freectx(void *vctx)                                         \
61
3.20M
{                                                                              \
62
3.20M
    CTX *ctx = (CTX *)vctx;                                                    \
63
3.20M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
3.20M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_freectx
sha2_prov.c:sha384_freectx
Line
Count
Source
60
2.82M
static void name##_freectx(void *vctx)                                         \
61
2.82M
{                                                                              \
62
2.82M
    CTX *ctx = (CTX *)vctx;                                                    \
63
2.82M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
2.82M
}                                                                              \
sha2_prov.c:sha512_freectx
Line
Count
Source
60
81.6k
static void name##_freectx(void *vctx)                                         \
61
81.6k
{                                                                              \
62
81.6k
    CTX *ctx = (CTX *)vctx;                                                    \
63
81.6k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
81.6k
}                                                                              \
sha2_prov.c:sha512_224_freectx
Line
Count
Source
60
5.64k
static void name##_freectx(void *vctx)                                         \
61
5.64k
{                                                                              \
62
5.64k
    CTX *ctx = (CTX *)vctx;                                                    \
63
5.64k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
5.64k
}                                                                              \
sha2_prov.c:sha512_256_freectx
Line
Count
Source
60
11.1k
static void name##_freectx(void *vctx)                                         \
61
11.1k
{                                                                              \
62
11.1k
    CTX *ctx = (CTX *)vctx;                                                    \
63
11.1k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
11.1k
}                                                                              \
sm3_prov.c:sm3_freectx
Line
Count
Source
60
2.17k
static void name##_freectx(void *vctx)                                         \
61
2.17k
{                                                                              \
62
2.17k
    CTX *ctx = (CTX *)vctx;                                                    \
63
2.17k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
2.17k
}                                                                              \
65
5.75M
static void *name##_dupctx(void *ctx)                                          \
66
5.75M
{                                                                              \
67
5.75M
    CTX *in = (CTX *)ctx;                                                      \
68
5.75M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
5.75M
    if (ret != NULL)                                                           \
70
5.75M
        *ret = *in;                                                            \
71
5.75M
    return ret;                                                                \
72
5.75M
}                                                                              \
blake2_prov.c:blake2s256_dupctx
Line
Count
Source
65
935
static void *name##_dupctx(void *ctx)                                          \
66
935
{                                                                              \
67
935
    CTX *in = (CTX *)ctx;                                                      \
68
935
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
935
    if (ret != NULL)                                                           \
70
935
        *ret = *in;                                                            \
71
935
    return ret;                                                                \
72
935
}                                                                              \
md5_prov.c:md5_dupctx
Line
Count
Source
65
1.17M
static void *name##_dupctx(void *ctx)                                          \
66
1.17M
{                                                                              \
67
1.17M
    CTX *in = (CTX *)ctx;                                                      \
68
1.17M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.17M
    if (ret != NULL)                                                           \
70
1.17M
        *ret = *in;                                                            \
71
1.17M
    return ret;                                                                \
72
1.17M
}                                                                              \
md5_sha1_prov.c:md5_sha1_dupctx
Line
Count
Source
65
8.14k
static void *name##_dupctx(void *ctx)                                          \
66
8.14k
{                                                                              \
67
8.14k
    CTX *in = (CTX *)ctx;                                                      \
68
8.14k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
8.14k
    if (ret != NULL)                                                           \
70
8.14k
        *ret = *in;                                                            \
71
8.14k
    return ret;                                                                \
72
8.14k
}                                                                              \
null_prov.c:nullmd_dupctx
Line
Count
Source
65
3
static void *name##_dupctx(void *ctx)                                          \
66
3
{                                                                              \
67
3
    CTX *in = (CTX *)ctx;                                                      \
68
3
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
3
    if (ret != NULL)                                                           \
70
3
        *ret = *in;                                                            \
71
3
    return ret;                                                                \
72
3
}                                                                              \
ripemd_prov.c:ripemd160_dupctx
Line
Count
Source
65
1.10k
static void *name##_dupctx(void *ctx)                                          \
66
1.10k
{                                                                              \
67
1.10k
    CTX *in = (CTX *)ctx;                                                      \
68
1.10k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.10k
    if (ret != NULL)                                                           \
70
1.10k
        *ret = *in;                                                            \
71
1.10k
    return ret;                                                                \
72
1.10k
}                                                                              \
sha2_prov.c:sha1_dupctx
Line
Count
Source
65
1.23M
static void *name##_dupctx(void *ctx)                                          \
66
1.23M
{                                                                              \
67
1.23M
    CTX *in = (CTX *)ctx;                                                      \
68
1.23M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.23M
    if (ret != NULL)                                                           \
70
1.23M
        *ret = *in;                                                            \
71
1.23M
    return ret;                                                                \
72
1.23M
}                                                                              \
sha2_prov.c:sha224_dupctx
Line
Count
Source
65
1.32k
static void *name##_dupctx(void *ctx)                                          \
66
1.32k
{                                                                              \
67
1.32k
    CTX *in = (CTX *)ctx;                                                      \
68
1.32k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.32k
    if (ret != NULL)                                                           \
70
1.32k
        *ret = *in;                                                            \
71
1.32k
    return ret;                                                                \
72
1.32k
}                                                                              \
sha2_prov.c:sha256_dupctx
Line
Count
Source
65
1.99M
static void *name##_dupctx(void *ctx)                                          \
66
1.99M
{                                                                              \
67
1.99M
    CTX *in = (CTX *)ctx;                                                      \
68
1.99M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.99M
    if (ret != NULL)                                                           \
70
1.99M
        *ret = *in;                                                            \
71
1.99M
    return ret;                                                                \
72
1.99M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_dupctx
sha2_prov.c:sha384_dupctx
Line
Count
Source
65
1.33M
static void *name##_dupctx(void *ctx)                                          \
66
1.33M
{                                                                              \
67
1.33M
    CTX *in = (CTX *)ctx;                                                      \
68
1.33M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.33M
    if (ret != NULL)                                                           \
70
1.33M
        *ret = *in;                                                            \
71
1.33M
    return ret;                                                                \
72
1.33M
}                                                                              \
sha2_prov.c:sha512_dupctx
Line
Count
Source
65
1.67k
static void *name##_dupctx(void *ctx)                                          \
66
1.67k
{                                                                              \
67
1.67k
    CTX *in = (CTX *)ctx;                                                      \
68
1.67k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
1.67k
    if (ret != NULL)                                                           \
70
1.67k
        *ret = *in;                                                            \
71
1.67k
    return ret;                                                                \
72
1.67k
}                                                                              \
sha2_prov.c:sha512_224_dupctx
Line
Count
Source
65
354
static void *name##_dupctx(void *ctx)                                          \
66
354
{                                                                              \
67
354
    CTX *in = (CTX *)ctx;                                                      \
68
354
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
354
    if (ret != NULL)                                                           \
70
354
        *ret = *in;                                                            \
71
354
    return ret;                                                                \
72
354
}                                                                              \
sha2_prov.c:sha512_256_dupctx
Line
Count
Source
65
142
static void *name##_dupctx(void *ctx)                                          \
66
142
{                                                                              \
67
142
    CTX *in = (CTX *)ctx;                                                      \
68
142
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
142
    if (ret != NULL)                                                           \
70
142
        *ret = *in;                                                            \
71
142
    return ret;                                                                \
72
142
}                                                                              \
sm3_prov.c:sm3_dupctx
Line
Count
Source
65
947
static void *name##_dupctx(void *ctx)                                          \
66
947
{                                                                              \
67
947
    CTX *in = (CTX *)ctx;                                                      \
68
947
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
947
    if (ret != NULL)                                                           \
70
947
        *ret = *in;                                                            \
71
947
    return ret;                                                                \
72
947
}                                                                              \
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
434M
                                ossl_unused const OSSL_PARAM params[])         \
92
434M
{                                                                              \
93
434M
    return ossl_prov_is_running() && init(ctx);                                \
94
434M
}                                                                              \
md5_prov.c:md5_internal_init
Line
Count
Source
91
103k
                                ossl_unused const OSSL_PARAM params[])         \
92
103k
{                                                                              \
93
103k
    return ossl_prov_is_running() && init(ctx);                                \
94
103k
}                                                                              \
null_prov.c:nullmd_internal_init
Line
Count
Source
91
43
                                ossl_unused const OSSL_PARAM params[])         \
92
43
{                                                                              \
93
43
    return ossl_prov_is_running() && init(ctx);                                \
94
43
}                                                                              \
ripemd_prov.c:ripemd160_internal_init
Line
Count
Source
91
1.40M
                                ossl_unused const OSSL_PARAM params[])         \
92
1.40M
{                                                                              \
93
1.40M
    return ossl_prov_is_running() && init(ctx);                                \
94
1.40M
}                                                                              \
sha2_prov.c:sha224_internal_init
Line
Count
Source
91
294k
                                ossl_unused const OSSL_PARAM params[])         \
92
294k
{                                                                              \
93
294k
    return ossl_prov_is_running() && init(ctx);                                \
94
294k
}                                                                              \
sha2_prov.c:sha256_internal_init
Line
Count
Source
91
410M
                                ossl_unused const OSSL_PARAM params[])         \
92
410M
{                                                                              \
93
410M
    return ossl_prov_is_running() && init(ctx);                                \
94
410M
}                                                                              \
Unexecuted instantiation: sha2_prov.c:sha256_192_internal_init
sha2_prov.c:sha384_internal_init
Line
Count
Source
91
1.83M
                                ossl_unused const OSSL_PARAM params[])         \
92
1.83M
{                                                                              \
93
1.83M
    return ossl_prov_is_running() && init(ctx);                                \
94
1.83M
}                                                                              \
sha2_prov.c:sha512_internal_init
Line
Count
Source
91
20.1M
                                ossl_unused const OSSL_PARAM params[])         \
92
20.1M
{                                                                              \
93
20.1M
    return ossl_prov_is_running() && init(ctx);                                \
94
20.1M
}                                                                              \
sha2_prov.c:sha512_224_internal_init
Line
Count
Source
91
164k
                                ossl_unused const OSSL_PARAM params[])         \
92
164k
{                                                                              \
93
164k
    return ossl_prov_is_running() && init(ctx);                                \
94
164k
}                                                                              \
sha2_prov.c:sha512_256_internal_init
Line
Count
Source
91
63.2k
                                ossl_unused const OSSL_PARAM params[])         \
92
63.2k
{                                                                              \
93
63.2k
    return ossl_prov_is_running() && init(ctx);                                \
94
63.2k
}                                                                              \
sm3_prov.c:sm3_internal_init
Line
Count
Source
91
3.51k
                                ossl_unused const OSSL_PARAM params[])         \
92
3.51k
{                                                                              \
93
3.51k
    return ossl_prov_is_running() && init(ctx);                                \
94
3.51k
}                                                                              \
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.01M
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
1.01M
{                                                                              \
106
1.01M
    return ossl_prov_is_running()                                              \
107
1.01M
           && init(ctx)                                                        \
108
1.01M
           && set_ctx_params(ctx, params);                                     \
109
1.01M
}                                                                              \
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.00M
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
1.00M
{                                                                              \
106
1.00M
    return ossl_prov_is_running()                                              \
107
1.00M
           && init(ctx)                                                        \
108
1.00M
           && set_ctx_params(ctx, params);                                     \
109
1.00M
}                                                                              \
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 */