Coverage Report

Created: 2026-04-01 06:39

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
284M
{
15
284M
    es->top = (es->top + 1) % ERR_NUM_ERRORS;
16
284M
    if (es->top == es->bottom)
17
33.8M
        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
18
284M
}
Unexecuted instantiation: err.c:err_get_slot
err_blocks.c:err_get_slot
Line
Count
Source
14
284M
{
15
284M
    es->top = (es->top + 1) % ERR_NUM_ERRORS;
16
284M
    if (es->top == es->bottom)
17
33.8M
        es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS;
18
284M
}
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.68G
{
22
1.68G
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
686M
        if (deall) {
24
72.1k
            OPENSSL_free(es->err_data[i]);
25
72.1k
            es->err_data[i] = NULL;
26
72.1k
            es->err_data_size[i] = 0;
27
72.1k
            es->err_data_flags[i] = 0;
28
686M
        } else if (es->err_data[i] != NULL) {
29
686M
            es->err_data[i][0] = '\0';
30
686M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
686M
        }
32
996M
    } else {
33
996M
        es->err_data[i] = NULL;
34
996M
        es->err_data_size[i] = 0;
35
996M
        es->err_data_flags[i] = 0;
36
996M
    }
37
1.68G
}
err.c:err_clear_data
Line
Count
Source
21
1.11G
{
22
1.11G
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
122M
        if (deall) {
24
72.1k
            OPENSSL_free(es->err_data[i]);
25
72.1k
            es->err_data[i] = NULL;
26
72.1k
            es->err_data_size[i] = 0;
27
72.1k
            es->err_data_flags[i] = 0;
28
122M
        } else if (es->err_data[i] != NULL) {
29
122M
            es->err_data[i][0] = '\0';
30
122M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
122M
        }
32
990M
    } else {
33
        es->err_data[i] = NULL;
34
990M
        es->err_data_size[i] = 0;
35
990M
        es->err_data_flags[i] = 0;
36
990M
    }
37
1.11G
}
err_blocks.c:err_clear_data
Line
Count
Source
21
569M
{
22
569M
    if (es->err_data_flags[i] & ERR_TXT_MALLOCED) {
23
563M
        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
563M
        } else if (es->err_data[i] != NULL) {
29
563M
            es->err_data[i][0] = '\0';
30
563M
            es->err_data_flags[i] = ERR_TXT_MALLOCED;
31
563M
        }
32
563M
    } else {
33
        es->err_data[i] = NULL;
34
5.79M
        es->err_data_size[i] = 0;
35
5.79M
        es->err_data_flags[i] = 0;
36
5.79M
    }
37
569M
}
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
284M
{
42
284M
    es->err_buffer[i] = lib == ERR_LIB_SYS
43
284M
        ? (unsigned int)(ERR_SYSTEM_FLAG | reason)
44
284M
        : ERR_PACK(lib, 0, reason);
45
284M
}
Unexecuted instantiation: err.c:err_set_error
err_blocks.c:err_set_error
Line
Count
Source
41
284M
{
42
284M
    es->err_buffer[i] = lib == ERR_LIB_SYS
43
284M
        ? (unsigned int)(ERR_SYSTEM_FLAG | reason)
44
284M
        : ERR_PACK(lib, 0, reason);
45
284M
}
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
24.4M
{
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
24.4M
    OPENSSL_free(es->err_file[i]);
56
24.4M
    if (file == NULL || file[0] == '\0')
57
0
        es->err_file[i] = NULL;
58
24.4M
    else
59
24.4M
        es->err_file[i] = OPENSSL_strdup(file);
60
24.4M
    es->err_line[i] = line;
61
24.4M
    OPENSSL_free(es->err_func[i]);
62
24.4M
    if (fn == NULL || fn[0] == '\0')
63
0
        es->err_func[i] = NULL;
64
24.4M
    else
65
24.4M
        es->err_func[i] = OPENSSL_strdup(fn);
66
24.4M
}
Unexecuted instantiation: err.c:err_set_debug
err_blocks.c:err_set_debug
Line
Count
Source
50
24.4M
{
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
24.4M
    OPENSSL_free(es->err_file[i]);
56
24.4M
    if (file == NULL || file[0] == '\0')
57
0
        es->err_file[i] = NULL;
58
24.4M
    else
59
24.4M
        es->err_file[i] = OPENSSL_strdup(file);
60
24.4M
    es->err_line[i] = line;
61
24.4M
    OPENSSL_free(es->err_func[i]);
62
24.4M
    if (fn == NULL || fn[0] == '\0')
63
0
        es->err_func[i] = NULL;
64
24.4M
    else
65
24.4M
        es->err_func[i] = OPENSSL_strdup(fn);
66
24.4M
}
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
21.0M
{
71
21.0M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
72
17.2M
        OPENSSL_free(es->err_data[i]);
73
21.0M
    es->err_data[i] = data;
74
21.0M
    es->err_data_size[i] = datasz;
75
21.0M
    es->err_data_flags[i] = flags;
76
21.0M
}
err.c:err_set_data
Line
Count
Source
70
17.2M
{
71
17.2M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
72
17.2M
        OPENSSL_free(es->err_data[i]);
73
17.2M
    es->err_data[i] = data;
74
17.2M
    es->err_data_size[i] = datasz;
75
17.2M
    es->err_data_flags[i] = flags;
76
17.2M
}
err_blocks.c:err_set_data
Line
Count
Source
70
3.73M
{
71
3.73M
    if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0)
72
0
        OPENSSL_free(es->err_data[i]);
73
3.73M
    es->err_data[i] = data;
74
3.73M
    es->err_data_size[i] = datasz;
75
3.73M
    es->err_data_flags[i] = flags;
76
3.73M
}
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.38G
{
80
1.38G
    err_clear_data(es, i, (deall));
81
1.38G
    es->err_marks[i] = 0;
82
1.38G
    es->err_flags[i] = 0;
83
1.38G
    es->err_buffer[i] = 0;
84
1.38G
    es->err_line[i] = -1;
85
1.38G
    OPENSSL_free(es->err_file[i]);
86
1.38G
    es->err_file[i] = NULL;
87
1.38G
    OPENSSL_free(es->err_func[i]);
88
    es->err_func[i] = NULL;
89
1.38G
}
err.c:err_clear
Line
Count
Source
79
1.09G
{
80
1.09G
    err_clear_data(es, i, (deall));
81
1.09G
    es->err_marks[i] = 0;
82
1.09G
    es->err_flags[i] = 0;
83
1.09G
    es->err_buffer[i] = 0;
84
1.09G
    es->err_line[i] = -1;
85
1.09G
    OPENSSL_free(es->err_file[i]);
86
1.09G
    es->err_file[i] = NULL;
87
1.09G
    OPENSSL_free(es->err_func[i]);
88
    es->err_func[i] = NULL;
89
1.09G
}
err_blocks.c:err_clear
Line
Count
Source
79
284M
{
80
284M
    err_clear_data(es, i, (deall));
81
284M
    es->err_marks[i] = 0;
82
284M
    es->err_flags[i] = 0;
83
284M
    es->err_buffer[i] = 0;
84
284M
    es->err_line[i] = -1;
85
284M
    OPENSSL_free(es->err_file[i]);
86
284M
    es->err_file[i] = NULL;
87
284M
    OPENSSL_free(es->err_func[i]);
88
    es->err_func[i] = NULL;
89
284M
}
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);