Coverage Report

Created: 2024-07-27 06:39

/src/openssl30/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
956
#define PROV_DIGEST_FLAG_XOF             0x0001
20
956
#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
836
static int name##_get_params(OSSL_PARAM params[])                              \
29
836
{                                                                              \
30
836
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
836
}
blake2_prov.c:blake2s256_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
blake2_prov.c:blake2b512_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
md5_prov.c:md5_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
md5_sha1_prov.c:md5_sha1_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
null_prov.c:nullmd_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
ripemd_prov.c:ripemd160_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha2_prov.c:sha1_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha2_prov.c:sha224_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha2_prov.c:sha256_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha2_prov.c:sha384_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha2_prov.c:sha512_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha2_prov.c:sha512_224_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha2_prov.c:sha512_256_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha3_prov.c:sha3_224_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha3_prov.c:sha3_256_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha3_prov.c:sha3_384_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha3_prov.c:sha3_512_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha3_prov.c:shake_128_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha3_prov.c:shake_256_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha3_prov.c:keccak_kmac_128_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sha3_prov.c:keccak_kmac_256_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
sm3_prov.c:sm3_get_params
Line
Count
Source
28
38
static int name##_get_params(OSSL_PARAM params[])                              \
29
38
{                                                                              \
30
38
    return ossl_digest_default_get_params(params, blksize, dgstsize, flags);   \
31
38
}
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
4.55M
                                 size_t outsz)                                 \
42
4.55M
{                                                                              \
43
4.55M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
4.55M
        *outl = dgstsize;                                                      \
45
4.55M
        return 1;                                                              \
46
4.55M
    }                                                                          \
47
4.55M
    return 0;                                                                  \
48
4.55M
}
Unexecuted instantiation: blake2_prov.c:blake2s256_internal_final
md5_prov.c:md5_internal_final
Line
Count
Source
41
294k
                                 size_t outsz)                                 \
42
294k
{                                                                              \
43
294k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
294k
        *outl = dgstsize;                                                      \
45
294k
        return 1;                                                              \
46
294k
    }                                                                          \
47
294k
    return 0;                                                                  \
48
294k
}
md5_sha1_prov.c:md5_sha1_internal_final
Line
Count
Source
41
5.67k
                                 size_t outsz)                                 \
42
5.67k
{                                                                              \
43
5.67k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
5.67k
        *outl = dgstsize;                                                      \
45
5.67k
        return 1;                                                              \
46
5.67k
    }                                                                          \
47
5.67k
    return 0;                                                                  \
48
5.67k
}
ripemd_prov.c:ripemd160_internal_final
Line
Count
Source
41
1.31M
                                 size_t outsz)                                 \
42
1.31M
{                                                                              \
43
1.31M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.31M
        *outl = dgstsize;                                                      \
45
1.31M
        return 1;                                                              \
46
1.31M
    }                                                                          \
47
1.31M
    return 0;                                                                  \
48
1.31M
}
sha2_prov.c:sha1_internal_final
Line
Count
Source
41
661k
                                 size_t outsz)                                 \
42
661k
{                                                                              \
43
661k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
661k
        *outl = dgstsize;                                                      \
45
661k
        return 1;                                                              \
46
661k
    }                                                                          \
47
661k
    return 0;                                                                  \
48
661k
}
sha2_prov.c:sha224_internal_final
Line
Count
Source
41
132k
                                 size_t outsz)                                 \
42
132k
{                                                                              \
43
132k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
132k
        *outl = dgstsize;                                                      \
45
132k
        return 1;                                                              \
46
132k
    }                                                                          \
47
132k
    return 0;                                                                  \
48
132k
}
sha2_prov.c:sha256_internal_final
Line
Count
Source
41
843k
                                 size_t outsz)                                 \
42
843k
{                                                                              \
43
843k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
843k
        *outl = dgstsize;                                                      \
45
843k
        return 1;                                                              \
46
843k
    }                                                                          \
47
843k
    return 0;                                                                  \
48
843k
}
sha2_prov.c:sha384_internal_final
Line
Count
Source
41
1.03M
                                 size_t outsz)                                 \
42
1.03M
{                                                                              \
43
1.03M
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
1.03M
        *outl = dgstsize;                                                      \
45
1.03M
        return 1;                                                              \
46
1.03M
    }                                                                          \
47
1.03M
    return 0;                                                                  \
48
1.03M
}
sha2_prov.c:sha512_internal_final
Line
Count
Source
41
73.7k
                                 size_t outsz)                                 \
