Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/statem/extensions_cust.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | typedef struct { | - | ||||||||||||||||||
3 | void *add_arg; | - | ||||||||||||||||||
4 | custom_ext_add_cb add_cb; | - | ||||||||||||||||||
5 | custom_ext_free_cb free_cb; | - | ||||||||||||||||||
6 | } custom_ext_add_cb_wrap; | - | ||||||||||||||||||
7 | - | |||||||||||||||||||
8 | typedef struct { | - | ||||||||||||||||||
9 | void *parse_arg; | - | ||||||||||||||||||
10 | custom_ext_parse_cb parse_cb; | - | ||||||||||||||||||
11 | } custom_ext_parse_cb_wrap; | - | ||||||||||||||||||
12 | - | |||||||||||||||||||
13 | - | |||||||||||||||||||
14 | - | |||||||||||||||||||
15 | - | |||||||||||||||||||
16 | static int custom_ext_add_old_cb_wrap(SSL *s, unsigned int ext_type, | - | ||||||||||||||||||
17 | unsigned int context, | - | ||||||||||||||||||
18 | const unsigned char **out, | - | ||||||||||||||||||
19 | size_t *outlen, X509 *x, size_t chainidx, | - | ||||||||||||||||||
20 | int *al, void *add_arg) | - | ||||||||||||||||||
21 | { | - | ||||||||||||||||||
22 | custom_ext_add_cb_wrap *add_cb_wrap = (custom_ext_add_cb_wrap *)add_arg; | - | ||||||||||||||||||
23 | - | |||||||||||||||||||
24 | if (add_cb_wrap->add_cb ==
| 6-24 | ||||||||||||||||||
25 | ((void *)0)
| 6-24 | ||||||||||||||||||
26 | ) | - | ||||||||||||||||||
27 | return executed 6 times by 1 test: 1;return 1; Executed by:
executed 6 times by 1 test: return 1; Executed by:
| 6 | ||||||||||||||||||
28 | - | |||||||||||||||||||
29 | return executed 24 times by 1 test: add_cb_wrap->add_cb(s, ext_type, out, outlen, al,return add_cb_wrap->add_cb(s, ext_type, out, outlen, al, add_cb_wrap->add_arg); Executed by:
executed 24 times by 1 test: return add_cb_wrap->add_cb(s, ext_type, out, outlen, al, add_cb_wrap->add_arg); Executed by:
| 24 | ||||||||||||||||||
30 | add_cb_wrap->add_arg); executed 24 times by 1 test: return add_cb_wrap->add_cb(s, ext_type, out, outlen, al, add_cb_wrap->add_arg); Executed by:
| 24 | ||||||||||||||||||
31 | } | - | ||||||||||||||||||
32 | - | |||||||||||||||||||
33 | static void custom_ext_free_old_cb_wrap(SSL *s, unsigned int ext_type, | - | ||||||||||||||||||
34 | unsigned int context, | - | ||||||||||||||||||
35 | const unsigned char *out, void *add_arg) | - | ||||||||||||||||||
36 | { | - | ||||||||||||||||||
37 | custom_ext_add_cb_wrap *add_cb_wrap = (custom_ext_add_cb_wrap *)add_arg; | - | ||||||||||||||||||
38 | - | |||||||||||||||||||
39 | if (add_cb_wrap->free_cb ==
| 3-23 | ||||||||||||||||||
40 | ((void *)0)
| 3-23 | ||||||||||||||||||
41 | ) | - | ||||||||||||||||||
42 | return; executed 23 times by 1 test: return; Executed by:
| 23 | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | add_cb_wrap->free_cb(s, ext_type, out, add_cb_wrap->add_arg); | - | ||||||||||||||||||
45 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||
46 | - | |||||||||||||||||||
47 | static int custom_ext_parse_old_cb_wrap(SSL *s, unsigned int ext_type, | - | ||||||||||||||||||
48 | unsigned int context, | - | ||||||||||||||||||
49 | const unsigned char *in, | - | ||||||||||||||||||
50 | size_t inlen, X509 *x, size_t chainidx, | - | ||||||||||||||||||
51 | int *al, void *parse_arg) | - | ||||||||||||||||||
52 | { | - | ||||||||||||||||||
53 | custom_ext_parse_cb_wrap *parse_cb_wrap = | - | ||||||||||||||||||
54 | (custom_ext_parse_cb_wrap *)parse_arg; | - | ||||||||||||||||||
55 | - | |||||||||||||||||||
56 | if (parse_cb_wrap->parse_cb ==
| 0-25 | ||||||||||||||||||
57 | ((void *)0)
| 0-25 | ||||||||||||||||||
58 | ) | - | ||||||||||||||||||
59 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
60 | - | |||||||||||||||||||
61 | return executed 25 times by 1 test: parse_cb_wrap->parse_cb(s, ext_type, in, inlen, al,return parse_cb_wrap->parse_cb(s, ext_type, in, inlen, al, parse_cb_wrap->parse_arg); Executed by:
executed 25 times by 1 test: return parse_cb_wrap->parse_cb(s, ext_type, in, inlen, al, parse_cb_wrap->parse_arg); Executed by:
| 25 | ||||||||||||||||||
62 | parse_cb_wrap->parse_arg); executed 25 times by 1 test: return parse_cb_wrap->parse_cb(s, ext_type, in, inlen, al, parse_cb_wrap->parse_arg); Executed by:
| 25 | ||||||||||||||||||
63 | } | - | ||||||||||||||||||
64 | custom_ext_method *custom_ext_find(const custom_ext_methods *exts, | - | ||||||||||||||||||
65 | ENDPOINT role, unsigned int ext_type, | - | ||||||||||||||||||
66 | size_t *idx) | - | ||||||||||||||||||
67 | { | - | ||||||||||||||||||
68 | size_t i; | - | ||||||||||||||||||
69 | custom_ext_method *meth = exts->meths; | - | ||||||||||||||||||
70 | - | |||||||||||||||||||
71 | for (i = 0; i < exts->meths_count
| 288-4686 | ||||||||||||||||||
72 | if (ext_type == meth->ext_type
| 125-163 | ||||||||||||||||||
73 | && (role == ENDPOINT_BOTH
| 30-95 | ||||||||||||||||||
74 | || meth->role == ENDPOINT_BOTH
| 0-37 | ||||||||||||||||||
75 | if (idx !=
| 53-72 | ||||||||||||||||||
76 | ((void *)0)
| 53-72 | ||||||||||||||||||
77 | ) | - | ||||||||||||||||||
78 | * executed 53 times by 1 test: idx = i;*idx = i; Executed by:
executed 53 times by 1 test: *idx = i; Executed by:
| 53 | ||||||||||||||||||
79 | return executed 125 times by 1 test: meth;return meth; Executed by:
executed 125 times by 1 test: return meth; Executed by:
| 125 | ||||||||||||||||||
80 | } | - | ||||||||||||||||||
81 | } executed 163 times by 1 test: end of block Executed by:
| 163 | ||||||||||||||||||
82 | return executed 4686 times by 1 test: return ((void *)0) ; Executed by:
executed 4686 times by 1 test: return ((void *)0) ; Executed by:
| 4686 | ||||||||||||||||||
83 | ((void *)0) executed 4686 times by 1 test: return ((void *)0) ; Executed by:
| 4686 | ||||||||||||||||||
84 | ; executed 4686 times by 1 test: return ((void *)0) ; Executed by:
| 4686 | ||||||||||||||||||
85 | } | - | ||||||||||||||||||
86 | - | |||||||||||||||||||
87 | - | |||||||||||||||||||
88 | - | |||||||||||||||||||
89 | - | |||||||||||||||||||
90 | void custom_ext_init(custom_ext_methods *exts) | - | ||||||||||||||||||
91 | { | - | ||||||||||||||||||
92 | size_t i; | - | ||||||||||||||||||
93 | custom_ext_method *meth = exts->meths; | - | ||||||||||||||||||
94 | - | |||||||||||||||||||
95 | for (i = 0; i < exts->meths_count
| 53-8632 | ||||||||||||||||||
96 | meth->ext_flags = 0; executed 53 times by 1 test: meth->ext_flags = 0; Executed by:
| 53 | ||||||||||||||||||
97 | } executed 8632 times by 1 test: end of block Executed by:
| 8632 | ||||||||||||||||||
98 | - | |||||||||||||||||||
99 | - | |||||||||||||||||||
100 | int custom_ext_parse(SSL *s, unsigned int context, unsigned int ext_type, | - | ||||||||||||||||||
101 | const unsigned char *ext_data, size_t ext_size, X509 *x, | - | ||||||||||||||||||
102 | size_t chainidx) | - | ||||||||||||||||||
103 | { | - | ||||||||||||||||||
104 | int al; | - | ||||||||||||||||||
105 | custom_ext_methods *exts = &s->cert->custext; | - | ||||||||||||||||||
106 | custom_ext_method *meth; | - | ||||||||||||||||||
107 | ENDPOINT role = ENDPOINT_BOTH; | - | ||||||||||||||||||
108 | - | |||||||||||||||||||
109 | if ((
| 13-323 | ||||||||||||||||||
110 | role = s->server
executed 323 times by 1 test: role = s->server ? ENDPOINT_SERVER : ENDPOINT_CLIENT; Executed by:
| 18-323 | ||||||||||||||||||
111 | - | |||||||||||||||||||
112 | meth = custom_ext_find(exts, role, ext_type, | - | ||||||||||||||||||
113 | ((void *)0) | - | ||||||||||||||||||
114 | ); | - | ||||||||||||||||||
115 | - | |||||||||||||||||||
116 | if (!meth
| 47-289 | ||||||||||||||||||
117 | return executed 289 times by 1 test: 1;return 1; Executed by:
executed 289 times by 1 test: return 1; Executed by:
| 289 | ||||||||||||||||||
118 | - | |||||||||||||||||||
119 | - | |||||||||||||||||||
120 | if (!extension_is_relevant(s, meth->context, context)
| 1-46 | ||||||||||||||||||
121 | return executed 1 time by 1 test: 1;return 1; Executed by:
executed 1 time by 1 test: return 1; Executed by:
| 1 | ||||||||||||||||||
122 | - | |||||||||||||||||||
123 | if ((
| 20-26 | ||||||||||||||||||
124 | | 0x0200
| 20-26 | ||||||||||||||||||
125 | | 0x0400)) != 0
| 20-26 | ||||||||||||||||||
126 | - | |||||||||||||||||||
127 | - | |||||||||||||||||||
128 | - | |||||||||||||||||||
129 | - | |||||||||||||||||||
130 | if ((
| 0-20 | ||||||||||||||||||
131 | ossl_statem_fatal((s), (110), (555), (110), | - | ||||||||||||||||||
132 | __FILE__ | - | ||||||||||||||||||
133 | , | - | ||||||||||||||||||
134 | 143 | - | ||||||||||||||||||
135 | ) | - | ||||||||||||||||||
136 | ; | - | ||||||||||||||||||
137 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
138 | } | - | ||||||||||||||||||
139 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||
140 | - | |||||||||||||||||||
141 | - | |||||||||||||||||||
142 | - | |||||||||||||||||||
143 | - | |||||||||||||||||||
144 | - | |||||||||||||||||||
145 | - | |||||||||||||||||||
146 | if ((
| 22-24 | ||||||||||||||||||
147 | meth->ext_flags |= 0x1; executed 22 times by 1 test: meth->ext_flags |= 0x1; Executed by:
| 22 | ||||||||||||||||||
148 | - | |||||||||||||||||||
149 | - | |||||||||||||||||||
150 | if (!meth->parse_cb
| 0-46 | ||||||||||||||||||
151 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
152 | - | |||||||||||||||||||
153 | if (meth->parse_cb(s, ext_type, context, ext_data, ext_size, x, chainidx,
| 0-46 | ||||||||||||||||||
154 | &al, meth->parse_arg) <= 0
| 0-46 | ||||||||||||||||||
155 | ossl_statem_fatal((s), (al), (555), (110), __FILE__, 162); | - | ||||||||||||||||||
156 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
157 | } | - | ||||||||||||||||||
158 | - | |||||||||||||||||||
159 | return executed 46 times by 1 test: 1;return 1; Executed by:
executed 46 times by 1 test: return 1; Executed by:
| 46 | ||||||||||||||||||
160 | } | - | ||||||||||||||||||
161 | - | |||||||||||||||||||
162 | - | |||||||||||||||||||
163 | - | |||||||||||||||||||
164 | - | |||||||||||||||||||
165 | - | |||||||||||||||||||
166 | int custom_ext_add(SSL *s, int context, WPACKET *pkt, X509 *x, size_t chainidx, | - | ||||||||||||||||||
167 | int maxversion) | - | ||||||||||||||||||
168 | { | - | ||||||||||||||||||
169 | custom_ext_methods *exts = &s->cert->custext; | - | ||||||||||||||||||
170 | custom_ext_method *meth; | - | ||||||||||||||||||
171 | size_t i; | - | ||||||||||||||||||
172 | int al; | - | ||||||||||||||||||
173 | - | |||||||||||||||||||
174 | for (i = 0; i < exts->meths_count
| 67-10211 | ||||||||||||||||||
175 | const unsigned char *out = | - | ||||||||||||||||||
176 | ((void *)0) | - | ||||||||||||||||||
177 | ; | - | ||||||||||||||||||
178 | size_t outlen = 0; | - | ||||||||||||||||||
179 | - | |||||||||||||||||||
180 | meth = exts->meths + i; | - | ||||||||||||||||||
181 | - | |||||||||||||||||||
182 | if (!should_add_extension(s, meth->context, context, maxversion)
| 9-58 | ||||||||||||||||||
183 | continue; executed 9 times by 1 test: continue; Executed by:
| 9 | ||||||||||||||||||
184 | - | |||||||||||||||||||
185 | if ((
| 26-32 | ||||||||||||||||||
186 | | 0x0200
| 26-32 | ||||||||||||||||||
187 | | 0x0400
| 26-32 | ||||||||||||||||||
188 | | 0x1000
| 26-32 | ||||||||||||||||||
189 | | 0x0800)) != 0
| 26-32 | ||||||||||||||||||
190 | - | |||||||||||||||||||
191 | if (!(meth->ext_flags & 0x1)
| 7-25 | ||||||||||||||||||
192 | continue; executed 7 times by 1 test: continue; Executed by:
| 7 | ||||||||||||||||||
193 | } executed 25 times by 1 test: end of block Executed by:
| 25 | ||||||||||||||||||
194 | - | |||||||||||||||||||
195 | - | |||||||||||||||||||
196 | - | |||||||||||||||||||
197 | - | |||||||||||||||||||
198 | if ((
| 0-28 | ||||||||||||||||||
199 | ((void *)0)
| 0-28 | ||||||||||||||||||
200 | ) | - | ||||||||||||||||||
201 | continue; never executed: continue; | 0 | ||||||||||||||||||
202 | - | |||||||||||||||||||
203 | if (meth->add_cb !=
| 0-51 | ||||||||||||||||||
204 | ((void *)0)
| 0-51 | ||||||||||||||||||
205 | ) { | - | ||||||||||||||||||
206 | int cb_retval = meth->add_cb(s, meth->ext_type, context, &out, | - | ||||||||||||||||||
207 | &outlen, x, chainidx, &al, | - | ||||||||||||||||||
208 | meth->add_arg); | - | ||||||||||||||||||
209 | - | |||||||||||||||||||
210 | if (cb_retval < 0
| 0-51 | ||||||||||||||||||
211 | ossl_statem_fatal((s), (al), (554), (234), __FILE__, 212); | - | ||||||||||||||||||
212 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
213 | } | - | ||||||||||||||||||
214 | if (cb_retval == 0
| 4-47 | ||||||||||||||||||
215 | continue; executed 4 times by 1 test: continue; Executed by:
| 4 | ||||||||||||||||||
216 | } executed 47 times by 1 test: end of block Executed by:
| 47 | ||||||||||||||||||
217 | - | |||||||||||||||||||
218 | if (!WPACKET_put_bytes__((pkt), (meth->ext_type), 2)
| 0-47 | ||||||||||||||||||
219 | || !WPACKET_start_sub_packet_len__((pkt), 2)
| 0-47 | ||||||||||||||||||
220 | || (outlen > 0
| 0-39 | ||||||||||||||||||
221 | || !WPACKET_close(pkt)
| 0-47 | ||||||||||||||||||
222 | ossl_statem_fatal((s), (80), (554), ((4|64)), | - | ||||||||||||||||||
223 | __FILE__ | - | ||||||||||||||||||
224 | , | - | ||||||||||||||||||
225 | 224 | - | ||||||||||||||||||
226 | ) | - | ||||||||||||||||||
227 | ; | - | ||||||||||||||||||
228 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
229 | } | - | ||||||||||||||||||
230 | if ((
| 21-26 | ||||||||||||||||||
231 | - | |||||||||||||||||||
232 | - | |||||||||||||||||||
233 | - | |||||||||||||||||||
234 | if (!(((meth->ext_flags & 0x2) == 0) != 0)
| 0-21 | ||||||||||||||||||
235 | ossl_statem_fatal((s), (80), (554), ((4|64)), | - | ||||||||||||||||||
236 | __FILE__ | - | ||||||||||||||||||
237 | , | - | ||||||||||||||||||
238 | 233 | - | ||||||||||||||||||
239 | ) | - | ||||||||||||||||||
240 | ; | - | ||||||||||||||||||
241 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
242 | } | - | ||||||||||||||||||
243 | - | |||||||||||||||||||
244 | - | |||||||||||||||||||
245 | - | |||||||||||||||||||
246 | - | |||||||||||||||||||
247 | - | |||||||||||||||||||
248 | meth->ext_flags |= 0x2; | - | ||||||||||||||||||
249 | } executed 21 times by 1 test: end of block Executed by:
| 21 | ||||||||||||||||||
250 | if (meth->free_cb !=
| 1-46 | ||||||||||||||||||
251 | ((void *)0)
| 1-46 | ||||||||||||||||||
252 | ) | - | ||||||||||||||||||
253 | meth->free_cb(s, meth->ext_type, context, out, meth->add_arg); executed 46 times by 1 test: meth->free_cb(s, meth->ext_type, context, out, meth->add_arg); Executed by:
| 46 | ||||||||||||||||||
254 | } executed 47 times by 1 test: end of block Executed by:
| 47 | ||||||||||||||||||
255 | return executed 10211 times by 1 test: 1;return 1; Executed by:
executed 10211 times by 1 test: return 1; Executed by:
| 10211 | ||||||||||||||||||
256 | } | - | ||||||||||||||||||
257 | - | |||||||||||||||||||
258 | - | |||||||||||||||||||
259 | int custom_exts_copy_flags(custom_ext_methods *dst, | - | ||||||||||||||||||
260 | const custom_ext_methods *src) | - | ||||||||||||||||||
261 | { | - | ||||||||||||||||||
262 | size_t i; | - | ||||||||||||||||||
263 | custom_ext_method *methsrc = src->meths; | - | ||||||||||||||||||
264 | - | |||||||||||||||||||
265 | for (i = 0; i < src->meths_count
| 2-24 | ||||||||||||||||||
266 | custom_ext_method *methdst = custom_ext_find(dst, methsrc->role, | - | ||||||||||||||||||
267 | methsrc->ext_type, | - | ||||||||||||||||||
268 | ((void *)0) | - | ||||||||||||||||||
269 | ); | - | ||||||||||||||||||
270 | - | |||||||||||||||||||
271 | if (methdst ==
| 0-2 | ||||||||||||||||||
272 | ((void *)0)
| 0-2 | ||||||||||||||||||
273 | ) | - | ||||||||||||||||||
274 | continue; never executed: continue; | 0 | ||||||||||||||||||
275 | - | |||||||||||||||||||
276 | methdst->ext_flags = methsrc->ext_flags; | - | ||||||||||||||||||
277 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
278 | - | |||||||||||||||||||
279 | return executed 24 times by 1 test: 1;return 1; Executed by:
executed 24 times by 1 test: return 1; Executed by:
| 24 | ||||||||||||||||||
280 | } | - | ||||||||||||||||||
281 | - | |||||||||||||||||||
282 | - | |||||||||||||||||||
283 | int custom_exts_copy(custom_ext_methods *dst, const custom_ext_methods *src) | - | ||||||||||||||||||
284 | { | - | ||||||||||||||||||
285 | size_t i; | - | ||||||||||||||||||
286 | int err = 0; | - | ||||||||||||||||||
287 | - | |||||||||||||||||||
288 | if (src->meths_count > 0
| 33-8245 | ||||||||||||||||||
289 | dst->meths = | - | ||||||||||||||||||
290 | CRYPTO_memdup((src->meths), sizeof(*src->meths) * src->meths_count, | - | ||||||||||||||||||
291 | __FILE__ | - | ||||||||||||||||||
292 | , | - | ||||||||||||||||||
293 | 278 | - | ||||||||||||||||||
294 | ) | - | ||||||||||||||||||
295 | ; | - | ||||||||||||||||||
296 | if (dst->meths ==
| 0-33 | ||||||||||||||||||
297 | ((void *)0)
| 0-33 | ||||||||||||||||||
298 | ) | - | ||||||||||||||||||
299 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
300 | dst->meths_count = src->meths_count; | - | ||||||||||||||||||
301 | - | |||||||||||||||||||
302 | for (i = 0; i < src->meths_count
| 33-55 | ||||||||||||||||||
303 | custom_ext_method *methsrc = src->meths + i; | - | ||||||||||||||||||
304 | custom_ext_method *methdst = dst->meths + i; | - | ||||||||||||||||||
305 | - | |||||||||||||||||||
306 | if (methsrc->add_cb != custom_ext_add_old_cb_wrap
| 17-38 | ||||||||||||||||||
307 | continue; executed 17 times by 1 test: continue; Executed by:
| 17 | ||||||||||||||||||
308 | - | |||||||||||||||||||
309 | - | |||||||||||||||||||
310 | - | |||||||||||||||||||
311 | - | |||||||||||||||||||
312 | - | |||||||||||||||||||
313 | - | |||||||||||||||||||
314 | if (err
| 0-38 | ||||||||||||||||||
315 | methdst->add_arg = | - | ||||||||||||||||||
316 | ((void *)0) | - | ||||||||||||||||||
317 | ; | - | ||||||||||||||||||
318 | methdst->parse_arg = | - | ||||||||||||||||||
319 | ((void *)0) | - | ||||||||||||||||||
320 | ; | - | ||||||||||||||||||
321 | continue; never executed: continue; | 0 | ||||||||||||||||||
322 | } | - | ||||||||||||||||||
323 | - | |||||||||||||||||||
324 | methdst->add_arg = CRYPTO_memdup((methsrc->add_arg), sizeof(custom_ext_add_cb_wrap), | - | ||||||||||||||||||
325 | __FILE__ | - | ||||||||||||||||||
326 | , | - | ||||||||||||||||||
327 | 302 | - | ||||||||||||||||||
328 | ) | - | ||||||||||||||||||
329 | ; | - | ||||||||||||||||||
330 | methdst->parse_arg = CRYPTO_memdup((methsrc->parse_arg), sizeof(custom_ext_parse_cb_wrap), | - | ||||||||||||||||||
331 | __FILE__ | - | ||||||||||||||||||
332 | , | - | ||||||||||||||||||
333 | 304 | - | ||||||||||||||||||
334 | ) | - | ||||||||||||||||||
335 | ; | - | ||||||||||||||||||
336 | - | |||||||||||||||||||
337 | if (methdst->add_arg ==
| 0-38 | ||||||||||||||||||
338 | ((void *)0)
| 0-38 | ||||||||||||||||||
339 | || methdst->parse_arg ==
| 0-38 | ||||||||||||||||||
340 | ((void *)0)
| 0-38 | ||||||||||||||||||
341 | ) | - | ||||||||||||||||||
342 | err = 1; never executed: err = 1; | 0 | ||||||||||||||||||
343 | } executed 38 times by 1 test: end of block Executed by:
| 38 | ||||||||||||||||||
344 | } executed 33 times by 1 test: end of block Executed by:
| 33 | ||||||||||||||||||
345 | - | |||||||||||||||||||
346 | if (err
| 0-8278 | ||||||||||||||||||
347 | custom_exts_free(dst); | - | ||||||||||||||||||
348 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
349 | } | - | ||||||||||||||||||
350 | - | |||||||||||||||||||
351 | return executed 8278 times by 2 tests: 1;return 1; Executed by:
executed 8278 times by 2 tests: return 1; Executed by:
| 8278 | ||||||||||||||||||
352 | } | - | ||||||||||||||||||
353 | - | |||||||||||||||||||
354 | void custom_exts_free(custom_ext_methods *exts) | - | ||||||||||||||||||
355 | { | - | ||||||||||||||||||
356 | size_t i; | - | ||||||||||||||||||
357 | custom_ext_method *meth; | - | ||||||||||||||||||
358 | - | |||||||||||||||||||
359 | for (i = 0, meth = exts->meths; i < exts->meths_count
| 123-16295 | ||||||||||||||||||
360 | if (meth->add_cb != custom_ext_add_old_cb_wrap
| 28-95 | ||||||||||||||||||
361 | continue; executed 28 times by 1 test: continue; Executed by:
| 28 | ||||||||||||||||||
362 | - | |||||||||||||||||||
363 | - | |||||||||||||||||||
364 | CRYPTO_free(meth->add_arg, __FILE__, 329); | - | ||||||||||||||||||
365 | CRYPTO_free(meth->parse_arg, __FILE__, 330); | - | ||||||||||||||||||
366 | } executed 95 times by 1 test: end of block Executed by:
| 95 | ||||||||||||||||||
367 | CRYPTO_free(exts->meths, __FILE__, 332); | - | ||||||||||||||||||
368 | } executed 16295 times by 2 tests: end of block Executed by:
| 16295 | ||||||||||||||||||
369 | - | |||||||||||||||||||
370 | - | |||||||||||||||||||
371 | int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, unsigned int ext_type) | - | ||||||||||||||||||
372 | { | - | ||||||||||||||||||
373 | return executed 22 times by 1 test: custom_ext_find(&ctx->cert->custext, ENDPOINT_CLIENT, ext_type,return custom_ext_find(&ctx->cert->custext, ENDPOINT_CLIENT, ext_type, ((void *)0) ) != ((void *)0) ; Executed by:
executed 22 times by 1 test: return custom_ext_find(&ctx->cert->custext, ENDPOINT_CLIENT, ext_type, ((void *)0) ) != ((void *)0) ; Executed by:
| 22 | ||||||||||||||||||
374 | executed 22 times by 1 test: return custom_ext_find(&ctx->cert->custext, ENDPOINT_CLIENT, ext_type, ((void *)0) ) != ((void *)0) ; Executed by:
| 22 | ||||||||||||||||||
375 | ((void *)0) executed 22 times by 1 test: return custom_ext_find(&ctx->cert->custext, ENDPOINT_CLIENT, ext_type, ((void *)0) ) != ((void *)0) ; Executed by:
| 22 | ||||||||||||||||||
376 | ) != executed 22 times by 1 test: return custom_ext_find(&ctx->cert->custext, ENDPOINT_CLIENT, ext_type, ((void *)0) ) != ((void *)0) ; Executed by:
| 22 | ||||||||||||||||||
377 | ((void *)0) executed 22 times by 1 test: return custom_ext_find(&ctx->cert->custext, ENDPOINT_CLIENT, ext_type, ((void *)0) ) != ((void *)0) ; Executed by:
| 22 | ||||||||||||||||||
378 | ; executed 22 times by 1 test: return custom_ext_find(&ctx->cert->custext, ENDPOINT_CLIENT, ext_type, ((void *)0) ) != ((void *)0) ; Executed by:
| 22 | ||||||||||||||||||
379 | } | - | ||||||||||||||||||
380 | - | |||||||||||||||||||
381 | static int add_custom_ext_intern(SSL_CTX *ctx, ENDPOINT role, | - | ||||||||||||||||||
382 | unsigned int ext_type, | - | ||||||||||||||||||
383 | unsigned int context, | - | ||||||||||||||||||
384 | SSL_custom_ext_add_cb_ex add_cb, | - | ||||||||||||||||||
385 | SSL_custom_ext_free_cb_ex free_cb, | - | ||||||||||||||||||
386 | void *add_arg, | - | ||||||||||||||||||
387 | SSL_custom_ext_parse_cb_ex parse_cb, | - | ||||||||||||||||||
388 | void *parse_arg) | - | ||||||||||||||||||
389 | { | - | ||||||||||||||||||
390 | custom_ext_methods *exts = &ctx->cert->custext; | - | ||||||||||||||||||
391 | custom_ext_method *meth, *tmp; | - | ||||||||||||||||||
392 | - | |||||||||||||||||||
393 | - | |||||||||||||||||||
394 | - | |||||||||||||||||||
395 | - | |||||||||||||||||||
396 | - | |||||||||||||||||||
397 | if (add_cb ==
| 0-88 | ||||||||||||||||||
398 | ((void *)0)
| 0-88 | ||||||||||||||||||
399 | && free_cb !=
| 0 | ||||||||||||||||||
400 | ((void *)0)
| 0 | ||||||||||||||||||
401 | ) | - | ||||||||||||||||||
402 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
403 | - | |||||||||||||||||||
404 | - | |||||||||||||||||||
405 | - | |||||||||||||||||||
406 | - | |||||||||||||||||||
407 | - | |||||||||||||||||||
408 | - | |||||||||||||||||||
409 | - | |||||||||||||||||||
410 | if (ext_type == 18
| 15-73 | ||||||||||||||||||
411 | && (
| 0-15 | ||||||||||||||||||
412 | && SSL_CTX_ct_is_enabled(ctx)
| 0-15 | ||||||||||||||||||
413 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
414 | - | |||||||||||||||||||
415 | - | |||||||||||||||||||
416 | - | |||||||||||||||||||
417 | - | |||||||||||||||||||
418 | - | |||||||||||||||||||
419 | - | |||||||||||||||||||
420 | if (SSL_extension_supported(ext_type)
| 15-73 | ||||||||||||||||||
421 | && ext_type != 18
| 0-15 | ||||||||||||||||||
422 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
423 | - | |||||||||||||||||||
424 | - | |||||||||||||||||||
425 | if (ext_type > 0xffff
| 0-88 | ||||||||||||||||||
426 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
427 | - | |||||||||||||||||||
428 | if (custom_ext_find(exts, role, ext_type,
| 20-68 | ||||||||||||||||||
429 | ((void *)0)
| 20-68 | ||||||||||||||||||
430 | )
| 20-68 | ||||||||||||||||||
431 | return executed 20 times by 1 test: 0;return 0; Executed by:
executed 20 times by 1 test: return 0; Executed by:
| 20 | ||||||||||||||||||
432 | tmp = CRYPTO_realloc(exts->meths, (exts->meths_count + 1) * sizeof(custom_ext_method), | - | ||||||||||||||||||
433 | __FILE__ | - | ||||||||||||||||||
434 | , | - | ||||||||||||||||||
435 | 388 | - | ||||||||||||||||||
436 | ) | - | ||||||||||||||||||
437 | ; | - | ||||||||||||||||||
438 | if (tmp ==
| 0-68 | ||||||||||||||||||
439 | ((void *)0)
| 0-68 | ||||||||||||||||||
440 | ) | - | ||||||||||||||||||
441 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
442 | - | |||||||||||||||||||
443 | exts->meths = tmp; | - | ||||||||||||||||||
444 | meth = exts->meths + exts->meths_count; | - | ||||||||||||||||||
445 | memset(meth, 0, sizeof(*meth)); | - | ||||||||||||||||||
446 | meth->role = role; | - | ||||||||||||||||||
447 | meth->context = context; | - | ||||||||||||||||||
448 | meth->parse_cb = parse_cb; | - | ||||||||||||||||||
449 | meth->add_cb = add_cb; | - | ||||||||||||||||||
450 | meth->free_cb = free_cb; | - | ||||||||||||||||||
451 | meth->ext_type = ext_type; | - | ||||||||||||||||||
452 | meth->add_arg = add_arg; | - | ||||||||||||||||||
453 | meth->parse_arg = parse_arg; | - | ||||||||||||||||||
454 | exts->meths_count++; | - | ||||||||||||||||||
455 | return executed 68 times by 1 test: 1;return 1; Executed by:
executed 68 times by 1 test: return 1; Executed by:
| 68 | ||||||||||||||||||
456 | } | - | ||||||||||||||||||
457 | - | |||||||||||||||||||
458 | static int add_old_custom_ext(SSL_CTX *ctx, ENDPOINT role, | - | ||||||||||||||||||
459 | unsigned int ext_type, | - | ||||||||||||||||||
460 | unsigned int context, | - | ||||||||||||||||||
461 | custom_ext_add_cb add_cb, | - | ||||||||||||||||||
462 | custom_ext_free_cb free_cb, | - | ||||||||||||||||||
463 | void *add_arg, | - | ||||||||||||||||||
464 | custom_ext_parse_cb parse_cb, void *parse_arg) | - | ||||||||||||||||||
465 | { | - | ||||||||||||||||||
466 | custom_ext_add_cb_wrap *add_cb_wrap | - | ||||||||||||||||||
467 | = CRYPTO_malloc(sizeof(*add_cb_wrap), __FILE__, 416); | - | ||||||||||||||||||
468 | custom_ext_parse_cb_wrap *parse_cb_wrap | - | ||||||||||||||||||
469 | = CRYPTO_malloc(sizeof(*parse_cb_wrap), __FILE__, 418); | - | ||||||||||||||||||
470 | int ret; | - | ||||||||||||||||||
471 | - | |||||||||||||||||||
472 | if (add_cb_wrap ==
| 0-67 | ||||||||||||||||||
473 | ((void *)0)
| 0-67 | ||||||||||||||||||
474 | || parse_cb_wrap ==
| 0-67 | ||||||||||||||||||
475 | ((void *)0)
| 0-67 | ||||||||||||||||||
476 | ) { | - | ||||||||||||||||||
477 | CRYPTO_free(add_cb_wrap, __FILE__, 422); | - | ||||||||||||||||||
478 | CRYPTO_free(parse_cb_wrap, __FILE__, 423); | - | ||||||||||||||||||
479 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
480 | } | - | ||||||||||||||||||
481 | - | |||||||||||||||||||
482 | add_cb_wrap->add_arg = add_arg; | - | ||||||||||||||||||
483 | add_cb_wrap->add_cb = add_cb; | - | ||||||||||||||||||
484 | add_cb_wrap->free_cb = free_cb; | - | ||||||||||||||||||
485 | parse_cb_wrap->parse_arg = parse_arg; | - | ||||||||||||||||||
486 | parse_cb_wrap->parse_cb = parse_cb; | - | ||||||||||||||||||
487 | - | |||||||||||||||||||
488 | ret = add_custom_ext_intern(ctx, role, ext_type, | - | ||||||||||||||||||
489 | context, | - | ||||||||||||||||||
490 | custom_ext_add_old_cb_wrap, | - | ||||||||||||||||||
491 | custom_ext_free_old_cb_wrap, | - | ||||||||||||||||||
492 | add_cb_wrap, | - | ||||||||||||||||||
493 | custom_ext_parse_old_cb_wrap, | - | ||||||||||||||||||
494 | parse_cb_wrap); | - | ||||||||||||||||||
495 | - | |||||||||||||||||||
496 | if (!ret
| 10-57 | ||||||||||||||||||
497 | CRYPTO_free(add_cb_wrap, __FILE__, 442); | - | ||||||||||||||||||
498 | CRYPTO_free(parse_cb_wrap, __FILE__, 443); | - | ||||||||||||||||||
499 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||
500 | - | |||||||||||||||||||
501 | return executed 67 times by 1 test: ret;return ret; Executed by:
executed 67 times by 1 test: return ret; Executed by:
| 67 | ||||||||||||||||||
502 | } | - | ||||||||||||||||||
503 | - | |||||||||||||||||||
504 | - | |||||||||||||||||||
505 | int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, unsigned int ext_type, | - | ||||||||||||||||||
506 | custom_ext_add_cb add_cb, | - | ||||||||||||||||||
507 | custom_ext_free_cb free_cb, | - | ||||||||||||||||||
508 | void *add_arg, | - | ||||||||||||||||||
509 | custom_ext_parse_cb parse_cb, void *parse_arg) | - | ||||||||||||||||||
510 | { | - | ||||||||||||||||||
511 | return executed 20 times by 1 test: add_old_custom_ext(ctx, ENDPOINT_CLIENT, ext_type,return add_old_custom_ext(ctx, ENDPOINT_CLIENT, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
executed 20 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_CLIENT, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 20 | ||||||||||||||||||
512 | 0x0010 executed 20 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_CLIENT, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 20 | ||||||||||||||||||
513 | | 0x0080 executed 20 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_CLIENT, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 20 | ||||||||||||||||||
514 | | 0x0100 executed 20 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_CLIENT, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 20 | ||||||||||||||||||
515 | | 0x0040, executed 20 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_CLIENT, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 20 | ||||||||||||||||||
516 | add_cb, free_cb, add_arg, parse_cb, parse_arg); executed 20 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_CLIENT, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 20 | ||||||||||||||||||
517 | } | - | ||||||||||||||||||
518 | - | |||||||||||||||||||
519 | int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, unsigned int ext_type, | - | ||||||||||||||||||
520 | custom_ext_add_cb add_cb, | - | ||||||||||||||||||
521 | custom_ext_free_cb free_cb, | - | ||||||||||||||||||
522 | void *add_arg, | - | ||||||||||||||||||
523 | custom_ext_parse_cb parse_cb, void *parse_arg) | - | ||||||||||||||||||
524 | { | - | ||||||||||||||||||
525 | return executed 47 times by 1 test: add_old_custom_ext(ctx, ENDPOINT_SERVER, ext_type,return add_old_custom_ext(ctx, ENDPOINT_SERVER, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
executed 47 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_SERVER, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 47 | ||||||||||||||||||
526 | 0x0010 executed 47 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_SERVER, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 47 | ||||||||||||||||||
527 | | 0x0080 executed 47 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_SERVER, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 47 | ||||||||||||||||||
528 | | 0x0100 executed 47 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_SERVER, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 47 | ||||||||||||||||||
529 | | 0x0040, executed 47 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_SERVER, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 47 | ||||||||||||||||||
530 | add_cb, free_cb, add_arg, parse_cb, parse_arg); executed 47 times by 1 test: return add_old_custom_ext(ctx, ENDPOINT_SERVER, ext_type, 0x0010 | 0x0080 | 0x0100 | 0x0040, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 47 | ||||||||||||||||||
531 | } | - | ||||||||||||||||||
532 | - | |||||||||||||||||||
533 | int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, | - | ||||||||||||||||||
534 | unsigned int context, | - | ||||||||||||||||||
535 | SSL_custom_ext_add_cb_ex add_cb, | - | ||||||||||||||||||
536 | SSL_custom_ext_free_cb_ex free_cb, | - | ||||||||||||||||||
537 | void *add_arg, | - | ||||||||||||||||||
538 | SSL_custom_ext_parse_cb_ex parse_cb, void *parse_arg) | - | ||||||||||||||||||
539 | { | - | ||||||||||||||||||
540 | return executed 21 times by 1 test: add_custom_ext_intern(ctx, ENDPOINT_BOTH, ext_type, context, add_cb,return add_custom_ext_intern(ctx, ENDPOINT_BOTH, ext_type, context, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
executed 21 times by 1 test: return add_custom_ext_intern(ctx, ENDPOINT_BOTH, ext_type, context, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 21 | ||||||||||||||||||
541 | free_cb, add_arg, parse_cb, parse_arg); executed 21 times by 1 test: return add_custom_ext_intern(ctx, ENDPOINT_BOTH, ext_type, context, add_cb, free_cb, add_arg, parse_cb, parse_arg); Executed by:
| 21 | ||||||||||||||||||
542 | } | - | ||||||||||||||||||
543 | - | |||||||||||||||||||
544 | int SSL_extension_supported(unsigned int ext_type) | - | ||||||||||||||||||
545 | { | - | ||||||||||||||||||
546 | switch (ext_type) { | - | ||||||||||||||||||
547 | - | |||||||||||||||||||
548 | case never executed: 16:case 16: never executed: case 16: | 0 | ||||||||||||||||||
549 | - | |||||||||||||||||||
550 | case never executed: 11:case 11: never executed: case 11: | 0 | ||||||||||||||||||
551 | case never executed: 10:case 10: never executed: case 10: | 0 | ||||||||||||||||||
552 | case never executed: 51:case 51: never executed: case 51: | 0 | ||||||||||||||||||
553 | - | |||||||||||||||||||
554 | - | |||||||||||||||||||
555 | case never executed: 13172:case 13172: never executed: case 13172: | 0 | ||||||||||||||||||
556 | - | |||||||||||||||||||
557 | case never executed: 21:case 21: never executed: case 21: | 0 | ||||||||||||||||||
558 | case never executed: 0xff01:case 0xff01: never executed: case 0xff01: | 0 | ||||||||||||||||||
559 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||
560 | case never executed: 0:case 0: never executed: case 0: | 0 | ||||||||||||||||||
561 | case never executed: 35:case 35: never executed: case 35: | 0 | ||||||||||||||||||
562 | case never executed: 13:case 13: never executed: case 13: | 0 | ||||||||||||||||||
563 | - | |||||||||||||||||||
564 | case never executed: 12:case 12: never executed: case 12: | 0 | ||||||||||||||||||
565 | - | |||||||||||||||||||
566 | - | |||||||||||||||||||
567 | case never executed: 5:case 5: never executed: case 5: | 0 | ||||||||||||||||||
568 | - | |||||||||||||||||||
569 | - | |||||||||||||||||||
570 | case executed 15 times by 1 test: 18:case 18: Executed by:
executed 15 times by 1 test: case 18: Executed by:
| 15 | ||||||||||||||||||
571 | - | |||||||||||||||||||
572 | - | |||||||||||||||||||
573 | case never executed: 14:case 14: never executed: case 14: | 0 | ||||||||||||||||||
574 | - | |||||||||||||||||||
575 | case never executed: 22:case 22: never executed: case 22: | 0 | ||||||||||||||||||
576 | case never executed: 43:case 43: never executed: case 43: | 0 | ||||||||||||||||||
577 | case never executed: 23:case 23: never executed: case 23: | 0 | ||||||||||||||||||
578 | case never executed: 45:case 45: never executed: case 45: | 0 | ||||||||||||||||||
579 | case never executed: 44:case 44: never executed: case 44: | 0 | ||||||||||||||||||
580 | case never executed: 42:case 42: never executed: case 42: | 0 | ||||||||||||||||||
581 | case never executed: 47:case 47: never executed: case 47: | 0 | ||||||||||||||||||
582 | case never executed: 41:case 41: never executed: case 41: | 0 | ||||||||||||||||||
583 | case never executed: 49:case 49: never executed: case 49: | 0 | ||||||||||||||||||
584 | return executed 15 times by 1 test: 1;return 1; Executed by:
executed 15 times by 1 test: return 1; Executed by:
| 15 | ||||||||||||||||||
585 | default executed 73 times by 1 test: :default: Executed by:
executed 73 times by 1 test: default: Executed by:
| 73 | ||||||||||||||||||
586 | return executed 73 times by 1 test: 0;return 0; Executed by:
executed 73 times by 1 test: return 0; Executed by:
| 73 | ||||||||||||||||||
587 | } | - | ||||||||||||||||||
588 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |