Coverage Report

Created: 2025-12-31 06:58

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl36/include/crypto/sparse_array.h
Line
Count
Source
1
/*
2
 * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
3
 * Copyright (c) 2019, Oracle and/or its affiliates.  All rights reserved.
4
 *
5
 * Licensed under the Apache License 2.0 (the "License").  You may not use
6
 * this file except in compliance with the License.  You can obtain a copy
7
 * in the file LICENSE in the source distribution or at
8
 * https://www.openssl.org/source/license.html
9
 */
10
11
#ifndef OSSL_CRYPTO_SPARSE_ARRAY_H
12
#define OSSL_CRYPTO_SPARSE_ARRAY_H
13
#pragma once
14
15
#include <openssl/e_os2.h>
16
17
#ifdef __cplusplus
18
extern "C" {
19
#endif
20
21
202k
#define SPARSE_ARRAY_OF(type) struct sparse_array_st_##type
22
23
#define DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, ctype)                                                               \
24
    SPARSE_ARRAY_OF(type);                                                                                         \
25
    static ossl_unused ossl_inline SPARSE_ARRAY_OF(type) * ossl_sa_##type##_new(void)                              \
26
191k
    {                                                                                                              \
27
191k
        return (SPARSE_ARRAY_OF(type) *)ossl_sa_new();                                                             \
28
191k
    }                                                                                                              \
threads_common.c:ossl_sa_CTX_TABLE_ENTRY_new
Line
Count
Source
26
167
    {                                                                                                              \
27
167
        return (SPARSE_ARRAY_OF(type) *)ossl_sa_new();                                                             \
28
167
    }                                                                                                              \
property.c:ossl_sa_ALGORITHM_new
Line
Count
Source
26
2.46k
    {                                                                                                              \
27
2.46k
        return (SPARSE_ARRAY_OF(type) *)ossl_sa_new();                                                             \
28
2.46k
    }                                                                                                              \
rsa_ossl.c:ossl_sa_BN_BLINDING_new
Line
Count
Source
26
189k
    {                                                                                                              \
27
189k
        return (SPARSE_ARRAY_OF(type) *)ossl_sa_new();                                                             \
28
189k
    }                                                                                                              \
29
    static ossl_unused ossl_inline void                                                                            \
30
    ossl_sa_##type##_free(SPARSE_ARRAY_OF(type) * sa)                                                              \
31
190k
    {                                                                                                              \
32
190k
        ossl_sa_free((OPENSSL_SA *)sa);                                                                            \
33
190k
    }                                                                                                              \
threads_common.c:ossl_sa_CTX_TABLE_ENTRY_free
Line
Count
Source
31
86
    {                                                                                                              \
32
86
        ossl_sa_free((OPENSSL_SA *)sa);                                                                            \
33
86
    }                                                                                                              \
property.c:ossl_sa_ALGORITHM_free
Line
Count
Source
31
827
    {                                                                                                              \
32
827
        ossl_sa_free((OPENSSL_SA *)sa);                                                                            \
33
827
    }                                                                                                              \
rsa_ossl.c:ossl_sa_BN_BLINDING_free
Line
Count
Source
31
189k
    {                                                                                                              \
32
189k
        ossl_sa_free((OPENSSL_SA *)sa);                                                                            \
33
189k
    }                                                                                                              \
34
    static ossl_unused ossl_inline void                                                                            \
35
    ossl_sa_##type##_free_leaves(SPARSE_ARRAY_OF(type) * sa)                                                       \
36
0
    {                                                                                                              \
37
0
        ossl_sa_free_leaves((OPENSSL_SA *)sa);                                                                     \
38
0
    }                                                                                                              \
Unexecuted instantiation: threads_common.c:ossl_sa_CTX_TABLE_ENTRY_free_leaves
Unexecuted instantiation: property.c:ossl_sa_ALGORITHM_free_leaves
Unexecuted instantiation: rsa_ossl.c:ossl_sa_BN_BLINDING_free_leaves
39
    static ossl_unused ossl_inline size_t                                                                          \
40
    ossl_sa_##type##_num(const SPARSE_ARRAY_OF(type) * sa)                                                         \
41
1.10M
    {                                                                                                              \
42
1.10M
        return ossl_sa_num((OPENSSL_SA *)sa);                                                                      \
43
1.10M
    }                                                                                                              \
Unexecuted instantiation: threads_common.c:ossl_sa_CTX_TABLE_ENTRY_num
property.c:ossl_sa_ALGORITHM_num
Line
Count
Source
41
1.10M
    {                                                                                                              \
42
1.10M
        return ossl_sa_num((OPENSSL_SA *)sa);                                                                      \
43
1.10M
    }                                                                                                              \
Unexecuted instantiation: rsa_ossl.c:ossl_sa_BN_BLINDING_num
44
    static ossl_unused ossl_inline void                                                                            \
45
    ossl_sa_##type##_doall(const SPARSE_ARRAY_OF(type) * sa,                                                       \
46
        void (*leaf)(ossl_uintmax_t, type *))                                                                      \
47
856
    {                                                                                                              \
48
856
        ossl_sa_doall((OPENSSL_SA *)sa,                                                                            \
49
856
            (void (*)(ossl_uintmax_t, void *))leaf);                                                               \
50
856
    }                                                                                                              \
Unexecuted instantiation: threads_common.c:ossl_sa_CTX_TABLE_ENTRY_doall
property.c:ossl_sa_ALGORITHM_doall
Line
Count
Source
47
856
    {                                                                                                              \
48
856
        ossl_sa_doall((OPENSSL_SA *)sa,                                                                            \
49
856
            (void (*)(ossl_uintmax_t, void *))leaf);                                                               \
50
856
    }                                                                                                              \