42
73.7k
{                                                                              \
43
73.7k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
73.7k
        *outl = dgstsize;                                                      \
45
73.7k
        return 1;                                                              \
46
73.7k
    }                                                                          \
47
73.7k
    return 0;                                                                  \
48
73.7k
}
sha2_prov.c:sha512_224_internal_final
Line
Count
Source
41
106k
                                 size_t outsz)                                 \
42
106k
{                                                                              \
43
106k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
106k
        *outl = dgstsize;                                                      \
45
106k
        return 1;                                                              \
46
106k
    }                                                                          \
47
106k
    return 0;                                                                  \
48
106k
}
sha2_prov.c:sha512_256_internal_final
Line
Count
Source
41
80.0k
                                 size_t outsz)                                 \
42
80.0k
{                                                                              \
43
80.0k
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
80.0k
        *outl = dgstsize;                                                      \
45
80.0k
        return 1;                                                              \
46
80.0k
    }                                                                          \
47
80.0k
    return 0;                                                                  \
48
80.0k
}
sm3_prov.c:sm3_internal_final
Line
Count
Source
41
775
                                 size_t outsz)                                 \
42
775
{                                                                              \
43
775
    if (ossl_prov_is_running() && outsz >= dgstsize && fin(out, ctx)) {        \
44
775
        *outl = dgstsize;                                                      \
45
775
        return 1;                                                              \
46
775
    }                                                                          \
47
775
    return 0;                                                                  \
48
775
}
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
2.19M
static void *name##_newctx(void *prov_ctx)                                     \
56
2.19M
{                                                                              \
57
2.19M
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
2.19M
    return ctx;                                                                \
59
2.19M
}                                                                              \
Unexecuted instantiation: blake2_prov.c:blake2s256_newctx
blake2_prov.c:blake2b512_newctx
Line
Count
Source
55
32.1k
static void *name##_newctx(void *prov_ctx)                                     \
56
32.1k
{                                                                              \
57
32.1k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
32.1k
    return ctx;                                                                \
59
32.1k
}                                                                              \
md5_prov.c:md5_newctx
Line
Count
Source
55
60.9k
static void *name##_newctx(void *prov_ctx)                                     \
56
60.9k
{                                                                              \
57
60.9k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
60.9k
    return ctx;                                                                \
59
60.9k
}                                                                              \
md5_sha1_prov.c:md5_sha1_newctx
Line
Count
Source
55
7.96k
static void *name##_newctx(void *prov_ctx)                                     \
56
7.96k
{                                                                              \
57
7.96k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
7.96k
    return ctx;                                                                \
59
7.96k
}                                                                              \
Unexecuted instantiation: null_prov.c:nullmd_newctx
ripemd_prov.c:ripemd160_newctx
Line
Count
Source
55
234k
static void *name##_newctx(void *prov_ctx)                                     \
56
234k
{                                                                              \
57
234k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
234k
    return ctx;                                                                \
59
234k
}                                                                              \
sha2_prov.c:sha1_newctx
Line
Count
Source
55
374k
static void *name##_newctx(void *prov_ctx)                                     \
56
374k
{                                                                              \
57
374k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
374k
    return ctx;                                                                \
59
374k
}                                                                              \
sha2_prov.c:sha224_newctx
Line
Count
Source
55
17.8k
static void *name##_newctx(void *prov_ctx)                                     \
56
17.8k
{                                                                              \
57
17.8k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
17.8k
    return ctx;                                                                \
59
17.8k
}                                                                              \
sha2_prov.c:sha256_newctx
Line
Count
Source
55
607k
static void *name##_newctx(void *prov_ctx)                                     \
56
607k
{                                                                              \
57
607k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
607k
    return ctx;                                                                \
59
607k
}                                                                              \
sha2_prov.c:sha384_newctx
Line
Count
Source
55
747k
static void *name##_newctx(void *prov_ctx)                                     \
56
747k
{                                                                              \
57
747k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
747k
    return ctx;                                                                \
59
747k
}                                                                              \
sha2_prov.c:sha512_newctx
Line
Count
Source
55
52.3k
static void *name##_newctx(void *prov_ctx)                                     \
56
52.3k
{                                                                              \
57
52.3k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
52.3k
    return ctx;                                                                \
59
52.3k
}                                                                              \
sha2_prov.c:sha512_224_newctx
Line
Count
Source
55
38.3k
static void *name##_newctx(void *prov_ctx)                                     \
56
38.3k
{                                                                              \
57
38.3k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
38.3k
    return ctx;                                                                \
59
38.3k
}                                                                              \
sha2_prov.c:sha512_256_newctx
Line
Count
Source
55
16.1k
static void *name##_newctx(void *prov_ctx)                                     \
56
16.1k
{                                                                              \
57
16.1k
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
16.1k
    return ctx;                                                                \
59
16.1k
}                                                                              \
sm3_prov.c:sm3_newctx
Line
Count
Source
55
363
static void *name##_newctx(void *prov_ctx)                                     \
56
363
{                                                                              \
57
363
    CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) : NULL;   \
