Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/engine/eng_dyn.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | static int dynamic_init(ENGINE *e); | - | ||||||||||||||||||||||||
2 | static int dynamic_finish(ENGINE *e); | - | ||||||||||||||||||||||||
3 | static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, | - | ||||||||||||||||||||||||
4 | void (*f) (void)); | - | ||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | typedef struct st_dynamic_data_ctx dynamic_data_ctx; | - | ||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx); | - | ||||||||||||||||||||||||
9 | static const char *engine_dynamic_id = "dynamic"; | - | ||||||||||||||||||||||||
10 | static const char *engine_dynamic_name = "Dynamic engine loading support"; | - | ||||||||||||||||||||||||
11 | static const ENGINE_CMD_DEFN dynamic_cmd_defns[] = { | - | ||||||||||||||||||||||||
12 | {200, | - | ||||||||||||||||||||||||
13 | "SO_PATH", | - | ||||||||||||||||||||||||
14 | "Specifies the path to the new ENGINE shared library", | - | ||||||||||||||||||||||||
15 | (unsigned int)0x0002}, | - | ||||||||||||||||||||||||
16 | {(200 + 1), | - | ||||||||||||||||||||||||
17 | "NO_VCHECK", | - | ||||||||||||||||||||||||
18 | "Specifies to continue even if version checking fails (boolean)", | - | ||||||||||||||||||||||||
19 | (unsigned int)0x0001}, | - | ||||||||||||||||||||||||
20 | {(200 + 2), | - | ||||||||||||||||||||||||
21 | "ID", | - | ||||||||||||||||||||||||
22 | "Specifies an ENGINE id name for loading", | - | ||||||||||||||||||||||||
23 | (unsigned int)0x0002}, | - | ||||||||||||||||||||||||
24 | {(200 + 3), | - | ||||||||||||||||||||||||
25 | "LIST_ADD", | - | ||||||||||||||||||||||||
26 | "Whether to add a loaded ENGINE to the internal list (0=no,1=yes,2=mandatory)", | - | ||||||||||||||||||||||||
27 | (unsigned int)0x0001}, | - | ||||||||||||||||||||||||
28 | {(200 + 4), | - | ||||||||||||||||||||||||
29 | "DIR_LOAD", | - | ||||||||||||||||||||||||
30 | "Specifies whether to load from 'DIR_ADD' directories (0=no,1=yes,2=mandatory)", | - | ||||||||||||||||||||||||
31 | (unsigned int)0x0001}, | - | ||||||||||||||||||||||||
32 | {(200 + 5), | - | ||||||||||||||||||||||||
33 | "DIR_ADD", | - | ||||||||||||||||||||||||
34 | "Adds a directory from which ENGINEs can be loaded", | - | ||||||||||||||||||||||||
35 | (unsigned int)0x0002}, | - | ||||||||||||||||||||||||
36 | {(200 + 6), | - | ||||||||||||||||||||||||
37 | "LOAD", | - | ||||||||||||||||||||||||
38 | "Load up the ENGINE specified by other settings", | - | ||||||||||||||||||||||||
39 | (unsigned int)0x0004}, | - | ||||||||||||||||||||||||
40 | {0, | - | ||||||||||||||||||||||||
41 | ((void *)0) | - | ||||||||||||||||||||||||
42 | , | - | ||||||||||||||||||||||||
43 | ((void *)0) | - | ||||||||||||||||||||||||
44 | , 0} | - | ||||||||||||||||||||||||
45 | }; | - | ||||||||||||||||||||||||
46 | - | |||||||||||||||||||||||||
47 | - | |||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||
49 | - | |||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||
52 | struct st_dynamic_data_ctx { | - | ||||||||||||||||||||||||
53 | - | |||||||||||||||||||||||||
54 | DSO *dynamic_dso; | - | ||||||||||||||||||||||||
55 | - | |||||||||||||||||||||||||
56 | - | |||||||||||||||||||||||||
57 | - | |||||||||||||||||||||||||
58 | dynamic_v_check_fn v_check; | - | ||||||||||||||||||||||||
59 | - | |||||||||||||||||||||||||
60 | - | |||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||
62 | dynamic_bind_engine bind_engine; | - | ||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||
64 | char *DYNAMIC_LIBNAME; | - | ||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||
66 | int no_vcheck; | - | ||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||
68 | char *engine_id; | - | ||||||||||||||||||||||||
69 | - | |||||||||||||||||||||||||
70 | - | |||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||
73 | - | |||||||||||||||||||||||||
74 | int list_add_value; | - | ||||||||||||||||||||||||
75 | - | |||||||||||||||||||||||||
76 | const char *DYNAMIC_F1; | - | ||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||
78 | const char *DYNAMIC_F2; | - | ||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||
83 | int dir_load; | - | ||||||||||||||||||||||||
84 | - | |||||||||||||||||||||||||
85 | struct stack_st_OPENSSL_STRING *dirs; | - | ||||||||||||||||||||||||
86 | }; | - | ||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||
89 | - | |||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||
92 | static int dynamic_ex_data_idx = -1; | - | ||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||
94 | static void int_free_str(char *s) | - | ||||||||||||||||||||||||
95 | { | - | ||||||||||||||||||||||||
96 | CRYPTO_free(s, __FILE__, 122); | - | ||||||||||||||||||||||||
97 | } executed 368 times by 1 test: end of block Executed by:
| 368 | ||||||||||||||||||||||||
98 | static void dynamic_data_ctx_free_func(void *parent, void *ptr, | - | ||||||||||||||||||||||||
99 | CRYPTO_EX_DATA *ad, int idx, long argl, | - | ||||||||||||||||||||||||
100 | void *argp) | - | ||||||||||||||||||||||||
101 | { | - | ||||||||||||||||||||||||
102 | if (ptr
| 368 | ||||||||||||||||||||||||
103 | dynamic_data_ctx *ctx = (dynamic_data_ctx *)ptr; | - | ||||||||||||||||||||||||
104 | DSO_free(ctx->dynamic_dso); | - | ||||||||||||||||||||||||
105 | CRYPTO_free(ctx->DYNAMIC_LIBNAME, __FILE__, 141); | - | ||||||||||||||||||||||||
106 | CRYPTO_free(ctx->engine_id, __FILE__, 142); | - | ||||||||||||||||||||||||
107 | sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str); | - | ||||||||||||||||||||||||
108 | CRYPTO_free(ctx, __FILE__, 144); | - | ||||||||||||||||||||||||
109 | } executed 368 times by 1 test: end of block Executed by:
| 368 | ||||||||||||||||||||||||
110 | } executed 736 times by 1 test: end of block Executed by:
| 736 | ||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||
112 | - | |||||||||||||||||||||||||
113 | - | |||||||||||||||||||||||||
114 | - | |||||||||||||||||||||||||
115 | - | |||||||||||||||||||||||||
116 | - | |||||||||||||||||||||||||
117 | - | |||||||||||||||||||||||||
118 | static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) | - | ||||||||||||||||||||||||
119 | { | - | ||||||||||||||||||||||||
120 | dynamic_data_ctx *c = CRYPTO_zalloc(sizeof(*c), __FILE__, 156); | - | ||||||||||||||||||||||||
121 | int ret = 1; | - | ||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||
123 | if (c ==
| 0-368 | ||||||||||||||||||||||||
124 | ((void *)0)
| 0-368 | ||||||||||||||||||||||||
125 | ) { | - | ||||||||||||||||||||||||
126 | ERR_put_error(38,(183),((1|64)),__FILE__,160); | - | ||||||||||||||||||||||||
127 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
128 | } | - | ||||||||||||||||||||||||
129 | c->dirs = sk_OPENSSL_STRING_new_null(); | - | ||||||||||||||||||||||||
130 | if (c->dirs ==
| 0-368 | ||||||||||||||||||||||||
131 | ((void *)0)
| 0-368 | ||||||||||||||||||||||||
132 | ) { | - | ||||||||||||||||||||||||
133 | ERR_put_error(38,(183),((1|64)),__FILE__,165); | - | ||||||||||||||||||||||||
134 | CRYPTO_free(c, __FILE__, 166); | - | ||||||||||||||||||||||||
135 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
136 | } | - | ||||||||||||||||||||||||
137 | c->DYNAMIC_F1 = "v_check"; | - | ||||||||||||||||||||||||
138 | c->DYNAMIC_F2 = "bind_engine"; | - | ||||||||||||||||||||||||
139 | c->dir_load = 1; | - | ||||||||||||||||||||||||
140 | CRYPTO_THREAD_write_lock(global_engine_lock); | - | ||||||||||||||||||||||||
141 | if ((*
| 0-368 | ||||||||||||||||||||||||
142 | dynamic_ex_data_idx))
| 0-368 | ||||||||||||||||||||||||
143 | ==
| 0-368 | ||||||||||||||||||||||||
144 | ((void *)0)
| 0-368 | ||||||||||||||||||||||||
145 | ) { | - | ||||||||||||||||||||||||
146 | - | |||||||||||||||||||||||||
147 | ret = ENGINE_set_ex_data(e, dynamic_ex_data_idx, c); | - | ||||||||||||||||||||||||
148 | if (ret
| 0-368 | ||||||||||||||||||||||||
149 | *ctx = c; | - | ||||||||||||||||||||||||
150 | c = | - | ||||||||||||||||||||||||
151 | ((void *)0) | - | ||||||||||||||||||||||||
152 | ; | - | ||||||||||||||||||||||||
153 | } executed 368 times by 1 test: end of block Executed by:
| 368 | ||||||||||||||||||||||||
154 | } executed 368 times by 1 test: end of block Executed by:
| 368 | ||||||||||||||||||||||||
155 | CRYPTO_THREAD_unlock(global_engine_lock); | - | ||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||
157 | - | |||||||||||||||||||||||||
158 | - | |||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||
160 | if (c
| 0-368 | ||||||||||||||||||||||||
161 | sk_OPENSSL_STRING_free(c->dirs); never executed: sk_OPENSSL_STRING_free(c->dirs); | 0 | ||||||||||||||||||||||||
162 | CRYPTO_free(c, __FILE__, 190); | - | ||||||||||||||||||||||||
163 | return executed 368 times by 1 test: ret;return ret; Executed by:
executed 368 times by 1 test: return ret; Executed by:
| 368 | ||||||||||||||||||||||||
164 | } | - | ||||||||||||||||||||||||
165 | - | |||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||
167 | - | |||||||||||||||||||||||||
168 | - | |||||||||||||||||||||||||
169 | - | |||||||||||||||||||||||||
170 | static dynamic_data_ctx *dynamic_get_data_ctx(ENGINE *e) | - | ||||||||||||||||||||||||
171 | { | - | ||||||||||||||||||||||||
172 | dynamic_data_ctx *ctx; | - | ||||||||||||||||||||||||
173 | if (dynamic_ex_data_idx < 0
| 368-1472 | ||||||||||||||||||||||||
174 | - | |||||||||||||||||||||||||
175 | - | |||||||||||||||||||||||||
176 | - | |||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||
178 | - | |||||||||||||||||||||||||
179 | int new_idx = CRYPTO_get_ex_new_index(10, 0, | - | ||||||||||||||||||||||||
180 | ((void *)0) | - | ||||||||||||||||||||||||
181 | , | - | ||||||||||||||||||||||||
182 | ((void *)0) | - | ||||||||||||||||||||||||
183 | , | - | ||||||||||||||||||||||||
184 | ((void *)0) | - | ||||||||||||||||||||||||
185 | , dynamic_data_ctx_free_func) | - | ||||||||||||||||||||||||
186 | ; | - | ||||||||||||||||||||||||
187 | if (new_idx == -1
| 0-368 | ||||||||||||||||||||||||
188 | ERR_put_error(38,(181),(144),__FILE__,210); | - | ||||||||||||||||||||||||
189 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
190 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
191 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
192 | } | - | ||||||||||||||||||||||||
193 | CRYPTO_THREAD_write_lock(global_engine_lock); | - | ||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||
195 | if (dynamic_ex_data_idx < 0
| 0-368 | ||||||||||||||||||||||||
196 | - | |||||||||||||||||||||||||
197 | dynamic_ex_data_idx = new_idx; | - | ||||||||||||||||||||||||
198 | new_idx = -1; | - | ||||||||||||||||||||||||
199 | } executed 368 times by 1 test: end of block Executed by:
| 368 | ||||||||||||||||||||||||
200 | CRYPTO_THREAD_unlock(global_engine_lock); | - | ||||||||||||||||||||||||
201 | - | |||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||
204 | - | |||||||||||||||||||||||||
205 | } executed 368 times by 1 test: end of block Executed by:
| 368 | ||||||||||||||||||||||||
206 | ctx = (dynamic_data_ctx *)ENGINE_get_ex_data(e, dynamic_ex_data_idx); | - | ||||||||||||||||||||||||
207 | - | |||||||||||||||||||||||||
208 | if ((
| 368-1472 | ||||||||||||||||||||||||
209 | ((void *)0)
| 368-1472 | ||||||||||||||||||||||||
210 | )
| 0-1472 | ||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||
212 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
213 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
214 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
215 | return executed 1840 times by 1 test: ctx;return ctx; Executed by:
executed 1840 times by 1 test: return ctx; Executed by:
| 1840 | ||||||||||||||||||||||||
216 | } | - | ||||||||||||||||||||||||
217 | - | |||||||||||||||||||||||||
218 | static ENGINE *engine_dynamic(void) | - | ||||||||||||||||||||||||
219 | { | - | ||||||||||||||||||||||||
220 | ENGINE *ret = ENGINE_new(); | - | ||||||||||||||||||||||||
221 | if (ret ==
| 0-1959 | ||||||||||||||||||||||||
222 | ((void *)0)
| 0-1959 | ||||||||||||||||||||||||
223 | ) | - | ||||||||||||||||||||||||
224 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
225 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
226 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
227 | if (!ENGINE_set_id(ret, engine_dynamic_id)
| 0-1959 | ||||||||||||||||||||||||
228 | !ENGINE_set_name(ret, engine_dynamic_name)
| 0-1959 | ||||||||||||||||||||||||
229 | !ENGINE_set_init_function(ret, dynamic_init)
| 0-1959 | ||||||||||||||||||||||||
230 | !ENGINE_set_finish_function(ret, dynamic_finish)
| 0-1959 | ||||||||||||||||||||||||
231 | !ENGINE_set_ctrl_function(ret, dynamic_ctrl)
| 0-1959 | ||||||||||||||||||||||||
232 | !ENGINE_set_flags(ret, (int)0x0004)
| 0-1959 | ||||||||||||||||||||||||
233 | !ENGINE_set_cmd_defns(ret, dynamic_cmd_defns)
| 0-1959 | ||||||||||||||||||||||||
234 | ENGINE_free(ret); | - | ||||||||||||||||||||||||
235 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
236 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
237 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
238 | } | - | ||||||||||||||||||||||||
239 | return executed 1959 times by 1 test: ret;return ret; Executed by:
executed 1959 times by 1 test: return ret; Executed by:
| 1959 | ||||||||||||||||||||||||
240 | } | - | ||||||||||||||||||||||||
241 | - | |||||||||||||||||||||||||
242 | void engine_load_dynamic_int(void) | - | ||||||||||||||||||||||||
243 | { | - | ||||||||||||||||||||||||
244 | ENGINE *toadd = engine_dynamic(); | - | ||||||||||||||||||||||||
245 | if (!toadd
| 0-1959 | ||||||||||||||||||||||||
246 | return; never executed: return; | 0 | ||||||||||||||||||||||||
247 | ENGINE_add(toadd); | - | ||||||||||||||||||||||||
248 | - | |||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||
251 | - | |||||||||||||||||||||||||
252 | ENGINE_free(toadd); | - | ||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||
257 | - | |||||||||||||||||||||||||
258 | ERR_clear_error(); | - | ||||||||||||||||||||||||
259 | } executed 1959 times by 1 test: end of block Executed by:
| 1959 | ||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||
261 | static int dynamic_init(ENGINE *e) | - | ||||||||||||||||||||||||
262 | { | - | ||||||||||||||||||||||||
263 | - | |||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
268 | } | - | ||||||||||||||||||||||||
269 | - | |||||||||||||||||||||||||
270 | static int dynamic_finish(ENGINE *e) | - | ||||||||||||||||||||||||
271 | { | - | ||||||||||||||||||||||||
272 | - | |||||||||||||||||||||||||
273 | - | |||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
277 | } | - | ||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||
279 | static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)) | - | ||||||||||||||||||||||||
280 | { | - | ||||||||||||||||||||||||
281 | dynamic_data_ctx *ctx = dynamic_get_data_ctx(e); | - | ||||||||||||||||||||||||
282 | int initialised; | - | ||||||||||||||||||||||||
283 | - | |||||||||||||||||||||||||
284 | if (!ctx
| 0-1840 | ||||||||||||||||||||||||
285 | ERR_put_error(38,(180),(112),__FILE__,295); | - | ||||||||||||||||||||||||
286 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
287 | } | - | ||||||||||||||||||||||||
288 | initialised = ((
| 0-1840 | ||||||||||||||||||||||||
289 | ((void *)0)
| 0-1840 | ||||||||||||||||||||||||
290 | )
| 0-1840 | ||||||||||||||||||||||||
291 | - | |||||||||||||||||||||||||
292 | if (initialised
| 0-1840 | ||||||||||||||||||||||||
293 | ERR_put_error(38,(180),(100),__FILE__,301); | - | ||||||||||||||||||||||||
294 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
295 | } | - | ||||||||||||||||||||||||
296 | switch (cmd) { | - | ||||||||||||||||||||||||
297 | case never executed: 200:case 200: never executed: case 200: | 0 | ||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||
299 | if (p
| 0 | ||||||||||||||||||||||||
300 | p = never executed: p = ((void *)0) ; | 0 | ||||||||||||||||||||||||
301 | ((void *)0) never executed: p = ((void *)0) ; | 0 | ||||||||||||||||||||||||
302 | ; never executed: p = ((void *)0) ; | 0 | ||||||||||||||||||||||||
303 | CRYPTO_free(ctx->DYNAMIC_LIBNAME, __FILE__, 309); | - | ||||||||||||||||||||||||
304 | if (p
| 0 | ||||||||||||||||||||||||
305 | ctx->DYNAMIC_LIBNAME = CRYPTO_strdup(p, __FILE__, 311); never executed: ctx->DYNAMIC_LIBNAME = CRYPTO_strdup(p, __FILE__, 311); | 0 | ||||||||||||||||||||||||
306 | else | - | ||||||||||||||||||||||||
307 | ctx->DYNAMIC_LIBNAME = never executed: ctx->DYNAMIC_LIBNAME = ((void *)0) ; | 0 | ||||||||||||||||||||||||
308 | ((void *)0) never executed: ctx->DYNAMIC_LIBNAME = ((void *)0) ; | 0 | ||||||||||||||||||||||||
309 | ; never executed: ctx->DYNAMIC_LIBNAME = ((void *)0) ; | 0 | ||||||||||||||||||||||||
310 | return never executed: (ctx->DYNAMIC_LIBNAMEreturn (ctx->DYNAMIC_LIBNAME ? 1 : 0);
never executed: return (ctx->DYNAMIC_LIBNAME ? 1 : 0); | 0 | ||||||||||||||||||||||||
311 | case never executed: (200 + 1):case (200 + 1): never executed: case (200 + 1): | 0 | ||||||||||||||||||||||||
312 | ctx->no_vcheck = ((
| 0 | ||||||||||||||||||||||||
313 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
314 | case executed 368 times by 1 test: (200 + 2):case (200 + 2): Executed by:
executed 368 times by 1 test: case (200 + 2): Executed by:
| 368 | ||||||||||||||||||||||||
315 | - | |||||||||||||||||||||||||
316 | if (p
| 0-368 | ||||||||||||||||||||||||
317 | p = never executed: p = ((void *)0) ; | 0 | ||||||||||||||||||||||||
318 | ((void *)0) never executed: p = ((void *)0) ; | 0 | ||||||||||||||||||||||||
319 | ; never executed: p = ((void *)0) ; | 0 | ||||||||||||||||||||||||
320 | CRYPTO_free(ctx->engine_id, __FILE__, 322); | - | ||||||||||||||||||||||||
321 | if (p
| 0-368 | ||||||||||||||||||||||||
322 | ctx->engine_id = CRYPTO_strdup(p, __FILE__, 324); executed 368 times by 1 test: ctx->engine_id = CRYPTO_strdup(p, __FILE__, 324); Executed by:
| 368 | ||||||||||||||||||||||||
323 | else | - | ||||||||||||||||||||||||
324 | ctx->engine_id = never executed: ctx->engine_id = ((void *)0) ; | 0 | ||||||||||||||||||||||||
325 | ((void *)0) never executed: ctx->engine_id = ((void *)0) ; | 0 | ||||||||||||||||||||||||
326 | ; never executed: ctx->engine_id = ((void *)0) ; | 0 | ||||||||||||||||||||||||
327 | return executed 368 times by 1 test: (ctx->engine_idreturn (ctx->engine_id ? 1 : 0); Executed by:
executed 368 times by 1 test: return (ctx->engine_id ? 1 : 0); Executed by:
| 0-368 | ||||||||||||||||||||||||
328 | case executed 368 times by 1 test: (200 + 3):case (200 + 3): Executed by:
executed 368 times by 1 test: case (200 + 3): Executed by:
| 368 | ||||||||||||||||||||||||
329 | if ((
| 0-368 | ||||||||||||||||||||||||
330 | ERR_put_error(38,(180),(143),__FILE__,330); | - | ||||||||||||||||||||||||
331 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
332 | } | - | ||||||||||||||||||||||||
333 | ctx->list_add_value = (int)i; | - | ||||||||||||||||||||||||
334 | return executed 368 times by 1 test: 1;return 1; Executed by:
executed 368 times by 1 test: return 1; Executed by:
| 368 | ||||||||||||||||||||||||
335 | case executed 368 times by 1 test: (200 + 6):case (200 + 6): Executed by:
executed 368 times by 1 test: case (200 + 6): Executed by:
| 368 | ||||||||||||||||||||||||
336 | return executed 368 times by 1 test: dynamic_load(e, ctx);return dynamic_load(e, ctx); Executed by:
executed 368 times by 1 test: return dynamic_load(e, ctx); Executed by:
| 368 | ||||||||||||||||||||||||
337 | case executed 368 times by 1 test: (200 + 4):case (200 + 4): Executed by:
executed 368 times by 1 test: case (200 + 4): Executed by:
| 368 | ||||||||||||||||||||||||
338 | if ((
| 0-368 | ||||||||||||||||||||||||
339 | ERR_put_error(38,(180),(143),__FILE__,339); | - | ||||||||||||||||||||||||
340 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
341 | } | - | ||||||||||||||||||||||||
342 | ctx->dir_load = (int)i; | - | ||||||||||||||||||||||||
343 | return executed 368 times by 1 test: 1;return 1; Executed by:
executed 368 times by 1 test: return 1; Executed by:
| 368 | ||||||||||||||||||||||||
344 | case executed 368 times by 1 test: (200 + 5):case (200 + 5): Executed by:
executed 368 times by 1 test: case (200 + 5): Executed by:
| 368 | ||||||||||||||||||||||||
345 | - | |||||||||||||||||||||||||
346 | if (!p
| 0-368 | ||||||||||||||||||||||||
347 | ERR_put_error(38,(180),(143),__FILE__,347); | - | ||||||||||||||||||||||||
348 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
349 | } | - | ||||||||||||||||||||||||
350 | { | - | ||||||||||||||||||||||||
351 | char *tmp_str = CRYPTO_strdup(p, __FILE__, 351); | - | ||||||||||||||||||||||||
352 | if (tmp_str ==
| 0-368 | ||||||||||||||||||||||||
353 | ((void *)0)
| 0-368 | ||||||||||||||||||||||||
354 | ) { | - | ||||||||||||||||||||||||
355 | ERR_put_error(38,(180),((1|64)),__FILE__,353); | - | ||||||||||||||||||||||||
356 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
357 | } | - | ||||||||||||||||||||||||
358 | if (!sk_OPENSSL_STRING_push(ctx->dirs, tmp_str)
| 0-368 | ||||||||||||||||||||||||
359 | CRYPTO_free(tmp_str, __FILE__, 357); | - | ||||||||||||||||||||||||
360 | ERR_put_error(38,(180),((1|64)),__FILE__,358); | - | ||||||||||||||||||||||||
361 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
362 | } | - | ||||||||||||||||||||||||
363 | } | - | ||||||||||||||||||||||||
364 | return executed 368 times by 1 test: 1;return 1; Executed by:
executed 368 times by 1 test: return 1; Executed by:
| 368 | ||||||||||||||||||||||||
365 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
366 | break; never executed: break; | 0 | ||||||||||||||||||||||||
367 | } | - | ||||||||||||||||||||||||
368 | ERR_put_error(38,(180),(119),__FILE__,366); | - | ||||||||||||||||||||||||
369 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
370 | } | - | ||||||||||||||||||||||||
371 | - | |||||||||||||||||||||||||
372 | static int int_load(dynamic_data_ctx *ctx) | - | ||||||||||||||||||||||||
373 | { | - | ||||||||||||||||||||||||
374 | int num, loop; | - | ||||||||||||||||||||||||
375 | - | |||||||||||||||||||||||||
376 | if ((
| 0-368 | ||||||||||||||||||||||||
377 | ctx->DYNAMIC_LIBNAME,
| 0 | ||||||||||||||||||||||||
378 | ((void *)0)
| 0 | ||||||||||||||||||||||||
379 | ,
| 0 | ||||||||||||||||||||||||
380 | 0)) !=
| 0 | ||||||||||||||||||||||||
381 | ((void *)0)
| 0 | ||||||||||||||||||||||||
382 | ) | - | ||||||||||||||||||||||||
383 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
384 | - | |||||||||||||||||||||||||
385 | if (!ctx->dir_load
| 0-368 | ||||||||||||||||||||||||
386 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
387 | for (loop = 0; loop < num
| 0-368 | ||||||||||||||||||||||||
388 | const char *s = sk_OPENSSL_STRING_value(ctx->dirs, loop); | - | ||||||||||||||||||||||||
389 | char *merge = DSO_merge(ctx->dynamic_dso, ctx->DYNAMIC_LIBNAME, s); | - | ||||||||||||||||||||||||
390 | if (!merge
| 0-368 | ||||||||||||||||||||||||
391 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
392 | if (DSO_load(ctx->dynamic_dso, merge,
| 0-368 | ||||||||||||||||||||||||
393 | ((void *)0)
| 0-368 | ||||||||||||||||||||||||
394 | , 0)
| 0-368 | ||||||||||||||||||||||||
395 | - | |||||||||||||||||||||||||
396 | CRYPTO_free(merge, __FILE__, 388); | - | ||||||||||||||||||||||||
397 | return executed 368 times by 1 test: 1;return 1; Executed by:
executed 368 times by 1 test: return 1; Executed by:
| 368 | ||||||||||||||||||||||||
398 | } | - | ||||||||||||||||||||||||
399 | CRYPTO_free(merge, __FILE__, 391); | - | ||||||||||||||||||||||||
400 | } never executed: end of block | 0 | ||||||||||||||||||||||||
401 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
402 | } | - | ||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||
404 | static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx) | - | ||||||||||||||||||||||||
405 | { | - | ||||||||||||||||||||||||
406 | ENGINE cpy; | - | ||||||||||||||||||||||||
407 | dynamic_fns fns; | - | ||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||
409 | if (ctx->dynamic_dso ==
| 0-368 | ||||||||||||||||||||||||
410 | ((void *)0)
| 0-368 | ||||||||||||||||||||||||
411 | ) | - | ||||||||||||||||||||||||
412 | ctx->dynamic_dso = DSO_new(); executed 368 times by 1 test: ctx->dynamic_dso = DSO_new(); Executed by:
| 368 | ||||||||||||||||||||||||
413 | if (ctx->dynamic_dso ==
| 0-368 | ||||||||||||||||||||||||
414 | ((void *)0)
| 0-368 | ||||||||||||||||||||||||
415 | ) | - | ||||||||||||||||||||||||
416 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
417 | if (!ctx->DYNAMIC_LIBNAME
| 0-368 | ||||||||||||||||||||||||
418 | if (!ctx->engine_id
| 0-368 | ||||||||||||||||||||||||
419 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
420 | DSO_ctrl(ctx->dynamic_dso, 2, | - | ||||||||||||||||||||||||
421 | 0x02, | - | ||||||||||||||||||||||||
422 | ((void *)0) | - | ||||||||||||||||||||||||
423 | ); | - | ||||||||||||||||||||||||
424 | ctx->DYNAMIC_LIBNAME = | - | ||||||||||||||||||||||||
425 | DSO_convert_filename(ctx->dynamic_dso, ctx->engine_id); | - | ||||||||||||||||||||||||
426 | } executed 368 times by 1 test: end of block Executed by:
| 368 | ||||||||||||||||||||||||
427 | if (!int_load(ctx)
| 0-368 | ||||||||||||||||||||||||
428 | ERR_put_error(38,(182),(132),__FILE__,414); | - | ||||||||||||||||||||||||
429 | DSO_free(ctx->dynamic_dso); | - | ||||||||||||||||||||||||
430 | ctx->dynamic_dso = | - | ||||||||||||||||||||||||
431 | ((void *)0) | - | ||||||||||||||||||||||||
432 | ; | - | ||||||||||||||||||||||||
433 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
434 | } | - | ||||||||||||||||||||||||
435 | - | |||||||||||||||||||||||||
436 | if (!
| 0-368 | ||||||||||||||||||||||||
437 | (ctx->bind_engine =
| 0-368 | ||||||||||||||||||||||||
438 | (dynamic_bind_engine) DSO_bind_func(ctx->dynamic_dso,
| 0-368 | ||||||||||||||||||||||||
439 | ctx->DYNAMIC_F2))
| 0-368 | ||||||||||||||||||||||||
440 | ctx->bind_engine = | - | ||||||||||||||||||||||||
441 | ((void *)0) | - | ||||||||||||||||||||||||
442 | ; | - | ||||||||||||||||||||||||
443 | DSO_free(ctx->dynamic_dso); | - | ||||||||||||||||||||||||
444 | ctx->dynamic_dso = | - | ||||||||||||||||||||||||
445 | ((void *)0) | - | ||||||||||||||||||||||||
446 | ; | - | ||||||||||||||||||||||||
447 | ERR_put_error(38,(182),(104),__FILE__,427); | - | ||||||||||||||||||||||||
448 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
449 | } | - | ||||||||||||||||||||||||
450 | - | |||||||||||||||||||||||||
451 | if (!ctx->no_vcheck
| 0-368 | ||||||||||||||||||||||||
452 | unsigned long vcheck_res = 0; | - | ||||||||||||||||||||||||
453 | - | |||||||||||||||||||||||||
454 | - | |||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||
456 | - | |||||||||||||||||||||||||
457 | ctx->v_check = | - | ||||||||||||||||||||||||
458 | (dynamic_v_check_fn) DSO_bind_func(ctx->dynamic_dso, | - | ||||||||||||||||||||||||
459 | ctx->DYNAMIC_F1); | - | ||||||||||||||||||||||||
460 | if (ctx->v_check
| 0-368 | ||||||||||||||||||||||||
461 | vcheck_res = ctx->v_check((unsigned long)0x00030000); executed 368 times by 1 test: vcheck_res = ctx->v_check((unsigned long)0x00030000); Executed by:
| 368 | ||||||||||||||||||||||||
462 | - | |||||||||||||||||||||||||
463 | - | |||||||||||||||||||||||||
464 | - | |||||||||||||||||||||||||
465 | - | |||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||
467 | if (vcheck_res < (unsigned long)0x00030000
| 0-368 | ||||||||||||||||||||||||
468 | - | |||||||||||||||||||||||||
469 | ctx->bind_engine = | - | ||||||||||||||||||||||||
470 | ((void *)0) | - | ||||||||||||||||||||||||
471 | ; | - | ||||||||||||||||||||||||
472 | ctx->v_check = | - | ||||||||||||||||||||||||
473 | ((void *)0) | - | ||||||||||||||||||||||||
474 | ; | - | ||||||||||||||||||||||||
475 | DSO_free(ctx->dynamic_dso); | - | ||||||||||||||||||||||||
476 | ctx->dynamic_dso = | - | ||||||||||||||||||||||||
477 | ((void *)0) | - | ||||||||||||||||||||||||
478 | ; | - | ||||||||||||||||||||||||
479 | ERR_put_error(38,(182),(145),__FILE__,454) | - | ||||||||||||||||||||||||
480 | ; | - | ||||||||||||||||||||||||
481 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
482 | } | - | ||||||||||||||||||||||||
483 | } executed 368 times by 1 test: end of block Executed by:
| 368 | ||||||||||||||||||||||||
484 | - | |||||||||||||||||||||||||
485 | - | |||||||||||||||||||||||||
486 | - | |||||||||||||||||||||||||
487 | - | |||||||||||||||||||||||||
488 | memcpy(&cpy, e, sizeof(ENGINE)); | - | ||||||||||||||||||||||||
489 | - | |||||||||||||||||||||||||
490 | - | |||||||||||||||||||||||||
491 | - | |||||||||||||||||||||||||
492 | - | |||||||||||||||||||||||||
493 | - | |||||||||||||||||||||||||
494 | - | |||||||||||||||||||||||||
495 | - | |||||||||||||||||||||||||
496 | fns.static_state = ENGINE_get_static_state(); | - | ||||||||||||||||||||||||
497 | CRYPTO_get_mem_functions(&fns.mem_fns.malloc_fn, &fns.mem_fns.realloc_fn, | - | ||||||||||||||||||||||||
498 | &fns.mem_fns.free_fn); | - | ||||||||||||||||||||||||
499 | - | |||||||||||||||||||||||||
500 | - | |||||||||||||||||||||||||
501 | - | |||||||||||||||||||||||||
502 | - | |||||||||||||||||||||||||
503 | engine_set_all_null(e); | - | ||||||||||||||||||||||||
504 | - | |||||||||||||||||||||||||
505 | - | |||||||||||||||||||||||||
506 | if (!ctx->bind_engine(e, ctx->engine_id, &fns)
| 0-368 | ||||||||||||||||||||||||
507 | ctx->bind_engine = | - | ||||||||||||||||||||||||
508 | ((void *)0) | - | ||||||||||||||||||||||||
509 | ; | - | ||||||||||||||||||||||||
510 | ctx->v_check = | - | ||||||||||||||||||||||||
511 | ((void *)0) | - | ||||||||||||||||||||||||
512 | ; | - | ||||||||||||||||||||||||
513 | DSO_free(ctx->dynamic_dso); | - | ||||||||||||||||||||||||
514 | ctx->dynamic_dso = | - | ||||||||||||||||||||||||
515 | ((void *)0) | - | ||||||||||||||||||||||||
516 | ; | - | ||||||||||||||||||||||||
517 | ERR_put_error(38,(182),(109),__FILE__,485); | - | ||||||||||||||||||||||||
518 | - | |||||||||||||||||||||||||
519 | memcpy(e, &cpy, sizeof(ENGINE)); | - | ||||||||||||||||||||||||
520 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
521 | } | - | ||||||||||||||||||||||||
522 | - | |||||||||||||||||||||||||
523 | if (ctx->list_add_value > 0
| 0-368 | ||||||||||||||||||||||||
524 | if (!ENGINE_add(e)
| 0-368 | ||||||||||||||||||||||||
525 | - | |||||||||||||||||||||||||
526 | if (ctx->list_add_value > 1
| 0 | ||||||||||||||||||||||||
527 | - | |||||||||||||||||||||||||
528 | - | |||||||||||||||||||||||||
529 | - | |||||||||||||||||||||||||
530 | - | |||||||||||||||||||||||||
531 | - | |||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||
533 | ERR_put_error(38,(182),(103),__FILE__,502) | - | ||||||||||||||||||||||||
534 | ; | - | ||||||||||||||||||||||||
535 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
536 | } | - | ||||||||||||||||||||||||
537 | - | |||||||||||||||||||||||||
538 | ERR_clear_error(); | - | ||||||||||||||||||||||||
539 | } never executed: end of block | 0 | ||||||||||||||||||||||||
540 | } executed 368 times by 1 test: end of block Executed by:
| 368 | ||||||||||||||||||||||||
541 | return executed 368 times by 1 test: 1;return 1; Executed by:
executed 368 times by 1 test: return 1; Executed by:
| 368 | ||||||||||||||||||||||||
542 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |