Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/engine/eng_lib.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | ENGINE * | - | ||||||
7 | ENGINE_new(void) | - | ||||||
8 | { | - | ||||||
9 | ENGINE *ret; | - | ||||||
10 | - | |||||||
11 | if (!OPENSSL_init_crypto(0,
| 0-516 | ||||||
12 | ((void *)0)
| 0-516 | ||||||
13 | )
| 0-516 | ||||||
14 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||
15 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||
16 | ; never executed: return ((void *)0) ; | 0 | ||||||
17 | - | |||||||
18 | ret = malloc(sizeof(ENGINE)); | - | ||||||
19 | if (ret ==
| 0-516 | ||||||
20 | ((void *)0)
| 0-516 | ||||||
21 | ) { | - | ||||||
22 | ERR_put_error(38,(0xfff),((1|64)),__FILE__,78); | - | ||||||
23 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||
24 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||
25 | ; never executed: return ((void *)0) ; | 0 | ||||||
26 | } | - | ||||||
27 | memset(ret, 0, sizeof(ENGINE)); | - | ||||||
28 | ret->struct_ref = 1; | - | ||||||
29 | - | |||||||
30 | CRYPTO_new_ex_data(9, ret, &ret->ex_data); | - | ||||||
31 | return executed 516 times by 1 test: ret;return ret; Executed by:
executed 516 times by 1 test: return ret; Executed by:
| 516 | ||||||
32 | } | - | ||||||
33 | - | |||||||
34 | - | |||||||
35 | - | |||||||
36 | - | |||||||
37 | void | - | ||||||
38 | engine_set_all_null(ENGINE *e) | - | ||||||
39 | { | - | ||||||
40 | e->id = | - | ||||||
41 | ((void *)0) | - | ||||||
42 | ; | - | ||||||
43 | e->name = | - | ||||||
44 | ((void *)0) | - | ||||||
45 | ; | - | ||||||
46 | e->rsa_meth = | - | ||||||
47 | ((void *)0) | - | ||||||
48 | ; | - | ||||||
49 | e->dsa_meth = | - | ||||||
50 | ((void *)0) | - | ||||||
51 | ; | - | ||||||
52 | e->dh_meth = | - | ||||||
53 | ((void *)0) | - | ||||||
54 | ; | - | ||||||
55 | e->rand_meth = | - | ||||||
56 | ((void *)0) | - | ||||||
57 | ; | - | ||||||
58 | e->store_meth = | - | ||||||
59 | ((void *)0) | - | ||||||
60 | ; | - | ||||||
61 | e->ciphers = | - | ||||||
62 | ((void *)0) | - | ||||||
63 | ; | - | ||||||
64 | e->digests = | - | ||||||
65 | ((void *)0) | - | ||||||
66 | ; | - | ||||||
67 | e->destroy = | - | ||||||
68 | ((void *)0) | - | ||||||
69 | ; | - | ||||||
70 | e->init = | - | ||||||
71 | ((void *)0) | - | ||||||
72 | ; | - | ||||||
73 | e->finish = | - | ||||||
74 | ((void *)0) | - | ||||||
75 | ; | - | ||||||
76 | e->ctrl = | - | ||||||
77 | ((void *)0) | - | ||||||
78 | ; | - | ||||||
79 | e->load_privkey = | - | ||||||
80 | ((void *)0) | - | ||||||
81 | ; | - | ||||||
82 | e->load_pubkey = | - | ||||||
83 | ((void *)0) | - | ||||||
84 | ; | - | ||||||
85 | e->cmd_defns = | - | ||||||
86 | ((void *)0) | - | ||||||
87 | ; | - | ||||||
88 | e->flags = 0; | - | ||||||
89 | } never executed: end of block | 0 | ||||||
90 | - | |||||||
91 | int | - | ||||||
92 | engine_free_util(ENGINE *e, int locked) | - | ||||||
93 | { | - | ||||||
94 | int i; | - | ||||||
95 | - | |||||||
96 | if (e ==
| 11-1553 | ||||||
97 | ((void *)0)
| 11-1553 | ||||||
98 | ) | - | ||||||
99 | return executed 11 times by 2 tests: 1;return 1; Executed by:
executed 11 times by 2 tests: return 1; Executed by:
| 11 | ||||||
100 | if (locked
| 517-1036 | ||||||
101 | i = CRYPTO_add_lock(&e->struct_ref,-1,30,__FILE__,121); executed 1036 times by 1 test: i = CRYPTO_add_lock(&e->struct_ref,-1,30,__FILE__,121); Executed by:
| 1036 | ||||||
102 | else | - | ||||||
103 | i = --e->struct_ref; executed 517 times by 1 test: i = --e->struct_ref; Executed by:
| 517 | ||||||
104 | - | |||||||
105 | if (i > 0
| 516-1037 | ||||||
106 | return executed 1037 times by 1 test: 1;return 1; Executed by:
executed 1037 times by 1 test: return 1; Executed by:
| 1037 | ||||||
107 | - | |||||||
108 | - | |||||||
109 | engine_pkey_meths_free(e); | - | ||||||
110 | engine_pkey_asn1_meths_free(e); | - | ||||||
111 | - | |||||||
112 | - | |||||||
113 | if (e->destroy
| 0-516 | ||||||
114 | e->destroy(e); never executed: e->destroy(e); | 0 | ||||||
115 | CRYPTO_free_ex_data(9, e, &e->ex_data); | - | ||||||
116 | free(e); | - | ||||||
117 | return executed 516 times by 1 test: 1;return 1; Executed by:
executed 516 times by 1 test: return 1; Executed by:
| 516 | ||||||
118 | } | - | ||||||
119 | - | |||||||
120 | int | - | ||||||
121 | ENGINE_free(ENGINE *e) | - | ||||||
122 | { | - | ||||||
123 | return executed 1047 times by 2 tests: engine_free_util(e, 1);return engine_free_util(e, 1); Executed by:
executed 1047 times by 2 tests: return engine_free_util(e, 1); Executed by:
| 1047 | ||||||
124 | } | - | ||||||
125 | - | |||||||
126 | - | |||||||
127 | - | |||||||
128 | - | |||||||
129 | - | |||||||
130 | - | |||||||
131 | - | |||||||
132 | static struct stack_st_ENGINE_CLEANUP_ITEM *cleanup_stack = | - | ||||||
133 | ((void *)0) | - | ||||||
134 | ; | - | ||||||
135 | static int | - | ||||||
136 | int_cleanup_check(int create) | - | ||||||
137 | { | - | ||||||
138 | if (cleanup_stack
| 4-54 | ||||||
139 | return executed 4 times by 1 test: 1;return 1; Executed by:
executed 4 times by 1 test: return 1; Executed by:
| 4 | ||||||
140 | if (!create
| 1-53 | ||||||
141 | return executed 53 times by 4 tests: 0;return 0; Executed by:
executed 53 times by 4 tests: return 0; Executed by:
| 53 | ||||||
142 | cleanup_stack = ((struct stack_st_ENGINE_CLEANUP_ITEM *)sk_new_null()); | - | ||||||
143 | return executed 1 time by 1 test: (cleanup_stackreturn (cleanup_stack ? 1 : 0); Executed by:
executed 1 time by 1 test: return (cleanup_stack ? 1 : 0); Executed by:
| 0-1 | ||||||
144 | } | - | ||||||
145 | - | |||||||
146 | static ENGINE_CLEANUP_ITEM * | - | ||||||
147 | int_cleanup_item(ENGINE_CLEANUP_CB *cb) | - | ||||||
148 | { | - | ||||||
149 | ENGINE_CLEANUP_ITEM *item = malloc(sizeof(ENGINE_CLEANUP_ITEM)); | - | ||||||
150 | - | |||||||
151 | if (!item
| 0-4 | ||||||
152 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||
153 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||
154 | ; never executed: return ((void *)0) ; | 0 | ||||||
155 | item->cb = cb; | - | ||||||
156 | return executed 4 times by 1 test: item;return item; Executed by:
executed 4 times by 1 test: return item; Executed by:
| 4 | ||||||
157 | } | - | ||||||
158 | - | |||||||
159 | void | - | ||||||
160 | engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb) | - | ||||||
161 | { | - | ||||||
162 | ENGINE_CLEANUP_ITEM *item; | - | ||||||
163 | - | |||||||
164 | if (!int_cleanup_check(1)
| 0 | ||||||
165 | return; never executed: return; | 0 | ||||||
166 | item = int_cleanup_item(cb); | - | ||||||
167 | if (item
| 0 | ||||||
168 | sk_insert(((_STACK*) (1 ? (cleanup_stack) : (struct stack_st_ENGINE_CLEANUP_ITEM*)0)), ((void*) (1 ? (item) : (ENGINE_CLEANUP_ITEM*)0)), (0)); never executed: sk_insert(((_STACK*) (1 ? (cleanup_stack) : (struct stack_st_ENGINE_CLEANUP_ITEM*)0)), ((void*) (1 ? (item) : (ENGINE_CLEANUP_ITEM*)0)), (0)); | 0 | ||||||
169 | } never executed: end of block | 0 | ||||||
170 | - | |||||||
171 | void | - | ||||||
172 | engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb) | - | ||||||
173 | { | - | ||||||
174 | ENGINE_CLEANUP_ITEM *item; | - | ||||||
175 | - | |||||||
176 | if (!int_cleanup_check(1)
| 0-4 | ||||||
177 | return; never executed: return; | 0 | ||||||
178 | item = int_cleanup_item(cb); | - | ||||||
179 | if (item
| 0-4 | ||||||
180 | sk_push(((_STACK*) (1 ? (cleanup_stack) : (struct stack_st_ENGINE_CLEANUP_ITEM*)0)), ((void*) (1 ? (item) : (ENGINE_CLEANUP_ITEM*)0))); executed 4 times by 1 test: sk_push(((_STACK*) (1 ? (cleanup_stack) : (struct stack_st_ENGINE_CLEANUP_ITEM*)0)), ((void*) (1 ? (item) : (ENGINE_CLEANUP_ITEM*)0))); Executed by:
| 4 | ||||||
181 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||
182 | - | |||||||
183 | static void | - | ||||||
184 | engine_cleanup_cb_free(ENGINE_CLEANUP_ITEM *item) | - | ||||||
185 | { | - | ||||||
186 | (*(item->cb))(); | - | ||||||
187 | free(item); | - | ||||||
188 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||
189 | - | |||||||
190 | void | - | ||||||
191 | ENGINE_cleanup(void) | - | ||||||
192 | { | - | ||||||
193 | if (int_cleanup_check(0)
| 1-53 | ||||||
194 | sk_pop_free(((_STACK*) (1 ? (cleanup_stack) : (struct stack_st_ENGINE_CLEANUP_ITEM*)0)), ((void (*)(void *)) ((1 ? (engine_cleanup_cb_free) : (void (*)(ENGINE_CLEANUP_ITEM *))0)))) | - | ||||||
195 | ; | - | ||||||
196 | cleanup_stack = | - | ||||||
197 | ((void *)0) | - | ||||||
198 | ; | - | ||||||
199 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||
200 | - | |||||||
201 | - | |||||||
202 | RAND_set_rand_method( | - | ||||||
203 | ((void *)0) | - | ||||||
204 | ); | - | ||||||
205 | } executed 54 times by 5 tests: end of block Executed by:
| 54 | ||||||
206 | - | |||||||
207 | - | |||||||
208 | - | |||||||
209 | int | - | ||||||
210 | ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | - | ||||||
211 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | - | ||||||
212 | { | - | ||||||
213 | return never executed: CRYPTO_get_ex_new_index(9, argl, argp,return CRYPTO_get_ex_new_index(9, argl, argp, new_func, dup_func, free_func); never executed: return CRYPTO_get_ex_new_index(9, argl, argp, new_func, dup_func, free_func); | 0 | ||||||
214 | new_func, dup_func, free_func); never executed: return CRYPTO_get_ex_new_index(9, argl, argp, new_func, dup_func, free_func); | 0 | ||||||
215 | } | - | ||||||
216 | - | |||||||
217 | int | - | ||||||
218 | ENGINE_set_ex_data(ENGINE *e, int idx, void *arg) | - | ||||||
219 | { | - | ||||||
220 | return never executed: (CRYPTO_set_ex_data(&e->ex_data, idx, arg));return (CRYPTO_set_ex_data(&e->ex_data, idx, arg)); never executed: return (CRYPTO_set_ex_data(&e->ex_data, idx, arg)); | 0 | ||||||
221 | } | - | ||||||
222 | - | |||||||
223 | void * | - | ||||||
224 | ENGINE_get_ex_data(const ENGINE *e, int idx) | - | ||||||
225 | { | - | ||||||
226 | return never executed: (CRYPTO_get_ex_data(&e->ex_data, idx));return (CRYPTO_get_ex_data(&e->ex_data, idx)); never executed: return (CRYPTO_get_ex_data(&e->ex_data, idx)); | 0 | ||||||
227 | } | - | ||||||
228 | - | |||||||
229 | - | |||||||
230 | - | |||||||
231 | - | |||||||
232 | int | - | ||||||
233 | ENGINE_set_id(ENGINE *e, const char *id) | - | ||||||
234 | { | - | ||||||
235 | if (id ==
| 0-516 | ||||||
236 | ((void *)0)
| 0-516 | ||||||
237 | ) { | - | ||||||
238 | ERR_put_error(38,(0xfff),((3|64)),__FILE__,248); | - | ||||||
239 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
240 | } | - | ||||||
241 | e->id = id; | - | ||||||
242 | return executed 516 times by 1 test: 1;return 1; Executed by:
executed 516 times by 1 test: return 1; Executed by:
| 516 | ||||||
243 | } | - | ||||||
244 | - | |||||||
245 | int | - | ||||||
246 | ENGINE_set_name(ENGINE *e, const char *name) | - | ||||||
247 | { | - | ||||||
248 | if (name ==
| 0-516 | ||||||
249 | ((void *)0)
| 0-516 | ||||||
250 | ) { | - | ||||||
251 | ERR_put_error(38,(0xfff),((3|64)),__FILE__,259); | - | ||||||
252 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
253 | } | - | ||||||
254 | e->name = name; | - | ||||||
255 | return executed 516 times by 1 test: 1;return 1; Executed by:
executed 516 times by 1 test: return 1; Executed by:
| 516 | ||||||
256 | } | - | ||||||
257 | - | |||||||
258 | int | - | ||||||
259 | ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f) | - | ||||||
260 | { | - | ||||||
261 | e->destroy = destroy_f; | - | ||||||
262 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||
263 | } | - | ||||||
264 | - | |||||||
265 | int | - | ||||||
266 | ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f) | - | ||||||
267 | { | - | ||||||
268 | e->init = init_f; | - | ||||||
269 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||
270 | } | - | ||||||
271 | - | |||||||
272 | int | - | ||||||
273 | ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f) | - | ||||||
274 | { | - | ||||||
275 | e->finish = finish_f; | - | ||||||
276 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||
277 | } | - | ||||||
278 | - | |||||||
279 | int | - | ||||||
280 | ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f) | - | ||||||
281 | { | - | ||||||
282 | e->ctrl = ctrl_f; | - | ||||||
283 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||
284 | } | - | ||||||
285 | - | |||||||
286 | int | - | ||||||
287 | ENGINE_set_flags(ENGINE *e, int flags) | - | ||||||
288 | { | - | ||||||
289 | e->flags = flags; | - | ||||||
290 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||
291 | } | - | ||||||
292 | - | |||||||
293 | int | - | ||||||
294 | ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns) | - | ||||||
295 | { | - | ||||||
296 | e->cmd_defns = defns; | - | ||||||
297 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||
298 | } | - | ||||||
299 | - | |||||||
300 | const char * | - | ||||||
301 | ENGINE_get_id(const ENGINE *e) | - | ||||||
302 | { | - | ||||||
303 | return executed 519 times by 1 test: e->id;return e->id; Executed by:
executed 519 times by 1 test: return e->id; Executed by:
| 519 | ||||||
304 | } | - | ||||||
305 | - | |||||||
306 | const char * | - | ||||||
307 | ENGINE_get_name(const ENGINE *e) | - | ||||||
308 | { | - | ||||||
309 | return executed 519 times by 1 test: e->name;return e->name; Executed by:
executed 519 times by 1 test: return e->name; Executed by:
| 519 | ||||||
310 | } | - | ||||||
311 | - | |||||||
312 | ENGINE_GEN_INT_FUNC_PTR | - | ||||||
313 | ENGINE_get_destroy_function(const ENGINE *e) | - | ||||||
314 | { | - | ||||||
315 | return never executed: e->destroy;return e->destroy; never executed: return e->destroy; | 0 | ||||||
316 | } | - | ||||||
317 | - | |||||||
318 | ENGINE_GEN_INT_FUNC_PTR | - | ||||||
319 | ENGINE_get_init_function(const ENGINE *e) | - | ||||||
320 | { | - | ||||||
321 | return never executed: e->init;return e->init; never executed: return e->init; | 0 | ||||||
322 | } | - | ||||||
323 | - | |||||||
324 | ENGINE_GEN_INT_FUNC_PTR | - | ||||||
325 | ENGINE_get_finish_function(const ENGINE *e) | - | ||||||
326 | { | - | ||||||
327 | return never executed: e->finish;return e->finish; never executed: return e->finish; | 0 | ||||||
328 | } | - | ||||||
329 | - | |||||||
330 | ENGINE_CTRL_FUNC_PTR | - | ||||||
331 | ENGINE_get_ctrl_function(const ENGINE *e) | - | ||||||
332 | { | - | ||||||
333 | return never executed: e->ctrl;return e->ctrl; never executed: return e->ctrl; | 0 | ||||||
334 | } | - | ||||||
335 | - | |||||||
336 | int | - | ||||||
337 | ENGINE_get_flags(const ENGINE *e) | - | ||||||
338 | { | - | ||||||
339 | return never executed: e->flags;return e->flags; never executed: return e->flags; | 0 | ||||||
340 | } | - | ||||||
341 | - | |||||||
342 | const ENGINE_CMD_DEFN * | - | ||||||
343 | ENGINE_get_cmd_defns(const ENGINE *e) | - | ||||||
344 | { | - | ||||||
345 | return never executed: e->cmd_defns;return e->cmd_defns; never executed: return e->cmd_defns; | 0 | ||||||
346 | } | - | ||||||
347 | - | |||||||
348 | - | |||||||
349 | - | |||||||
350 | - | |||||||
351 | static int internal_static_hack = 0; | - | ||||||
352 | - | |||||||
353 | void * | - | ||||||
354 | ENGINE_get_static_state(void) | - | ||||||
355 | { | - | ||||||
356 | return never executed: &internal_static_hack;return &internal_static_hack; never executed: return &internal_static_hack; | 0 | ||||||
357 | } | - | ||||||
Switch to Source code | Preprocessed file |