58
363
    return ctx;                                                                \
59
363
}                                                                              \
60
5.19M
static void name##_freectx(void *vctx)                                         \
61
5.19M
{                                                                              \
62
5.19M
    CTX *ctx = (CTX *)vctx;                                                    \
63
5.19M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
5.19M
}                                                                              \
Unexecuted instantiation: blake2_prov.c:blake2s256_freectx
blake2_prov.c:blake2b512_freectx
Line
Count
Source
60
32.1k
static void name##_freectx(void *vctx)                                         \
61
32.1k
{                                                                              \
62
32.1k
    CTX *ctx = (CTX *)vctx;                                                    \
63
32.1k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
32.1k
}                                                                              \
md5_prov.c:md5_freectx
Line
Count
Source
60
764k
static void name##_freectx(void *vctx)                                         \
61
764k
{                                                                              \
62
764k
    CTX *ctx = (CTX *)vctx;                                                    \
63
764k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
764k
}                                                                              \
md5_sha1_prov.c:md5_sha1_freectx
Line
Count
Source
60
13.2k
static void name##_freectx(void *vctx)                                         \
61
13.2k
{                                                                              \
62
13.2k
    CTX *ctx = (CTX *)vctx;                                                    \
63
13.2k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
13.2k
}                                                                              \
Unexecuted instantiation: null_prov.c:nullmd_freectx
ripemd_prov.c:ripemd160_freectx
Line
Count
Source
60
235k
static void name##_freectx(void *vctx)                                         \
61
235k
{                                                                              \
62
235k
    CTX *ctx = (CTX *)vctx;                                                    \
63
235k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
235k
}                                                                              \
sha2_prov.c:sha1_freectx
Line
Count
Source
60
883k
static void name##_freectx(void *vctx)                                         \
61
883k
{                                                                              \
62
883k
    CTX *ctx = (CTX *)vctx;                                                    \
63
883k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
883k
}                                                                              \
sha2_prov.c:sha224_freectx
Line
Count
Source
60
18.7k
static void name##_freectx(void *vctx)                                         \
61
18.7k
{                                                                              \
62
18.7k
    CTX *ctx = (CTX *)vctx;                                                    \
63
18.7k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
18.7k
}                                                                              \
sha2_prov.c:sha256_freectx
Line
Count
Source
60
1.59M
static void name##_freectx(void *vctx)                                         \
61
1.59M
{                                                                              \
62
1.59M
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.59M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.59M
}                                                                              \
sha2_prov.c:sha384_freectx
Line
Count
Source
60
1.54M
static void name##_freectx(void *vctx)                                         \
61
1.54M
{                                                                              \
62
1.54M
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.54M
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.54M
}                                                                              \
sha2_prov.c:sha512_freectx
Line
Count
Source
60
53.7k
static void name##_freectx(void *vctx)                                         \
61
53.7k
{                                                                              \
62
53.7k
    CTX *ctx = (CTX *)vctx;                                                    \
63
53.7k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
53.7k
}                                                                              \
sha2_prov.c:sha512_224_freectx
Line
Count
Source
60
38.4k
static void name##_freectx(void *vctx)                                         \
61
38.4k
{                                                                              \
62
38.4k
    CTX *ctx = (CTX *)vctx;                                                    \
63
38.4k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
38.4k
}                                                                              \
sha2_prov.c:sha512_256_freectx
Line
Count
Source
60
16.2k
static void name##_freectx(void *vctx)                                         \
61
16.2k
{                                                                              \
62
16.2k
    CTX *ctx = (CTX *)vctx;                                                    \
63
16.2k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
16.2k
}                                                                              \
sm3_prov.c:sm3_freectx
Line
Count
Source
60
1.17k
static void name##_freectx(void *vctx)                                         \
61
1.17k
{                                                                              \
62
1.17k
    CTX *ctx = (CTX *)vctx;                                                    \
63
1.17k
    OPENSSL_clear_free(ctx,  sizeof(*ctx));                                    \
64
1.17k
}                                                                              \
65
3.00M
static void *name##_dupctx(void *ctx)                                          \
66
3.00M
{                                                                              \
67
3.00M
    CTX *in = (CTX *)ctx;                                                      \
68
3.00M
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
3.00M
    if (ret != NULL)                                                           \
70
3.00M
        *ret = *in;                                                            \
71
3.00M
    return ret;                                                                \
72
3.00M
}                                                                              \
Unexecuted instantiation: blake2_prov.c:blake2s256_dupctx
Unexecuted instantiation: blake2_prov.c:blake2b512_dupctx
md5_prov.c:md5_dupctx
Line
Count
Source
65
703k
static void *name##_dupctx(void *ctx)                                          \
66
703k
{                                                                              \
67
703k
    CTX *in = (CTX *)ctx;                                                      \
68
703k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
703k
    if (ret != NULL)                                                           \
70
703k
        *ret = *in;                                                            \
71
703k
    return ret;                                                                \
72
703k
}                                                                              \
md5_sha1_prov.c:md5_sha1_dupctx
Line
Count
Source
65
5.32k
static void *name##_dupctx(void *ctx)                                          \
66
5.32k
{                                                                              \
67
5.32k
    CTX *in = (CTX *)ctx;                                                      \
68
5.32k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
5.32k
    if (ret != NULL)                                                           \
70
5.32k
        *ret = *in;                                                            \
71
5.32k
    return ret;                                                                \
72
5.32k
}                                                                              \
Unexecuted instantiation: null_prov.c:nullmd_dupctx
ripemd_prov.c:ripemd160_dupctx
Line
Count
Source
65
950
static void *name##_dupctx(void *ctx)                                          \
66
950
{                                                                              \
67
950
    CTX *in = (CTX *)ctx;                                                      \
68
950
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
950
    if (ret != NULL)                                                           \
70
950
        *ret = *in;                                                            \
71
950
    return ret;                                                                \
72
950
}                                                                              \
sha2_prov.c:sha1_dupctx
Line
Count
Source
65
509k
static void *name##_dupctx(void *ctx)                                          \
66
509k
{                                                                              \
67
509k
    CTX *in = (CTX *)ctx;                                                      \
68
509k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
509k
    if (ret != NULL)                                                           \
70
509k
        *ret = *in;                                                            \
71
509k
    return ret;                                                                \
72
509k
}                                                                              \
sha2_prov.c:sha224_dupctx
Line
Count
Source
65
890
static void *name##_dupctx(void *ctx)                                          \
66
890
{                                                                              \
67
890
    CTX *in = (CTX *)ctx;                                                      \
68
890
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
890
    if (ret != NULL)                                                           \
70
890
        *ret = *in;                                                            \
71
890
    return ret;                                                                \
72
890
}                                                                              \
sha2_prov.c:sha256_dupctx
Line
Count
Source
65
982k
static void *name##_dupctx(void *ctx)                                          \
66
982k
{                                                                              \
67
982k
    CTX *in = (CTX *)ctx;                                                      \
68
982k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
982k
    if (ret != NULL)                                                           \
70
982k
        *ret = *in;                                                            \
71
982k
    return ret;                                                                \
72
982k
}                                                                              \
sha2_prov.c:sha384_dupctx
Line
Count
Source
65
797k
static void *name##_dupctx(void *ctx)                                          \
66
797k
{                                                                              \
67
797k
    CTX *in = (CTX *)ctx;                                                      \
68
797k
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
797k
    if (ret != NULL)                                                           \
70
797k
        *ret = *in;                                                            \
71
797k
    return ret;                                                                \
72
797k
}                                                                              \
sha2_prov.c:sha512_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:sha512_224_dupctx
Line
Count
Source
65
111
static void *name##_dupctx(void *ctx)                                          \
66
111
{                                                                              \
67
111
    CTX *in = (CTX *)ctx;                                                      \
68
111
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
111
    if (ret != NULL)                                                           \
70
111
        *ret = *in;                                                            \
71
111
    return ret;                                                                \
72
111
}                                                                              \
sha2_prov.c:sha512_256_dupctx
Line
Count
Source
65
57
static void *name##_dupctx(void *ctx)                                          \
66
57
{                                                                              \
67
57
    CTX *in = (CTX *)ctx;                                                      \
68
57
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
57
    if (ret != NULL)                                                           \
70
57
        *ret = *in;                                                            \
71
57
    return ret;                                                                \
72
57
}                                                                              \
sm3_prov.c:sm3_dupctx
Line
Count
Source
65
809
static void *name##_dupctx(void *ctx)                                          \
66
809
{                                                                              \
67
809
    CTX *in = (CTX *)ctx;                                                      \
68
809
    CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) : NULL;   \