Unexecuted instantiation: rsa_ossl.c:ossl_sa_BN_BLINDING_doall
51
    static ossl_unused ossl_inline void                                                                            \
52
    ossl_sa_##type##_doall_arg(const SPARSE_ARRAY_OF(type) * sa,                                                   \
53
        void (*leaf)(ossl_uintmax_t, type *, void *),                                                              \
54
        void *arg)                                                                                                 \
55
1.29M
    {                                                                                                              \
56
1.29M
        ossl_sa_doall_arg((OPENSSL_SA *)sa,                                                                        \
57
1.29M
            (void (*)(ossl_uintmax_t, void *, void *))leaf, arg);                                                  \
58
1.29M
    }                                                                                                              \
Unexecuted instantiation: threads_common.c:ossl_sa_CTX_TABLE_ENTRY_doall_arg
property.c:ossl_sa_ALGORITHM_doall_arg
Line
Count
Source
55
1.10M
    {                                                                                                              \
56
1.10M
        ossl_sa_doall_arg((OPENSSL_SA *)sa,                                                                        \
57
1.10M
            (void (*)(ossl_uintmax_t, void *, void *))leaf, arg);                                                  \
58
1.10M
    }                                                                                                              \
rsa_ossl.c:ossl_sa_BN_BLINDING_doall_arg
Line
Count
Source
55
189k
    {                                                                                                              \
56
189k
        ossl_sa_doall_arg((OPENSSL_SA *)sa,                                                                        \
57
189k
            (void (*)(ossl_uintmax_t, void *, void *))leaf, arg);                                                  \
58
189k
    }                                                                                                              \
59
    static ossl_unused ossl_inline ctype *ossl_sa_##type##_get(const SPARSE_ARRAY_OF(type) * sa, ossl_uintmax_t n) \
60
906M
    {                                                                                                              \
61
906M
        return (type *)ossl_sa_get((OPENSSL_SA *)sa, n);                                                           \
62
906M
    }                                                                                                              \
threads_common.c:ossl_sa_CTX_TABLE_ENTRY_get
Line
Count
Source
60
879M
    {                                                                                                              \
61
879M
        return (type *)ossl_sa_get((OPENSSL_SA *)sa, n);                                                           \
62
879M
    }                                                                                                              \
property.c:ossl_sa_ALGORITHM_get
Line
Count
Source
60
26.3M
    {                                                                                                              \
61
26.3M
        return (type *)ossl_sa_get((OPENSSL_SA *)sa, n);                                                           \
62
26.3M
    }                                                                                                              \
rsa_ossl.c:ossl_sa_BN_BLINDING_get
Line
Count
Source
60
6.56k
    {                                                                                                              \
61
6.56k
        return (type *)ossl_sa_get((OPENSSL_SA *)sa, n);                                                           \
62
6.56k
    }                                                                                                              \
63
    static ossl_unused ossl_inline int                                                                             \
64
    ossl_sa_##type##_set(SPARSE_ARRAY_OF(type) * sa,                                                               \
65
        ossl_uintmax_t n, ctype * val)                                                                             \
66
39.8k
    {                                                                                                              \
67
39.8k
        return ossl_sa_set((OPENSSL_SA *)sa, n, (void *)val);                                                      \
68
39.8k
    }                                                                                                              \
threads_common.c:ossl_sa_CTX_TABLE_ENTRY_set
Line
Count
Source
66
565
    {                                                                                                              \
67
565
        return ossl_sa_set((OPENSSL_SA *)sa, n, (void *)val);                                                      \
68
565
    }                                                                                                              \
property.c:ossl_sa_ALGORITHM_set
Line
Count
Source
66
32.6k
    {                                                                                                              \
67
32.6k
        return ossl_sa_set((OPENSSL_SA *)sa, n, (void *)val);                                                      \
68
32.6k
    }                                                                                                              \
rsa_ossl.c:ossl_sa_BN_BLINDING_set
Line
Count
Source
66
6.56k
    {                                                                                                              \
67
6.56k
        return ossl_sa_set((OPENSSL_SA *)sa, n, (void *)val);                                                      \
68
6.56k
    }                                                                                                              \
69
    SPARSE_ARRAY_OF(type)
70
71
#define DEFINE_SPARSE_ARRAY_OF(type) \
72
    DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, type)
73
#define DEFINE_SPARSE_ARRAY_OF_CONST(type) \
74
    DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, const type)
75
76
typedef struct sparse_array_st OPENSSL_SA;
77
OPENSSL_SA *ossl_sa_new(void);
78
void ossl_sa_free(OPENSSL_SA *sa);
79
void ossl_sa_free_leaves(OPENSSL_SA *sa);
80
size_t ossl_sa_num(const OPENSSL_SA *sa);
81
void ossl_sa_doall(const OPENSSL_SA *sa, void (*leaf)(ossl_uintmax_t, void *));
82
void ossl_sa_doall_arg(const OPENSSL_SA *sa,
83
    void (*leaf)(ossl_uintmax_t, void *, void *), void *);
84
void *ossl_sa_get(const OPENSSL_SA *sa, ossl_uintmax_t n);
85
int ossl_sa_set(OPENSSL_SA *sa, ossl_uintmax_t n, void *val);
86
87
#ifdef __cplusplus
88
}
89
#endif
90
#endif