Coverage Report

Created: 2025-08-11 07:04

/src/openssl30/crypto/err/err_local.h
Line
Count
Source (jump to first uncovered line)
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
255M
{
15
255M
    es->top = (es->top + 1) % ERR_NUM_ERRORS;
16
255M
    if (es->top == es->bottom)
17
30.1M
        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
18
255M
}
Unexecuted instantiation: err.c:err_get_slot
err_blocks.c:err_get_slot
Line
Count
Source
14
255M
{
15
255M
    es->top = (es->top + 1) % ERR_NUM_ERRORS;
16
255M
    if (es->top == es->bottom)
17
30.1M
        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
18
255M
}
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.39G
{
22
1.39G
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
621M
        if (deall) {
24
65.7k
            OPENSSL_free(es->err_data[i]);
25
65.7k
            es->err_data[i] = NULL;
26
65.7k
            es->err_data_size[i] = 0;
27
65.7k
            es->err_data_flags[i] = 0;
28
621M
        } else if (es->err_data[i] != NULL) {
29
621M
            es->err_data[i][0] = '\0';
30
621M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
621M
        }
32
771M
    } else {
33
771M
        es->err_data[i] = NULL;
34
771M
        es->err_data_size[i] = 0;
35
771M
        es->err_data_flags[i] = 0;
36
771M
    }
37
1.39G
}
err.c:err_clear_data
Line
Count
Source
21
882M
{
22
882M
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
115M
        if (deall) {
24
65.7k
            OPENSSL_free(es->err_data[i]);
25
65.7k
            es->err_data[i] = NULL;
26
65.7k
            es->err_data_size[i] = 0;
27
65.7k
            es->err_data_flags[i] = 0;
28
115M
        } else if (es->err_data[i] != NULL) {
29
115M
            es->err_data[i][0] = '\0';
30
115M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
115M
        }
32
766M
    } else {
33
766M
        es->err_data[i] = NULL;
34
766M
        es->err_data_size[i] = 0;
35
766M
        es->err_data_flags[i] = 0;
36
766M
    }
37
882M
}
err_blocks.c:err_clear_data
Line
Count
Source
21
510M
{
22
510M
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
505M
        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
505M
        } else if (es->err_data[i] != NULL) {
29
505M
            es->err_data[i][0] = '\0';
30
505M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
505M
        }
32
505M
    } else {
33
4.72M
        es->err_data[i] = NULL;
34
4.72M
        es->err_data_size[i] = 0;
35
4.72M
        es->err_data_flags[i] = 0;
36
4.72M
    }
37
510M
}
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
255M
{
42
255M
    es->err_buffer[i] =
43
255M
        lib == ERR_LIB_SYS
44
255M
        ? (unsigned int)(ERR_SYSTEM_FLAG |  reason)
45
255M
        : ERR_PACK(lib, 0, reason);
46
255M
}
Unexecuted instantiation: err.c:err_set_error
err_blocks.c:err_set_error
Line
Count
Source
41
255M
{
42
255M
    es->err_buffer[i] =
43
255M
        lib == ERR_LIB_SYS
44
255M
        ? (unsigned int)(ERR_SYSTEM_FLAG |  reason)
45
255M
        : ERR_PACK(lib, 0, reason);
46
255M
}
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
34.8M
{
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
34.8M
    OPENSSL_free(es->err_file[i]);
57
34.8M
    if (file == NULL || file[0] == '\0')
58
0
        es->err_file[i] = NULL;
59
34.8M
    else
60
34.8M
        es->err_file[i] = OPENSSL_strdup(file);
61
34.8M
    es->err_line[i] = line;
62
34.8M
    OPENSSL_free(es->err_func[i]);
63
34.8M
    if (fn == NULL || fn[0] == '\0')
64
0
        es->err_func[i] = NULL;
65
34.8M
    else
66
34.8M
        es->err_func[i] = OPENSSL_strdup(fn);
67
34.8M
}
Unexecuted instantiation: err.c:err_set_debug
err_blocks.c:err_set_debug
Line
Count
Source
51
34.8M
{
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
34.8M
    OPENSSL_free(es->err_file[i]);
57
34.8M
    if (file == NULL || file[0] == '\0')
58
0
        es->err_file[i] = NULL;
59
34.8M
    else
60
34.8M
        es->err_file[i] = OPENSSL_strdup(file);
61
34.8M
    es->err_line[i] = line;
62
34.8M
    OPENSSL_free(es->err_func[i]);
63
34.8M
    if (fn == NULL || fn[0] == '\0')
64
0
        es->err_func[i] = NULL;
65
34.8M
    else
66
34.8M
        es->err_func[i] = OPENSSL_strdup(fn);
67
34.8M
}
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
18.3M
{
72
18.3M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
73
15.2M
        OPENSSL_free(es->err_data[i]);
74
18.3M
    es->err_data[i] = data;
75
18.3M
    es->err_data_size[i] = datasz;
76
18.3M
    es->err_data_flags[i] = flags;
77
18.3M
}
err.c:err_set_data
Line
Count
Source
71
15.3M
{
72
15.3M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
73
15.2M
        OPENSSL_free(es->err_data[i]);
74
15.3M
    es->err_data[i] = data;
75
15.3M
    es->err_data_size[i] = datasz;
76
15.3M
    es->err_data_flags[i] = flags;
77
15.3M
}
err_blocks.c:err_set_data
Line
Count
Source
71
3.00M
{
72
3.00M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
73
0
        OPENSSL_free(es->err_data[i]);
74
3.00M
    es->err_data[i] = data;
75
3.00M
    es->err_data_size[i] = datasz;
76
3.00M
    es->err_data_flags[i] = flags;
77
3.00M
}
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.12G
{
81
1.12G
    err_clear_data(es, i, (deall));
82
1.12G
    es->err_marks[i] = 0;
83
1.12G
    es->err_flags[i] = 0;
84
1.12G
    es->err_buffer[i] = 0;
85
1.12G
    es->err_line[i] = -1;
86
1.12G
    OPENSSL_free(es->err_file[i]);
87
1.12G
    es->err_file[i] = NULL;
88
1.12G
    OPENSSL_free(es->err_func[i]);
89
1.12G
    es->err_func[i] = NULL;
90
1.12G
}
err.c:err_clear
Line
Count
Source
80
866M
{
81
866M
    err_clear_data(es, i, (deall));
82
866M
    es->err_marks[i] = 0;
83
866M
    es->err_flags[i] = 0;
84
866M
    es->err_buffer[i] = 0;
85
866M
    es->err_line[i] = -1;
86
866M
    OPENSSL_free(es->err_file[i]);
87
866M
    es->err_file[i] = NULL;
88
866M
    OPENSSL_free(es->err_func[i]);
89
866M
    es->err_func[i] = NULL;
90
866M
}
err_blocks.c:err_clear
Line
Count
Source
80
255M
{
81
255M
    err_clear_data(es, i, (deall));
82
255M
    es->err_marks[i] = 0;
83
255M
    es->err_flags[i] = 0;
84
255M
    es->err_buffer[i] = 0;
85
255M
    es->err_line[i] = -1;
86
255M
    OPENSSL_free(es->err_file[i]);
87
255M
    es->err_file[i] = NULL;
88
255M
    OPENSSL_free(es->err_func[i]);
89
255M
    es->err_func[i] = NULL;
90
255M
}
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);