69
809
    if (ret != NULL)                                                           \
70
809
        *ret = *in;                                                            \
71
809
    return ret;                                                                \
72
809
}                                                                              \
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
3.49M
                                ossl_unused const OSSL_PARAM params[])         \
92
3.49M
{                                                                              \
93
3.49M
    return ossl_prov_is_running() && init(ctx);                                \
94
3.49M
}                                                                              \
Unexecuted instantiation: blake2_prov.c:blake2s256_internal_init
md5_prov.c:md5_internal_init
Line
Count
Source
91
66.4k
                                ossl_unused const OSSL_PARAM params[])         \
92
66.4k
{                                                                              \
93
66.4k
    return ossl_prov_is_running() && init(ctx);                                \
94
66.4k
}                                                                              \
Unexecuted instantiation: null_prov.c:nullmd_internal_init
ripemd_prov.c:ripemd160_internal_init
Line
Count
Source
91
1.31M
                                ossl_unused const OSSL_PARAM params[])         \
92
1.31M
{                                                                              \
93
1.31M
    return ossl_prov_is_running() && init(ctx);                                \
94
1.31M
}                                                                              \
sha2_prov.c:sha224_internal_init
Line
Count
Source
91
133k
                                ossl_unused const OSSL_PARAM params[])         \
92
133k
{                                                                              \
93
133k
    return ossl_prov_is_running() && init(ctx);                                \
94
133k
}                                                                              \
sha2_prov.c:sha256_internal_init
Line
Count
Source
91
704k
                                ossl_unused const OSSL_PARAM params[])         \
