Coverage Report

Created: 2025-11-16 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl30/crypto/err/err_local.h
Line
Count
Source
1
/*
2
 * Copyright 1995-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
#include <openssl/err.h>
11
#include <openssl/e_os2.h>
12
13
static ossl_inline void err_get_slot(ERR_STATE *es)
14
265M
{
15
265M
    es->top = (es->top + 1) % ERR_NUM_ERRORS;
16
265M
    if (es->top == es->bottom)
17
33.2M
        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
18
265M
}
Unexecuted instantiation: err.c:err_get_slot
err_blocks.c:err_get_slot
Line
Count
Source
14
265M
{
15
265M
    es->top = (es->top + 1) % ERR_NUM_ERRORS;
16
265M
    if (es->top == es->bottom)
17
33.2M
        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
18
265M
}
Unexecuted instantiation: err_prn.c:err_get_slot
19
20
static ossl_inline void err_clear_data(ERR_STATE *es, size_t i, int deall)
21
1.62G
{
22
1.62G
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
652M
        if (deall) {
24
68.7k
            OPENSSL_free(es->err_data[i]);
25
68.7k
            es->err_data[i] = NULL;
26
68.7k
            es->err_data_size[i] = 0;
27
68.7k
            es->err_data_flags[i] = 0;
28
652M
        } else if (es->err_data[i] != NULL) {
29
652M
            es->err_data[i][0] = '\0';
30
652M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
652M
        }
32
968M
    } else {
33
968M
        es->err_data[i] = NULL;
34
968M
        es->err_data_size[i] = 0;
35
968M
        es->err_data_flags[i] = 0;
36
968M
    }
37
1.62G
}
err.c:err_clear_data
Line
Count
Source
21
1.09G
{
22
1.09G
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
127M
        if (deall) {
24
68.7k
            OPENSSL_free(es->err_data[i]);
25
68.7k
            es->err_data[i] = NULL;
26
68.7k
            es->err_data_size[i] = 0;
27
68.7k
            es->err_data_flags[i] = 0;
28
127M
        } else if (es->err_data[i] != NULL) {
29
127M
            es->err_data[i][0] = '\0';
30
127M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
127M
        }
32
963M
    } else {
33
        es->err_data[i] = NULL;
34
963M
        es->err_data_size[i] = 0;
35
963M
        es->err_data_flags[i] = 0;
36
963M
    }
37
1.09G
}
err_blocks.c:err_clear_data
Line
Count
Source
21
530M
{
22
530M
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
525M
        if (deall) {
24
0
            OPENSSL_free(es->err_data[i]);
25
0
            es->err_data[i] = NULL;
26
0
            es->err_data_size[i] = 0;
27
0
            es->err_data_flags[i] = 0;
28
525M
        } else if (es->err_data[i] != NULL) {
29
525M
            es->err_data[i][0] = '\0';
30
525M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
525M
        }
32
525M
    } else {
33
        es->err_data[i] = NULL;
34
4.78M
        es->err_data_size[i] = 0;
35
4.78M
        es->err_data_flags[i] = 0;
36
4.78M
    }
37
530M
}
Unexecuted instantiation: err_prn.c:err_clear_data
38
39
static ossl_inline void err_set_error(ERR_STATE *es, size_t i,
40
                                      int lib, int reason)
41
265M
{
42
265M
    es->err_buffer[i] =
43
265M
        lib == ERR_LIB_SYS
44
265M
        ? (unsigned int)(ERR_SYSTEM_FLAG |  reason)
45
265M
        : ERR_PACK(lib, 0, reason);
46
265M
}
Unexecuted instantiation: err.c:err_set_error
err_blocks.c:err_set_error
Line
Count
Source
41
265M
{
42
265M
    es->err_buffer[i] =
43
265M
        lib == ERR_LIB_SYS
44
265M
        ? (unsigned int)(ERR_SYSTEM_FLAG |  reason)
45
265M
        : ERR_PACK(lib, 0, reason);
46
265M
}
Unexecuted instantiation: err_prn.c:err_set_error
47
48
static ossl_inline void err_set_debug(ERR_STATE *es, size_t i,
49
                                      const char *file, int line,
50
                                      const char *fn)
51
32.9M
{
52
    /*
53
     * We dup the file and fn strings because they may be provider owned. If the
54
     * provider gets unloaded, they may not be valid anymore.
55
     */
56
32.9M
    OPENSSL_free(es->err_file[i]);
57
32.9M
    if (file == NULL || file[0] == '\0')
58
0
        es->err_file[i] = NULL;
59
32.9M
    else
60
32.9M
        es->err_file[i] = OPENSSL_strdup(file);
