/src/openssl34/crypto/err/err_local.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 1995-2023 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 <string.h> |
11 | | #include <openssl/err.h> |
12 | | #include <openssl/e_os2.h> |
13 | | |
14 | | static ossl_inline void err_get_slot(ERR_STATE *es) |
15 | 476M | { |
16 | 476M | es->top = (es->top + 1) % ERR_NUM_ERRORS; |
17 | 476M | if (es->top == es->bottom) |
18 | 32.2M | es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS; |
19 | 476M | } Unexecuted instantiation: err.c:err_get_slot err_blocks.c:err_get_slot Line | Count | Source | 15 | 476M | { | 16 | 476M | es->top = (es->top + 1) % ERR_NUM_ERRORS; | 17 | 476M | if (es->top == es->bottom) | 18 | 32.2M | es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS; | 19 | 476M | } |
Line | Count | Source | 15 | 67.1k | { | 16 | 67.1k | es->top = (es->top + 1) % ERR_NUM_ERRORS; | 17 | 67.1k | if (es->top == es->bottom) | 18 | 4.76k | es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS; | 19 | 67.1k | } |
Unexecuted instantiation: err_mark.c:err_get_slot Unexecuted instantiation: err_prn.c:err_get_slot |
20 | | |
21 | | static ossl_inline void err_clear_data(ERR_STATE *es, size_t i, int deall) |
22 | 2.45G | { |
23 | 2.45G | if (es->err_data_flags[i] & ERR_TXT_MALLOCED) { |
24 | 1.50G | if (deall) { |
25 | 81.4k | OPENSSL_free(es->err_data[i]); |
26 | 81.4k | es->err_data[i] = NULL; |
27 | 81.4k | es->err_data_size[i] = 0; |
28 | 81.4k | es->err_data_flags[i] = 0; |
29 | 1.50G | } else if (es->err_data[i] != NULL) { |
30 | 1.50G | es->err_data[i][0] = '\0'; |
31 | 1.50G | es->err_data_flags[i] = ERR_TXT_MALLOCED; |
32 | 1.50G | } |
33 | 1.50G | } else { |
34 | 949M | es->err_data[i] = NULL; |
35 | 949M | es->err_data_size[i] = 0; |
36 | 949M | es->err_data_flags[i] = 0; |
37 | 949M | } |
38 | 2.45G | } Line | Count | Source | 22 | 1.06G | { | 23 | 1.06G | if (es->err_data_flags[i] & ERR_TXT_MALLOCED) { | 24 | 125M | if (deall) { | 25 | 81.4k | OPENSSL_free(es->err_data[i]); | 26 | 81.4k | es->err_data[i] = NULL; | 27 | 81.4k | es->err_data_size[i] = 0; | 28 | 81.4k | es->err_data_flags[i] = 0; | 29 | 125M | } else if (es->err_data[i] != NULL) { | 30 | 125M | es->err_data[i][0] = '\0'; | 31 | 125M | es->err_data_flags[i] = ERR_TXT_MALLOCED; | 32 | 125M | } | 33 | 936M | } else { | 34 | | es->err_data[i] = NULL; | 35 | 936M | es->err_data_size[i] = 0; | 36 | 936M | es->err_data_flags[i] = 0; | 37 | 936M | } | 38 | 1.06G | } |
err_blocks.c:err_clear_data Line | Count | Source | 22 | 953M | { | 23 | 953M | if (es->err_data_flags[i] & ERR_TXT_MALLOCED) { | 24 | 943M | if (deall) { | 25 | 0 | OPENSSL_free(es->err_data[i]); | 26 | 0 | es->err_data[i] = NULL; | 27 | 0 | es->err_data_size[i] = 0; | 28 | 0 | es->err_data_flags[i] = 0; | 29 | 943M | } else if (es->err_data[i] != NULL) { | 30 | 943M | es->err_data[i][0] = '\0'; | 31 | 943M | es->err_data_flags[i] = ERR_TXT_MALLOCED; | 32 | 943M | } | 33 | 943M | } else { | 34 | | es->err_data[i] = NULL; | 35 | 9.83M | es->err_data_size[i] = 0; | 36 | 9.83M | es->err_data_flags[i] = 0; | 37 | 9.83M | } | 38 | 953M | } |
err_save.c:err_clear_data Line | Count | Source | 22 | 703k | { | 23 | 703k | if (es->err_data_flags[i] & ERR_TXT_MALLOCED) { | 24 | 4.59k | if (deall) { | 25 | 0 | OPENSSL_free(es->err_data[i]); | 26 | 0 | es->err_data[i] = NULL; | 27 | 0 | es->err_data_size[i] = 0; | 28 | 0 | es->err_data_flags[i] = 0; | 29 | 4.59k | } else if (es->err_data[i] != NULL) { | 30 | 4.59k | es->err_data[i][0] = '\0'; | 31 | 4.59k | es->err_data_flags[i] = ERR_TXT_MALLOCED; | 32 | 4.59k | } | 33 | 698k | } else { | 34 | | es->err_data[i] = NULL; | 35 | 698k | es->err_data_size[i] = 0; | 36 | 698k | es->err_data_flags[i] = 0; | 37 | 698k | } | 38 | 703k | } |
err_mark.c:err_clear_data Line | Count | Source | 22 | 441M | { | 23 | 441M | if (es->err_data_flags[i] & ERR_TXT_MALLOCED) { | 24 | 438M | if (deall) { | 25 | 0 | OPENSSL_free(es->err_data[i]); | 26 | 0 | es->err_data[i] = NULL; | 27 | 0 | es->err_data_size[i] = 0; | 28 | 0 | es->err_data_flags[i] = 0; | 29 | 438M | } else if (es->err_data[i] != NULL) { | 30 | 438M | es->err_data[i][0] = '\0'; | 31 | 438M | es->err_data_flags[i] = ERR_TXT_MALLOCED; | 32 | 438M | } | 33 | 438M | } else { | 34 | | es->err_data[i] = NULL; | 35 | 2.63M | es->err_data_size[i] = 0; | 36 | 2.63M | es->err_data_flags[i] = 0; | 37 | 2.63M | } | 38 | 441M | } |
Unexecuted instantiation: err_prn.c:err_clear_data |
39 | | |
40 | | static ossl_inline void err_set_error(ERR_STATE *es, size_t i, |
41 | | int lib, int reason) |
42 | 476M | { |
43 | 476M | es->err_buffer[i] = lib == ERR_LIB_SYS |
44 | 476M | ? (unsigned int)(ERR_SYSTEM_FLAG | reason) |
45 | 476M | : ERR_PACK(lib, 0, reason); |
46 | 476M | } Unexecuted instantiation: err.c:err_set_error err_blocks.c:err_set_error Line | Count | Source | 42 | 476M | { | 43 | 476M | es->err_buffer[i] = lib == ERR_LIB_SYS | 44 | 476M | ? (unsigned int)(ERR_SYSTEM_FLAG | reason) | 45 | 476M | : ERR_PACK(lib, 0, reason); | 46 | 476M | } |
Unexecuted instantiation: err_save.c:err_set_error Unexecuted instantiation: err_mark.c:err_set_error 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 | 476M | { |
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 | 476M | OPENSSL_free(es->err_file[i]); |
57 | 476M | if (file == NULL || file[0] == '\0') |
58 | 0 | es->err_file[i] = NULL; |
59 | 476M | else if ((es->err_file[i] = CRYPTO_malloc(strlen(file) + 1, |
60 | 476M | NULL, 0)) |
61 | 476M | != NULL) |
62 | | /* We cannot use OPENSSL_strdup due to possible recursion */ |
63 | 476M | strcpy(es->err_file[i], file); |
64 | | |
65 | 476M | es->err_line[i] = line; |
66 | 476M | OPENSSL_free(es->err_func[i]); |
67 | 476M | if (fn == NULL || fn[0] == '\0') |
68 | 8.86k | es->err_func[i] = NULL; |
69 | 476M | else if ((es->err_func[i] = CRYPTO_malloc(strlen(fn) + 1, |
70 | 476M | NULL, 0)) |
71 | 476M | != NULL) |
72 | 476M | strcpy(es->err_func[i], fn); |
73 | 476M | } Unexecuted instantiation: err.c:err_set_debug err_blocks.c:err_set_debug Line | Count | Source | 51 | 476M | { | 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 | 476M | OPENSSL_free(es->err_file[i]); | 57 | 476M | if (file == NULL || file[0] == '\0') | 58 | 0 | es->err_file[i] = NULL; | 59 | 476M | else if ((es->err_file[i] = CRYPTO_malloc(strlen(file) + 1, | 60 | 476M | NULL, 0)) | 61 | 476M | != NULL) | 62 | | /* We cannot use OPENSSL_strdup due to possible recursion */ | 63 | 476M | strcpy(es->err_file[i], file); | 64 | | | 65 | 476M | es->err_line[i] = line; | 66 | 476M | OPENSSL_free(es->err_func[i]); | 67 | 476M | if (fn == NULL || fn[0] == '\0') | 68 | 8.86k | es->err_func[i] = NULL; | 69 | 476M | else if ((es->err_func[i] = CRYPTO_malloc(strlen(fn) + 1, | 70 | 476M | NULL, 0)) | 71 | 476M | != NULL) | 72 | 476M | strcpy(es->err_func[i], fn); | 73 | 476M | } |
Line | Count | Source | 51 | 67.1k | { | 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 | 67.1k | OPENSSL_free(es->err_file[i]); | 57 | 67.1k | if (file == NULL || file[0] == '\0') | 58 | 0 | es->err_file[i] = NULL; | 59 | 67.1k | else if ((es->err_file[i] = CRYPTO_malloc(strlen(file) + 1, | 60 | 67.1k | NULL, 0)) | 61 | 67.1k | != NULL) | 62 | | /* We cannot use OPENSSL_strdup due to possible recursion */ | 63 | 67.1k | strcpy(es->err_file[i], file); | 64 | | | 65 | 67.1k | es->err_line[i] = line; | 66 | 67.1k | OPENSSL_free(es->err_func[i]); | 67 | 67.1k | if (fn == NULL || fn[0] == '\0') | 68 | 0 | es->err_func[i] = NULL; | 69 | 67.1k | else if ((es->err_func[i] = CRYPTO_malloc(strlen(fn) + 1, | 70 | 67.1k | NULL, 0)) | 71 | 67.1k | != NULL) | 72 | 67.1k | strcpy(es->err_func[i], fn); | 73 | 67.1k | } |
Unexecuted instantiation: err_mark.c:err_set_debug Unexecuted instantiation: err_prn.c:err_set_debug |
74 | | |
75 | | static ossl_inline void err_set_data(ERR_STATE *es, size_t i, |
76 | | void *data, size_t datasz, int flags) |
77 | 20.7M | { |
78 | 20.7M | if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0) |
79 | 16.8M | OPENSSL_free(es->err_data[i]); |
80 | 20.7M | es->err_data[i] = data; |
81 | 20.7M | es->err_data_size[i] = datasz; |
82 | 20.7M | es->err_data_flags[i] = flags; |
83 | 20.7M | } Line | Count | Source | 77 | 16.8M | { | 78 | 16.8M | if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0) | 79 | 16.8M | OPENSSL_free(es->err_data[i]); | 80 | 16.8M | es->err_data[i] = data; | 81 | 16.8M | es->err_data_size[i] = datasz; | 82 | 16.8M | es->err_data_flags[i] = flags; | 83 | 16.8M | } |
err_blocks.c:err_set_data Line | Count | Source | 77 | 3.87M | { | 78 | 3.87M | if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0) | 79 | 0 | OPENSSL_free(es->err_data[i]); | 80 | 3.87M | es->err_data[i] = data; | 81 | 3.87M | es->err_data_size[i] = datasz; | 82 | 3.87M | es->err_data_flags[i] = flags; | 83 | 3.87M | } |
Line | Count | Source | 77 | 57.7k | { | 78 | 57.7k | if ((es->err_data_flags[i] & ERR_TXT_MALLOCED) != 0) | 79 | 2.56k | OPENSSL_free(es->err_data[i]); | 80 | 57.7k | es->err_data[i] = data; | 81 | 57.7k | es->err_data_size[i] = datasz; | 82 | 57.7k | es->err_data_flags[i] = flags; | 83 | 57.7k | } |
Unexecuted instantiation: err_mark.c:err_set_data Unexecuted instantiation: err_prn.c:err_set_data |
84 | | |
85 | | static ossl_inline void err_clear(ERR_STATE *es, size_t i, int deall) |
86 | 1.96G | { |
87 | 1.96G | err_clear_data(es, i, (deall)); |
88 | 1.96G | es->err_marks[i] = 0; |
89 | 1.96G | es->err_flags[i] = 0; |
90 | 1.96G | es->err_buffer[i] = 0; |
91 | 1.96G | es->err_line[i] = -1; |
92 | 1.96G | OPENSSL_free(es->err_file[i]); |
93 | 1.96G | es->err_file[i] = NULL; |
94 | 1.96G | OPENSSL_free(es->err_func[i]); |
95 | | es->err_func[i] = NULL; |
96 | 1.96G | } Line | Count | Source | 86 | 1.04G | { | 87 | 1.04G | err_clear_data(es, i, (deall)); | 88 | 1.04G | es->err_marks[i] = 0; | 89 | 1.04G | es->err_flags[i] = 0; | 90 | 1.04G | es->err_buffer[i] = 0; | 91 | 1.04G | es->err_line[i] = -1; | 92 | 1.04G | OPENSSL_free(es->err_file[i]); | 93 | 1.04G | es->err_file[i] = NULL; | 94 | 1.04G | OPENSSL_free(es->err_func[i]); | 95 | | es->err_func[i] = NULL; | 96 | 1.04G | } |
Line | Count | Source | 86 | 476M | { | 87 | 476M | err_clear_data(es, i, (deall)); | 88 | 476M | es->err_marks[i] = 0; | 89 | 476M | es->err_flags[i] = 0; | 90 | 476M | es->err_buffer[i] = 0; | 91 | 476M | es->err_line[i] = -1; | 92 | 476M | OPENSSL_free(es->err_file[i]); | 93 | 476M | es->err_file[i] = NULL; | 94 | 476M | OPENSSL_free(es->err_func[i]); | 95 | | es->err_func[i] = NULL; | 96 | 476M | } |
Line | Count | Source | 86 | 693k | { | 87 | 693k | err_clear_data(es, i, (deall)); | 88 | 693k | es->err_marks[i] = 0; | 89 | 693k | es->err_flags[i] = 0; | 90 | 693k | es->err_buffer[i] = 0; | 91 | 693k | es->err_line[i] = -1; | 92 | 693k | OPENSSL_free(es->err_file[i]); | 93 | 693k | es->err_file[i] = NULL; | 94 | 693k | OPENSSL_free(es->err_func[i]); | 95 | | es->err_func[i] = NULL; | 96 | 693k | } |
Line | Count | Source | 86 | 441M | { | 87 | 441M | err_clear_data(es, i, (deall)); | 88 | 441M | es->err_marks[i] = 0; | 89 | 441M | es->err_flags[i] = 0; | 90 | 441M | es->err_buffer[i] = 0; | 91 | 441M | es->err_line[i] = -1; | 92 | 441M | OPENSSL_free(es->err_file[i]); | 93 | 441M | es->err_file[i] = NULL; | 94 | 441M | OPENSSL_free(es->err_func[i]); | 95 | | es->err_func[i] = NULL; | 96 | 441M | } |
Unexecuted instantiation: err_prn.c:err_clear |
97 | | |
98 | | ERR_STATE *ossl_err_get_state_int(void); |
99 | | void ossl_err_string_int(unsigned long e, const char *func, |
100 | | char *buf, size_t len); |