92
704k
{                                                                              \
93
704k
    return ossl_prov_is_running() && init(ctx);                                \
94
704k
}                                                                              \
sha2_prov.c:sha384_internal_init
Line
Count
Source
91
996k
                                ossl_unused const OSSL_PARAM params[])         \
92
996k
{                                                                              \
93
996k
    return ossl_prov_is_running() && init(ctx);                                \
94
996k
}                                                                              \
sha2_prov.c:sha512_internal_init
Line
Count
Source
91
93.1k
                                ossl_unused const OSSL_PARAM params[])         \
92
93.1k
{                                                                              \
93
93.1k
    return ossl_prov_is_running() && init(ctx);                                \
94
93.1k
}                                                                              \
sha2_prov.c:sha512_224_internal_init
Line
Count
Source
91
106k
                                ossl_unused const OSSL_PARAM params[])         \
92
106k
{                                                                              \
93
106k
    return ossl_prov_is_running() && init(ctx);                                \
94
106k
}                                                                              \
sha2_prov.c:sha512_256_internal_init
Line
Count
Source
91
80.0k
                                ossl_unused const OSSL_PARAM params[])         \
92
80.0k
{                                                                              \
93
80.0k
    return ossl_prov_is_running() && init(ctx);                                \
94
80.0k
}                                                                              \
sm3_prov.c:sm3_internal_init
Line
Count
Source
91
849
                                ossl_unused const OSSL_PARAM params[])         \
92
849
{                                                                              \
93
849
    return ossl_prov_is_running() && init(ctx);                                \
94
849
}                                                                              \
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
517k
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
517k
{                                                                              \
106
517k
    return ossl_prov_is_running()                                              \
107
517k
           && init(ctx)                                                        \
108
517k
           && set_ctx_params(ctx, params);                                     \
109
517k
}                                                                              \
md5_sha1_prov.c:md5_sha1_internal_init
Line
Count
Source
104
8.54k
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
8.54k
{                                                                              \
106
8.54k
    return ossl_prov_is_running()                                              \
107
8.54k
           && init(ctx)                                                        \
108
8.54k
           && set_ctx_params(ctx, params);                                     \
109
8.54k
}                                                                              \
sha2_prov.c:sha1_internal_init
Line
Count
Source
104
508k
static int name##_internal_init(void *ctx, const OSSL_PARAM params[])          \
105
508k
{                                                                              \
106
508k
    return ossl_prov_is_running()                                              \
107
508k
           && init(ctx)                                                        \
108
508k
           && set_ctx_params(ctx, params);                                     \
109
508k
}                                                                              \
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 */