61
32.9M
    es->err_line[i] = line;
62
32.9M
    OPENSSL_free(es->err_func[i]);
63
32.9M
    if (fn == NULL || fn[0] == '\0')
64
0
        es->err_func[i] = NULL;
65
32.9M
    else
66
32.9M
        es->err_func[i] = OPENSSL_strdup(fn);
67
32.9M
}
Unexecuted instantiation: err.c:err_set_debug
err_blocks.c:err_set_debug
Line
Count
Source
51
32.9M
{
52
    /*
53
     * We dup the file and fn strings because they may be provider owned. If the
54
     * provider gets unloaded, they may not be valid anymore.
55
     */
56
32.9M
    OPENSSL_free(es->err_file[i]);
57
32.9M
    if (file == NULL || file[0] == '\0')
58
0
        es->err_file[i] = NULL;
59
32.9M
    else
60
32.9M
        es->err_file[i] = OPENSSL_strdup(file);
61
32.9M
    es->err_line[i] = line;
62
32.9M
    OPENSSL_free(es->err_func[i]);
63
32.9M
    if (fn == NULL || fn[0] == '\0')
64
0
        es->err_func[i] = NULL;
65
32.9M
    else
66
32.9M
        es->err_func[i] = OPENSSL_strdup(fn);
67
32.9M
}
Unexecuted instantiation: err_prn.c:err_set_debug
68
69
static ossl_inline void err_set_data(ERR_STATE *es, size_t i,
70
                                     void *data, size_t datasz, int flags)
71
20.0M
{
72
20.0M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
73
16.7M
        OPENSSL_free(es->err_data[i]);
74
20.0M
    es->err_data[i] = data;
75
20.0M
    es->err_data_size[i] = datasz;
76
20.0M
    es->err_data_flags[i] = flags;
77
20.0M
}
err.c:err_set_data
Line
Count
Source
71
16.7M
{
72
16.7M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
73
16.7M
        OPENSSL_free(es->err_data[i]);
74
16.7M
    es->err_data[i] = data;
75
16.7M
    es->err_data_size[i] = datasz;
76
16.7M
    es->err_data_flags[i] = flags;
77
16.7M
}
err_blocks.c:err_set_data
Line
Count
Source
71
3.31M
{
72
3.31M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
73
0
        OPENSSL_free(es->err_data[i]);
74
3.31M
    es->err_data[i] = data;
75
3.31M
    es->err_data_size[i] = datasz;
76
3.31M
    es->err_data_flags[i] = flags;
77
3.31M
}
Unexecuted instantiation: err_prn.c:err_set_data
78
79
static ossl_inline void err_clear(ERR_STATE *es, size_t i, int deall)
80
1.33G
{
81
1.33G
    err_clear_data(es, i, (deall));
82
1.33G
    es->err_marks[i] = 0;
83
1.33G
    es->err_flags[i] = 0;
84
1.33G
    es->err_buffer[i] = 0;
85
1.33G
    es->err_line[i] = -1;
86
1.33G
    OPENSSL_free(es->err_file[i]);
87
1.33G
    es->err_file[i] = NULL;
88
1.33G
    OPENSSL_free(es->err_func[i]);
89
    es->err_func[i] = NULL;
90
1.33G
}
err.c:err_clear
Line
Count
Source
80
1.07G
{
81
1.07G
    err_clear_data(es, i, (deall));
82
1.07G
    es->err_marks[i] = 0;
83
1.07G
    es->err_flags[i] = 0;
84
1.07G
    es->err_buffer[i] = 0;
85
1.07G
    es->err_line[i] = -1;
86
1.07G
    OPENSSL_free(es->err_file[i]);
87
1.07G
    es->err_file[i] = NULL;
88
1.07G
    OPENSSL_free(es->err_func[i]);
89
    es->err_func[i] = NULL;
90
1.07G
}
err_blocks.c:err_clear
Line
Count
Source
80
265M
{
81
265M
    err_clear_data(es, i, (deall));
82
265M
    es->err_marks[i] = 0;
83
265M
    es->err_flags[i] = 0;
84
265M
    es->err_buffer[i] = 0;
85
265M
    es->err_line[i] = -1;
86
265M
    OPENSSL_free(es->err_file[i]);
87
265M
    es->err_file[i] = NULL;
88
265M
    OPENSSL_free(es->err_func[i]);
89
    es->err_func[i] = NULL;
90
265M
}
Unexecuted instantiation: err_prn.c:err_clear
91
92
ERR_STATE *ossl_err_get_state_int(void);
93
void ossl_err_string_int(unsigned long e, const char *func,
94
                         char *buf, size_t len);