Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/ex_data.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | struct st_CRYPTO_EX_DATA_IMPL { | - | ||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | int (*cb_new_class)(void); | - | ||||||||||||||||||
9 | - | |||||||||||||||||||
10 | void (*cb_cleanup)(void); | - | ||||||||||||||||||
11 | - | |||||||||||||||||||
12 | - | |||||||||||||||||||
13 | - | |||||||||||||||||||
14 | int (*cb_get_new_index)(int class_index, long argl, void *argp, | - | ||||||||||||||||||
15 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, | - | ||||||||||||||||||
16 | CRYPTO_EX_free *free_func); | - | ||||||||||||||||||
17 | - | |||||||||||||||||||
18 | int (*cb_new_ex_data)(int class_index, void *obj, | - | ||||||||||||||||||
19 | CRYPTO_EX_DATA *ad); | - | ||||||||||||||||||
20 | - | |||||||||||||||||||
21 | int (*cb_dup_ex_data)(int class_index, CRYPTO_EX_DATA *to, | - | ||||||||||||||||||
22 | CRYPTO_EX_DATA *from); | - | ||||||||||||||||||
23 | - | |||||||||||||||||||
24 | void (*cb_free_ex_data)(int class_index, void *obj, | - | ||||||||||||||||||
25 | CRYPTO_EX_DATA *ad); | - | ||||||||||||||||||
26 | }; | - | ||||||||||||||||||
27 | - | |||||||||||||||||||
28 | - | |||||||||||||||||||
29 | static const CRYPTO_EX_DATA_IMPL *impl = | - | ||||||||||||||||||
30 | ((void *)0) | - | ||||||||||||||||||
31 | ; | - | ||||||||||||||||||
32 | - | |||||||||||||||||||
33 | - | |||||||||||||||||||
34 | - | |||||||||||||||||||
35 | - | |||||||||||||||||||
36 | - | |||||||||||||||||||
37 | - | |||||||||||||||||||
38 | - | |||||||||||||||||||
39 | static int int_new_class(void); | - | ||||||||||||||||||
40 | static void int_cleanup(void); | - | ||||||||||||||||||
41 | static int int_get_new_index(int class_index, long argl, void *argp, | - | ||||||||||||||||||
42 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, | - | ||||||||||||||||||
43 | CRYPTO_EX_free *free_func); | - | ||||||||||||||||||
44 | static int int_new_ex_data(int class_index, void *obj, | - | ||||||||||||||||||
45 | CRYPTO_EX_DATA *ad); | - | ||||||||||||||||||
46 | static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, | - | ||||||||||||||||||
47 | CRYPTO_EX_DATA *from); | - | ||||||||||||||||||
48 | static void int_free_ex_data(int class_index, void *obj, | - | ||||||||||||||||||
49 | CRYPTO_EX_DATA *ad); | - | ||||||||||||||||||
50 | - | |||||||||||||||||||
51 | static CRYPTO_EX_DATA_IMPL impl_default = { | - | ||||||||||||||||||
52 | int_new_class, | - | ||||||||||||||||||
53 | int_cleanup, | - | ||||||||||||||||||
54 | int_get_new_index, | - | ||||||||||||||||||
55 | int_new_ex_data, | - | ||||||||||||||||||
56 | int_dup_ex_data, | - | ||||||||||||||||||
57 | int_free_ex_data | - | ||||||||||||||||||
58 | }; | - | ||||||||||||||||||
59 | - | |||||||||||||||||||
60 | - | |||||||||||||||||||
61 | - | |||||||||||||||||||
62 | static void | - | ||||||||||||||||||
63 | impl_check(void) | - | ||||||||||||||||||
64 | { | - | ||||||||||||||||||
65 | CRYPTO_lock(1|8,2,__FILE__,204); | - | ||||||||||||||||||
66 | if (!impl
| 0-553 | ||||||||||||||||||
67 | impl = &impl_default; executed 553 times by 31 tests: impl = &impl_default; Executed by:
| 553 | ||||||||||||||||||
68 | CRYPTO_lock(2|8,2,__FILE__,207); | - | ||||||||||||||||||
69 | } executed 553 times by 31 tests: end of block Executed by:
| 553 | ||||||||||||||||||
70 | - | |||||||||||||||||||
71 | - | |||||||||||||||||||
72 | - | |||||||||||||||||||
73 | - | |||||||||||||||||||
74 | - | |||||||||||||||||||
75 | const CRYPTO_EX_DATA_IMPL * | - | ||||||||||||||||||
76 | CRYPTO_get_ex_data_implementation(void) | - | ||||||||||||||||||
77 | { | - | ||||||||||||||||||
78 | if(!impl
never executed: impl_check(); | 0 | ||||||||||||||||||
79 | return never executed: impl;return impl; never executed: return impl; | 0 | ||||||||||||||||||
80 | } | - | ||||||||||||||||||
81 | - | |||||||||||||||||||
82 | int | - | ||||||||||||||||||
83 | CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i) | - | ||||||||||||||||||
84 | { | - | ||||||||||||||||||
85 | int toret = 0; | - | ||||||||||||||||||
86 | CRYPTO_lock(1|8,2,__FILE__,225); | - | ||||||||||||||||||
87 | if (!impl
| 0 | ||||||||||||||||||
88 | impl = i; | - | ||||||||||||||||||
89 | toret = 1; | - | ||||||||||||||||||
90 | } never executed: end of block | 0 | ||||||||||||||||||
91 | CRYPTO_lock(2|8,2,__FILE__,230); | - | ||||||||||||||||||
92 | return never executed: toret;return toret; never executed: return toret; | 0 | ||||||||||||||||||
93 | } | - | ||||||||||||||||||
94 | typedef struct st_ex_class_item { | - | ||||||||||||||||||
95 | int class_index; | - | ||||||||||||||||||
96 | struct stack_st_CRYPTO_EX_DATA_FUNCS *meth; | - | ||||||||||||||||||
97 | int meth_num; | - | ||||||||||||||||||
98 | } EX_CLASS_ITEM; | - | ||||||||||||||||||
99 | - | |||||||||||||||||||
100 | - | |||||||||||||||||||
101 | static int ex_class = 100; | - | ||||||||||||||||||
102 | - | |||||||||||||||||||
103 | - | |||||||||||||||||||
104 | struct lhash_st_EX_CLASS_ITEM { int dummy; }; | - | ||||||||||||||||||
105 | static struct lhash_st_EX_CLASS_ITEM *ex_data = | - | ||||||||||||||||||
106 | ((void *)0) | - | ||||||||||||||||||
107 | ; | - | ||||||||||||||||||
108 | - | |||||||||||||||||||
109 | - | |||||||||||||||||||
110 | static unsigned long | - | ||||||||||||||||||
111 | ex_class_item_hash(const EX_CLASS_ITEM *a) | - | ||||||||||||||||||
112 | { | - | ||||||||||||||||||
113 | return executed 10277 times by 29 tests: a->class_index;return a->class_index; Executed by:
executed 10277 times by 29 tests: return a->class_index; Executed by:
| 10277 | ||||||||||||||||||
114 | } | - | ||||||||||||||||||
115 | - | |||||||||||||||||||
116 | static unsigned long ex_class_item_LHASH_HASH(const void *arg) { const EX_CLASS_ITEM *a = arg; return executed 10277 times by 29 tests: ex_class_item_hash(a);return ex_class_item_hash(a); Executed by:
executed 10277 times by 29 tests: }return ex_class_item_hash(a); Executed by:
| 10277 | ||||||||||||||||||
117 | - | |||||||||||||||||||
118 | static int | - | ||||||||||||||||||
119 | ex_class_item_cmp(const EX_CLASS_ITEM *a, const EX_CLASS_ITEM *b) | - | ||||||||||||||||||
120 | { | - | ||||||||||||||||||
121 | return executed 8177 times by 28 tests: a->class_index - b->class_index;return a->class_index - b->class_index; Executed by:
executed 8177 times by 28 tests: return a->class_index - b->class_index; Executed by:
| 8177 | ||||||||||||||||||
122 | } | - | ||||||||||||||||||
123 | - | |||||||||||||||||||
124 | static int ex_class_item_LHASH_COMP(const void *arg1, const void *arg2) { const EX_CLASS_ITEM *a = arg1; const EX_CLASS_ITEM *b = arg2; return executed 8177 times by 28 tests: ex_class_item_cmp(a,b);return ex_class_item_cmp(a,b); Executed by:
executed 8177 times by 28 tests: }return ex_class_item_cmp(a,b); Executed by:
| 8177 | ||||||||||||||||||
125 | - | |||||||||||||||||||
126 | - | |||||||||||||||||||
127 | - | |||||||||||||||||||
128 | - | |||||||||||||||||||
129 | static int | - | ||||||||||||||||||
130 | ex_data_check(void) | - | ||||||||||||||||||
131 | { | - | ||||||||||||||||||
132 | int toret = 1; | - | ||||||||||||||||||
133 | CRYPTO_lock(1|8,2,__FILE__,278); | - | ||||||||||||||||||
134 | if (!ex_data
| 0-553 | ||||||||||||||||||
135 | (
| 0-553 | ||||||||||||||||||
136 | ((void *)0)
| 0-553 | ||||||||||||||||||
137 | ) | - | ||||||||||||||||||
138 | toret = 0; never executed: toret = 0; | 0 | ||||||||||||||||||
139 | CRYPTO_lock(2|8,2,__FILE__,282); | - | ||||||||||||||||||
140 | return executed 553 times by 31 tests: toret;return toret; Executed by:
executed 553 times by 31 tests: return toret; Executed by:
| 553 | ||||||||||||||||||
141 | } | - | ||||||||||||||||||
142 | - | |||||||||||||||||||
143 | - | |||||||||||||||||||
144 | - | |||||||||||||||||||
145 | - | |||||||||||||||||||
146 | - | |||||||||||||||||||
147 | static void | - | ||||||||||||||||||
148 | def_cleanup_util_cb(CRYPTO_EX_DATA_FUNCS *funcs) | - | ||||||||||||||||||
149 | { | - | ||||||||||||||||||
150 | free(funcs); | - | ||||||||||||||||||
151 | } executed 52 times by 2 tests: end of block Executed by:
| 52 | ||||||||||||||||||
152 | - | |||||||||||||||||||
153 | - | |||||||||||||||||||
154 | - | |||||||||||||||||||
155 | - | |||||||||||||||||||
156 | static void | - | ||||||||||||||||||
157 | def_cleanup_cb(void *a_void) | - | ||||||||||||||||||
158 | { | - | ||||||||||||||||||
159 | EX_CLASS_ITEM *item = (EX_CLASS_ITEM *)a_void; | - | ||||||||||||||||||
160 | sk_pop_free(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), ((void (*)(void *)) ((1 ? (def_cleanup_util_cb) : (void (*)(CRYPTO_EX_DATA_FUNCS *))0)))); | - | ||||||||||||||||||
161 | free(item); | - | ||||||||||||||||||
162 | } executed 714 times by 7 tests: end of block Executed by:
| 714 | ||||||||||||||||||
163 | - | |||||||||||||||||||
164 | - | |||||||||||||||||||
165 | - | |||||||||||||||||||
166 | static EX_CLASS_ITEM * | - | ||||||||||||||||||
167 | def_get_class(int class_index) | - | ||||||||||||||||||
168 | { | - | ||||||||||||||||||
169 | EX_CLASS_ITEM d, *p, *gen; | - | ||||||||||||||||||
170 | if(!ex_data
never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0-8676 | ||||||||||||||||||
171 | (( never executed: return ((void *)0) ; never executed: void *)0)return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
172 | ; never executed: }return ((void *)0) ; | 0 | ||||||||||||||||||
173 | d.class_index = class_index; | - | ||||||||||||||||||
174 | if (!OPENSSL_init_crypto(0,
| 0-9227 | ||||||||||||||||||
175 | ((void *)0)
| 0-9227 | ||||||||||||||||||
176 | )
| 0-9227 | ||||||||||||||||||
177 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
178 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
179 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
180 | CRYPTO_lock(1|8,2,__FILE__,317); | - | ||||||||||||||||||
181 | p = ((EX_CLASS_ITEM *)lh_retrieve(((_LHASH *)((void*) (1 ? ex_data : (struct lhash_st_EX_CLASS_ITEM*)0))), ((void*) (1 ? &d : (EX_CLASS_ITEM*)0)))); | - | ||||||||||||||||||
182 | if (!p
| 1050-8177 | ||||||||||||||||||
183 | gen = malloc(sizeof(EX_CLASS_ITEM)); | - | ||||||||||||||||||
184 | if (gen
| 0-1050 | ||||||||||||||||||
185 | gen->class_index = class_index; | - | ||||||||||||||||||
186 | gen->meth_num = 0; | - | ||||||||||||||||||
187 | gen->meth = ((struct stack_st_CRYPTO_EX_DATA_FUNCS *)sk_new_null()); | - | ||||||||||||||||||
188 | if (!gen->meth
| 0-1050 | ||||||||||||||||||
189 | free(gen); never executed: free(gen); | 0 | ||||||||||||||||||
190 | else { | - | ||||||||||||||||||
191 | - | |||||||||||||||||||
192 | - | |||||||||||||||||||
193 | (void)((EX_CLASS_ITEM *)lh_insert(((_LHASH *)((void*) (1 ? ex_data : (struct lhash_st_EX_CLASS_ITEM*)0))), ((void*) (1 ? gen : (EX_CLASS_ITEM*)0)))); | - | ||||||||||||||||||
194 | p = gen; | - | ||||||||||||||||||
195 | } executed 1050 times by 29 tests: end of block Executed by:
| 1050 | ||||||||||||||||||
196 | } | - | ||||||||||||||||||
197 | } executed 1050 times by 29 tests: end of block Executed by:
| 1050 | ||||||||||||||||||
198 | CRYPTO_lock(2|8,2,__FILE__,335); | - | ||||||||||||||||||
199 | if (!p
| 0-9227 | ||||||||||||||||||
200 | ERR_put_error(15,(0xfff),((1|64)),__FILE__,337); never executed: ERR_put_error(15,(0xfff),((1|64)),__FILE__,337); | 0 | ||||||||||||||||||
201 | return executed 9227 times by 29 tests: p;return p; Executed by:
executed 9227 times by 29 tests: return p; Executed by:
| 9227 | ||||||||||||||||||
202 | } | - | ||||||||||||||||||
203 | - | |||||||||||||||||||
204 | - | |||||||||||||||||||
205 | - | |||||||||||||||||||
206 | static int | - | ||||||||||||||||||
207 | def_add_index(EX_CLASS_ITEM *item, long argl, void *argp, | - | ||||||||||||||||||
208 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | - | ||||||||||||||||||
209 | { | - | ||||||||||||||||||
210 | int toret = -1; | - | ||||||||||||||||||
211 | CRYPTO_EX_DATA_FUNCS *a = malloc(sizeof(CRYPTO_EX_DATA_FUNCS)); | - | ||||||||||||||||||
212 | - | |||||||||||||||||||
213 | if (!a
| 0-63 | ||||||||||||||||||
214 | ERR_put_error(15,(0xfff),((1|64)),__FILE__,351); | - | ||||||||||||||||||
215 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
216 | } | - | ||||||||||||||||||
217 | a->argl = argl; | - | ||||||||||||||||||
218 | a->argp = argp; | - | ||||||||||||||||||
219 | a->new_func = new_func; | - | ||||||||||||||||||
220 | a->dup_func = dup_func; | - | ||||||||||||||||||
221 | a->free_func = free_func; | - | ||||||||||||||||||
222 | CRYPTO_lock(1|8,2,__FILE__,359); | - | ||||||||||||||||||
223 | while (sk_num(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0))) <= item->meth_num
| 63 | ||||||||||||||||||
224 | if (!sk_push(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), ((void*) (1 ? (
| 0-63 | ||||||||||||||||||
225 | ((void *)0)
| 0-63 | ||||||||||||||||||
226 | ) : (CRYPTO_EX_DATA_FUNCS*)0)))
| 0-63 | ||||||||||||||||||
227 | ERR_put_error(15,(0xfff),((1|64)),__FILE__,362); | - | ||||||||||||||||||
228 | free(a); | - | ||||||||||||||||||
229 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
230 | } | - | ||||||||||||||||||
231 | } executed 63 times by 13 tests: end of block Executed by:
| 63 | ||||||||||||||||||
232 | toret = item->meth_num++; | - | ||||||||||||||||||
233 | (void)sk_set(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), (toret), ((void*) (1 ? (a) : (CRYPTO_EX_DATA_FUNCS*)0))); | - | ||||||||||||||||||
234 | err: code before this statement executed 63 times by 13 tests: err: Executed by:
| 63 | ||||||||||||||||||
235 | CRYPTO_lock(2|8,2,__FILE__,370); | - | ||||||||||||||||||
236 | return executed 63 times by 13 tests: toret;return toret; Executed by:
executed 63 times by 13 tests: return toret; Executed by:
| 63 | ||||||||||||||||||
237 | } | - | ||||||||||||||||||
238 | - | |||||||||||||||||||
239 | - | |||||||||||||||||||
240 | - | |||||||||||||||||||
241 | - | |||||||||||||||||||
242 | static int | - | ||||||||||||||||||
243 | int_new_class(void) | - | ||||||||||||||||||
244 | { | - | ||||||||||||||||||
245 | int toret; | - | ||||||||||||||||||
246 | - | |||||||||||||||||||
247 | CRYPTO_lock(1|8,2,__FILE__,382); | - | ||||||||||||||||||
248 | toret = ex_class++; | - | ||||||||||||||||||
249 | CRYPTO_lock(2|8,2,__FILE__,384); | - | ||||||||||||||||||
250 | return never executed: toret;return toret; never executed: return toret; | 0 | ||||||||||||||||||
251 | } | - | ||||||||||||||||||
252 | - | |||||||||||||||||||
253 | static void | - | ||||||||||||||||||
254 | int_cleanup(void) | - | ||||||||||||||||||
255 | { | - | ||||||||||||||||||
256 | if(!ex_data
never executed: }return; | 0-266 | ||||||||||||||||||
257 | lh_doall(((_LHASH *)((void*) (1 ? ex_data : (struct lhash_st_EX_CLASS_ITEM*)0))), def_cleanup_cb); | - | ||||||||||||||||||
258 | lh_free(((_LHASH *)((void*) (1 ? ex_data : (struct lhash_st_EX_CLASS_ITEM*)0)))); | - | ||||||||||||||||||
259 | ex_data = | - | ||||||||||||||||||
260 | ((void *)0) | - | ||||||||||||||||||
261 | ; | - | ||||||||||||||||||
262 | impl = | - | ||||||||||||||||||
263 | ((void *)0) | - | ||||||||||||||||||
264 | ; | - | ||||||||||||||||||
265 | } executed 268 times by 9 tests: end of block Executed by:
| 268 | ||||||||||||||||||
266 | - | |||||||||||||||||||
267 | static int | - | ||||||||||||||||||
268 | int_get_new_index(int class_index, long argl, void *argp, | - | ||||||||||||||||||
269 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, | - | ||||||||||||||||||
270 | CRYPTO_EX_free *free_func) | - | ||||||||||||||||||
271 | { | - | ||||||||||||||||||
272 | EX_CLASS_ITEM *item = def_get_class(class_index); | - | ||||||||||||||||||
273 | - | |||||||||||||||||||
274 | if (!item
| 0-63 | ||||||||||||||||||
275 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
276 | return executed 63 times by 13 tests: def_add_index(item, argl, argp, new_func, dup_func, free_func);return def_add_index(item, argl, argp, new_func, dup_func, free_func); Executed by:
executed 63 times by 13 tests: return def_add_index(item, argl, argp, new_func, dup_func, free_func); Executed by:
| 63 | ||||||||||||||||||
277 | } | - | ||||||||||||||||||
278 | - | |||||||||||||||||||
279 | - | |||||||||||||||||||
280 | - | |||||||||||||||||||
281 | - | |||||||||||||||||||
282 | - | |||||||||||||||||||
283 | static int | - | ||||||||||||||||||
284 | int_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) | - | ||||||||||||||||||
285 | { | - | ||||||||||||||||||
286 | int mx, i; | - | ||||||||||||||||||
287 | void *ptr; | - | ||||||||||||||||||
288 | CRYPTO_EX_DATA_FUNCS **storage = | - | ||||||||||||||||||
289 | ((void *)0) | - | ||||||||||||||||||
290 | ; | - | ||||||||||||||||||
291 | EX_CLASS_ITEM *item = def_get_class(class_index); | - | ||||||||||||||||||
292 | - | |||||||||||||||||||
293 | if (!item
| 0-4600 | ||||||||||||||||||
294 | - | |||||||||||||||||||
295 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
296 | ad->sk = | - | ||||||||||||||||||
297 | ((void *)0) | - | ||||||||||||||||||
298 | ; | - | ||||||||||||||||||
299 | CRYPTO_lock(1|4,2,__FILE__,426); | - | ||||||||||||||||||
300 | mx = sk_num(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0))); | - | ||||||||||||||||||
301 | if (mx > 0
| 122-4478 | ||||||||||||||||||
302 | storage = reallocarray( | - | ||||||||||||||||||
303 | ((void *)0) | - | ||||||||||||||||||
304 | , mx, sizeof(CRYPTO_EX_DATA_FUNCS*)); | - | ||||||||||||||||||
305 | if (!storage
| 0-122 | ||||||||||||||||||
306 | goto never executed: skip;goto skip; never executed: goto skip; | 0 | ||||||||||||||||||
307 | for (i = 0; i < mx
| 122 | ||||||||||||||||||
308 | storage[i] = ((CRYPTO_EX_DATA_FUNCS *)sk_value(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), (i))) executed 122 times by 3 tests: storage[i] = ((CRYPTO_EX_DATA_FUNCS *)sk_value(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), (i))) ; Executed by:
| 122 | ||||||||||||||||||
309 | ; executed 122 times by 3 tests: storage[i] = ((CRYPTO_EX_DATA_FUNCS *)sk_value(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), (i))) ; Executed by:
| 122 | ||||||||||||||||||
310 | } executed 122 times by 3 tests: end of block Executed by:
| 122 | ||||||||||||||||||
311 | skip: code before this statement executed 4600 times by 29 tests: skip: Executed by:
| 4600 | ||||||||||||||||||
312 | CRYPTO_lock(2|4,2,__FILE__,437); | - | ||||||||||||||||||
313 | if ((
| 0-4478 | ||||||||||||||||||
314 | ERR_put_error(15,(0xfff),((1|64)),__FILE__,439); | - | ||||||||||||||||||
315 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
316 | } | - | ||||||||||||||||||
317 | for (i = 0; i < mx
| 122-4600 | ||||||||||||||||||
318 | if (storage[i]
| 0-122 | ||||||||||||||||||
319 | ptr = CRYPTO_get_ex_data(ad, i); | - | ||||||||||||||||||
320 | storage[i]->new_func(obj, ptr, ad, i, | - | ||||||||||||||||||
321 | storage[i]->argl, storage[i]->argp); | - | ||||||||||||||||||
322 | } never executed: end of block | 0 | ||||||||||||||||||
323 | } executed 122 times by 3 tests: end of block Executed by:
| 122 | ||||||||||||||||||
324 | free(storage); | - | ||||||||||||||||||
325 | return executed 4600 times by 29 tests: 1;return 1; Executed by:
executed 4600 times by 29 tests: return 1; Executed by:
| 4600 | ||||||||||||||||||
326 | } | - | ||||||||||||||||||
327 | - | |||||||||||||||||||
328 | - | |||||||||||||||||||
329 | static int | - | ||||||||||||||||||
330 | int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from) | - | ||||||||||||||||||
331 | { | - | ||||||||||||||||||
332 | int mx, j, i; | - | ||||||||||||||||||
333 | char *ptr; | - | ||||||||||||||||||
334 | CRYPTO_EX_DATA_FUNCS **storage = | - | ||||||||||||||||||
335 | ((void *)0) | - | ||||||||||||||||||
336 | ; | - | ||||||||||||||||||
337 | EX_CLASS_ITEM *item; | - | ||||||||||||||||||
338 | - | |||||||||||||||||||
339 | if (!from->sk
| 0 | ||||||||||||||||||
340 | - | |||||||||||||||||||
341 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
342 | if ((
| 0 | ||||||||||||||||||
343 | ((void *)0)
| 0 | ||||||||||||||||||
344 | ) | - | ||||||||||||||||||
345 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
346 | CRYPTO_lock(1|4,2,__FILE__,467); | - | ||||||||||||||||||
347 | mx = sk_num(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0))); | - | ||||||||||||||||||
348 | j = sk_num(((_STACK*) (1 ? (from->sk) : (struct stack_st_void*)0))); | - | ||||||||||||||||||
349 | if (j < mx
| 0 | ||||||||||||||||||
350 | mx = j; never executed: mx = j; | 0 | ||||||||||||||||||
351 | if (mx > 0
| 0 | ||||||||||||||||||
352 | storage = reallocarray( | - | ||||||||||||||||||
353 | ((void *)0) | - | ||||||||||||||||||
354 | , mx, sizeof(CRYPTO_EX_DATA_FUNCS*)); | - | ||||||||||||||||||
355 | if (!storage
| 0 | ||||||||||||||||||
356 | goto never executed: skip;goto skip; never executed: goto skip; | 0 | ||||||||||||||||||
357 | for (i = 0; i < mx
| 0 | ||||||||||||||||||
358 | storage[i] = ((CRYPTO_EX_DATA_FUNCS *)sk_value(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), (i))) never executed: storage[i] = ((CRYPTO_EX_DATA_FUNCS *)sk_value(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), (i))) ; | 0 | ||||||||||||||||||
359 | ; never executed: storage[i] = ((CRYPTO_EX_DATA_FUNCS *)sk_value(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), (i))) ; | 0 | ||||||||||||||||||
360 | } never executed: end of block | 0 | ||||||||||||||||||
361 | skip: code before this statement never executed: skip: | 0 | ||||||||||||||||||
362 | CRYPTO_lock(2|4,2,__FILE__,481); | - | ||||||||||||||||||
363 | if ((
| 0 | ||||||||||||||||||
364 | ERR_put_error(15,(0xfff),((1|64)),__FILE__,483); | - | ||||||||||||||||||
365 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
366 | } | - | ||||||||||||||||||
367 | for (i = 0; i < mx
| 0 | ||||||||||||||||||
368 | ptr = CRYPTO_get_ex_data(from, i); | - | ||||||||||||||||||
369 | if (storage[i]
| 0 | ||||||||||||||||||
370 | storage[i]->dup_func(to, from, &ptr, i, never executed: storage[i]->dup_func(to, from, &ptr, i, storage[i]->argl, storage[i]->argp); | 0 | ||||||||||||||||||
371 | storage[i]->argl, storage[i]->argp); never executed: storage[i]->dup_func(to, from, &ptr, i, storage[i]->argl, storage[i]->argp); | 0 | ||||||||||||||||||
372 | CRYPTO_set_ex_data(to, i, ptr); | - | ||||||||||||||||||
373 | } never executed: end of block | 0 | ||||||||||||||||||
374 | free(storage); | - | ||||||||||||||||||
375 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
376 | } | - | ||||||||||||||||||
377 | - | |||||||||||||||||||
378 | - | |||||||||||||||||||
379 | static void | - | ||||||||||||||||||
380 | int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) | - | ||||||||||||||||||
381 | { | - | ||||||||||||||||||
382 | int mx, i; | - | ||||||||||||||||||
383 | EX_CLASS_ITEM *item; | - | ||||||||||||||||||
384 | void *ptr; | - | ||||||||||||||||||
385 | CRYPTO_EX_DATA_FUNCS **storage = | - | ||||||||||||||||||
386 | ((void *)0) | - | ||||||||||||||||||
387 | ; | - | ||||||||||||||||||
388 | - | |||||||||||||||||||
389 | if ((
| 0-4564 | ||||||||||||||||||
390 | ((void *)0)
| 0-4564 | ||||||||||||||||||
391 | ) | - | ||||||||||||||||||
392 | return; never executed: return; | 0 | ||||||||||||||||||
393 | CRYPTO_lock(1|4,2,__FILE__,508); | - | ||||||||||||||||||
394 | mx = sk_num(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0))); | - | ||||||||||||||||||
395 | if (mx > 0
| 122-4442 | ||||||||||||||||||
396 | storage = reallocarray( | - | ||||||||||||||||||
397 | ((void *)0) | - | ||||||||||||||||||
398 | , mx, sizeof(CRYPTO_EX_DATA_FUNCS*)); | - | ||||||||||||||||||
399 | if (!storage
| 0-122 | ||||||||||||||||||
400 | goto never executed: skip;goto skip; never executed: goto skip; | 0 | ||||||||||||||||||
401 | for (i = 0; i < mx
| 122 | ||||||||||||||||||
402 | storage[i] = ((CRYPTO_EX_DATA_FUNCS *)sk_value(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), (i))) executed 122 times by 3 tests: storage[i] = ((CRYPTO_EX_DATA_FUNCS *)sk_value(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), (i))) ; Executed by:
| 122 | ||||||||||||||||||
403 | ; executed 122 times by 3 tests: storage[i] = ((CRYPTO_EX_DATA_FUNCS *)sk_value(((_STACK*) (1 ? (item->meth) : (struct stack_st_CRYPTO_EX_DATA_FUNCS*)0)), (i))) ; Executed by:
| 122 | ||||||||||||||||||
404 | } executed 122 times by 3 tests: end of block Executed by:
| 122 | ||||||||||||||||||
405 | skip: code before this statement executed 4564 times by 28 tests: skip: Executed by:
| 4564 | ||||||||||||||||||
406 | CRYPTO_lock(2|4,2,__FILE__,519); | - | ||||||||||||||||||
407 | if ((
| 0-4442 | ||||||||||||||||||
408 | ERR_put_error(15,(0xfff),((1|64)),__FILE__,521); | - | ||||||||||||||||||
409 | return; never executed: return; | 0 | ||||||||||||||||||
410 | } | - | ||||||||||||||||||
411 | for (i = 0; i < mx
| 122-4564 | ||||||||||||||||||
412 | if (storage[i]
| 0-122 | ||||||||||||||||||
413 | ptr = CRYPTO_get_ex_data(ad, i); | - | ||||||||||||||||||
414 | storage[i]->free_func(obj, ptr, ad, i, | - | ||||||||||||||||||
415 | storage[i]->argl, storage[i]->argp); | - | ||||||||||||||||||
416 | } never executed: end of block | 0 | ||||||||||||||||||
417 | } executed 122 times by 3 tests: end of block Executed by:
| 122 | ||||||||||||||||||
418 | free(storage); | - | ||||||||||||||||||
419 | if (ad->sk
| 72-4492 | ||||||||||||||||||
420 | sk_free(((_STACK*) (1 ? (ad->sk) : (struct stack_st_void*)0))); | - | ||||||||||||||||||
421 | ad->sk = | - | ||||||||||||||||||
422 | ((void *)0) | - | ||||||||||||||||||
423 | ; | - | ||||||||||||||||||
424 | } executed 72 times by 2 tests: end of block Executed by:
| 72 | ||||||||||||||||||
425 | } executed 4564 times by 28 tests: end of block Executed by:
| 4564 | ||||||||||||||||||
426 | - | |||||||||||||||||||
427 | - | |||||||||||||||||||
428 | - | |||||||||||||||||||
429 | - | |||||||||||||||||||
430 | - | |||||||||||||||||||
431 | - | |||||||||||||||||||
432 | - | |||||||||||||||||||
433 | int | - | ||||||||||||||||||
434 | CRYPTO_ex_data_new_class(void) | - | ||||||||||||||||||
435 | { | - | ||||||||||||||||||
436 | if(!impl
never executed: impl_check(); | 0 | ||||||||||||||||||
437 | return never executed: impl->cb_new_class();return impl->cb_new_class(); never executed: return impl->cb_new_class(); | 0 | ||||||||||||||||||
438 | } | - | ||||||||||||||||||
439 | - | |||||||||||||||||||
440 | - | |||||||||||||||||||
441 | - | |||||||||||||||||||
442 | - | |||||||||||||||||||
443 | - | |||||||||||||||||||
444 | void | - | ||||||||||||||||||
445 | CRYPTO_cleanup_all_ex_data(void) | - | ||||||||||||||||||
446 | { | - | ||||||||||||||||||
447 | if(!impl
executed 2 times by 2 tests: impl_check(); Executed by:
| 2-266 | ||||||||||||||||||
448 | impl->cb_cleanup(); | - | ||||||||||||||||||
449 | } executed 268 times by 9 tests: end of block Executed by:
| 268 | ||||||||||||||||||
450 | - | |||||||||||||||||||
451 | - | |||||||||||||||||||
452 | int | - | ||||||||||||||||||
453 | CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, | - | ||||||||||||||||||
454 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | - | ||||||||||||||||||
455 | { | - | ||||||||||||||||||
456 | int ret = -1; | - | ||||||||||||||||||
457 | - | |||||||||||||||||||
458 | if(!impl
executed 9 times by 9 tests: impl_check(); Executed by:
| 9-54 | ||||||||||||||||||
459 | ret = impl->cb_get_new_index(class_index, | - | ||||||||||||||||||
460 | argl, argp, new_func, dup_func, free_func); | - | ||||||||||||||||||
461 | return executed 63 times by 13 tests: ret;return ret; Executed by:
executed 63 times by 13 tests: return ret; Executed by:
| 63 | ||||||||||||||||||
462 | } | - | ||||||||||||||||||
463 | - | |||||||||||||||||||
464 | - | |||||||||||||||||||
465 | - | |||||||||||||||||||
466 | int | - | ||||||||||||||||||
467 | CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) | - | ||||||||||||||||||
468 | { | - | ||||||||||||||||||
469 | if(!impl
executed 279 times by 20 tests: impl_check(); Executed by:
| 279-4321 | ||||||||||||||||||
470 | return executed 4600 times by 29 tests: impl->cb_new_ex_data(class_index, obj, ad);return impl->cb_new_ex_data(class_index, obj, ad); Executed by:
executed 4600 times by 29 tests: return impl->cb_new_ex_data(class_index, obj, ad); Executed by:
| 4600 | ||||||||||||||||||
471 | } | - | ||||||||||||||||||
472 | - | |||||||||||||||||||
473 | - | |||||||||||||||||||
474 | - | |||||||||||||||||||
475 | int | - | ||||||||||||||||||
476 | CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from) | - | ||||||||||||||||||
477 | { | - | ||||||||||||||||||
478 | if(!impl
never executed: impl_check(); | 0 | ||||||||||||||||||
479 | return never executed: impl->cb_dup_ex_data(class_index, to, from);return impl->cb_dup_ex_data(class_index, to, from); never executed: return impl->cb_dup_ex_data(class_index, to, from); | 0 | ||||||||||||||||||
480 | } | - | ||||||||||||||||||
481 | - | |||||||||||||||||||
482 | - | |||||||||||||||||||
483 | - | |||||||||||||||||||
484 | void | - | ||||||||||||||||||
485 | CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) | - | ||||||||||||||||||
486 | { | - | ||||||||||||||||||
487 | if(!impl
executed 263 times by 4 tests: impl_check(); Executed by:
| 263-4301 | ||||||||||||||||||
488 | impl->cb_free_ex_data(class_index, obj, ad); | - | ||||||||||||||||||
489 | } executed 4564 times by 28 tests: end of block Executed by:
| 4564 | ||||||||||||||||||
490 | - | |||||||||||||||||||
491 | - | |||||||||||||||||||
492 | - | |||||||||||||||||||
493 | int | - | ||||||||||||||||||
494 | CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val) | - | ||||||||||||||||||
495 | { | - | ||||||||||||||||||
496 | int i; | - | ||||||||||||||||||
497 | - | |||||||||||||||||||
498 | if (ad->sk ==
| 0-72 | ||||||||||||||||||
499 | ((void *)0)
| 0-72 | ||||||||||||||||||
500 | ) { | - | ||||||||||||||||||
501 | if ((
| 0-72 | ||||||||||||||||||
502 | ((void *)0)
| 0-72 | ||||||||||||||||||
503 | ) { | - | ||||||||||||||||||
504 | ERR_put_error(15,(0xfff),((1|64)),__FILE__,611); | - | ||||||||||||||||||
505 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||
506 | } | - | ||||||||||||||||||
507 | } executed 72 times by 2 tests: end of block Executed by:
| 72 | ||||||||||||||||||
508 | i = sk_num(((_STACK*) (1 ? (ad->sk) : (struct stack_st_void*)0))); | - | ||||||||||||||||||
509 | - | |||||||||||||||||||
510 | while (i <= idx
| 72 | ||||||||||||||||||
511 | if (!sk_push(((_STACK*) (1 ? (ad->sk) : (struct stack_st_void*)0)), ((void*) (1 ? (
| 0-72 | ||||||||||||||||||
512 | ((void *)0)
| 0-72 | ||||||||||||||||||
513 | ) : (void*)0)))
| 0-72 | ||||||||||||||||||
514 | ERR_put_error(15,(0xfff),((1|64)),__FILE__,619); | - | ||||||||||||||||||
515 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||
516 | } | - | ||||||||||||||||||
517 | i++; | - | ||||||||||||||||||
518 | } executed 72 times by 2 tests: end of block Executed by:
| 72 | ||||||||||||||||||
519 | sk_set(((_STACK*) (1 ? (ad->sk) : (struct stack_st_void*)0)), (idx), ((void*) (1 ? (val) : (void*)0))); | - | ||||||||||||||||||
520 | return executed 72 times by 2 tests: (1);return (1); Executed by:
executed 72 times by 2 tests: return (1); Executed by:
| 72 | ||||||||||||||||||
521 | } | - | ||||||||||||||||||
522 | - | |||||||||||||||||||
523 | - | |||||||||||||||||||
524 | - | |||||||||||||||||||
525 | void * | - | ||||||||||||||||||
526 | CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) | - | ||||||||||||||||||
527 | { | - | ||||||||||||||||||
528 | if (ad->sk ==
| 0-12 | ||||||||||||||||||
529 | ((void *)0)
| 0-12 | ||||||||||||||||||
530 | ) | - | ||||||||||||||||||
531 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||
532 | else if (idx >= sk_num(((_STACK*) (1 ? (ad->sk) : (struct stack_st_void*)0)))
| 0-12 | ||||||||||||||||||
533 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||
534 | else | - | ||||||||||||||||||
535 | return executed 12 times by 1 test: (((void *)sk_value(((_STACK*) (1 ? (ad->sk) : (struct stack_st_void*)0)), (idx))));return (((void *)sk_value(((_STACK*) (1 ? (ad->sk) : (struct stack_st_void*)0)), (idx)))); Executed by:
executed 12 times by 1 test: return (((void *)sk_value(((_STACK*) (1 ? (ad->sk) : (struct stack_st_void*)0)), (idx)))); Executed by:
| 12 | ||||||||||||||||||
536 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |