Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/ssl/ssl_tlsext.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||
9 | int | - | ||||||||||||||||||||||||
10 | tlsext_alpn_clienthello_needs(SSL *s) | - | ||||||||||||||||||||||||
11 | { | - | ||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||
13 | return executed 80 times by 4 tests: s->internal->alpn_client_proto_list != return s->internal->alpn_client_proto_list != ((void *)0) && (s->s3->internal)->tmp.finish_md_len == 0; Executed by:
executed 80 times by 4 tests: return s->internal->alpn_client_proto_list != ((void *)0) && (s->s3->internal)->tmp.finish_md_len == 0; Executed by:
| 10-80 | ||||||||||||||||||||||||
14 | ((void *)0)
executed 80 times by 4 tests: return s->internal->alpn_client_proto_list != ((void *)0) && (s->s3->internal)->tmp.finish_md_len == 0; Executed by:
| 10-80 | ||||||||||||||||||||||||
15 | && executed 80 times by 4 tests: return s->internal->alpn_client_proto_list != ((void *)0) && (s->s3->internal)->tmp.finish_md_len == 0; Executed by:
| 80 | ||||||||||||||||||||||||
16 | (
executed 80 times by 4 tests: return s->internal->alpn_client_proto_list != ((void *)0) && (s->s3->internal)->tmp.finish_md_len == 0; Executed by:
| 0-80 | ||||||||||||||||||||||||
17 | } | - | ||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||
19 | int | - | ||||||||||||||||||||||||
20 | tlsext_alpn_clienthello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
21 | { | - | ||||||||||||||||||||||||
22 | CBB protolist; | - | ||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||
24 | if (!CBB_add_u16_length_prefixed(cbb, &protolist)
| 0-10 | ||||||||||||||||||||||||
25 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||
27 | if (!CBB_add_bytes(&protolist, s->internal->alpn_client_proto_list,
| 0-10 | ||||||||||||||||||||||||
28 | s->internal->alpn_client_proto_list_len)
| 0-10 | ||||||||||||||||||||||||
29 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||
31 | if (!CBB_flush(cbb)
| 0-10 | ||||||||||||||||||||||||
32 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
33 | - | |||||||||||||||||||||||||
34 | return executed 10 times by 2 tests: 1;return 1; Executed by:
executed 10 times by 2 tests: return 1; Executed by:
| 10 | ||||||||||||||||||||||||
35 | } | - | ||||||||||||||||||||||||
36 | - | |||||||||||||||||||||||||
37 | int | - | ||||||||||||||||||||||||
38 | tlsext_alpn_clienthello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
39 | { | - | ||||||||||||||||||||||||
40 | CBS proto_name_list, alpn; | - | ||||||||||||||||||||||||
41 | const unsigned char *selected; | - | ||||||||||||||||||||||||
42 | unsigned char selected_len; | - | ||||||||||||||||||||||||
43 | int r; | - | ||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||
45 | if (!CBS_get_u16_length_prefixed(cbs, &alpn)
| 3-18 | ||||||||||||||||||||||||
46 | goto executed 3 times by 1 test: err;goto err; Executed by:
executed 3 times by 1 test: goto err; Executed by:
| 3 | ||||||||||||||||||||||||
47 | if (CBS_len(&alpn) < 2
| 1-17 | ||||||||||||||||||||||||
48 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||||||||
49 | if (CBS_len(cbs) != 0
| 1-16 | ||||||||||||||||||||||||
50 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||
52 | CBS_dup(&alpn, &proto_name_list); | - | ||||||||||||||||||||||||
53 | while (CBS_len(&proto_name_list) > 0
| 14-29 | ||||||||||||||||||||||||
54 | CBS proto_name; | - | ||||||||||||||||||||||||
55 | - | |||||||||||||||||||||||||
56 | if (!CBS_get_u8_length_prefixed(&proto_name_list, &proto_name)
| 2-27 | ||||||||||||||||||||||||
57 | goto executed 2 times by 1 test: err;goto err; Executed by:
executed 2 times by 1 test: goto err; Executed by:
| 2 | ||||||||||||||||||||||||
58 | if (CBS_len(&proto_name) == 0
| 0-27 | ||||||||||||||||||||||||
59 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
60 | } executed 27 times by 3 tests: end of block Executed by:
| 27 | ||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||
62 | if (s->ctx->internal->alpn_select_cb ==
| 2-12 | ||||||||||||||||||||||||
63 | ((void *)0)
| 2-12 | ||||||||||||||||||||||||
64 | ) | - | ||||||||||||||||||||||||
65 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||
67 | r = s->ctx->internal->alpn_select_cb(s, &selected, &selected_len, | - | ||||||||||||||||||||||||
68 | CBS_data(&alpn), CBS_len(&alpn), | - | ||||||||||||||||||||||||
69 | s->ctx->internal->alpn_select_cb_arg); | - | ||||||||||||||||||||||||
70 | if (r == 0
| 2-10 | ||||||||||||||||||||||||
71 | free((s->s3->internal)->alpn_selected); | - | ||||||||||||||||||||||||
72 | if (((
| 0-10 | ||||||||||||||||||||||||
73 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||
74 | ) { | - | ||||||||||||||||||||||||
75 | *alert = 80; | - | ||||||||||||||||||||||||
76 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
77 | } | - | ||||||||||||||||||||||||
78 | memcpy((s->s3->internal)->alpn_selected, selected, selected_len); | - | ||||||||||||||||||||||||
79 | (s->s3->internal)->alpn_selected_len = selected_len; | - | ||||||||||||||||||||||||
80 | } executed 10 times by 2 tests: end of block Executed by:
| 10 | ||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||
82 | return executed 12 times by 2 tests: 1;return 1; Executed by:
executed 12 times by 2 tests: return 1; Executed by:
| 12 | ||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||
84 | err: | - | ||||||||||||||||||||||||
85 | *alert = 50; | - | ||||||||||||||||||||||||
86 | return executed 7 times by 1 test: 0;return 0; Executed by:
executed 7 times by 1 test: return 0; Executed by:
| 7 | ||||||||||||||||||||||||
87 | } | - | ||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||
89 | int | - | ||||||||||||||||||||||||
90 | tlsext_alpn_serverhello_needs(SSL *s) | - | ||||||||||||||||||||||||
91 | { | - | ||||||||||||||||||||||||
92 | return executed 70 times by 4 tests: (s->s3->internal)->alpn_selected != return (s->s3->internal)->alpn_selected != ((void *)0) ; Executed by:
executed 70 times by 4 tests: return (s->s3->internal)->alpn_selected != ((void *)0) ; Executed by:
| 70 | ||||||||||||||||||||||||
93 | ((void *)0) executed 70 times by 4 tests: return (s->s3->internal)->alpn_selected != ((void *)0) ; Executed by:
| 70 | ||||||||||||||||||||||||
94 | ; executed 70 times by 4 tests: return (s->s3->internal)->alpn_selected != ((void *)0) ; Executed by:
| 70 | ||||||||||||||||||||||||
95 | } | - | ||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||
97 | int | - | ||||||||||||||||||||||||
98 | tlsext_alpn_serverhello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
99 | { | - | ||||||||||||||||||||||||
100 | CBB list, selected; | - | ||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||
102 | if (!CBB_add_u16_length_prefixed(cbb, &list)
| 0-7 | ||||||||||||||||||||||||
103 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
104 | - | |||||||||||||||||||||||||
105 | if (!CBB_add_u8_length_prefixed(&list, &selected)
| 0-7 | ||||||||||||||||||||||||
106 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||
108 | if (!CBB_add_bytes(&selected, (s->s3->internal)->alpn_selected,
| 0-7 | ||||||||||||||||||||||||
109 | (s->s3->internal)->alpn_selected_len)
| 0-7 | ||||||||||||||||||||||||
110 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||
112 | if (!CBB_flush(cbb)
| 0-7 | ||||||||||||||||||||||||
113 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
114 | - | |||||||||||||||||||||||||
115 | return executed 7 times by 2 tests: 1;return 1; Executed by:
executed 7 times by 2 tests: return 1; Executed by:
| 7 | ||||||||||||||||||||||||
116 | } | - | ||||||||||||||||||||||||
117 | - | |||||||||||||||||||||||||
118 | int | - | ||||||||||||||||||||||||
119 | tlsext_alpn_serverhello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
120 | { | - | ||||||||||||||||||||||||
121 | CBS list, proto; | - | ||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||
123 | if (s->internal->alpn_client_proto_list ==
| 1-18 | ||||||||||||||||||||||||
124 | ((void *)0)
| 1-18 | ||||||||||||||||||||||||
125 | ) { | - | ||||||||||||||||||||||||
126 | *alert = 110; | - | ||||||||||||||||||||||||
127 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
128 | } | - | ||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||
130 | if (!CBS_get_u16_length_prefixed(cbs, &list)
| 3-15 | ||||||||||||||||||||||||
131 | goto executed 3 times by 1 test: err;goto err; Executed by:
executed 3 times by 1 test: goto err; Executed by:
| 3 | ||||||||||||||||||||||||
132 | if (CBS_len(cbs) != 0
| 1-14 | ||||||||||||||||||||||||
133 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||||||||
134 | - | |||||||||||||||||||||||||
135 | if (!CBS_get_u8_length_prefixed(&list, &proto)
| 1-13 | ||||||||||||||||||||||||
136 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||||||||
137 | - | |||||||||||||||||||||||||
138 | if (CBS_len(&list) != 0
| 4-9 | ||||||||||||||||||||||||
139 | goto executed 4 times by 1 test: err;goto err; Executed by:
executed 4 times by 1 test: goto err; Executed by:
| 4 | ||||||||||||||||||||||||
140 | if (CBS_len(&proto) == 0
| 1-8 | ||||||||||||||||||||||||
141 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||||||||
142 | - | |||||||||||||||||||||||||
143 | if (!CBS_stow(&proto, &((s->s3->internal)->alpn_selected),
| 0-8 | ||||||||||||||||||||||||
144 | &((s->s3->internal)->alpn_selected_len))
| 0-8 | ||||||||||||||||||||||||
145 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
146 | - | |||||||||||||||||||||||||
147 | return executed 8 times by 3 tests: 1;return 1; Executed by:
executed 8 times by 3 tests: return 1; Executed by:
| 8 | ||||||||||||||||||||||||
148 | - | |||||||||||||||||||||||||
149 | err: | - | ||||||||||||||||||||||||
150 | *alert = 50; | - | ||||||||||||||||||||||||
151 | return executed 10 times by 1 test: 0;return 0; Executed by:
executed 10 times by 1 test: return 0; Executed by:
| 10 | ||||||||||||||||||||||||
152 | } | - | ||||||||||||||||||||||||
153 | - | |||||||||||||||||||||||||
154 | - | |||||||||||||||||||||||||
155 | - | |||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||
157 | int | - | ||||||||||||||||||||||||
158 | tlsext_ec_clienthello_needs(SSL *s) | - | ||||||||||||||||||||||||
159 | { | - | ||||||||||||||||||||||||
160 | return executed 81 times by 4 tests: ssl_has_ecc_ciphers(s);return ssl_has_ecc_ciphers(s); Executed by:
executed 81 times by 4 tests: return ssl_has_ecc_ciphers(s); Executed by:
| 81 | ||||||||||||||||||||||||
161 | } | - | ||||||||||||||||||||||||
162 | - | |||||||||||||||||||||||||
163 | int | - | ||||||||||||||||||||||||
164 | tlsext_ec_clienthello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
165 | { | - | ||||||||||||||||||||||||
166 | CBB curvelist; | - | ||||||||||||||||||||||||
167 | size_t curves_len; | - | ||||||||||||||||||||||||
168 | int i; | - | ||||||||||||||||||||||||
169 | const uint16_t *curves; | - | ||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||
171 | tls1_get_curvelist(s, 0, &curves, &curves_len); | - | ||||||||||||||||||||||||
172 | - | |||||||||||||||||||||||||
173 | if (curves_len == 0
| 0-41 | ||||||||||||||||||||||||
174 | SSL_error_internal(s, (4|64), __FILE__, 185); | - | ||||||||||||||||||||||||
175 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
176 | } | - | ||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||
178 | if (!CBB_add_u16_length_prefixed(cbb, &curvelist)
| 0-41 | ||||||||||||||||||||||||
179 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
180 | - | |||||||||||||||||||||||||
181 | for (i = 0; i < curves_len
| 41-122 | ||||||||||||||||||||||||
182 | if (!CBB_add_u16(&curvelist, curves[i])
| 0-122 | ||||||||||||||||||||||||
183 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
184 | } executed 122 times by 4 tests: end of block Executed by:
| 122 | ||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||
186 | if (!CBB_flush(cbb)
| 0-41 | ||||||||||||||||||||||||
187 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
188 | - | |||||||||||||||||||||||||
189 | return executed 41 times by 4 tests: 1;return 1; Executed by:
executed 41 times by 4 tests: return 1; Executed by:
| 41 | ||||||||||||||||||||||||
190 | } | - | ||||||||||||||||||||||||
191 | - | |||||||||||||||||||||||||
192 | int | - | ||||||||||||||||||||||||
193 | tlsext_ec_clienthello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
194 | { | - | ||||||||||||||||||||||||
195 | CBS curvelist; | - | ||||||||||||||||||||||||
196 | size_t curves_len; | - | ||||||||||||||||||||||||
197 | - | |||||||||||||||||||||||||
198 | if (!CBS_get_u16_length_prefixed(cbs, &curvelist)
| 0-30 | ||||||||||||||||||||||||
199 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
200 | if (CBS_len(cbs) != 0
| 0-30 | ||||||||||||||||||||||||
201 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||
203 | curves_len = CBS_len(&curvelist); | - | ||||||||||||||||||||||||
204 | if (curves_len == 0
| 0-30 | ||||||||||||||||||||||||
205 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
206 | curves_len /= 2; | - | ||||||||||||||||||||||||
207 | - | |||||||||||||||||||||||||
208 | if (!s->internal->hit
| 0-30 | ||||||||||||||||||||||||
209 | int i; | - | ||||||||||||||||||||||||
210 | uint16_t *curves; | - | ||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||
212 | if ((
| 0-30 | ||||||||||||||||||||||||
213 | ((void *)0)
| 0-30 | ||||||||||||||||||||||||
214 | ) | - | ||||||||||||||||||||||||
215 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
216 | - | |||||||||||||||||||||||||
217 | if ((
| 0-30 | ||||||||||||||||||||||||
218 | ((void *)0)
| 0-30 | ||||||||||||||||||||||||
219 | , curves_len,
| 0-30 | ||||||||||||||||||||||||
220 | sizeof(uint16_t))) ==
| 0-30 | ||||||||||||||||||||||||
221 | ((void *)0)
| 0-30 | ||||||||||||||||||||||||
222 | ) { | - | ||||||||||||||||||||||||
223 | *alert = 80; | - | ||||||||||||||||||||||||
224 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
225 | } | - | ||||||||||||||||||||||||
226 | - | |||||||||||||||||||||||||
227 | for (i = 0; i < curves_len
| 30-87 | ||||||||||||||||||||||||
228 | if (!CBS_get_u16(&curvelist, &curves[i])
| 0-87 | ||||||||||||||||||||||||
229 | free(curves); | - | ||||||||||||||||||||||||
230 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
231 | } | - | ||||||||||||||||||||||||
232 | } executed 87 times by 3 tests: end of block Executed by:
| 87 | ||||||||||||||||||||||||
233 | - | |||||||||||||||||||||||||
234 | if (CBS_len(&curvelist) != 0
| 0-30 | ||||||||||||||||||||||||
235 | free(curves); | - | ||||||||||||||||||||||||
236 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
237 | } | - | ||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||
239 | (s->session->internal)->tlsext_supportedgroups = curves; | - | ||||||||||||||||||||||||
240 | (s->session->internal)->tlsext_supportedgroups_length = curves_len; | - | ||||||||||||||||||||||||
241 | } executed 30 times by 3 tests: end of block Executed by:
| 30 | ||||||||||||||||||||||||
242 | - | |||||||||||||||||||||||||
243 | return executed 30 times by 3 tests: 1;return 1; Executed by:
executed 30 times by 3 tests: return 1; Executed by:
| 30 | ||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||
245 | err: | - | ||||||||||||||||||||||||
246 | *alert = 50; | - | ||||||||||||||||||||||||
247 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
248 | } | - | ||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||
251 | int | - | ||||||||||||||||||||||||
252 | tlsext_ec_serverhello_needs(SSL *s) | - | ||||||||||||||||||||||||
253 | { | - | ||||||||||||||||||||||||
254 | return executed 69 times by 4 tests: 0;return 0; Executed by:
executed 69 times by 4 tests: return 0; Executed by:
| 69 | ||||||||||||||||||||||||
255 | } | - | ||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||
257 | int | - | ||||||||||||||||||||||||
258 | tlsext_ec_serverhello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
259 | { | - | ||||||||||||||||||||||||
260 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
261 | } | - | ||||||||||||||||||||||||
262 | - | |||||||||||||||||||||||||
263 | int | - | ||||||||||||||||||||||||
264 | tlsext_ec_serverhello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
265 | { | - | ||||||||||||||||||||||||
266 | if (!CBS_skip(cbs, CBS_len(cbs))
| 0 | ||||||||||||||||||||||||
267 | *alert = 80; | - | ||||||||||||||||||||||||
268 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
269 | } | - | ||||||||||||||||||||||||
270 | - | |||||||||||||||||||||||||
271 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
272 | } | - | ||||||||||||||||||||||||
273 | - | |||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||
277 | static int | - | ||||||||||||||||||||||||
278 | tlsext_ecpf_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
279 | { | - | ||||||||||||||||||||||||
280 | CBB ecpf; | - | ||||||||||||||||||||||||
281 | size_t formats_len; | - | ||||||||||||||||||||||||
282 | const uint8_t *formats; | - | ||||||||||||||||||||||||
283 | - | |||||||||||||||||||||||||
284 | tls1_get_formatlist(s, 0, &formats, &formats_len); | - | ||||||||||||||||||||||||
285 | - | |||||||||||||||||||||||||
286 | if (formats_len == 0
| 0-72 | ||||||||||||||||||||||||
287 | SSL_error_internal(s, (4|64), __FILE__, 302); | - | ||||||||||||||||||||||||
288 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
289 | } | - | ||||||||||||||||||||||||
290 | - | |||||||||||||||||||||||||
291 | if (!CBB_add_u8_length_prefixed(cbb, &ecpf)
| 0-72 | ||||||||||||||||||||||||
292 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
293 | if (!CBB_add_bytes(&ecpf, formats, formats_len)
| 0-72 | ||||||||||||||||||||||||
294 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
295 | if (!CBB_flush(cbb)
| 0-72 | ||||||||||||||||||||||||
296 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
297 | - | |||||||||||||||||||||||||
298 | return executed 72 times by 4 tests: 1;return 1; Executed by:
executed 72 times by 4 tests: return 1; Executed by:
| 72 | ||||||||||||||||||||||||
299 | } | - | ||||||||||||||||||||||||
300 | - | |||||||||||||||||||||||||
301 | static int | - | ||||||||||||||||||||||||
302 | tlsext_ecpf_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
303 | { | - | ||||||||||||||||||||||||
304 | CBS ecpf; | - | ||||||||||||||||||||||||
305 | - | |||||||||||||||||||||||||
306 | if (!CBS_get_u8_length_prefixed(cbs, &ecpf)
| 0-60 | ||||||||||||||||||||||||
307 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
308 | if (CBS_len(&ecpf) == 0
| 0-60 | ||||||||||||||||||||||||
309 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
310 | if (CBS_len(cbs) != 0
| 0-60 | ||||||||||||||||||||||||
311 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
312 | - | |||||||||||||||||||||||||
313 | - | |||||||||||||||||||||||||
314 | if (!CBS_contains_zero_byte(&ecpf)
| 1-59 | ||||||||||||||||||||||||
315 | SSL_error_internal(s, 157, __FILE__, 330); | - | ||||||||||||||||||||||||
316 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||||||||
317 | } | - | ||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||
319 | if (!s->internal->hit
| 0-59 | ||||||||||||||||||||||||
320 | if (!CBS_stow(&ecpf, &((s->session->internal)->tlsext_ecpointformatlist),
| 0-59 | ||||||||||||||||||||||||
321 | &((s->session->internal)->tlsext_ecpointformatlist_length))
| 0-59 | ||||||||||||||||||||||||
322 | *alert = 80; | - | ||||||||||||||||||||||||
323 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
324 | } | - | ||||||||||||||||||||||||
325 | } executed 59 times by 3 tests: end of block Executed by:
| 59 | ||||||||||||||||||||||||
326 | - | |||||||||||||||||||||||||
327 | return executed 59 times by 3 tests: 1;return 1; Executed by:
executed 59 times by 3 tests: return 1; Executed by:
| 59 | ||||||||||||||||||||||||
328 | - | |||||||||||||||||||||||||
329 | err: | - | ||||||||||||||||||||||||
330 | *alert = 50; | - | ||||||||||||||||||||||||
331 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
332 | } | - | ||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||
334 | int | - | ||||||||||||||||||||||||
335 | tlsext_ecpf_clienthello_needs(SSL *s) | - | ||||||||||||||||||||||||
336 | { | - | ||||||||||||||||||||||||
337 | return executed 80 times by 4 tests: ssl_has_ecc_ciphers(s);return ssl_has_ecc_ciphers(s); Executed by:
executed 80 times by 4 tests: return ssl_has_ecc_ciphers(s); Executed by:
| 80 | ||||||||||||||||||||||||
338 | } | - | ||||||||||||||||||||||||
339 | - | |||||||||||||||||||||||||
340 | int | - | ||||||||||||||||||||||||
341 | tlsext_ecpf_clienthello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
342 | { | - | ||||||||||||||||||||||||
343 | return executed 41 times by 4 tests: tlsext_ecpf_build(s, cbb);return tlsext_ecpf_build(s, cbb); Executed by:
executed 41 times by 4 tests: return tlsext_ecpf_build(s, cbb); Executed by:
| 41 | ||||||||||||||||||||||||
344 | } | - | ||||||||||||||||||||||||
345 | - | |||||||||||||||||||||||||
346 | int | - | ||||||||||||||||||||||||
347 | tlsext_ecpf_clienthello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
348 | { | - | ||||||||||||||||||||||||
349 | return executed 30 times by 3 tests: tlsext_ecpf_parse(s, cbs, alert);return tlsext_ecpf_parse(s, cbs, alert); Executed by:
executed 30 times by 3 tests: return tlsext_ecpf_parse(s, cbs, alert); Executed by:
| 30 | ||||||||||||||||||||||||
350 | } | - | ||||||||||||||||||||||||
351 | - | |||||||||||||||||||||||||
352 | int | - | ||||||||||||||||||||||||
353 | tlsext_ecpf_serverhello_needs(SSL *s) | - | ||||||||||||||||||||||||
354 | { | - | ||||||||||||||||||||||||
355 | if (s->version == 0xFEFF
| 11-58 | ||||||||||||||||||||||||
356 | return executed 11 times by 1 test: 0;return 0; Executed by:
executed 11 times by 1 test: return 0; Executed by:
| 11 | ||||||||||||||||||||||||
357 | - | |||||||||||||||||||||||||
358 | return executed 58 times by 4 tests: ssl_using_ecc_cipher(s);return ssl_using_ecc_cipher(s); Executed by:
executed 58 times by 4 tests: return ssl_using_ecc_cipher(s); Executed by:
| 58 | ||||||||||||||||||||||||
359 | } | - | ||||||||||||||||||||||||
360 | - | |||||||||||||||||||||||||
361 | int | - | ||||||||||||||||||||||||
362 | tlsext_ecpf_serverhello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
363 | { | - | ||||||||||||||||||||||||
364 | return executed 31 times by 3 tests: tlsext_ecpf_build(s, cbb);return tlsext_ecpf_build(s, cbb); Executed by:
executed 31 times by 3 tests: return tlsext_ecpf_build(s, cbb); Executed by:
| 31 | ||||||||||||||||||||||||
365 | } | - | ||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||
367 | int | - | ||||||||||||||||||||||||
368 | tlsext_ecpf_serverhello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
369 | { | - | ||||||||||||||||||||||||
370 | return executed 30 times by 3 tests: tlsext_ecpf_parse(s, cbs, alert);return tlsext_ecpf_parse(s, cbs, alert); Executed by:
executed 30 times by 3 tests: return tlsext_ecpf_parse(s, cbs, alert); Executed by:
| 30 | ||||||||||||||||||||||||
371 | } | - | ||||||||||||||||||||||||
372 | - | |||||||||||||||||||||||||
373 | - | |||||||||||||||||||||||||
374 | - | |||||||||||||||||||||||||
375 | - | |||||||||||||||||||||||||
376 | int | - | ||||||||||||||||||||||||
377 | tlsext_ri_clienthello_needs(SSL *s) | - | ||||||||||||||||||||||||
378 | { | - | ||||||||||||||||||||||||
379 | return executed 78 times by 4 tests: (s->internal->renegotiate);return (s->internal->renegotiate); Executed by:
executed 78 times by 4 tests: return (s->internal->renegotiate); Executed by:
| 78 | ||||||||||||||||||||||||
380 | } | - | ||||||||||||||||||||||||
381 | - | |||||||||||||||||||||||||
382 | int | - | ||||||||||||||||||||||||
383 | tlsext_ri_clienthello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
384 | { | - | ||||||||||||||||||||||||
385 | CBB reneg; | - | ||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||
387 | if (!CBB_add_u8_length_prefixed(cbb, &reneg)
| 0-1 | ||||||||||||||||||||||||
388 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
389 | if (!CBB_add_bytes(&reneg, (s->s3->internal)->previous_client_finished,
| 0-1 | ||||||||||||||||||||||||
390 | (s->s3->internal)->previous_client_finished_len)
| 0-1 | ||||||||||||||||||||||||
391 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
392 | if (!CBB_flush(cbb)
| 0-1 | ||||||||||||||||||||||||
393 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
394 | - | |||||||||||||||||||||||||
395 | return executed 1 time by 1 test: 1;return 1; Executed by:
executed 1 time by 1 test: return 1; Executed by:
| 1 | ||||||||||||||||||||||||
396 | } | - | ||||||||||||||||||||||||
397 | - | |||||||||||||||||||||||||
398 | int | - | ||||||||||||||||||||||||
399 | tlsext_ri_clienthello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
400 | { | - | ||||||||||||||||||||||||
401 | CBS reneg; | - | ||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||
403 | if (!CBS_get_u8_length_prefixed(cbs, &reneg)
| 0-2 | ||||||||||||||||||||||||
404 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
405 | if (CBS_len(cbs) != 0
| 0-2 | ||||||||||||||||||||||||
406 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
407 | - | |||||||||||||||||||||||||
408 | if (!CBS_mem_equal(&reneg, (s->s3->internal)->previous_client_finished,
| 1 | ||||||||||||||||||||||||
409 | (s->s3->internal)->previous_client_finished_len)
| 1 | ||||||||||||||||||||||||
410 | SSL_error_internal(s, 337, __FILE__, 425); | - | ||||||||||||||||||||||||
411 | *alert = 40; | - | ||||||||||||||||||||||||
412 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
413 | } | - | ||||||||||||||||||||||||
414 | - | |||||||||||||||||||||||||
415 | (s->s3->internal)->renegotiate_seen = 1; | - | ||||||||||||||||||||||||
416 | (s->s3->internal)->send_connection_binding = 1; | - | ||||||||||||||||||||||||
417 | - | |||||||||||||||||||||||||
418 | return executed 1 time by 1 test: 1;return 1; Executed by:
executed 1 time by 1 test: return 1; Executed by:
| 1 | ||||||||||||||||||||||||
419 | - | |||||||||||||||||||||||||
420 | err: | - | ||||||||||||||||||||||||
421 | SSL_error_internal(s, 336, __FILE__, 436); | - | ||||||||||||||||||||||||
422 | *alert = 50; | - | ||||||||||||||||||||||||
423 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
424 | } | - | ||||||||||||||||||||||||
425 | - | |||||||||||||||||||||||||
426 | int | - | ||||||||||||||||||||||||
427 | tlsext_ri_serverhello_needs(SSL *s) | - | ||||||||||||||||||||||||
428 | { | - | ||||||||||||||||||||||||
429 | return executed 69 times by 4 tests: ((s->s3->internal)->send_connection_binding);return ((s->s3->internal)->send_connection_binding); Executed by:
executed 69 times by 4 tests: return ((s->s3->internal)->send_connection_binding); Executed by:
| 69 | ||||||||||||||||||||||||
430 | } | - | ||||||||||||||||||||||||
431 | - | |||||||||||||||||||||||||
432 | int | - | ||||||||||||||||||||||||
433 | tlsext_ri_serverhello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
434 | { | - | ||||||||||||||||||||||||
435 | CBB reneg; | - | ||||||||||||||||||||||||
436 | - | |||||||||||||||||||||||||
437 | if (!CBB_add_u8_length_prefixed(cbb, &reneg)
| 0-66 | ||||||||||||||||||||||||
438 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
439 | if (!CBB_add_bytes(&reneg, (s->s3->internal)->previous_client_finished,
| 0-66 | ||||||||||||||||||||||||
440 | (s->s3->internal)->previous_client_finished_len)
| 0-66 | ||||||||||||||||||||||||
441 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
442 | if (!CBB_add_bytes(&reneg, (s->s3->internal)->previous_server_finished,
| 0-66 | ||||||||||||||||||||||||
443 | (s->s3->internal)->previous_server_finished_len)
| 0-66 | ||||||||||||||||||||||||
444 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
445 | if (!CBB_flush(cbb)
| 0-66 | ||||||||||||||||||||||||
446 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
447 | - | |||||||||||||||||||||||||
448 | return executed 66 times by 4 tests: 1;return 1; Executed by:
executed 66 times by 4 tests: return 1; Executed by:
| 66 | ||||||||||||||||||||||||
449 | } | - | ||||||||||||||||||||||||
450 | - | |||||||||||||||||||||||||
451 | int | - | ||||||||||||||||||||||||
452 | tlsext_ri_serverhello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
453 | { | - | ||||||||||||||||||||||||
454 | CBS reneg, prev_client, prev_server; | - | ||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||
456 | - | |||||||||||||||||||||||||
457 | - | |||||||||||||||||||||||||
458 | - | |||||||||||||||||||||||||
459 | - | |||||||||||||||||||||||||
460 | if (((
| 2-63 | ||||||||||||||||||||||||
461 | (
| 0-63 | ||||||||||||||||||||||||
462 | ((
| 2-63 | ||||||||||||||||||||||||
463 | (
| 0-2 | ||||||||||||||||||||||||
464 | *alert = 80; | - | ||||||||||||||||||||||||
465 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
466 | } | - | ||||||||||||||||||||||||
467 | - | |||||||||||||||||||||||||
468 | if (!CBS_get_u8_length_prefixed(cbs, &reneg)
| 0-65 | ||||||||||||||||||||||||
469 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
470 | if (!CBS_get_bytes(&reneg, &prev_client,
| 0-65 | ||||||||||||||||||||||||
471 | (s->s3->internal)->previous_client_finished_len)
| 0-65 | ||||||||||||||||||||||||
472 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
473 | if (!CBS_get_bytes(&reneg, &prev_server,
| 0-65 | ||||||||||||||||||||||||
474 | (s->s3->internal)->previous_server_finished_len)
| 0-65 | ||||||||||||||||||||||||
475 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
476 | if (CBS_len(&reneg) != 0
| 0-65 | ||||||||||||||||||||||||
477 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
478 | if (CBS_len(cbs) != 0
| 0-65 | ||||||||||||||||||||||||
479 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
480 | - | |||||||||||||||||||||||||
481 | if (!CBS_mem_equal(&prev_client, (s->s3->internal)->previous_client_finished,
| 1-64 | ||||||||||||||||||||||||
482 | (s->s3->internal)->previous_client_finished_len)
| 1-64 | ||||||||||||||||||||||||
483 | SSL_error_internal(s, 337, __FILE__, 498); | - | ||||||||||||||||||||||||
484 | *alert = 40; | - | ||||||||||||||||||||||||
485 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
486 | } | - | ||||||||||||||||||||||||
487 | if (!CBS_mem_equal(&prev_server, (s->s3->internal)->previous_server_finished,
| 0-64 | ||||||||||||||||||||||||
488 | (s->s3->internal)->previous_server_finished_len)
| 0-64 | ||||||||||||||||||||||||
489 | SSL_error_internal(s, 337, __FILE__, 504); | - | ||||||||||||||||||||||||
490 | *alert = 40; | - | ||||||||||||||||||||||||
491 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
492 | } | - | ||||||||||||||||||||||||
493 | - | |||||||||||||||||||||||||
494 | (s->s3->internal)->renegotiate_seen = 1; | - | ||||||||||||||||||||||||
495 | (s->s3->internal)->send_connection_binding = 1; | - | ||||||||||||||||||||||||
496 | - | |||||||||||||||||||||||||
497 | return executed 64 times by 3 tests: 1;return 1; Executed by:
executed 64 times by 3 tests: return 1; Executed by:
| 64 | ||||||||||||||||||||||||
498 | - | |||||||||||||||||||||||||
499 | err: | - | ||||||||||||||||||||||||
500 | SSL_error_internal(s, 336, __FILE__, 515); | - | ||||||||||||||||||||||||
501 | *alert = 50; | - | ||||||||||||||||||||||||
502 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
503 | } | - | ||||||||||||||||||||||||
504 | - | |||||||||||||||||||||||||
505 | - | |||||||||||||||||||||||||
506 | - | |||||||||||||||||||||||||
507 | - | |||||||||||||||||||||||||
508 | int | - | ||||||||||||||||||||||||
509 | tlsext_sigalgs_clienthello_needs(SSL *s) | - | ||||||||||||||||||||||||
510 | { | - | ||||||||||||||||||||||||
511 | return executed 78 times by 4 tests: (((return (((s->client_version >> 8) == 0x03 ? s->client_version : 0) >= 0x0303); Executed by:
executed 78 times by 4 tests: return (((s->client_version >> 8) == 0x03 ? s->client_version : 0) >= 0x0303); Executed by:
| 12-78 | ||||||||||||||||||||||||
512 | } | - | ||||||||||||||||||||||||
513 | - | |||||||||||||||||||||||||
514 | int | - | ||||||||||||||||||||||||
515 | tlsext_sigalgs_clienthello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
516 | { | - | ||||||||||||||||||||||||
517 | unsigned char *sigalgs_data; | - | ||||||||||||||||||||||||
518 | size_t sigalgs_len; | - | ||||||||||||||||||||||||
519 | CBB sigalgs; | - | ||||||||||||||||||||||||
520 | - | |||||||||||||||||||||||||
521 | tls12_get_req_sig_algs(s, &sigalgs_data, &sigalgs_len); | - | ||||||||||||||||||||||||
522 | - | |||||||||||||||||||||||||
523 | if (!CBB_add_u16_length_prefixed(cbb, &sigalgs)
| 0-40 | ||||||||||||||||||||||||
524 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
525 | if (!CBB_add_bytes(&sigalgs, sigalgs_data, sigalgs_len)
| 0-40 | ||||||||||||||||||||||||
526 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
527 | if (!CBB_flush(cbb)
| 0-40 | ||||||||||||||||||||||||
528 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
529 | - | |||||||||||||||||||||||||
530 | return executed 40 times by 4 tests: 1;return 1; Executed by:
executed 40 times by 4 tests: return 1; Executed by:
| 40 | ||||||||||||||||||||||||
531 | } | - | ||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||
533 | int | - | ||||||||||||||||||||||||
534 | tlsext_sigalgs_clienthello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
535 | { | - | ||||||||||||||||||||||||
536 | CBS sigalgs; | - | ||||||||||||||||||||||||
537 | - | |||||||||||||||||||||||||
538 | if (!CBS_get_u16_length_prefixed(cbs, &sigalgs)
| 0-35 | ||||||||||||||||||||||||
539 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
540 | - | |||||||||||||||||||||||||
541 | return executed 35 times by 3 tests: tls1_process_sigalgs(s, &sigalgs);return tls1_process_sigalgs(s, &sigalgs); Executed by:
executed 35 times by 3 tests: return tls1_process_sigalgs(s, &sigalgs); Executed by:
| 35 | ||||||||||||||||||||||||
542 | } | - | ||||||||||||||||||||||||
543 | - | |||||||||||||||||||||||||
544 | int | - | ||||||||||||||||||||||||
545 | tlsext_sigalgs_serverhello_needs(SSL *s) | - | ||||||||||||||||||||||||
546 | { | - | ||||||||||||||||||||||||
547 | return executed 68 times by 4 tests: 0;return 0; Executed by:
executed 68 times by 4 tests: return 0; Executed by:
| 68 | ||||||||||||||||||||||||
548 | } | - | ||||||||||||||||||||||||
549 | - | |||||||||||||||||||||||||
550 | int | - | ||||||||||||||||||||||||
551 | tlsext_sigalgs_serverhello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
552 | { | - | ||||||||||||||||||||||||
553 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
554 | } | - | ||||||||||||||||||||||||
555 | - | |||||||||||||||||||||||||
556 | int | - | ||||||||||||||||||||||||
557 | tlsext_sigalgs_serverhello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
558 | { | - | ||||||||||||||||||||||||
559 | - | |||||||||||||||||||||||||
560 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
561 | } | - | ||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||
564 | - | |||||||||||||||||||||||||
565 | - | |||||||||||||||||||||||||
566 | int | - | ||||||||||||||||||||||||
567 | tlsext_sni_clienthello_needs(SSL *s) | - | ||||||||||||||||||||||||
568 | { | - | ||||||||||||||||||||||||
569 | return executed 78 times by 4 tests: (s->tlsext_hostname != return (s->tlsext_hostname != ((void *)0) ); Executed by:
executed 78 times by 4 tests: return (s->tlsext_hostname != ((void *)0) ); Executed by:
| 78 | ||||||||||||||||||||||||
570 | ((void *)0) executed 78 times by 4 tests: return (s->tlsext_hostname != ((void *)0) ); Executed by:
| 78 | ||||||||||||||||||||||||
571 | ); executed 78 times by 4 tests: return (s->tlsext_hostname != ((void *)0) ); Executed by:
| 78 | ||||||||||||||||||||||||
572 | } | - | ||||||||||||||||||||||||
573 | - | |||||||||||||||||||||||||
574 | int | - | ||||||||||||||||||||||||
575 | tlsext_sni_clienthello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
576 | { | - | ||||||||||||||||||||||||
577 | CBB server_name_list, host_name; | - | ||||||||||||||||||||||||
578 | - | |||||||||||||||||||||||||
579 | if (!CBB_add_u16_length_prefixed(cbb, &server_name_list)
| 0-5 | ||||||||||||||||||||||||
580 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
581 | if (!CBB_add_u8(&server_name_list, 0)
| 0-5 | ||||||||||||||||||||||||
582 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
583 | if (!CBB_add_u16_length_prefixed(&server_name_list, &host_name)
| 0-5 | ||||||||||||||||||||||||
584 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
585 | if (!CBB_add_bytes(&host_name, (const uint8_t *)s->tlsext_hostname,
| 0-5 | ||||||||||||||||||||||||
586 | strlen(s->tlsext_hostname))
| 0-5 | ||||||||||||||||||||||||
587 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
588 | if (!CBB_flush(cbb)
| 0-5 | ||||||||||||||||||||||||
589 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
590 | - | |||||||||||||||||||||||||
591 | return executed 5 times by 2 tests: 1;return 1; Executed by:
executed 5 times by 2 tests: return 1; Executed by:
| 5 | ||||||||||||||||||||||||
592 | } | - | ||||||||||||||||||||||||
593 | - | |||||||||||||||||||||||||
594 | int | - | ||||||||||||||||||||||||
595 | tlsext_sni_clienthello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
596 | { | - | ||||||||||||||||||||||||
597 | CBS server_name_list, host_name; | - | ||||||||||||||||||||||||
598 | uint8_t name_type; | - | ||||||||||||||||||||||||
599 | - | |||||||||||||||||||||||||
600 | if (!CBS_get_u16_length_prefixed(cbs, &server_name_list)
| 0-6 | ||||||||||||||||||||||||
601 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
602 | - | |||||||||||||||||||||||||
603 | - | |||||||||||||||||||||||||
604 | - | |||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||
606 | - | |||||||||||||||||||||||||
607 | if (!CBS_get_u8(&server_name_list, &name_type)
| 0-6 | ||||||||||||||||||||||||
608 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
609 | if (name_type != 0
| 0-6 | ||||||||||||||||||||||||
610 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
611 | - | |||||||||||||||||||||||||
612 | if (!CBS_get_u16_length_prefixed(&server_name_list, &host_name)
| 0-6 | ||||||||||||||||||||||||
613 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
614 | if (CBS_len(&host_name) == 0
| 0-6 | ||||||||||||||||||||||||
615 | CBS_len(&host_name) > 255
| 0-6 | ||||||||||||||||||||||||
616 | CBS_contains_zero_byte(&host_name)
| 0-6 | ||||||||||||||||||||||||
617 | *alert = 112; | - | ||||||||||||||||||||||||
618 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
619 | } | - | ||||||||||||||||||||||||
620 | - | |||||||||||||||||||||||||
621 | if (s->internal->hit
| 1-5 | ||||||||||||||||||||||||
622 | if (s->session->tlsext_hostname ==
| 0-1 | ||||||||||||||||||||||||
623 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||
624 | ) { | - | ||||||||||||||||||||||||
625 | *alert = 112; | - | ||||||||||||||||||||||||
626 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
627 | } | - | ||||||||||||||||||||||||
628 | if (!CBS_mem_equal(&host_name, s->session->tlsext_hostname,
| 0-1 | ||||||||||||||||||||||||
629 | strlen(s->session->tlsext_hostname))
| 0-1 | ||||||||||||||||||||||||
630 | *alert = 112; | - | ||||||||||||||||||||||||
631 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
632 | } | - | ||||||||||||||||||||||||
633 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
634 | if (s->session->tlsext_hostname !=
| 0-5 | ||||||||||||||||||||||||
635 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
636 | ) | - | ||||||||||||||||||||||||
637 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
638 | if (!CBS_strdup(&host_name, &s->session->tlsext_hostname)
| 0-5 | ||||||||||||||||||||||||
639 | *alert = 80; | - | ||||||||||||||||||||||||
640 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
641 | } | - | ||||||||||||||||||||||||
642 | } executed 5 times by 2 tests: end of block Executed by:
| 5 | ||||||||||||||||||||||||
643 | - | |||||||||||||||||||||||||
644 | if (CBS_len(&server_name_list) != 0
| 0-5 | ||||||||||||||||||||||||
645 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
646 | if (CBS_len(cbs) != 0
| 0-5 | ||||||||||||||||||||||||
647 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
648 | - | |||||||||||||||||||||||||
649 | return executed 5 times by 2 tests: 1;return 1; Executed by:
executed 5 times by 2 tests: return 1; Executed by:
| 5 | ||||||||||||||||||||||||
650 | - | |||||||||||||||||||||||||
651 | err: | - | ||||||||||||||||||||||||
652 | *alert = 50; | - | ||||||||||||||||||||||||
653 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
654 | } | - | ||||||||||||||||||||||||
655 | - | |||||||||||||||||||||||||
656 | int | - | ||||||||||||||||||||||||
657 | tlsext_sni_serverhello_needs(SSL *s) | - | ||||||||||||||||||||||||
658 | { | - | ||||||||||||||||||||||||
659 | return executed 69 times by 4 tests: (s->session->tlsext_hostname != return (s->session->tlsext_hostname != ((void *)0) ); Executed by:
executed 69 times by 4 tests: return (s->session->tlsext_hostname != ((void *)0) ); Executed by:
| 69 | ||||||||||||||||||||||||
660 | ((void *)0) executed 69 times by 4 tests: return (s->session->tlsext_hostname != ((void *)0) ); Executed by:
| 69 | ||||||||||||||||||||||||
661 | ); executed 69 times by 4 tests: return (s->session->tlsext_hostname != ((void *)0) ); Executed by:
| 69 | ||||||||||||||||||||||||
662 | } | - | ||||||||||||||||||||||||
663 | - | |||||||||||||||||||||||||
664 | int | - | ||||||||||||||||||||||||
665 | tlsext_sni_serverhello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
666 | { | - | ||||||||||||||||||||||||
667 | return executed 5 times by 2 tests: 1;return 1; Executed by:
executed 5 times by 2 tests: return 1; Executed by:
| 5 | ||||||||||||||||||||||||
668 | } | - | ||||||||||||||||||||||||
669 | - | |||||||||||||||||||||||||
670 | int | - | ||||||||||||||||||||||||
671 | tlsext_sni_serverhello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
672 | { | - | ||||||||||||||||||||||||
673 | if (s->tlsext_hostname ==
| 0-5 | ||||||||||||||||||||||||
674 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
675 | || CBS_len(cbs) != 0
| 0-5 | ||||||||||||||||||||||||
676 | *alert = 112; | - | ||||||||||||||||||||||||
677 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
678 | } | - | ||||||||||||||||||||||||
679 | - | |||||||||||||||||||||||||
680 | if (s->internal->hit
| 0-5 | ||||||||||||||||||||||||
681 | if (s->session->tlsext_hostname ==
| 0 | ||||||||||||||||||||||||
682 | ((void *)0)
| 0 | ||||||||||||||||||||||||
683 | ) { | - | ||||||||||||||||||||||||
684 | *alert = 112; | - | ||||||||||||||||||||||||
685 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
686 | } | - | ||||||||||||||||||||||||
687 | if ( | - | ||||||||||||||||||||||||
688 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
| 0 | ||||||||||||||||||||||||
689 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
690 | ) && __builtin_constant_p (
| 0 | ||||||||||||||||||||||||
691 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
692 | ) && (__s1_len = __builtin_strlen (
| 0 | ||||||||||||||||||||||||
693 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
694 | ), __s2_len = __builtin_strlen (
| 0 | ||||||||||||||||||||||||
695 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
696 | ), (!((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||
697 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
698 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||
699 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
700 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||
701 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
702 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||
703 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
704 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
| 0 | ||||||||||||||||||||||||
705 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
706 | ,
| 0 | ||||||||||||||||||||||||
707 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
708 | ) : (__builtin_constant_p (
| 0 | ||||||||||||||||||||||||
709 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
710 | ) && ((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||
711 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
712 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||
713 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
714 | ) == 1) && (__s1_len = __builtin_strlen (
| 0 | ||||||||||||||||||||||||
715 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
716 | ), __s1_len < 4) ? (__builtin_constant_p (
| 0 | ||||||||||||||||||||||||
717 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
718 | ) && ((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||
719 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
720 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||
721 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
722 | ) == 1) ? __builtin_strcmp (
| 0 | ||||||||||||||||||||||||
723 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
724 | ,
| 0 | ||||||||||||||||||||||||
725 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
726 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 0 | ||||||||||||||||||||||||
727 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
728 | ); int __result = (((const unsigned char *) (const char *) (
| 0 | ||||||||||||||||||||||||
729 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
730 | ))[0] - __s2[0]); if (__s1_len > 0
| 0 | ||||||||||||||||||||||||
731 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
732 | ))[1] - __s2[1]); if (__s1_len > 1
| 0 | ||||||||||||||||||||||||
733 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
734 | ))[2] - __s2[2]); if (__s1_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( s->tlsext_hostname ))[3] - __s2[3]); | 0 | ||||||||||||||||||||||||
735 | s->tlsext_hostname
never executed: __result = (((const unsigned char *) (const char *) ( s->tlsext_hostname ))[3] - __s2[3]); | 0 | ||||||||||||||||||||||||
736 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
| 0 | ||||||||||||||||||||||||
737 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
738 | ) && ((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||
739 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
740 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||
741 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
742 | ) == 1) && (__s2_len = __builtin_strlen (
| 0 | ||||||||||||||||||||||||
743 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
744 | ), __s2_len < 4) ? (__builtin_constant_p (
| 0 | ||||||||||||||||||||||||
745 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
746 | ) && ((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||
747 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
748 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||
749 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
750 | ) == 1) ? __builtin_strcmp (
| 0 | ||||||||||||||||||||||||
751 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
752 | ,
| 0 | ||||||||||||||||||||||||
753 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
754 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 0 | ||||||||||||||||||||||||
755 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
756 | ); int __result = (((const unsigned char *) (const char *) (
| 0 | ||||||||||||||||||||||||
757 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
758 | ))[0] - __s2[0]); if (__s2_len > 0
| 0 | ||||||||||||||||||||||||
759 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
760 | ))[1] - __s2[1]); if (__s2_len > 1
| 0 | ||||||||||||||||||||||||
761 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
762 | ))[2] - __s2[2]); if (__s2_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( s->session->tlsext_hostname ))[3] - __s2[3]); | 0 | ||||||||||||||||||||||||
763 | s->session->tlsext_hostname
never executed: __result = (((const unsigned char *) (const char *) ( s->session->tlsext_hostname ))[3] - __s2[3]); | 0 | ||||||||||||||||||||||||
764 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
| 0 | ||||||||||||||||||||||||
765 | s->tlsext_hostname
| 0 | ||||||||||||||||||||||||
766 | ,
| 0 | ||||||||||||||||||||||||
767 | s->session->tlsext_hostname
| 0 | ||||||||||||||||||||||||
768 | )))); })
| 0 | ||||||||||||||||||||||||
769 |
| 0 | ||||||||||||||||||||||||
770 | != 0
| 0 | ||||||||||||||||||||||||
771 | *alert = 112; | - | ||||||||||||||||||||||||
772 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
773 | } | - | ||||||||||||||||||||||||
774 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
775 | if (s->session->tlsext_hostname !=
| 0-5 | ||||||||||||||||||||||||
776 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
777 | ) { | - | ||||||||||||||||||||||||
778 | *alert = 50; | - | ||||||||||||||||||||||||
779 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
780 | } | - | ||||||||||||||||||||||||
781 | if ((
| 0-5 | ||||||||||||||||||||||||
782 |
| 0-5 | ||||||||||||||||||||||||
783 | (__extension__ (__builtin_constant_p (
| 0-5 | ||||||||||||||||||||||||
784 | s->tlsext_hostname
| 0-5 | ||||||||||||||||||||||||
785 | )
| 0-5 | ||||||||||||||||||||||||
786 | s->tlsext_hostname
| 0-5 | ||||||||||||||||||||||||
787 | ) + 1) - (size_t)(const void *)(
| 0-5 | ||||||||||||||||||||||||
788 | s->tlsext_hostname
| 0-5 | ||||||||||||||||||||||||
789 | ) == 1)
| 0-5 | ||||||||||||||||||||||||
790 | s->tlsext_hostname
| 0-5 | ||||||||||||||||||||||||
791 | ))[0] == '\0'
| 0-5 | ||||||||||||||||||||||||
792 | s->tlsext_hostname
| 0-5 | ||||||||||||||||||||||||
793 | ) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)
never executed: __retval = (char *) memcpy (__retval, s->tlsext_hostname , __len);
| 0-5 | ||||||||||||||||||||||||
794 | s->tlsext_hostname
never executed: __retval = (char *) memcpy (__retval, s->tlsext_hostname , __len); | 0-5 | ||||||||||||||||||||||||
795 | , __len);
never executed: __retval; })) : __strdup (__retval = (char *) memcpy (__retval, s->tlsext_hostname , __len);
| 0-5 | ||||||||||||||||||||||||
796 | s->tlsext_hostname
| 0-5 | ||||||||||||||||||||||||
797 | )))
| 0-5 | ||||||||||||||||||||||||
798 | ) ==
| 0-5 | ||||||||||||||||||||||||
799 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
800 | ) { | - | ||||||||||||||||||||||||
801 | *alert = 80; | - | ||||||||||||||||||||||||
802 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
803 | } | - | ||||||||||||||||||||||||
804 | } executed 5 times by 2 tests: end of block Executed by:
| 5 | ||||||||||||||||||||||||
805 | - | |||||||||||||||||||||||||
806 | return executed 5 times by 2 tests: 1;return 1; Executed by:
executed 5 times by 2 tests: return 1; Executed by:
| 5 | ||||||||||||||||||||||||
807 | } | - | ||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||
809 | - | |||||||||||||||||||||||||
810 | - | |||||||||||||||||||||||||
811 | - | |||||||||||||||||||||||||
812 | - | |||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||
814 | int | - | ||||||||||||||||||||||||
815 | tlsext_ocsp_clienthello_needs(SSL *s) | - | ||||||||||||||||||||||||
816 | { | - | ||||||||||||||||||||||||
817 | return executed 78 times by 4 tests: (s->tlsext_status_type == 1return (s->tlsext_status_type == 1 && s->version != 0xFEFF); Executed by:
executed 78 times by 4 tests: return (s->tlsext_status_type == 1 && s->version != 0xFEFF); Executed by:
| 5-78 | ||||||||||||||||||||||||
818 | s->version != 0xFEFF
executed 78 times by 4 tests: return (s->tlsext_status_type == 1 && s->version != 0xFEFF); Executed by:
| 0-78 | ||||||||||||||||||||||||
819 | } | - | ||||||||||||||||||||||||
820 | - | |||||||||||||||||||||||||
821 | int | - | ||||||||||||||||||||||||
822 | tlsext_ocsp_clienthello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
823 | { | - | ||||||||||||||||||||||||
824 | CBB respid_list, respid, exts; | - | ||||||||||||||||||||||||
825 | unsigned char *ext_data; | - | ||||||||||||||||||||||||
826 | size_t ext_len; | - | ||||||||||||||||||||||||
827 | int i; | - | ||||||||||||||||||||||||
828 | - | |||||||||||||||||||||||||
829 | if (!CBB_add_u8(cbb, 1)
| 0-5 | ||||||||||||||||||||||||
830 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
831 | if (!CBB_add_u16_length_prefixed(cbb, &respid_list)
| 0-5 | ||||||||||||||||||||||||
832 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
833 | for (i = 0; i < sk_num(((_STACK*) (1 ? (s->internal->tlsext_ocsp_ids) : (struct stack_st_OCSP_RESPID*)0)))
| 0-5 | ||||||||||||||||||||||||
834 | unsigned char *respid_data; | - | ||||||||||||||||||||||||
835 | OCSP_RESPID *id; | - | ||||||||||||||||||||||||
836 | size_t id_len; | - | ||||||||||||||||||||||||
837 | - | |||||||||||||||||||||||||
838 | if ((
| 0 | ||||||||||||||||||||||||
839 | ) ==
| 0 | ||||||||||||||||||||||||
840 | ((void *)0)
| 0 | ||||||||||||||||||||||||
841 | ) | - | ||||||||||||||||||||||||
842 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
843 | if ((
| 0 | ||||||||||||||||||||||||
844 | ((void *)0)
| 0 | ||||||||||||||||||||||||
845 | )) == -1
| 0 | ||||||||||||||||||||||||
846 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
847 | if (!CBB_add_u16_length_prefixed(&respid_list, &respid)
| 0 | ||||||||||||||||||||||||
848 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
849 | if (!CBB_add_space(&respid, &respid_data, id_len)
| 0 | ||||||||||||||||||||||||
850 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
851 | if ((
| 0 | ||||||||||||||||||||||||
852 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
853 | } never executed: end of block | 0 | ||||||||||||||||||||||||
854 | if (!CBB_add_u16_length_prefixed(cbb, &exts)
| 0-5 | ||||||||||||||||||||||||
855 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
856 | if ((
| 0-5 | ||||||||||||||||||||||||
857 |
| 0-5 | ||||||||||||||||||||||||
858 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
859 | )) == -1
| 0-5 | ||||||||||||||||||||||||
860 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
861 | if (!CBB_add_space(&exts, &ext_data, ext_len)
| 0-5 | ||||||||||||||||||||||||
862 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
863 | if ((
| 0-5 | ||||||||||||||||||||||||
864 | ext_len)
| 0-5 | ||||||||||||||||||||||||
865 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
866 | if (!CBB_flush(cbb)
| 0-5 | ||||||||||||||||||||||||
867 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
868 | return executed 5 times by 2 tests: 1;return 1; Executed by:
executed 5 times by 2 tests: return 1; Executed by:
| 5 | ||||||||||||||||||||||||
869 | } | - | ||||||||||||||||||||||||
870 | - | |||||||||||||||||||||||||
871 | int | - | ||||||||||||||||||||||||
872 | tlsext_ocsp_clienthello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
873 | { | - | ||||||||||||||||||||||||
874 | int failure = 50; | - | ||||||||||||||||||||||||
875 | CBS respid_list, respid, exts; | - | ||||||||||||||||||||||||
876 | const unsigned char *p; | - | ||||||||||||||||||||||||
877 | uint8_t status_type; | - | ||||||||||||||||||||||||
878 | int ret = 0; | - | ||||||||||||||||||||||||
879 | - | |||||||||||||||||||||||||
880 | if (!CBS_get_u8(cbs, &status_type)
| 0-5 | ||||||||||||||||||||||||
881 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
882 | if (status_type != 1
| 0-5 | ||||||||||||||||||||||||
883 | - | |||||||||||||||||||||||||
884 | s->tlsext_status_type = -1; | - | ||||||||||||||||||||||||
885 | - | |||||||||||||||||||||||||
886 | if (!CBS_skip(cbs, CBS_len(cbs))
| 0 | ||||||||||||||||||||||||
887 | *alert = 80; | - | ||||||||||||||||||||||||
888 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
889 | } | - | ||||||||||||||||||||||||
890 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
891 | } | - | ||||||||||||||||||||||||
892 | s->tlsext_status_type = status_type; | - | ||||||||||||||||||||||||
893 | if (!CBS_get_u16_length_prefixed(cbs, &respid_list)
| 0-5 | ||||||||||||||||||||||||
894 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
895 | - | |||||||||||||||||||||||||
896 | - | |||||||||||||||||||||||||
897 | sk_pop_free(((_STACK*) (1 ? (s->internal->tlsext_ocsp_ids) : (struct stack_st_OCSP_RESPID*)0)), ((void (*)(void *)) ((1 ? (OCSP_RESPID_free) : (void (*)(OCSP_RESPID *))0)))); | - | ||||||||||||||||||||||||
898 | s->internal->tlsext_ocsp_ids = | - | ||||||||||||||||||||||||
899 | ((void *)0) | - | ||||||||||||||||||||||||
900 | ; | - | ||||||||||||||||||||||||
901 | if (CBS_len(&respid_list) > 0
| 0-5 | ||||||||||||||||||||||||
902 | s->internal->tlsext_ocsp_ids = ((struct stack_st_OCSP_RESPID *)sk_new_null()); | - | ||||||||||||||||||||||||
903 | if (s->internal->tlsext_ocsp_ids ==
| 0 | ||||||||||||||||||||||||
904 | ((void *)0)
| 0 | ||||||||||||||||||||||||
905 | ) { | - | ||||||||||||||||||||||||
906 | failure = 80; | - | ||||||||||||||||||||||||
907 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
908 | } | - | ||||||||||||||||||||||||
909 | } never executed: end of block | 0 | ||||||||||||||||||||||||
910 | - | |||||||||||||||||||||||||
911 | while (CBS_len(&respid_list) > 0
| 0-5 | ||||||||||||||||||||||||
912 | OCSP_RESPID *id; | - | ||||||||||||||||||||||||
913 | - | |||||||||||||||||||||||||
914 | if (!CBS_get_u16_length_prefixed(&respid_list, &respid)
| 0 | ||||||||||||||||||||||||
915 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
916 | p = CBS_data(&respid); | - | ||||||||||||||||||||||||
917 | if ((
| 0 | ||||||||||||||||||||||||
918 | ((void *)0)
| 0 | ||||||||||||||||||||||||
919 | , &p, CBS_len(&respid))) ==
| 0 | ||||||||||||||||||||||||
920 | ((void *)0)
| 0 | ||||||||||||||||||||||||
921 | ) | - | ||||||||||||||||||||||||
922 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
923 | if (!sk_push(((_STACK*) (1 ? (s->internal->tlsext_ocsp_ids) : (struct stack_st_OCSP_RESPID*)0)), ((void*) (1 ? (id) : (OCSP_RESPID*)0)))
| 0 | ||||||||||||||||||||||||
924 | failure = 80; | - | ||||||||||||||||||||||||
925 | OCSP_RESPID_free(id); | - | ||||||||||||||||||||||||
926 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
927 | } | - | ||||||||||||||||||||||||
928 | } never executed: end of block | 0 | ||||||||||||||||||||||||
929 | - | |||||||||||||||||||||||||
930 | - | |||||||||||||||||||||||||
931 | if (!CBS_get_u16_length_prefixed(cbs, &exts)
| 0-5 | ||||||||||||||||||||||||
932 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
933 | if (CBS_len(&exts) > 0
| 0-5 | ||||||||||||||||||||||||
934 | sk_pop_free(((_STACK*) (1 ? (s->internal->tlsext_ocsp_exts) : (struct stack_st_X509_EXTENSION*)0)), ((void (*)(void *)) ((1 ? (X509_EXTENSION_free) : (void (*)(X509_EXTENSION *))0)))) | - | ||||||||||||||||||||||||
935 | ; | - | ||||||||||||||||||||||||
936 | p = CBS_data(&exts); | - | ||||||||||||||||||||||||
937 | if ((
| 0 | ||||||||||||||||||||||||
938 | ((void *)0)
| 0 | ||||||||||||||||||||||||
939 | ,
| 0 | ||||||||||||||||||||||||
940 | &p, CBS_len(&exts))) ==
| 0 | ||||||||||||||||||||||||
941 | ((void *)0)
| 0 | ||||||||||||||||||||||||
942 | ) | - | ||||||||||||||||||||||||
943 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
944 | } never executed: end of block | 0 | ||||||||||||||||||||||||
945 | - | |||||||||||||||||||||||||
946 | - | |||||||||||||||||||||||||
947 | if (CBS_len(cbs) > 0
| 0-5 | ||||||||||||||||||||||||
948 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
949 | - | |||||||||||||||||||||||||
950 | ret = 1; | - | ||||||||||||||||||||||||
951 | err: code before this statement executed 5 times by 2 tests: err: Executed by:
| 5 | ||||||||||||||||||||||||
952 | if (ret == 0
| 0-5 | ||||||||||||||||||||||||
953 | * never executed: alert = failure;*alert = failure; never executed: *alert = failure; | 0 | ||||||||||||||||||||||||
954 | return executed 5 times by 2 tests: ret;return ret; Executed by:
executed 5 times by 2 tests: return ret; Executed by:
| 5 | ||||||||||||||||||||||||
955 | } | - | ||||||||||||||||||||||||
956 | - | |||||||||||||||||||||||||
957 | int | - | ||||||||||||||||||||||||
958 | tlsext_ocsp_serverhello_needs(SSL *s) | - | ||||||||||||||||||||||||
959 | { | - | ||||||||||||||||||||||||
960 | return executed 69 times by 4 tests: s->internal->tlsext_status_expected;return s->internal->tlsext_status_expected; Executed by:
executed 69 times by 4 tests: return s->internal->tlsext_status_expected; Executed by:
| 69 | ||||||||||||||||||||||||
961 | } | - | ||||||||||||||||||||||||
962 | - | |||||||||||||||||||||||||
963 | int | - | ||||||||||||||||||||||||
964 | tlsext_ocsp_serverhello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
965 | { | - | ||||||||||||||||||||||||
966 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||
967 | } | - | ||||||||||||||||||||||||
968 | - | |||||||||||||||||||||||||
969 | int | - | ||||||||||||||||||||||||
970 | tlsext_ocsp_serverhello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
971 | { | - | ||||||||||||||||||||||||
972 | if (s->tlsext_status_type == -1
| 0 | ||||||||||||||||||||||||
973 | *alert = 110; | - | ||||||||||||||||||||||||
974 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
975 | } | - | ||||||||||||||||||||||||
976 | - | |||||||||||||||||||||||||
977 | s->internal->tlsext_status_expected = 1; | - | ||||||||||||||||||||||||
978 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
979 | } | - | ||||||||||||||||||||||||
980 | - | |||||||||||||||||||||||||
981 | - | |||||||||||||||||||||||||
982 | - | |||||||||||||||||||||||||
983 | - | |||||||||||||||||||||||||
984 | int | - | ||||||||||||||||||||||||
985 | tlsext_sessionticket_clienthello_needs(SSL *s) | - | ||||||||||||||||||||||||
986 | { | - | ||||||||||||||||||||||||
987 | - | |||||||||||||||||||||||||
988 | - | |||||||||||||||||||||||||
989 | - | |||||||||||||||||||||||||
990 | - | |||||||||||||||||||||||||
991 | - | |||||||||||||||||||||||||
992 | if ((
| 6-78 | ||||||||||||||||||||||||
993 | ((void *)0)
| 6-78 | ||||||||||||||||||||||||
994 | ) & 0x00004000L) != 0
| 6-78 | ||||||||||||||||||||||||
995 | return executed 6 times by 2 tests: 0;return 0; Executed by:
executed 6 times by 2 tests: return 0; Executed by:
| 6 | ||||||||||||||||||||||||
996 | - | |||||||||||||||||||||||||
997 | if (s->internal->new_session
| 0-78 | ||||||||||||||||||||||||
998 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
999 | - | |||||||||||||||||||||||||
1000 | if (s->internal->tlsext_session_ticket !=
| 2-76 | ||||||||||||||||||||||||
1001 | ((void *)0)
| 2-76 | ||||||||||||||||||||||||
1002 | && | - | ||||||||||||||||||||||||
1003 | s->internal->tlsext_session_ticket->data ==
| 1 | ||||||||||||||||||||||||
1004 | ((void *)0)
| 1 | ||||||||||||||||||||||||
1005 | ) | - | ||||||||||||||||||||||||
1006 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
1007 | - | |||||||||||||||||||||||||
1008 | return executed 77 times by 3 tests: 1;return 1; Executed by:
executed 77 times by 3 tests: return 1; Executed by:
| 77 | ||||||||||||||||||||||||
1009 | } | - | ||||||||||||||||||||||||
1010 | - | |||||||||||||||||||||||||
1011 | int | - | ||||||||||||||||||||||||
1012 | tlsext_sessionticket_clienthello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
1013 | { | - | ||||||||||||||||||||||||
1014 | - | |||||||||||||||||||||||||
1015 | - | |||||||||||||||||||||||||
1016 | - | |||||||||||||||||||||||||
1017 | - | |||||||||||||||||||||||||
1018 | if (s->internal->new_session
| 0-75 | ||||||||||||||||||||||||
1019 | ((void *)0)
| 2-73 | ||||||||||||||||||||||||
1020 | ) | - | ||||||||||||||||||||||||
1021 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||
1022 | - | |||||||||||||||||||||||||
1023 | if (s->session->tlsext_tick !=
| 1-72 | ||||||||||||||||||||||||
1024 | ((void *)0)
| 1-72 | ||||||||||||||||||||||||
1025 | ) { | - | ||||||||||||||||||||||||
1026 | - | |||||||||||||||||||||||||
1027 | if (!CBB_add_bytes(cbb, s->session->tlsext_tick,
| 0-1 | ||||||||||||||||||||||||
1028 | s->session->tlsext_ticklen)
| 0-1 | ||||||||||||||||||||||||
1029 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1030 | - | |||||||||||||||||||||||||
1031 | } executed 1 time by 1 test: else if (s->internal->tlsext_session_ticket != end of block Executed by:
| 1-71 | ||||||||||||||||||||||||
1032 | ((void *)0)
| 1-71 | ||||||||||||||||||||||||
1033 | ) { | - | ||||||||||||||||||||||||
1034 | - | |||||||||||||||||||||||||
1035 | - | |||||||||||||||||||||||||
1036 | - | |||||||||||||||||||||||||
1037 | - | |||||||||||||||||||||||||
1038 | if (s->internal->tlsext_session_ticket->length > 0
| 0-1 | ||||||||||||||||||||||||
1039 | size_t ticklen = s->internal->tlsext_session_ticket->length; | - | ||||||||||||||||||||||||
1040 | - | |||||||||||||||||||||||||
1041 | if ((
| 0-1 | ||||||||||||||||||||||||
1042 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||
1043 | ) | - | ||||||||||||||||||||||||
1044 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1045 | memcpy(s->session->tlsext_tick, | - | ||||||||||||||||||||||||
1046 | s->internal->tlsext_session_ticket->data, | - | ||||||||||||||||||||||||
1047 | ticklen); | - | ||||||||||||||||||||||||
1048 | s->session->tlsext_ticklen = ticklen; | - | ||||||||||||||||||||||||
1049 | - | |||||||||||||||||||||||||
1050 | if (!CBB_add_bytes(cbb, s->session->tlsext_tick,
| 0-1 | ||||||||||||||||||||||||
1051 | s->session->tlsext_ticklen)
| 0-1 | ||||||||||||||||||||||||
1052 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1053 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
1054 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
1055 | - | |||||||||||||||||||||||||
1056 | if (!CBB_flush(cbb)
| 0-73 | ||||||||||||||||||||||||
1057 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1058 | - | |||||||||||||||||||||||||
1059 | return executed 73 times by 3 tests: 1;return 1; Executed by:
executed 73 times by 3 tests: return 1; Executed by:
| 73 | ||||||||||||||||||||||||
1060 | } | - | ||||||||||||||||||||||||
1061 | - | |||||||||||||||||||||||||
1062 | int | - | ||||||||||||||||||||||||
1063 | tlsext_sessionticket_clienthello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
1064 | { | - | ||||||||||||||||||||||||
1065 | if (s->internal->tls_session_ticket_ext_cb
| 0-59 | ||||||||||||||||||||||||
1066 | if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs),
| 0 | ||||||||||||||||||||||||
1067 | (int)CBS_len(cbs),
| 0 | ||||||||||||||||||||||||
1068 | s->internal->tls_session_ticket_ext_cb_arg)
| 0 | ||||||||||||||||||||||||
1069 | *alert = 80; | - | ||||||||||||||||||||||||
1070 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1071 | } | - | ||||||||||||||||||||||||
1072 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1073 | - | |||||||||||||||||||||||||
1074 | - | |||||||||||||||||||||||||
1075 | if (!CBS_skip(cbs, CBS_len(cbs))
| 0-59 | ||||||||||||||||||||||||
1076 | *alert = 80; | - | ||||||||||||||||||||||||
1077 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1078 | } | - | ||||||||||||||||||||||||
1079 | - | |||||||||||||||||||||||||
1080 | return executed 59 times by 1 test: 1;return 1; Executed by:
executed 59 times by 1 test: return 1; Executed by:
| 59 | ||||||||||||||||||||||||
1081 | } | - | ||||||||||||||||||||||||
1082 | - | |||||||||||||||||||||||||
1083 | int | - | ||||||||||||||||||||||||
1084 | tlsext_sessionticket_serverhello_needs(SSL *s) | - | ||||||||||||||||||||||||
1085 | { | - | ||||||||||||||||||||||||
1086 | return executed 71 times by 4 tests: (s->internal->tlsext_ticket_expectedreturn (s->internal->tlsext_ticket_expected && !(SSL_ctrl((s),32,0, ((void *)0) ) & 0x00004000L)); Executed by:
executed 71 times by 4 tests: return (s->internal->tlsext_ticket_expected && !(SSL_ctrl((s),32,0, ((void *)0) ) & 0x00004000L)); Executed by:
| 10-71 | ||||||||||||||||||||||||
1087 | !(SSL_ctrl((s),32,0,
executed 71 times by 4 tests: return (s->internal->tlsext_ticket_expected && !(SSL_ctrl((s),32,0, ((void *)0) ) & 0x00004000L)); Executed by:
| 0-71 | ||||||||||||||||||||||||
1088 | ((void *)0)
executed 71 times by 4 tests: return (s->internal->tlsext_ticket_expected && !(SSL_ctrl((s),32,0, ((void *)0) ) & 0x00004000L)); Executed by:
| 0-71 | ||||||||||||||||||||||||
1089 | ) & 0x00004000L)
executed 71 times by 4 tests: return (s->internal->tlsext_ticket_expected && !(SSL_ctrl((s),32,0, ((void *)0) ) & 0x00004000L)); Executed by:
| 0-71 | ||||||||||||||||||||||||
1090 | } | - | ||||||||||||||||||||||||
1091 | - | |||||||||||||||||||||||||
1092 | int | - | ||||||||||||||||||||||||
1093 | tlsext_sessionticket_serverhello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
1094 | { | - | ||||||||||||||||||||||||
1095 | - | |||||||||||||||||||||||||
1096 | - | |||||||||||||||||||||||||
1097 | return executed 61 times by 2 tests: 1;return 1; Executed by:
executed 61 times by 2 tests: return 1; Executed by:
| 61 | ||||||||||||||||||||||||
1098 | } | - | ||||||||||||||||||||||||
1099 | - | |||||||||||||||||||||||||
1100 | int | - | ||||||||||||||||||||||||
1101 | tlsext_sessionticket_serverhello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
1102 | { | - | ||||||||||||||||||||||||
1103 | if (s->internal->tls_session_ticket_ext_cb
| 0-59 | ||||||||||||||||||||||||
1104 | if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs),
| 0 | ||||||||||||||||||||||||
1105 | (int)CBS_len(cbs),
| 0 | ||||||||||||||||||||||||
1106 | s->internal->tls_session_ticket_ext_cb_arg)
| 0 | ||||||||||||||||||||||||
1107 | *alert = 80; | - | ||||||||||||||||||||||||
1108 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1109 | } | - | ||||||||||||||||||||||||
1110 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1111 | - | |||||||||||||||||||||||||
1112 | if ((
| 0-59 | ||||||||||||||||||||||||
1113 | ((void *)0)
| 0-59 | ||||||||||||||||||||||||
1114 | ) & 0x00004000L) != 0
| 0-59 | ||||||||||||||||||||||||
1115 | *alert = 110; | - | ||||||||||||||||||||||||
1116 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1117 | } | - | ||||||||||||||||||||||||
1118 | - | |||||||||||||||||||||||||
1119 | s->internal->tlsext_ticket_expected = 1; | - | ||||||||||||||||||||||||
1120 | - | |||||||||||||||||||||||||
1121 | return executed 59 times by 1 test: 1;return 1; Executed by:
executed 59 times by 1 test: return 1; Executed by:
| 59 | ||||||||||||||||||||||||
1122 | } | - | ||||||||||||||||||||||||
1123 | - | |||||||||||||||||||||||||
1124 | - | |||||||||||||||||||||||||
1125 | - | |||||||||||||||||||||||||
1126 | - | |||||||||||||||||||||||||
1127 | - | |||||||||||||||||||||||||
1128 | - | |||||||||||||||||||||||||
1129 | - | |||||||||||||||||||||||||
1130 | int | - | ||||||||||||||||||||||||
1131 | tlsext_srtp_clienthello_needs(SSL *s) | - | ||||||||||||||||||||||||
1132 | { | - | ||||||||||||||||||||||||
1133 | return executed 79 times by 4 tests: (return (s->method->internal->version == 0xFEFF) && SSL_get_srtp_profiles(s) != ((void *)0) ; Executed by:
executed 79 times by 4 tests: return (s->method->internal->version == 0xFEFF) && SSL_get_srtp_profiles(s) != ((void *)0) ; Executed by:
| 2-79 | ||||||||||||||||||||||||
1134 | ((void *)0)
executed 79 times by 4 tests: return (s->method->internal->version == 0xFEFF) && SSL_get_srtp_profiles(s) != ((void *)0) ; Executed by:
| 2-79 | ||||||||||||||||||||||||
1135 | ; executed 79 times by 4 tests: return (s->method->internal->version == 0xFEFF) && SSL_get_srtp_profiles(s) != ((void *)0) ; Executed by:
| 79 | ||||||||||||||||||||||||
1136 | } | - | ||||||||||||||||||||||||
1137 | - | |||||||||||||||||||||||||
1138 | int | - | ||||||||||||||||||||||||
1139 | tlsext_srtp_clienthello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
1140 | { | - | ||||||||||||||||||||||||
1141 | CBB profiles, mki; | - | ||||||||||||||||||||||||
1142 | int ct, i; | - | ||||||||||||||||||||||||
1143 | struct stack_st_SRTP_PROTECTION_PROFILE *clnt = | - | ||||||||||||||||||||||||
1144 | ((void *)0) | - | ||||||||||||||||||||||||
1145 | ; | - | ||||||||||||||||||||||||
1146 | SRTP_PROTECTION_PROFILE *prof; | - | ||||||||||||||||||||||||
1147 | - | |||||||||||||||||||||||||
1148 | if ((
| 0-2 | ||||||||||||||||||||||||
1149 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
1150 | ) { | - | ||||||||||||||||||||||||
1151 | SSL_error_internal(s, 354, __FILE__, 1010); | - | ||||||||||||||||||||||||
1152 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1153 | } | - | ||||||||||||||||||||||||
1154 | - | |||||||||||||||||||||||||
1155 | if ((
| 0-2 | ||||||||||||||||||||||||
1156 | SSL_error_internal(s, 354, __FILE__, 1015); | - | ||||||||||||||||||||||||
1157 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1158 | } | - | ||||||||||||||||||||||||
1159 | - | |||||||||||||||||||||||||
1160 | if (!CBB_add_u16_length_prefixed(cbb, &profiles)
| 0-2 | ||||||||||||||||||||||||
1161 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1162 | - | |||||||||||||||||||||||||
1163 | for (i = 0; i < ct
| 2-3 | ||||||||||||||||||||||||
1164 | if ((
| 0-3 | ||||||||||||||||||||||||
1165 | ((void *)0)
| 0-3 | ||||||||||||||||||||||||
1166 | ) | - | ||||||||||||||||||||||||
1167 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1168 | if (!CBB_add_u16(&profiles, prof->id)
| 0-3 | ||||||||||||||||||||||||
1169 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1170 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||||||||
1171 | - | |||||||||||||||||||||||||
1172 | if (!CBB_add_u8_length_prefixed(cbb, &mki)
| 0-2 | ||||||||||||||||||||||||
1173 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1174 | - | |||||||||||||||||||||||||
1175 | if (!CBB_flush(cbb)
| 0-2 | ||||||||||||||||||||||||
1176 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1177 | - | |||||||||||||||||||||||||
1178 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||
1179 | } | - | ||||||||||||||||||||||||
1180 | - | |||||||||||||||||||||||||
1181 | int | - | ||||||||||||||||||||||||
1182 | tlsext_srtp_clienthello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
1183 | { | - | ||||||||||||||||||||||||
1184 | SRTP_PROTECTION_PROFILE *cprof, *sprof; | - | ||||||||||||||||||||||||
1185 | struct stack_st_SRTP_PROTECTION_PROFILE *clnt = | - | ||||||||||||||||||||||||
1186 | ((void *)0) | - | ||||||||||||||||||||||||
1187 | , *srvr; | - | ||||||||||||||||||||||||
1188 | int i, j; | - | ||||||||||||||||||||||||
1189 | int ret; | - | ||||||||||||||||||||||||
1190 | uint16_t id; | - | ||||||||||||||||||||||||
1191 | CBS profiles, mki; | - | ||||||||||||||||||||||||
1192 | - | |||||||||||||||||||||||||
1193 | ret = 0; | - | ||||||||||||||||||||||||
1194 | - | |||||||||||||||||||||||||
1195 | if (!CBS_get_u16_length_prefixed(cbs, &profiles)
| 0-4 | ||||||||||||||||||||||||
1196 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1197 | if (CBS_len(&profiles) == 0
| 0-4 | ||||||||||||||||||||||||
1198 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1199 | - | |||||||||||||||||||||||||
1200 | if ((
| 0-4 | ||||||||||||||||||||||||
1201 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||
1202 | ) | - | ||||||||||||||||||||||||
1203 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1204 | - | |||||||||||||||||||||||||
1205 | while (CBS_len(&profiles) > 0
| 4-7 | ||||||||||||||||||||||||
1206 | if (!CBS_get_u16(&profiles, &id)
| 0-7 | ||||||||||||||||||||||||
1207 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1208 | - | |||||||||||||||||||||||||
1209 | if (!srtp_find_profile_by_num(id, &cprof)
| 3-4 | ||||||||||||||||||||||||
1210 | if (!sk_push(((_STACK*) (1 ? (clnt) : (struct stack_st_SRTP_PROTECTION_PROFILE*)0)), ((void*) (1 ? (cprof) : (SRTP_PROTECTION_PROFILE*)0)))
| 0-4 | ||||||||||||||||||||||||
1211 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1212 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
1213 | } executed 7 times by 1 test: end of block Executed by:
| 7 | ||||||||||||||||||||||||
1214 | - | |||||||||||||||||||||||||
1215 | if (!CBS_get_u8_length_prefixed(cbs, &mki)
| 0-4 | ||||||||||||||||||||||||
1216 | SSL_error_internal(s, 352, __FILE__, 1069); | - | ||||||||||||||||||||||||
1217 | *alert = 50; | - | ||||||||||||||||||||||||
1218 | goto never executed: done;goto done; never executed: goto done; | 0 | ||||||||||||||||||||||||
1219 | } | - | ||||||||||||||||||||||||
1220 | if (CBS_len(cbs) != 0
| 0-4 | ||||||||||||||||||||||||
1221 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1222 | if ((
| 0-4 | ||||||||||||||||||||||||
1223 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||
1224 | ) | - | ||||||||||||||||||||||||
1225 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1226 | for (i = 0; i < sk_num(((_STACK*) (1 ? (srvr) : (struct stack_st_SRTP_PROTECTION_PROFILE*)0)))
| 1-6 | ||||||||||||||||||||||||
1227 | if ((
| 0-6 | ||||||||||||||||||||||||
1228 | ==
| 0-6 | ||||||||||||||||||||||||
1229 | ((void *)0)
| 0-6 | ||||||||||||||||||||||||
1230 | ) | - | ||||||||||||||||||||||||
1231 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1232 | - | |||||||||||||||||||||||||
1233 | for (j = 0; j < sk_num(((_STACK*) (1 ? (clnt) : (struct stack_st_SRTP_PROTECTION_PROFILE*)0)))
| 3-4 | ||||||||||||||||||||||||
1234 | if ((
| 0-4 | ||||||||||||||||||||||||
1235 | ==
| 0-4 | ||||||||||||||||||||||||
1236 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||
1237 | ) | - | ||||||||||||||||||||||||
1238 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1239 | - | |||||||||||||||||||||||||
1240 | if (cprof->id == sprof->id
| 1-3 | ||||||||||||||||||||||||
1241 | s->internal->srtp_profile = sprof; | - | ||||||||||||||||||||||||
1242 | ret = 1; | - | ||||||||||||||||||||||||
1243 | goto executed 3 times by 1 test: done;goto done; Executed by:
executed 3 times by 1 test: goto done; Executed by:
| 3 | ||||||||||||||||||||||||
1244 | } | - | ||||||||||||||||||||||||
1245 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
1246 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||||||||
1247 | - | |||||||||||||||||||||||||
1248 | - | |||||||||||||||||||||||||
1249 | ret = 1; | - | ||||||||||||||||||||||||
1250 | goto executed 1 time by 1 test: done;goto done; Executed by:
executed 1 time by 1 test: goto done; Executed by:
| 1 | ||||||||||||||||||||||||
1251 | - | |||||||||||||||||||||||||
1252 | err: | - | ||||||||||||||||||||||||
1253 | SSL_error_internal(s, 353, __FILE__, 1110); | - | ||||||||||||||||||||||||
1254 | *alert = 50; | - | ||||||||||||||||||||||||
1255 | - | |||||||||||||||||||||||||
1256 | done: code before this statement never executed: done: | 0 | ||||||||||||||||||||||||
1257 | sk_free(((_STACK*) (1 ? (clnt) : (struct stack_st_SRTP_PROTECTION_PROFILE*)0))); | - | ||||||||||||||||||||||||
1258 | return executed 4 times by 1 test: ret;return ret; Executed by:
executed 4 times by 1 test: return ret; Executed by:
| 4 | ||||||||||||||||||||||||
1259 | } | - | ||||||||||||||||||||||||
1260 | - | |||||||||||||||||||||||||
1261 | int | - | ||||||||||||||||||||||||
1262 | tlsext_srtp_serverhello_needs(SSL *s) | - | ||||||||||||||||||||||||
1263 | { | - | ||||||||||||||||||||||||
1264 | return executed 73 times by 4 tests: (return (s->method->internal->version == 0xFEFF) && SSL_get_selected_srtp_profile(s) != ((void *)0) ; Executed by:
executed 73 times by 4 tests: return (s->method->internal->version == 0xFEFF) && SSL_get_selected_srtp_profile(s) != ((void *)0) ; Executed by:
| 4-73 | ||||||||||||||||||||||||
1265 | ((void *)0)
executed 73 times by 4 tests: return (s->method->internal->version == 0xFEFF) && SSL_get_selected_srtp_profile(s) != ((void *)0) ; Executed by:
| 4-73 | ||||||||||||||||||||||||
1266 | ; executed 73 times by 4 tests: return (s->method->internal->version == 0xFEFF) && SSL_get_selected_srtp_profile(s) != ((void *)0) ; Executed by:
| 73 | ||||||||||||||||||||||||
1267 | } | - | ||||||||||||||||||||||||
1268 | - | |||||||||||||||||||||||||
1269 | int | - | ||||||||||||||||||||||||
1270 | tlsext_srtp_serverhello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
1271 | { | - | ||||||||||||||||||||||||
1272 | SRTP_PROTECTION_PROFILE *profile; | - | ||||||||||||||||||||||||
1273 | CBB srtp, mki; | - | ||||||||||||||||||||||||
1274 | - | |||||||||||||||||||||||||
1275 | if (!CBB_add_u16_length_prefixed(cbb, &srtp)
| 0-1 | ||||||||||||||||||||||||
1276 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1277 | - | |||||||||||||||||||||||||
1278 | if ((
| 0-1 | ||||||||||||||||||||||||
1279 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||
1280 | ) | - | ||||||||||||||||||||||||
1281 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1282 | - | |||||||||||||||||||||||||
1283 | if (!CBB_add_u16(&srtp, profile->id)
| 0-1 | ||||||||||||||||||||||||
1284 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1285 | - | |||||||||||||||||||||||||
1286 | if (!CBB_add_u8_length_prefixed(cbb, &mki)
| 0-1 | ||||||||||||||||||||||||
1287 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1288 | - | |||||||||||||||||||||||||
1289 | if (!CBB_flush(cbb)
| 0-1 | ||||||||||||||||||||||||
1290 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1291 | - | |||||||||||||||||||||||||
1292 | return executed 1 time by 1 test: 1;return 1; Executed by:
executed 1 time by 1 test: return 1; Executed by:
| 1 | ||||||||||||||||||||||||
1293 | } | - | ||||||||||||||||||||||||
1294 | - | |||||||||||||||||||||||||
1295 | int | - | ||||||||||||||||||||||||
1296 | tlsext_srtp_serverhello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
1297 | { | - | ||||||||||||||||||||||||
1298 | struct stack_st_SRTP_PROTECTION_PROFILE *clnt; | - | ||||||||||||||||||||||||
1299 | SRTP_PROTECTION_PROFILE *prof; | - | ||||||||||||||||||||||||
1300 | int i; | - | ||||||||||||||||||||||||
1301 | uint16_t id; | - | ||||||||||||||||||||||||
1302 | CBS profile_ids, mki; | - | ||||||||||||||||||||||||
1303 | - | |||||||||||||||||||||||||
1304 | if (!CBS_get_u16_length_prefixed(cbs, &profile_ids)
| 0-3 | ||||||||||||||||||||||||
1305 | SSL_error_internal(s, 353, __FILE__, 1158); | - | ||||||||||||||||||||||||
1306 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1307 | } | - | ||||||||||||||||||||||||
1308 | - | |||||||||||||||||||||||||
1309 | if (!CBS_get_u16(&profile_ids, &id)
| 0-3 | ||||||||||||||||||||||||
1310 | SSL_error_internal(s, 353, __FILE__, 1163); | - | ||||||||||||||||||||||||
1311 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||||||||
1312 | } | - | ||||||||||||||||||||||||
1313 | - | |||||||||||||||||||||||||
1314 | if (!CBS_get_u8_length_prefixed(cbs, &mki)
| 0-2 | ||||||||||||||||||||||||
1315 | SSL_error_internal(s, 352, __FILE__, 1168); | - | ||||||||||||||||||||||||
1316 | *alert = 47; | - | ||||||||||||||||||||||||
1317 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1318 | } | - | ||||||||||||||||||||||||
1319 | - | |||||||||||||||||||||||||
1320 | if ((
| 0-2 | ||||||||||||||||||||||||
1321 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
1322 | ) { | - | ||||||||||||||||||||||||
1323 | SSL_error_internal(s, 359, __FILE__, 1174); | - | ||||||||||||||||||||||||
1324 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1325 | } | - | ||||||||||||||||||||||||
1326 | - | |||||||||||||||||||||||||
1327 | for (i = 0; i < sk_num(((_STACK*) (1 ? (clnt) : (struct stack_st_SRTP_PROTECTION_PROFILE*)0)))
| 1-3 | ||||||||||||||||||||||||
1328 | if ((
| 0-3 | ||||||||||||||||||||||||
1329 | ==
| 0-3 | ||||||||||||||||||||||||
1330 | ((void *)0)
| 0-3 | ||||||||||||||||||||||||
1331 | ) { | - | ||||||||||||||||||||||||
1332 | SSL_error_internal(s, 359, __FILE__, 1181); | - | ||||||||||||||||||||||||
1333 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1334 | } | - | ||||||||||||||||||||||||
1335 | - | |||||||||||||||||||||||||
1336 | if (prof->id == id
| 1-2 | ||||||||||||||||||||||||
1337 | s->internal->srtp_profile = prof; | - | ||||||||||||||||||||||||
1338 | return executed 1 time by 1 test: 1;return 1; Executed by:
executed 1 time by 1 test: return 1; Executed by:
| 1 | ||||||||||||||||||||||||
1339 | } | - | ||||||||||||||||||||||||
1340 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
1341 | - | |||||||||||||||||||||||||
1342 | SSL_error_internal(s, 353, __FILE__, 1191); | - | ||||||||||||||||||||||||
1343 | err: code before this statement executed 1 time by 1 test: err: Executed by:
| 1 | ||||||||||||||||||||||||
1344 | *alert = 50; | - | ||||||||||||||||||||||||
1345 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||||||||||||||
1346 | } | - | ||||||||||||||||||||||||
1347 | - | |||||||||||||||||||||||||
1348 | - | |||||||||||||||||||||||||
1349 | - | |||||||||||||||||||||||||
1350 | struct tls_extension { | - | ||||||||||||||||||||||||
1351 | uint16_t type; | - | ||||||||||||||||||||||||
1352 | int (*clienthello_needs)(SSL *s); | - | ||||||||||||||||||||||||
1353 | int (*clienthello_build)(SSL *s, CBB *cbb); | - | ||||||||||||||||||||||||
1354 | int (*clienthello_parse)(SSL *s, CBS *cbs, int *alert); | - | ||||||||||||||||||||||||
1355 | int (*serverhello_needs)(SSL *s); | - | ||||||||||||||||||||||||
1356 | int (*serverhello_build)(SSL *s, CBB *cbb); | - | ||||||||||||||||||||||||
1357 | int (*serverhello_parse)(SSL *s, CBS *cbs, int *alert); | - | ||||||||||||||||||||||||
1358 | }; | - | ||||||||||||||||||||||||
1359 | - | |||||||||||||||||||||||||
1360 | static struct tls_extension tls_extensions[] = { | - | ||||||||||||||||||||||||
1361 | { | - | ||||||||||||||||||||||||
1362 | .type = 0, | - | ||||||||||||||||||||||||
1363 | .clienthello_needs = tlsext_sni_clienthello_needs, | - | ||||||||||||||||||||||||
1364 | .clienthello_build = tlsext_sni_clienthello_build, | - | ||||||||||||||||||||||||
1365 | .clienthello_parse = tlsext_sni_clienthello_parse, | - | ||||||||||||||||||||||||
1366 | .serverhello_needs = tlsext_sni_serverhello_needs, | - | ||||||||||||||||||||||||
1367 | .serverhello_build = tlsext_sni_serverhello_build, | - | ||||||||||||||||||||||||
1368 | .serverhello_parse = tlsext_sni_serverhello_parse, | - | ||||||||||||||||||||||||
1369 | }, | - | ||||||||||||||||||||||||
1370 | { | - | ||||||||||||||||||||||||
1371 | .type = 0xff01, | - | ||||||||||||||||||||||||
1372 | .clienthello_needs = tlsext_ri_clienthello_needs, | - | ||||||||||||||||||||||||
1373 | .clienthello_build = tlsext_ri_clienthello_build, | - | ||||||||||||||||||||||||
1374 | .clienthello_parse = tlsext_ri_clienthello_parse, | - | ||||||||||||||||||||||||
1375 | .serverhello_needs = tlsext_ri_serverhello_needs, | - | ||||||||||||||||||||||||
1376 | .serverhello_build = tlsext_ri_serverhello_build, | - | ||||||||||||||||||||||||
1377 | .serverhello_parse = tlsext_ri_serverhello_parse, | - | ||||||||||||||||||||||||
1378 | }, | - | ||||||||||||||||||||||||
1379 | { | - | ||||||||||||||||||||||||
1380 | .type = 5, | - | ||||||||||||||||||||||||
1381 | .clienthello_needs = tlsext_ocsp_clienthello_needs, | - | ||||||||||||||||||||||||
1382 | .clienthello_build = tlsext_ocsp_clienthello_build, | - | ||||||||||||||||||||||||
1383 | .clienthello_parse = tlsext_ocsp_clienthello_parse, | - | ||||||||||||||||||||||||
1384 | .serverhello_needs = tlsext_ocsp_serverhello_needs, | - | ||||||||||||||||||||||||
1385 | .serverhello_build = tlsext_ocsp_serverhello_build, | - | ||||||||||||||||||||||||
1386 | .serverhello_parse = tlsext_ocsp_serverhello_parse, | - | ||||||||||||||||||||||||
1387 | }, | - | ||||||||||||||||||||||||
1388 | { | - | ||||||||||||||||||||||||
1389 | .type = 11, | - | ||||||||||||||||||||||||
1390 | .clienthello_needs = tlsext_ecpf_clienthello_needs, | - | ||||||||||||||||||||||||
1391 | .clienthello_build = tlsext_ecpf_clienthello_build, | - | ||||||||||||||||||||||||
1392 | .clienthello_parse = tlsext_ecpf_clienthello_parse, | - | ||||||||||||||||||||||||
1393 | .serverhello_needs = tlsext_ecpf_serverhello_needs, | - | ||||||||||||||||||||||||
1394 | .serverhello_build = tlsext_ecpf_serverhello_build, | - | ||||||||||||||||||||||||
1395 | .serverhello_parse = tlsext_ecpf_serverhello_parse, | - | ||||||||||||||||||||||||
1396 | }, | - | ||||||||||||||||||||||||
1397 | { | - | ||||||||||||||||||||||||
1398 | .type = 10, | - | ||||||||||||||||||||||||
1399 | .clienthello_needs = tlsext_ec_clienthello_needs, | - | ||||||||||||||||||||||||
1400 | .clienthello_build = tlsext_ec_clienthello_build, | - | ||||||||||||||||||||||||
1401 | .clienthello_parse = tlsext_ec_clienthello_parse, | - | ||||||||||||||||||||||||
1402 | .serverhello_needs = tlsext_ec_serverhello_needs, | - | ||||||||||||||||||||||||
1403 | .serverhello_build = tlsext_ec_serverhello_build, | - | ||||||||||||||||||||||||
1404 | .serverhello_parse = tlsext_ec_serverhello_parse, | - | ||||||||||||||||||||||||
1405 | }, | - | ||||||||||||||||||||||||
1406 | { | - | ||||||||||||||||||||||||
1407 | .type = 35, | - | ||||||||||||||||||||||||
1408 | .clienthello_needs = tlsext_sessionticket_clienthello_needs, | - | ||||||||||||||||||||||||
1409 | .clienthello_build = tlsext_sessionticket_clienthello_build, | - | ||||||||||||||||||||||||
1410 | .clienthello_parse = tlsext_sessionticket_clienthello_parse, | - | ||||||||||||||||||||||||
1411 | .serverhello_needs = tlsext_sessionticket_serverhello_needs, | - | ||||||||||||||||||||||||
1412 | .serverhello_build = tlsext_sessionticket_serverhello_build, | - | ||||||||||||||||||||||||
1413 | .serverhello_parse = tlsext_sessionticket_serverhello_parse, | - | ||||||||||||||||||||||||
1414 | }, | - | ||||||||||||||||||||||||
1415 | { | - | ||||||||||||||||||||||||
1416 | .type = 13, | - | ||||||||||||||||||||||||
1417 | .clienthello_needs = tlsext_sigalgs_clienthello_needs, | - | ||||||||||||||||||||||||
1418 | .clienthello_build = tlsext_sigalgs_clienthello_build, | - | ||||||||||||||||||||||||
1419 | .clienthello_parse = tlsext_sigalgs_clienthello_parse, | - | ||||||||||||||||||||||||
1420 | .serverhello_needs = tlsext_sigalgs_serverhello_needs, | - | ||||||||||||||||||||||||
1421 | .serverhello_build = tlsext_sigalgs_serverhello_build, | - | ||||||||||||||||||||||||
1422 | .serverhello_parse = tlsext_sigalgs_serverhello_parse, | - | ||||||||||||||||||||||||
1423 | }, | - | ||||||||||||||||||||||||
1424 | { | - | ||||||||||||||||||||||||
1425 | .type = 16, | - | ||||||||||||||||||||||||
1426 | .clienthello_needs = tlsext_alpn_clienthello_needs, | - | ||||||||||||||||||||||||
1427 | .clienthello_build = tlsext_alpn_clienthello_build, | - | ||||||||||||||||||||||||
1428 | .clienthello_parse = tlsext_alpn_clienthello_parse, | - | ||||||||||||||||||||||||
1429 | .serverhello_needs = tlsext_alpn_serverhello_needs, | - | ||||||||||||||||||||||||
1430 | .serverhello_build = tlsext_alpn_serverhello_build, | - | ||||||||||||||||||||||||
1431 | .serverhello_parse = tlsext_alpn_serverhello_parse, | - | ||||||||||||||||||||||||
1432 | }, | - | ||||||||||||||||||||||||
1433 | - | |||||||||||||||||||||||||
1434 | { | - | ||||||||||||||||||||||||
1435 | .type = 14, | - | ||||||||||||||||||||||||
1436 | .clienthello_needs = tlsext_srtp_clienthello_needs, | - | ||||||||||||||||||||||||
1437 | .clienthello_build = tlsext_srtp_clienthello_build, | - | ||||||||||||||||||||||||
1438 | .clienthello_parse = tlsext_srtp_clienthello_parse, | - | ||||||||||||||||||||||||
1439 | .serverhello_needs = tlsext_srtp_serverhello_needs, | - | ||||||||||||||||||||||||
1440 | .serverhello_build = tlsext_srtp_serverhello_build, | - | ||||||||||||||||||||||||
1441 | .serverhello_parse = tlsext_srtp_serverhello_parse, | - | ||||||||||||||||||||||||
1442 | } | - | ||||||||||||||||||||||||
1443 | - | |||||||||||||||||||||||||
1444 | }; | - | ||||||||||||||||||||||||
1445 | - | |||||||||||||||||||||||||
1446 | - | |||||||||||||||||||||||||
1447 | - | |||||||||||||||||||||||||
1448 | - | |||||||||||||||||||||||||
1449 | extern char _ctassert[((sizeof(tls_extensions) / sizeof(*tls_extensions)) <= (sizeof(uint32_t) * 8)) ? 1 : -1 ] __attribute__((__unused__)); | - | ||||||||||||||||||||||||
1450 | - | |||||||||||||||||||||||||
1451 | static struct tls_extension * | - | ||||||||||||||||||||||||
1452 | tls_extension_find(uint16_t type, size_t *tls_extensions_idx) | - | ||||||||||||||||||||||||
1453 | { | - | ||||||||||||||||||||||||
1454 | size_t i; | - | ||||||||||||||||||||||||
1455 | - | |||||||||||||||||||||||||
1456 | for (i = 0; i < (sizeof(tls_extensions) / sizeof(*tls_extensions))
| 0-1744 | ||||||||||||||||||||||||
1457 | if (tls_extensions[i].type == type
| 347-1397 | ||||||||||||||||||||||||
1458 | *tls_extensions_idx = i; | - | ||||||||||||||||||||||||
1459 | return executed 347 times by 3 tests: &tls_extensions[i];return &tls_extensions[i]; Executed by:
executed 347 times by 3 tests: return &tls_extensions[i]; Executed by:
| 347 | ||||||||||||||||||||||||
1460 | } | - | ||||||||||||||||||||||||
1461 | } executed 1397 times by 3 tests: end of block Executed by:
| 1397 | ||||||||||||||||||||||||
1462 | - | |||||||||||||||||||||||||
1463 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
1464 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
1465 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
1466 | } | - | ||||||||||||||||||||||||
1467 | - | |||||||||||||||||||||||||
1468 | static int | - | ||||||||||||||||||||||||
1469 | tls_extension_needs(struct tls_extension *tlsext, int is_serverhello, SSL *s) | - | ||||||||||||||||||||||||
1470 | { | - | ||||||||||||||||||||||||
1471 | if (is_serverhello
| 603-684 | ||||||||||||||||||||||||
1472 | return executed 603 times by 4 tests: tlsext->serverhello_needs(s);return tlsext->serverhello_needs(s); Executed by:
executed 603 times by 4 tests: return tlsext->serverhello_needs(s); Executed by:
| 603 | ||||||||||||||||||||||||
1473 | return executed 684 times by 4 tests: tlsext->clienthello_needs(s);return tlsext->clienthello_needs(s); Executed by:
executed 684 times by 4 tests: return tlsext->clienthello_needs(s); Executed by:
| 684 | ||||||||||||||||||||||||
1474 | } | - | ||||||||||||||||||||||||
1475 | - | |||||||||||||||||||||||||
1476 | static int | - | ||||||||||||||||||||||||
1477 | tls_extension_build(struct tls_extension *tlsext, int is_serverhello, SSL *s, | - | ||||||||||||||||||||||||
1478 | CBB *cbb) | - | ||||||||||||||||||||||||
1479 | { | - | ||||||||||||||||||||||||
1480 | if (is_serverhello
| 165-204 | ||||||||||||||||||||||||
1481 | return executed 165 times by 4 tests: tlsext->serverhello_build(s, cbb);return tlsext->serverhello_build(s, cbb); Executed by:
executed 165 times by 4 tests: return tlsext->serverhello_build(s, cbb); Executed by:
| 165 | ||||||||||||||||||||||||
1482 | return executed 204 times by 4 tests: tlsext->clienthello_build(s, cbb);return tlsext->clienthello_build(s, cbb); Executed by:
executed 204 times by 4 tests: return tlsext->clienthello_build(s, cbb); Executed by:
| 204 | ||||||||||||||||||||||||
1483 | } | - | ||||||||||||||||||||||||
1484 | - | |||||||||||||||||||||||||
1485 | static int | - | ||||||||||||||||||||||||
1486 | tls_extension_parse(struct tls_extension *tlsext, int is_serverhello, SSL *s, | - | ||||||||||||||||||||||||
1487 | CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
1488 | { | - | ||||||||||||||||||||||||
1489 | if (is_serverhello
| 171-176 | ||||||||||||||||||||||||
1490 | return executed 171 times by 3 tests: tlsext->serverhello_parse(s, cbs, alert);return tlsext->serverhello_parse(s, cbs, alert); Executed by:
executed 171 times by 3 tests: return tlsext->serverhello_parse(s, cbs, alert); Executed by:
| 171 | ||||||||||||||||||||||||
1491 | return executed 176 times by 3 tests: tlsext->clienthello_parse(s, cbs, alert);return tlsext->clienthello_parse(s, cbs, alert); Executed by:
executed 176 times by 3 tests: return tlsext->clienthello_parse(s, cbs, alert); Executed by:
| 176 | ||||||||||||||||||||||||
1492 | } | - | ||||||||||||||||||||||||
1493 | - | |||||||||||||||||||||||||
1494 | static int | - | ||||||||||||||||||||||||
1495 | tlsext_build(SSL *s, CBB *cbb, int is_serverhello) | - | ||||||||||||||||||||||||
1496 | { | - | ||||||||||||||||||||||||
1497 | CBB extensions, extension_data; | - | ||||||||||||||||||||||||
1498 | struct tls_extension *tlsext; | - | ||||||||||||||||||||||||
1499 | int extensions_present = 0; | - | ||||||||||||||||||||||||
1500 | size_t i; | - | ||||||||||||||||||||||||
1501 | - | |||||||||||||||||||||||||
1502 | if (!CBB_add_u16_length_prefixed(cbb, &extensions)
| 0-143 | ||||||||||||||||||||||||
1503 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1504 | - | |||||||||||||||||||||||||
1505 | for (i = 0; i < (sizeof(tls_extensions) / sizeof(*tls_extensions))
| 143-1287 | ||||||||||||||||||||||||
1506 | tlsext = &tls_extensions[i]; | - | ||||||||||||||||||||||||
1507 | - | |||||||||||||||||||||||||
1508 | if (!tls_extension_needs(tlsext, is_serverhello, s)
| 369-918 | ||||||||||||||||||||||||
1509 | continue; executed 918 times by 5 tests: continue; Executed by:
| 918 | ||||||||||||||||||||||||
1510 | - | |||||||||||||||||||||||||
1511 | if (!CBB_add_u16(&extensions, tlsext->type)
| 0-369 | ||||||||||||||||||||||||
1512 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1513 | if (!CBB_add_u16_length_prefixed(&extensions, &extension_data)
| 0-369 | ||||||||||||||||||||||||
1514 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1515 | - | |||||||||||||||||||||||||
1516 | if (!tls_extension_build(tlsext, is_serverhello, s,
| 0-369 | ||||||||||||||||||||||||
1517 | &extension_data)
| 0-369 | ||||||||||||||||||||||||
1518 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1519 | - | |||||||||||||||||||||||||
1520 | extensions_present = 1; | - | ||||||||||||||||||||||||
1521 | } executed 369 times by 5 tests: end of block Executed by:
| 369 | ||||||||||||||||||||||||
1522 | - | |||||||||||||||||||||||||
1523 | if (!extensions_present
| 3-140 | ||||||||||||||||||||||||
1524 | CBB_discard_child(cbb); executed 3 times by 2 tests: CBB_discard_child(cbb); Executed by:
| 3 | ||||||||||||||||||||||||
1525 | - | |||||||||||||||||||||||||
1526 | if (!CBB_flush(cbb)
| 0-143 | ||||||||||||||||||||||||
1527 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1528 | - | |||||||||||||||||||||||||
1529 | return executed 143 times by 5 tests: 1;return 1; Executed by:
executed 143 times by 5 tests: return 1; Executed by:
| 143 | ||||||||||||||||||||||||
1530 | } | - | ||||||||||||||||||||||||
1531 | - | |||||||||||||||||||||||||
1532 | static int | - | ||||||||||||||||||||||||
1533 | tlsext_parse(SSL *s, CBS *cbs, int *alert, int is_serverhello) | - | ||||||||||||||||||||||||
1534 | { | - | ||||||||||||||||||||||||
1535 | CBS extensions, extension_data; | - | ||||||||||||||||||||||||
1536 | struct tls_extension *tlsext; | - | ||||||||||||||||||||||||
1537 | uint32_t extensions_seen = 0; | - | ||||||||||||||||||||||||
1538 | uint16_t type; | - | ||||||||||||||||||||||||
1539 | size_t idx; | - | ||||||||||||||||||||||||
1540 | - | |||||||||||||||||||||||||
1541 | - | |||||||||||||||||||||||||
1542 | if (CBS_len(cbs) == 0
| 2-170 | ||||||||||||||||||||||||
1543 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||
1544 | - | |||||||||||||||||||||||||
1545 | *alert = 50; | - | ||||||||||||||||||||||||
1546 | - | |||||||||||||||||||||||||
1547 | if (!CBS_get_u16_length_prefixed(cbs, &extensions)
| 14-156 | ||||||||||||||||||||||||
1548 | return executed 14 times by 1 test: 0;return 0; Executed by:
executed 14 times by 1 test: return 0; Executed by:
| 14 | ||||||||||||||||||||||||
1549 | - | |||||||||||||||||||||||||
1550 | while (CBS_len(&extensions) > 0
| 133-353 | ||||||||||||||||||||||||
1551 | if (!CBS_get_u16(&extensions, &type)
| 2-351 | ||||||||||||||||||||||||
1552 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||||||||||||||
1553 | if (!CBS_get_u16_length_prefixed(&extensions, &extension_data)
| 4-347 | ||||||||||||||||||||||||
1554 | return executed 4 times by 1 test: 0;return 0; Executed by:
executed 4 times by 1 test: return 0; Executed by:
| 4 | ||||||||||||||||||||||||
1555 | - | |||||||||||||||||||||||||
1556 | if (s->internal->tlsext_debug_cb !=
| 0-347 | ||||||||||||||||||||||||
1557 | ((void *)0)
| 0-347 | ||||||||||||||||||||||||
1558 | ) | - | ||||||||||||||||||||||||
1559 | s->internal->tlsext_debug_cb(s, is_serverhello, type, never executed: s->internal->tlsext_debug_cb(s, is_serverhello, type, (unsigned char *)CBS_data(&extension_data), CBS_len(&extension_data), s->internal->tlsext_debug_arg); | 0 | ||||||||||||||||||||||||
1560 | (unsigned char *)CBS_data(&extension_data), never executed: s->internal->tlsext_debug_cb(s, is_serverhello, type, (unsigned char *)CBS_data(&extension_data), CBS_len(&extension_data), s->internal->tlsext_debug_arg); | 0 | ||||||||||||||||||||||||
1561 | CBS_len(&extension_data), never executed: s->internal->tlsext_debug_cb(s, is_serverhello, type, (unsigned char *)CBS_data(&extension_data), CBS_len(&extension_data), s->internal->tlsext_debug_arg); | 0 | ||||||||||||||||||||||||
1562 | s->internal->tlsext_debug_arg); never executed: s->internal->tlsext_debug_cb(s, is_serverhello, type, (unsigned char *)CBS_data(&extension_data), CBS_len(&extension_data), s->internal->tlsext_debug_arg); | 0 | ||||||||||||||||||||||||
1563 | - | |||||||||||||||||||||||||
1564 | - | |||||||||||||||||||||||||
1565 | if ((
| 0-347 | ||||||||||||||||||||||||
1566 | ((void *)0)
| 0-347 | ||||||||||||||||||||||||
1567 | ) | - | ||||||||||||||||||||||||
1568 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1569 | - | |||||||||||||||||||||||||
1570 | - | |||||||||||||||||||||||||
1571 | if ((
| 0-347 | ||||||||||||||||||||||||
1572 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1573 | extensions_seen |= (1 << idx); | - | ||||||||||||||||||||||||
1574 | - | |||||||||||||||||||||||||
1575 | if (!tls_extension_parse(tlsext, is_serverhello, s,
| 17-330 | ||||||||||||||||||||||||
1576 | &extension_data, alert)
| 17-330 | ||||||||||||||||||||||||
1577 | return executed 17 times by 1 test: 0;return 0; Executed by:
executed 17 times by 1 test: return 0; Executed by:
| 17 | ||||||||||||||||||||||||
1578 | - | |||||||||||||||||||||||||
1579 | if (CBS_len(&extension_data) != 0
| 0-330 | ||||||||||||||||||||||||
1580 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1581 | } executed 330 times by 3 tests: end of block Executed by:
| 330 | ||||||||||||||||||||||||
1582 | - | |||||||||||||||||||||||||
1583 | return executed 133 times by 3 tests: 1;return 1; Executed by:
executed 133 times by 3 tests: return 1; Executed by:
| 133 | ||||||||||||||||||||||||
1584 | } | - | ||||||||||||||||||||||||
1585 | - | |||||||||||||||||||||||||
1586 | static void | - | ||||||||||||||||||||||||
1587 | tlsext_clienthello_reset_state(SSL *s) | - | ||||||||||||||||||||||||
1588 | { | - | ||||||||||||||||||||||||
1589 | s->internal->servername_done = 0; | - | ||||||||||||||||||||||||
1590 | s->tlsext_status_type = -1; | - | ||||||||||||||||||||||||
1591 | (s->s3->internal)->renegotiate_seen = 0; | - | ||||||||||||||||||||||||
1592 | free((s->s3->internal)->alpn_selected); | - | ||||||||||||||||||||||||
1593 | (s->s3->internal)->alpn_selected = | - | ||||||||||||||||||||||||
1594 | ((void *)0) | - | ||||||||||||||||||||||||
1595 | ; | - | ||||||||||||||||||||||||
1596 | s->internal->srtp_profile = | - | ||||||||||||||||||||||||
1597 | ((void *)0) | - | ||||||||||||||||||||||||
1598 | ; | - | ||||||||||||||||||||||||
1599 | } executed 87 times by 4 tests: end of block Executed by:
| 87 | ||||||||||||||||||||||||
1600 | - | |||||||||||||||||||||||||
1601 | int | - | ||||||||||||||||||||||||
1602 | tlsext_clienthello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
1603 | { | - | ||||||||||||||||||||||||
1604 | return executed 76 times by 4 tests: tlsext_build(s, cbb, 0);return tlsext_build(s, cbb, 0); Executed by:
executed 76 times by 4 tests: return tlsext_build(s, cbb, 0); Executed by:
| 76 | ||||||||||||||||||||||||
1605 | } | - | ||||||||||||||||||||||||
1606 | - | |||||||||||||||||||||||||
1607 | int | - | ||||||||||||||||||||||||
1608 | tlsext_clienthello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
1609 | { | - | ||||||||||||||||||||||||
1610 | - | |||||||||||||||||||||||||
1611 | tlsext_clienthello_reset_state(s); | - | ||||||||||||||||||||||||
1612 | - | |||||||||||||||||||||||||
1613 | return executed 87 times by 4 tests: tlsext_parse(s, cbs, alert, 0);return tlsext_parse(s, cbs, alert, 0); Executed by:
executed 87 times by 4 tests: return tlsext_parse(s, cbs, alert, 0); Executed by:
| 87 | ||||||||||||||||||||||||
1614 | } | - | ||||||||||||||||||||||||
1615 | - | |||||||||||||||||||||||||
1616 | static void | - | ||||||||||||||||||||||||
1617 | tlsext_serverhello_reset_state(SSL *s) | - | ||||||||||||||||||||||||
1618 | { | - | ||||||||||||||||||||||||
1619 | (s->s3->internal)->renegotiate_seen = 0; | - | ||||||||||||||||||||||||
1620 | free((s->s3->internal)->alpn_selected); | - | ||||||||||||||||||||||||
1621 | (s->s3->internal)->alpn_selected = | - | ||||||||||||||||||||||||
1622 | ((void *)0) | - | ||||||||||||||||||||||||
1623 | ; | - | ||||||||||||||||||||||||
1624 | } executed 85 times by 3 tests: end of block Executed by:
| 85 | ||||||||||||||||||||||||
1625 | - | |||||||||||||||||||||||||
1626 | int | - | ||||||||||||||||||||||||
1627 | tlsext_serverhello_build(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
1628 | { | - | ||||||||||||||||||||||||
1629 | return executed 67 times by 4 tests: tlsext_build(s, cbb, 1);return tlsext_build(s, cbb, 1); Executed by:
executed 67 times by 4 tests: return tlsext_build(s, cbb, 1); Executed by:
| 67 | ||||||||||||||||||||||||
1630 | } | - | ||||||||||||||||||||||||
1631 | - | |||||||||||||||||||||||||
1632 | int | - | ||||||||||||||||||||||||
1633 | tlsext_serverhello_parse(SSL *s, CBS *cbs, int *alert) | - | ||||||||||||||||||||||||
1634 | { | - | ||||||||||||||||||||||||
1635 | - | |||||||||||||||||||||||||
1636 | tlsext_serverhello_reset_state(s); | - | ||||||||||||||||||||||||
1637 | - | |||||||||||||||||||||||||
1638 | return executed 85 times by 3 tests: tlsext_parse(s, cbs, alert, 1);return tlsext_parse(s, cbs, alert, 1); Executed by:
executed 85 times by 3 tests: return tlsext_parse(s, cbs, alert, 1); Executed by:
| 85 | ||||||||||||||||||||||||
1639 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |