Coverage Report

Created: 2026-07-23 06:28

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
487M
{
15
487M
    es->top = (es->top + 1) % ERR_NUM_ERRORS;
16
487M
    if (es->top == es->bottom)
17
28.6M
        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
18
487M
}
Unexecuted instantiation: err.c:err_get_slot
err_blocks.c:err_get_slot
Line
Count
Source
14
487M
{
15
487M
    es->top = (es->top + 1) % ERR_NUM_ERRORS;
16
487M
    if (es->top == es->bottom)
17
28.6M
        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
18
487M
}
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
2.14G
{
22
2.14G
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
1.12G
        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
1.12G
        } else if (es->err_data[i] != NULL) {
29
1.12G
            es->err_data[i][0] = '\0';
30
1.12G
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
1.12G
        }
32
1.12G
    } else {
33
1.01G
        es->err_data[i] = NULL;
34
1.01G
        es->err_data_size[i] = 0;
35
1.01G
        es->err_data_flags[i] = 0;
36
1.01G
    }
37
2.14G
}
err.c:err_clear_data
Line
Count
Source
21
1.16G
{
22
1.16G
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
158M
        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
158M
        } else if (es->err_data[i] != NULL) {
29
158M
            es->err_data[i][0] = '\0';
30
158M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
158M
        }
32
1.01G
    } else {
33
        es->err_data[i] = NULL;
34
1.01G
        es->err_data_size[i] = 0;
35
1.01G
        es->err_data_flags[i] = 0;
36
1.01G
    }
37
1.16G
}
err_blocks.c:err_clear_data
Line
Count
Source
21
975M
{
22
975M
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
970M
        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
970M
        } else if (es->err_data[i] != NULL) {
29
970M
            es->err_data[i][0] = '\0';
30
970M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
970M
        }
32
970M
    } else {
33
        es->err_data[i] = NULL;
34
5.41M
        es->err_data_size[i] = 0;
35
5.41M
        es->err_data_flags[i] = 0;
36
5.41M
    }
37
975M
}
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
487M
{
42
487M
    es->err_buffer[i] = lib == ERR_LIB_SYS
43
487M
        ? (unsigned int)(ERR_SYSTEM_FLAG | reason)
44
487M
        : ERR_PACK(lib, 0, reason);
45
487M
}
Unexecuted instantiation: err.c:err_set_error
err_blocks.c:err_set_error
Line
Count
Source
41
487M
{
42
487M
    es->err_buffer[i] = lib == ERR_LIB_SYS
43
487M
        ? (unsigned int)(ERR_SYSTEM_FLAG | reason)
44
487M
        : ERR_PACK(lib, 0, reason);
45
487M
}
Unexecuted instantiation: err_prn.c:err_set_error
46
47
static ossl_inline void err_set_debug(ERR_STATE *es, size_t i,
48
    const char *file, int line,
49
    const char *fn)
50
63.6M
{
51
    /*
52
     * We dup the file and fn strings because they may be provider owned. If the
53
     * provider gets unloaded, they may not be valid anymore.
54
     */
55
63.6M
    OPENSSL_free(es->err_file[i]);
56
63.6M
    if (file == NULL || file[0] == '\0')
57
0
        es->err_file[i] = NULL;
58
63.6M
    else
59
63.6M
        es->err_file[i] = OPENSSL_strdup(file);
60
63.6M
    es->err_line[i] = line;
61
63.6M
    OPENSSL_free(es->err_func[i]);
62
63.6M
    if (fn == NULL || fn[0] == '\0')
63
0
        es->err_func[i] = NULL;
64
63.6M
    else
65
63.6M
        es->err_func[i] = OPENSSL_strdup(fn);
66
63.6M
}
Unexecuted instantiation: err.c:err_set_debug
err_blocks.c:err_set_debug
Line
Count
Source
50
63.6M
{
51
    /*
52
     * We dup the file and fn strings because they may be provider owned. If the
53
     * provider gets unloaded, they may not be valid anymore.
54
     */
55
63.6M
    OPENSSL_free(es->err_file[i]);
56
63.6M
    if (file == NULL || file[0] == '\0')
57
0
        es->err_file[i] = NULL;
58
63.6M
    else
59
63.6M
        es->err_file[i] = OPENSSL_strdup(file);
60
63.6M
    es->err_line[i] = line;
61
63.6M
    OPENSSL_free(es->err_func[i]);
62
63.6M
    if (fn == NULL || fn[0] == '\0')
63
0
        es->err_func[i] = NULL;
64
63.6M
    else
65
63.6M
        es->err_func[i] = OPENSSL_strdup(fn);
66
63.6M
}
Unexecuted instantiation: err_prn.c:err_set_debug
67
68
static ossl_inline void err_set_data(ERR_STATE *es, size_t i,
69
    void *data, size_t datasz, int flags)
70
18.6M
{
71
18.6M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
72
14.8M
        OPENSSL_free(es->err_data[i]);
73
18.6M
    es->err_data[i] = data;
74
18.6M
    es->err_data_size[i] = datasz;
75
18.6M
    es->err_data_flags[i] = flags;
76
18.6M
}
err.c:err_set_data
Line
Count
Source
70
14.9M
{
71
14.9M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
72
14.8M
        OPENSSL_free(es->err_data[i]);
73
14.9M
    es->err_data[i] = data;
74
14.9M
    es->err_data_size[i] = datasz;
75
14.9M
    es->err_data_flags[i] = flags;
76
14.9M
}
err_blocks.c:err_set_data
Line
Count
Source
70
3.74M
{
71
3.74M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
72
0
        OPENSSL_free(es->err_data[i]);
73
3.74M
    es->err_data[i] = data;
74
3.74M
    es->err_data_size[i] = datasz;
75
3.74M
    es->err_data_flags[i] = flags;
76
3.74M
}
Unexecuted instantiation: err_prn.c:err_set_data
77
78
static ossl_inline void err_clear(ERR_STATE *es, size_t i, int deall)
79
1.64G
{
80
1.64G
    err_clear_data(es, i, (deall));
81
1.64G
    es->err_marks[i] = 0;
82
1.64G
    es->err_flags[i] = 0;
83
1.64G
    es->err_buffer[i] = 0;
84
1.64G
    es->err_line[i] = -1;
85
1.64G
    OPENSSL_free(es->err_file[i]);
86
1.64G
    es->err_file[i] = NULL;
87
1.64G
    OPENSSL_free(es->err_func[i]);
88
    es->err_func[i] = NULL;
89
1.64G
}
err.c:err_clear
Line
Count
Source
79
1.15G
{
80
1.15G
    err_clear_data(es, i, (deall));
81
1.15G
    es->err_marks[i] = 0;
82
1.15G
    es->err_flags[i] = 0;
83
1.15G
    es->err_buffer[i] = 0;
84
1.15G
    es->err_line[i] = -1;
85
1.15G
    OPENSSL_free(es->err_file[i]);
86
1.15G
    es->err_file[i] = NULL;
87
1.15G
    OPENSSL_free(es->err_func[i]);
88
    es->err_func[i] = NULL;
89
1.15G
}
err_blocks.c:err_clear
Line
Count
Source
79
487M
{
80
487M
    err_clear_data(es, i, (deall));
81
487M
    es->err_marks[i] = 0;
82
487M
    es->err_flags[i] = 0;
83
487M
    es->err_buffer[i] = 0;
84
487M
    es->err_line[i] = -1;
85
487M
    OPENSSL_free(es->err_file[i]);
86
487M
    es->err_file[i] = NULL;
87
487M
    OPENSSL_free(es->err_func[i]);
88
    es->err_func[i] = NULL;
89
487M
}
Unexecuted instantiation: err_prn.c:err_clear
90
91
ERR_STATE *ossl_err_get_state_int(void);
92
void ossl_err_string_int(unsigned long e, const char *func,
93
    char *buf, size_t len);