Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/ssl/ssl_clnt.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||
16 | static int ca_dn_cmp(const X509_NAME * const *a, const X509_NAME * const *b); | - | ||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | int | - | ||||||||||||||||||||||||
19 | ssl3_connect(SSL *s) | - | ||||||||||||||||||||||||
20 | { | - | ||||||||||||||||||||||||
21 | void (*cb)(const SSL *ssl, int type, int val) = | - | ||||||||||||||||||||||||
22 | ((void *)0) | - | ||||||||||||||||||||||||
23 | ; | - | ||||||||||||||||||||||||
24 | int ret = -1; | - | ||||||||||||||||||||||||
25 | int new_state, state, skip = 0; | - | ||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||
27 | ERR_clear_error(); | - | ||||||||||||||||||||||||
28 | - | |||||||||||||||||||||||||
29 | (*__errno_location ()) | - | ||||||||||||||||||||||||
30 | = 0; | - | ||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||
32 | if (s->internal->info_callback !=
| 0-1332 | ||||||||||||||||||||||||
33 | ((void *)0)
| 0-1332 | ||||||||||||||||||||||||
34 | ) | - | ||||||||||||||||||||||||
35 | cb = s->internal->info_callback; never executed: cb = s->internal->info_callback; | 0 | ||||||||||||||||||||||||
36 | else if (s->ctx->internal->info_callback !=
| 0-1332 | ||||||||||||||||||||||||
37 | ((void *)0)
| 0-1332 | ||||||||||||||||||||||||
38 | ) | - | ||||||||||||||||||||||||
39 | cb = s->ctx->internal->info_callback; never executed: cb = s->ctx->internal->info_callback; | 0 | ||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||
41 | s->internal->in_handshake++; | - | ||||||||||||||||||||||||
42 | if (!(SSL_state((s))&(0x1000|0x2000))
| 0-1332 | ||||||||||||||||||||||||
43 | SSL_clear(s); executed 74 times by 3 tests: SSL_clear(s); Executed by:
| 74 | ||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||
45 | for (;;) { | - | ||||||||||||||||||||||||
46 | state = (s->s3->internal)->hs.state; | - | ||||||||||||||||||||||||
47 | - | |||||||||||||||||||||||||
48 | switch ((s->s3->internal)->hs.state) { | - | ||||||||||||||||||||||||
49 | case never executed: (0x04|(0x1000|0x2000)):case (0x04|(0x1000|0x2000)): never executed: case (0x04|(0x1000|0x2000)): | 0 | ||||||||||||||||||||||||
50 | s->internal->renegotiate = 1; | - | ||||||||||||||||||||||||
51 | (s->s3->internal)->hs.state = 0x1000; | - | ||||||||||||||||||||||||
52 | s->ctx->internal->stats.sess_connect_renegotiate++; | - | ||||||||||||||||||||||||
53 | - | |||||||||||||||||||||||||
54 | case never executed: 0x4000:case 0x4000: never executed: case 0x4000: code before this statement never executed: case 0x4000: | 0 | ||||||||||||||||||||||||
55 | case never executed: 0x1000:case 0x1000: never executed: case 0x1000: | 0 | ||||||||||||||||||||||||
56 | case executed 74 times by 3 tests: 0x4000|0x1000:case 0x4000|0x1000: Executed by:
executed 74 times by 3 tests: case 0x4000|0x1000: Executed by:
| 74 | ||||||||||||||||||||||||
57 | case never executed: 0x03|0x1000:case 0x03|0x1000: never executed: case 0x03|0x1000: | 0 | ||||||||||||||||||||||||
58 | - | |||||||||||||||||||||||||
59 | s->server = 0; | - | ||||||||||||||||||||||||
60 | if (cb !=
| 0-74 | ||||||||||||||||||||||||
61 | ((void *)0)
| 0-74 | ||||||||||||||||||||||||
62 | ) | - | ||||||||||||||||||||||||
63 | cb(s, 0x10, 1); never executed: cb(s, 0x10, 1); | 0 | ||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||
65 | if ((
| 12-62 | ||||||||||||||||||||||||
66 | if ((
| 0-12 | ||||||||||||||||||||||||
67 | SSL_error_internal(s, (4|64), __FILE__, 216); | - | ||||||||||||||||||||||||
68 | ret = -1; | - | ||||||||||||||||||||||||
69 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
70 | } | - | ||||||||||||||||||||||||
71 | } executed 12 times by 2 tests: else {end of block Executed by:
| 12 | ||||||||||||||||||||||||
72 | if ((
| 0-62 | ||||||||||||||||||||||||
73 | SSL_error_internal(s, (4|64), __FILE__, 222); | - | ||||||||||||||||||||||||
74 | ret = -1; | - | ||||||||||||||||||||||||
75 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
76 | } | - | ||||||||||||||||||||||||
77 | } executed 62 times by 3 tests: end of block Executed by:
| 62 | ||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||
80 | s->internal->type = 0x1000; | - | ||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||
82 | if (!ssl3_setup_init_buffer(s)
| 0-74 | ||||||||||||||||||||||||
83 | ret = -1; | - | ||||||||||||||||||||||||
84 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
85 | } | - | ||||||||||||||||||||||||
86 | if (!ssl3_setup_buffers(s)
| 0-74 | ||||||||||||||||||||||||
87 | ret = -1; | - | ||||||||||||||||||||||||
88 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
89 | } | - | ||||||||||||||||||||||||
90 | if (!ssl_init_wbio_buffer(s, 0)
| 0-74 | ||||||||||||||||||||||||
91 | ret = -1; | - | ||||||||||||||||||||||||
92 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
93 | } | - | ||||||||||||||||||||||||
94 | - | |||||||||||||||||||||||||
95 | - | |||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||
97 | if (!(s->method->internal->version == 0xFEFF)
| 12-62 | ||||||||||||||||||||||||
98 | if (!tls1_init_finished_mac(s)
| 0-62 | ||||||||||||||||||||||||
99 | ret = -1; | - | ||||||||||||||||||||||||
100 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
101 | } | - | ||||||||||||||||||||||||
102 | } executed 62 times by 3 tests: end of block Executed by:
| 62 | ||||||||||||||||||||||||
103 | - | |||||||||||||||||||||||||
104 | (s->s3->internal)->hs.state = (0x110|0x1000); | - | ||||||||||||||||||||||||
105 | s->ctx->internal->stats.sess_connect++; | - | ||||||||||||||||||||||||
106 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||
108 | if ((
| 12-62 | ||||||||||||||||||||||||
109 | - | |||||||||||||||||||||||||
110 | memset(s->s3->client_random, 0, | - | ||||||||||||||||||||||||
111 | sizeof(s->s3->client_random)); | - | ||||||||||||||||||||||||
112 | (s->d1->internal)->send_cookie = 0; | - | ||||||||||||||||||||||||
113 | s->internal->hit = 0; | - | ||||||||||||||||||||||||
114 | } executed 12 times by 2 tests: end of block Executed by:
| 12 | ||||||||||||||||||||||||
115 | break; executed 74 times by 3 tests: break; Executed by:
| 74 | ||||||||||||||||||||||||
116 | - | |||||||||||||||||||||||||
117 | case executed 74 times by 3 tests: (0x110|0x1000):case (0x110|0x1000): Executed by:
executed 74 times by 3 tests: case (0x110|0x1000): Executed by:
| 74 | ||||||||||||||||||||||||
118 | case never executed: (0x111|0x1000):case (0x111|0x1000): never executed: case (0x111|0x1000): | 0 | ||||||||||||||||||||||||
119 | s->internal->shutdown = 0; | - | ||||||||||||||||||||||||
120 | - | |||||||||||||||||||||||||
121 | if ((
| 12-62 | ||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||
123 | if (!tls1_init_finished_mac(s)
| 0-12 | ||||||||||||||||||||||||
124 | ret = -1; | - | ||||||||||||||||||||||||
125 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
126 | } | - | ||||||||||||||||||||||||
127 | - | |||||||||||||||||||||||||
128 | dtls1_start_timer(s); | - | ||||||||||||||||||||||||
129 | } executed 12 times by 2 tests: end of block Executed by:
| 12 | ||||||||||||||||||||||||
130 | - | |||||||||||||||||||||||||
131 | ret = ssl3_send_client_hello(s); | - | ||||||||||||||||||||||||
132 | if (ret <= 0
| 0-74 | ||||||||||||||||||||||||
133 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
134 | - | |||||||||||||||||||||||||
135 | if ((
| 0-62 | ||||||||||||||||||||||||
136 | (s->s3->internal)->hs.state = (0x100|0x1000); | - | ||||||||||||||||||||||||
137 | (s->s3->internal)->hs.next_state = (0x120|0x1000); | - | ||||||||||||||||||||||||
138 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
139 | ( executed 74 times by 3 tests: s->s3->internal)->hs.state = (0x120|0x1000);(s->s3->internal)->hs.state = (0x120|0x1000); Executed by:
executed 74 times by 3 tests: (s->s3->internal)->hs.state = (0x120|0x1000); Executed by:
| 74 | ||||||||||||||||||||||||
140 | - | |||||||||||||||||||||||||
141 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
142 | - | |||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||
144 | if (s->bbio != s->wbio
| 0-74 | ||||||||||||||||||||||||
145 | s->wbio = BIO_push(s->bbio, s->wbio); executed 74 times by 3 tests: s->wbio = BIO_push(s->bbio, s->wbio); Executed by:
| 74 | ||||||||||||||||||||||||
146 | - | |||||||||||||||||||||||||
147 | break; executed 74 times by 3 tests: break; Executed by:
| 74 | ||||||||||||||||||||||||
148 | - | |||||||||||||||||||||||||
149 | case executed 353 times by 3 tests: (0x120|0x1000):case (0x120|0x1000): Executed by:
executed 353 times by 3 tests: case (0x120|0x1000): Executed by:
| 353 | ||||||||||||||||||||||||
150 | case never executed: (0x121|0x1000):case (0x121|0x1000): never executed: case (0x121|0x1000): | 0 | ||||||||||||||||||||||||
151 | ret = ssl3_get_server_hello(s); | - | ||||||||||||||||||||||||
152 | if (ret <= 0
| 63-290 | ||||||||||||||||||||||||
153 | goto executed 290 times by 3 tests: end;goto end; Executed by:
executed 290 times by 3 tests: goto end; Executed by:
| 290 | ||||||||||||||||||||||||
154 | - | |||||||||||||||||||||||||
155 | if (s->internal->hit
| 0-63 | ||||||||||||||||||||||||
156 | (s->s3->internal)->hs.state = (0x1D0|0x1000); | - | ||||||||||||||||||||||||
157 | if (!(s->method->internal->version == 0xFEFF)
| 0 | ||||||||||||||||||||||||
158 | if (s->internal->tlsext_ticket_expected
| 0 | ||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||
160 | (s->s3->internal)->hs.state = (0x1E0|0x1000); | - | ||||||||||||||||||||||||
161 | } never executed: end of block | 0 | ||||||||||||||||||||||||
162 | } never executed: end of block | 0 | ||||||||||||||||||||||||
163 | } never executed: else if ((end of block
| 0-52 | ||||||||||||||||||||||||
164 | (s->s3->internal)->hs.state = (0x126|0x1000); | - | ||||||||||||||||||||||||
165 | } executed 11 times by 1 test: else {end of block Executed by:
| 11 | ||||||||||||||||||||||||
166 | (s->s3->internal)->hs.state = (0x130|0x1000); | - | ||||||||||||||||||||||||
167 | } executed 52 times by 2 tests: end of block Executed by:
| 52 | ||||||||||||||||||||||||
168 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
169 | break; executed 63 times by 2 tests: break; Executed by:
| 63 | ||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||
171 | case executed 11 times by 1 test: (0x126|0x1000):case (0x126|0x1000): Executed by:
executed 11 times by 1 test: case (0x126|0x1000): Executed by:
| 11 | ||||||||||||||||||||||||
172 | case never executed: (0x127|0x1000):case (0x127|0x1000): never executed: case (0x127|0x1000): | 0 | ||||||||||||||||||||||||
173 | ret = dtls1_get_hello_verify(s); | - | ||||||||||||||||||||||||
174 | if (ret <= 0
| 0-11 | ||||||||||||||||||||||||
175 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
176 | dtls1_stop_timer(s); | - | ||||||||||||||||||||||||
177 | if ((
| 0-11 | ||||||||||||||||||||||||
178 | ( never executed: s->s3->internal)->hs.state = (0x110|0x1000);(s->s3->internal)->hs.state = (0x110|0x1000); never executed: (s->s3->internal)->hs.state = (0x110|0x1000); | 0 | ||||||||||||||||||||||||
179 | else | - | ||||||||||||||||||||||||
180 | ( executed 11 times by 1 test: s->s3->internal)->hs.state = (0x130|0x1000);(s->s3->internal)->hs.state = (0x130|0x1000); Executed by:
executed 11 times by 1 test: (s->s3->internal)->hs.state = (0x130|0x1000); Executed by:
| 11 | ||||||||||||||||||||||||
181 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
182 | break; executed 11 times by 1 test: break; Executed by:
| 11 | ||||||||||||||||||||||||
183 | - | |||||||||||||||||||||||||
184 | case executed 225 times by 2 tests: (0x130|0x1000):case (0x130|0x1000): Executed by:
executed 225 times by 2 tests: case (0x130|0x1000): Executed by:
| 225 | ||||||||||||||||||||||||
185 | case never executed: (0x131|0x1000):case (0x131|0x1000): never executed: case (0x131|0x1000): | 0 | ||||||||||||||||||||||||
186 | ret = ssl3_check_finished(s); | - | ||||||||||||||||||||||||
187 | if (ret <= 0
| 0-225 | ||||||||||||||||||||||||
188 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
189 | if (ret == 2
| 0-225 | ||||||||||||||||||||||||
190 | s->internal->hit = 1; | - | ||||||||||||||||||||||||
191 | if (s->internal->tlsext_ticket_expected
| 0 | ||||||||||||||||||||||||
192 | ( never executed: s->s3->internal)->hs.state = (0x1E0|0x1000);(s->s3->internal)->hs.state = (0x1E0|0x1000); never executed: (s->s3->internal)->hs.state = (0x1E0|0x1000); | 0 | ||||||||||||||||||||||||
193 | else | - | ||||||||||||||||||||||||
194 | ( never executed: s->s3->internal)->hs.state = (0x1D0|0x1000);(s->s3->internal)->hs.state = (0x1D0|0x1000); never executed: (s->s3->internal)->hs.state = (0x1D0|0x1000); | 0 | ||||||||||||||||||||||||
195 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
196 | break; never executed: break; | 0 | ||||||||||||||||||||||||
197 | } | - | ||||||||||||||||||||||||
198 | - | |||||||||||||||||||||||||
199 | if (!((s->s3->internal)->hs.new_cipher->algorithm_auth &
| 10-215 | ||||||||||||||||||||||||
200 | 0x00000004L)
| 10-215 | ||||||||||||||||||||||||
201 | ret = ssl3_get_server_certificate(s); | - | ||||||||||||||||||||||||
202 | if (ret <= 0
| 53-162 | ||||||||||||||||||||||||
203 | goto executed 162 times by 2 tests: end;goto end; Executed by:
executed 162 times by 2 tests: goto end; Executed by:
| 162 | ||||||||||||||||||||||||
204 | if (s->internal->tlsext_status_expected
| 0-53 | ||||||||||||||||||||||||
205 | ( never executed: s->s3->internal)->hs.state = (0x1F0|0x1000);(s->s3->internal)->hs.state = (0x1F0|0x1000); never executed: (s->s3->internal)->hs.state = (0x1F0|0x1000); | 0 | ||||||||||||||||||||||||
206 | else | - | ||||||||||||||||||||||||
207 | ( executed 53 times by 2 tests: s->s3->internal)->hs.state = (0x140|0x1000);(s->s3->internal)->hs.state = (0x140|0x1000); Executed by:
executed 53 times by 2 tests: (s->s3->internal)->hs.state = (0x140|0x1000); Executed by:
| 53 | ||||||||||||||||||||||||
208 | } else { | - | ||||||||||||||||||||||||
209 | skip = 1; | - | ||||||||||||||||||||||||
210 | (s->s3->internal)->hs.state = (0x140|0x1000); | - | ||||||||||||||||||||||||
211 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||
212 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
213 | break; executed 63 times by 2 tests: break; Executed by:
| 63 | ||||||||||||||||||||||||
214 | - | |||||||||||||||||||||||||
215 | case executed 121 times by 2 tests: (0x140|0x1000):case (0x140|0x1000): Executed by:
executed 121 times by 2 tests: case (0x140|0x1000): Executed by:
| 121 | ||||||||||||||||||||||||
216 | case never executed: (0x141|0x1000):case (0x141|0x1000): never executed: case (0x141|0x1000): | 0 | ||||||||||||||||||||||||
217 | ret = ssl3_get_server_key_exchange(s); | - | ||||||||||||||||||||||||
218 | if (ret <= 0
| 58-63 | ||||||||||||||||||||||||
219 | goto executed 58 times by 2 tests: end;goto end; Executed by:
executed 58 times by 2 tests: goto end; Executed by:
| 58 | ||||||||||||||||||||||||
220 | (s->s3->internal)->hs.state = (0x150|0x1000); | - | ||||||||||||||||||||||||
221 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
222 | - | |||||||||||||||||||||||||
223 | - | |||||||||||||||||||||||||
224 | - | |||||||||||||||||||||||||
225 | - | |||||||||||||||||||||||||
226 | - | |||||||||||||||||||||||||
227 | if (!ssl3_check_cert_and_algorithm(s)
| 0-63 | ||||||||||||||||||||||||
228 | ret = -1; | - | ||||||||||||||||||||||||
229 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
230 | } | - | ||||||||||||||||||||||||
231 | break; executed 63 times by 2 tests: break; Executed by:
| 63 | ||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||
233 | case executed 63 times by 2 tests: (0x150|0x1000):case (0x150|0x1000): Executed by:
executed 63 times by 2 tests: case (0x150|0x1000): Executed by:
| 63 | ||||||||||||||||||||||||
234 | case never executed: (0x151|0x1000):case (0x151|0x1000): never executed: case (0x151|0x1000): | 0 | ||||||||||||||||||||||||
235 | ret = ssl3_get_certificate_request(s); | - | ||||||||||||||||||||||||
236 | if (ret <= 0
| 0-63 | ||||||||||||||||||||||||
237 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
238 | (s->s3->internal)->hs.state = (0x160|0x1000); | - | ||||||||||||||||||||||||
239 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
240 | break; executed 63 times by 2 tests: break; Executed by:
| 63 | ||||||||||||||||||||||||
241 | - | |||||||||||||||||||||||||
242 | case executed 63 times by 2 tests: (0x160|0x1000):case (0x160|0x1000): Executed by:
executed 63 times by 2 tests: case (0x160|0x1000): Executed by:
| 63 | ||||||||||||||||||||||||
243 | case never executed: (0x161|0x1000):case (0x161|0x1000): never executed: case (0x161|0x1000): | 0 | ||||||||||||||||||||||||
244 | ret = ssl3_get_server_done(s); | - | ||||||||||||||||||||||||
245 | if (ret <= 0
| 0-63 | ||||||||||||||||||||||||
246 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
247 | if ((
| 11-52 | ||||||||||||||||||||||||
248 | dtls1_stop_timer(s); executed 11 times by 1 test: dtls1_stop_timer(s); Executed by:
| 11 | ||||||||||||||||||||||||
249 | if ((
| 7-56 | ||||||||||||||||||||||||
250 | ( executed 7 times by 1 test: s->s3->internal)->hs.state = (0x170|0x1000);(s->s3->internal)->hs.state = (0x170|0x1000); Executed by:
executed 7 times by 1 test: (s->s3->internal)->hs.state = (0x170|0x1000); Executed by:
| 7 | ||||||||||||||||||||||||
251 | else | - | ||||||||||||||||||||||||
252 | ( executed 56 times by 2 tests: s->s3->internal)->hs.state = (0x180|0x1000);(s->s3->internal)->hs.state = (0x180|0x1000); Executed by:
executed 56 times by 2 tests: (s->s3->internal)->hs.state = (0x180|0x1000); Executed by:
| 56 | ||||||||||||||||||||||||
253 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||
255 | break; executed 63 times by 2 tests: break; Executed by:
| 63 | ||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||
257 | case executed 7 times by 1 test: (0x170|0x1000):case (0x170|0x1000): Executed by:
executed 7 times by 1 test: case (0x170|0x1000): Executed by:
| 7 | ||||||||||||||||||||||||
258 | case never executed: (0x171|0x1000):case (0x171|0x1000): never executed: case (0x171|0x1000): | 0 | ||||||||||||||||||||||||
259 | case never executed: (0x172|0x1000):case (0x172|0x1000): never executed: case (0x172|0x1000): | 0 | ||||||||||||||||||||||||
260 | case never executed: (0x173|0x1000):case (0x173|0x1000): never executed: case (0x173|0x1000): | 0 | ||||||||||||||||||||||||
261 | if ((
| 2-5 | ||||||||||||||||||||||||
262 | dtls1_start_timer(s); executed 2 times by 1 test: dtls1_start_timer(s); Executed by:
| 2 | ||||||||||||||||||||||||
263 | ret = ssl3_send_client_certificate(s); | - | ||||||||||||||||||||||||
264 | if (ret <= 0
| 0-7 | ||||||||||||||||||||||||
265 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
266 | (s->s3->internal)->hs.state = (0x180|0x1000); | - | ||||||||||||||||||||||||
267 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
268 | break; executed 7 times by 1 test: break; Executed by:
| 7 | ||||||||||||||||||||||||
269 | - | |||||||||||||||||||||||||
270 | case executed 63 times by 2 tests: (0x180|0x1000):case (0x180|0x1000): Executed by:
executed 63 times by 2 tests: case (0x180|0x1000): Executed by:
| 63 | ||||||||||||||||||||||||
271 | case never executed: (0x181|0x1000):case (0x181|0x1000): never executed: case (0x181|0x1000): | 0 | ||||||||||||||||||||||||
272 | if ((
| 11-52 | ||||||||||||||||||||||||
273 | dtls1_start_timer(s); executed 11 times by 1 test: dtls1_start_timer(s); Executed by:
| 11 | ||||||||||||||||||||||||
274 | ret = ssl3_send_client_key_exchange(s); | - | ||||||||||||||||||||||||
275 | if (ret <= 0
| 0-63 | ||||||||||||||||||||||||
276 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
277 | if ((
| 7-56 | ||||||||||||||||||||||||
278 | (s->s3->internal)->hs.state = (0x190|0x1000); | - | ||||||||||||||||||||||||
279 | } executed 7 times by 1 test: else {end of block Executed by:
| 7 | ||||||||||||||||||||||||
280 | (s->s3->internal)->hs.state = (0x1A0|0x1000); | - | ||||||||||||||||||||||||
281 | (s->s3->internal)->change_cipher_spec = 0; | - | ||||||||||||||||||||||||
282 | } executed 56 times by 2 tests: end of block Executed by:
| 56 | ||||||||||||||||||||||||
283 | if (!(s->method->internal->version == 0xFEFF)
| 11-52 | ||||||||||||||||||||||||
284 | if (s->s3->flags & 0x0010
| 0-52 | ||||||||||||||||||||||||
285 | (s->s3->internal)->hs.state = (0x1A0|0x1000); | - | ||||||||||||||||||||||||
286 | (s->s3->internal)->change_cipher_spec = 0; | - | ||||||||||||||||||||||||
287 | } never executed: end of block | 0 | ||||||||||||||||||||||||
288 | } executed 52 times by 2 tests: end of block Executed by:
| 52 | ||||||||||||||||||||||||
289 | - | |||||||||||||||||||||||||
290 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
291 | break; executed 63 times by 2 tests: break; Executed by:
| 63 | ||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||
293 | case executed 7 times by 1 test: (0x190|0x1000):case (0x190|0x1000): Executed by:
executed 7 times by 1 test: case (0x190|0x1000): Executed by:
| 7 | ||||||||||||||||||||||||
294 | case never executed: (0x191|0x1000):case (0x191|0x1000): never executed: case (0x191|0x1000): | 0 | ||||||||||||||||||||||||
295 | if ((
| 2-5 | ||||||||||||||||||||||||
296 | dtls1_start_timer(s); executed 2 times by 1 test: dtls1_start_timer(s); Executed by:
| 2 | ||||||||||||||||||||||||
297 | ret = ssl3_send_client_verify(s); | - | ||||||||||||||||||||||||
298 | if (ret <= 0
| 0-7 | ||||||||||||||||||||||||
299 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
300 | (s->s3->internal)->hs.state = (0x1A0|0x1000); | - | ||||||||||||||||||||||||
301 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
302 | (s->s3->internal)->change_cipher_spec = 0; | - | ||||||||||||||||||||||||
303 | break; executed 7 times by 1 test: break; Executed by:
| 7 | ||||||||||||||||||||||||
304 | - | |||||||||||||||||||||||||
305 | case executed 63 times by 2 tests: (0x1A0|0x1000):case (0x1A0|0x1000): Executed by:
executed 63 times by 2 tests: case (0x1A0|0x1000): Executed by:
| 63 | ||||||||||||||||||||||||
306 | case never executed: (0x1A1|0x1000):case (0x1A1|0x1000): never executed: case (0x1A1|0x1000): | 0 | ||||||||||||||||||||||||
307 | if ((
| 0-52 | ||||||||||||||||||||||||
308 | dtls1_start_timer(s); executed 11 times by 1 test: dtls1_start_timer(s); Executed by:
| 11 | ||||||||||||||||||||||||
309 | ret = ssl3_send_change_cipher_spec(s, | - | ||||||||||||||||||||||||
310 | (0x1A0|0x1000), (0x1A1|0x1000)); | - | ||||||||||||||||||||||||
311 | if (ret <= 0
| 0-63 | ||||||||||||||||||||||||
312 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
313 | - | |||||||||||||||||||||||||
314 | (s->s3->internal)->hs.state = (0x1B0|0x1000); | - | ||||||||||||||||||||||||
315 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
316 | - | |||||||||||||||||||||||||
317 | s->session->cipher = (s->s3->internal)->hs.new_cipher; | - | ||||||||||||||||||||||||
318 | if (!tls1_setup_key_block(s)
| 0-63 | ||||||||||||||||||||||||
319 | ret = -1; | - | ||||||||||||||||||||||||
320 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
321 | } | - | ||||||||||||||||||||||||
322 | - | |||||||||||||||||||||||||
323 | if (!tls1_change_cipher_state(s,
| 0-63 | ||||||||||||||||||||||||
324 | (0x10|0x02))
| 0-63 | ||||||||||||||||||||||||
325 | ret = -1; | - | ||||||||||||||||||||||||
326 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
327 | } | - | ||||||||||||||||||||||||
328 | - | |||||||||||||||||||||||||
329 | if ((
| 11-52 | ||||||||||||||||||||||||
330 | dtls1_reset_seq_numbers(s, 0x02); executed 11 times by 1 test: dtls1_reset_seq_numbers(s, 0x02); Executed by:
| 11 | ||||||||||||||||||||||||
331 | - | |||||||||||||||||||||||||
332 | break; executed 63 times by 2 tests: break; Executed by:
| 63 | ||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||
334 | case executed 63 times by 2 tests: (0x1B0|0x1000):case (0x1B0|0x1000): Executed by:
executed 63 times by 2 tests: case (0x1B0|0x1000): Executed by:
| 63 | ||||||||||||||||||||||||
335 | case never executed: (0x1B1|0x1000):case (0x1B1|0x1000): never executed: case (0x1B1|0x1000): | 0 | ||||||||||||||||||||||||
336 | if ((
| 0-52 | ||||||||||||||||||||||||
337 | dtls1_start_timer(s); executed 11 times by 1 test: dtls1_start_timer(s); Executed by:
| 11 | ||||||||||||||||||||||||
338 | ret = ssl3_send_finished(s, (0x1B0|0x1000), | - | ||||||||||||||||||||||||
339 | (0x1B1|0x1000), "client finished", | - | ||||||||||||||||||||||||
340 | 15); | - | ||||||||||||||||||||||||
341 | if (ret <= 0
| 0-63 | ||||||||||||||||||||||||
342 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
343 | if (!(s->method->internal->version == 0xFEFF)
| 11-52 | ||||||||||||||||||||||||
344 | s->s3->flags |= 0x0080; executed 52 times by 2 tests: s->s3->flags |= 0x0080; Executed by:
| 52 | ||||||||||||||||||||||||
345 | (s->s3->internal)->hs.state = (0x100|0x1000); | - | ||||||||||||||||||||||||
346 | - | |||||||||||||||||||||||||
347 | - | |||||||||||||||||||||||||
348 | if (s->internal->hit
| 0-63 | ||||||||||||||||||||||||
349 | (s->s3->internal)->hs.next_state = 0x03; | - | ||||||||||||||||||||||||
350 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
351 | - | |||||||||||||||||||||||||
352 | if (s->internal->tlsext_ticket_expected
| 4-59 | ||||||||||||||||||||||||
353 | ( executed 59 times by 1 test: s->s3->internal)->hs.next_state =(s->s3->internal)->hs.next_state = (0x1E0|0x1000); Executed by:
executed 59 times by 1 test: (s->s3->internal)->hs.next_state = (0x1E0|0x1000); Executed by:
| 59 | ||||||||||||||||||||||||
354 | (0x1E0|0x1000); executed 59 times by 1 test: (s->s3->internal)->hs.next_state = (0x1E0|0x1000); Executed by:
| 59 | ||||||||||||||||||||||||
355 | else | - | ||||||||||||||||||||||||
356 | ( executed 4 times by 1 test: s->s3->internal)->hs.next_state =(s->s3->internal)->hs.next_state = (0x1D0|0x1000); Executed by:
executed 4 times by 1 test: (s->s3->internal)->hs.next_state = (0x1D0|0x1000); Executed by:
| 4 | ||||||||||||||||||||||||
357 | (0x1D0|0x1000); executed 4 times by 1 test: (s->s3->internal)->hs.next_state = (0x1D0|0x1000); Executed by:
| 4 | ||||||||||||||||||||||||
358 | } | - | ||||||||||||||||||||||||
359 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
360 | break; executed 63 times by 2 tests: break; Executed by:
| 63 | ||||||||||||||||||||||||
361 | - | |||||||||||||||||||||||||
362 | case executed 682 times by 1 test: (0x1E0|0x1000):case (0x1E0|0x1000): Executed by:
executed 682 times by 1 test: case (0x1E0|0x1000): Executed by:
| 682 | ||||||||||||||||||||||||
363 | case never executed: (0x1E1|0x1000):case (0x1E1|0x1000): never executed: case (0x1E1|0x1000): | 0 | ||||||||||||||||||||||||
364 | ret = ssl3_get_new_session_ticket(s); | - | ||||||||||||||||||||||||
365 | if (ret <= 0
| 59-623 | ||||||||||||||||||||||||
366 | goto executed 623 times by 1 test: end;goto end; Executed by:
executed 623 times by 1 test: goto end; Executed by:
| 623 | ||||||||||||||||||||||||
367 | (s->s3->internal)->hs.state = (0x1D0|0x1000); | - | ||||||||||||||||||||||||
368 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
369 | break; executed 59 times by 1 test: break; Executed by:
| 59 | ||||||||||||||||||||||||
370 | - | |||||||||||||||||||||||||
371 | case never executed: (0x1F0|0x1000):case (0x1F0|0x1000): never executed: case (0x1F0|0x1000): | 0 | ||||||||||||||||||||||||
372 | case never executed: (0x1F1|0x1000):case (0x1F1|0x1000): never executed: case (0x1F1|0x1000): | 0 | ||||||||||||||||||||||||
373 | ret = ssl3_get_cert_status(s); | - | ||||||||||||||||||||||||
374 | if (ret <= 0
| 0 | ||||||||||||||||||||||||
375 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
376 | (s->s3->internal)->hs.state = (0x140|0x1000); | - | ||||||||||||||||||||||||
377 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
378 | break; never executed: break; | 0 | ||||||||||||||||||||||||
379 | - | |||||||||||||||||||||||||
380 | case executed 67 times by 2 tests: (0x1D0|0x1000):case (0x1D0|0x1000): Executed by:
executed 67 times by 2 tests: case (0x1D0|0x1000): Executed by:
| 67 | ||||||||||||||||||||||||
381 | case never executed: (0x1D1|0x1000):case (0x1D1|0x1000): never executed: case (0x1D1|0x1000): | 0 | ||||||||||||||||||||||||
382 | if ((
| 11-56 | ||||||||||||||||||||||||
383 | ( executed 11 times by 1 test: s->d1->internal)->change_cipher_spec_ok = 1;(s->d1->internal)->change_cipher_spec_ok = 1; Executed by:
executed 11 times by 1 test: (s->d1->internal)->change_cipher_spec_ok = 1; Executed by:
| 11 | ||||||||||||||||||||||||
384 | else | - | ||||||||||||||||||||||||
385 | s->s3->flags |= 0x0080; executed 56 times by 2 tests: s->s3->flags |= 0x0080; Executed by:
| 56 | ||||||||||||||||||||||||
386 | ret = ssl3_get_finished(s, (0x1D0|0x1000), | - | ||||||||||||||||||||||||
387 | (0x1D1|0x1000)); | - | ||||||||||||||||||||||||
388 | if (ret <= 0
| 4-63 | ||||||||||||||||||||||||
389 | goto executed 4 times by 1 test: end;goto end; Executed by:
executed 4 times by 1 test: goto end; Executed by:
| 4 | ||||||||||||||||||||||||
390 | if ((
| 11-52 | ||||||||||||||||||||||||
391 | dtls1_stop_timer(s); executed 11 times by 1 test: dtls1_stop_timer(s); Executed by:
| 11 | ||||||||||||||||||||||||
392 | - | |||||||||||||||||||||||||
393 | if (s->internal->hit
| 0-63 | ||||||||||||||||||||||||
394 | ( never executed: s->s3->internal)->hs.state = (0x1A0|0x1000);(s->s3->internal)->hs.state = (0x1A0|0x1000); never executed: (s->s3->internal)->hs.state = (0x1A0|0x1000); | 0 | ||||||||||||||||||||||||
395 | else | - | ||||||||||||||||||||||||
396 | ( executed 63 times by 2 tests: s->s3->internal)->hs.state = 0x03;(s->s3->internal)->hs.state = 0x03; Executed by:
executed 63 times by 2 tests: (s->s3->internal)->hs.state = 0x03; Executed by:
| 63 | ||||||||||||||||||||||||
397 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
398 | break; executed 63 times by 2 tests: break; Executed by:
| 63 | ||||||||||||||||||||||||
399 | - | |||||||||||||||||||||||||
400 | case executed 195 times by 2 tests: (0x100|0x1000):case (0x100|0x1000): Executed by:
executed 195 times by 2 tests: case (0x100|0x1000): Executed by:
| 195 | ||||||||||||||||||||||||
401 | s->internal->rwstate = 2; | - | ||||||||||||||||||||||||
402 | if ((
| 63-132 | ||||||||||||||||||||||||
403 | ((void *)0)
| 63-132 | ||||||||||||||||||||||||
404 | ) <= 0
| 63-132 | ||||||||||||||||||||||||
405 | if ((
| 0-132 | ||||||||||||||||||||||||
406 | - | |||||||||||||||||||||||||
407 | if (!BIO_test_flags(s->wbio, 0x08)
| 0 | ||||||||||||||||||||||||
408 | s->internal->rwstate = 1; | - | ||||||||||||||||||||||||
409 | (s->s3->internal)->hs.state = (s->s3->internal)->hs.next_state; | - | ||||||||||||||||||||||||
410 | } never executed: end of block | 0 | ||||||||||||||||||||||||
411 | } never executed: end of block | 0 | ||||||||||||||||||||||||
412 | ret = -1; | - | ||||||||||||||||||||||||
413 | goto executed 132 times by 1 test: end;goto end; Executed by:
executed 132 times by 1 test: goto end; Executed by:
| 132 | ||||||||||||||||||||||||
414 | } | - | ||||||||||||||||||||||||
415 | s->internal->rwstate = 1; | - | ||||||||||||||||||||||||
416 | (s->s3->internal)->hs.state = (s->s3->internal)->hs.next_state; | - | ||||||||||||||||||||||||
417 | break; executed 63 times by 2 tests: break; Executed by:
| 63 | ||||||||||||||||||||||||
418 | - | |||||||||||||||||||||||||
419 | case executed 63 times by 2 tests: 0x03:case 0x03: Executed by:
executed 63 times by 2 tests: case 0x03: Executed by:
| 63 | ||||||||||||||||||||||||
420 | - | |||||||||||||||||||||||||
421 | tls1_cleanup_key_block(s); | - | ||||||||||||||||||||||||
422 | - | |||||||||||||||||||||||||
423 | if (!(s->method->internal->version == 0xFEFF)
| 11-52 | ||||||||||||||||||||||||
424 | BUF_MEM_free(s->internal->init_buf); | - | ||||||||||||||||||||||||
425 | s->internal->init_buf = | - | ||||||||||||||||||||||||
426 | ((void *)0) | - | ||||||||||||||||||||||||
427 | ; | - | ||||||||||||||||||||||||
428 | } executed 52 times by 2 tests: end of block Executed by:
| 52 | ||||||||||||||||||||||||
429 | - | |||||||||||||||||||||||||
430 | ssl_free_wbio_buffer(s); | - | ||||||||||||||||||||||||
431 | - | |||||||||||||||||||||||||
432 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
433 | s->internal->renegotiate = 0; | - | ||||||||||||||||||||||||
434 | s->internal->new_session = 0; | - | ||||||||||||||||||||||||
435 | - | |||||||||||||||||||||||||
436 | ssl_update_cache(s, 0x0001); | - | ||||||||||||||||||||||||
437 | if (s->internal->hit
| 0-63 | ||||||||||||||||||||||||
438 | s->ctx->internal->stats.sess_hit++; never executed: s->ctx->internal->stats.sess_hit++; | 0 | ||||||||||||||||||||||||
439 | - | |||||||||||||||||||||||||
440 | ret = 1; | - | ||||||||||||||||||||||||
441 | - | |||||||||||||||||||||||||
442 | s->internal->handshake_func = ssl3_connect; | - | ||||||||||||||||||||||||
443 | s->ctx->internal->stats.sess_connect_good++; | - | ||||||||||||||||||||||||
444 | - | |||||||||||||||||||||||||
445 | if (cb !=
| 0-63 | ||||||||||||||||||||||||
446 | ((void *)0)
| 0-63 | ||||||||||||||||||||||||
447 | ) | - | ||||||||||||||||||||||||
448 | cb(s, 0x20, 1); never executed: cb(s, 0x20, 1); | 0 | ||||||||||||||||||||||||
449 | - | |||||||||||||||||||||||||
450 | if ((
| 11-52 | ||||||||||||||||||||||||
451 | - | |||||||||||||||||||||||||
452 | (s->d1->internal)->handshake_read_seq = 0; | - | ||||||||||||||||||||||||
453 | (s->d1->internal)->next_handshake_write_seq = 0; | - | ||||||||||||||||||||||||
454 | } executed 11 times by 1 test: end of block Executed by:
| 11 | ||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||
456 | goto executed 63 times by 2 tests: end;goto end; Executed by:
executed 63 times by 2 tests: goto end; Executed by:
| 63 | ||||||||||||||||||||||||
457 | - | |||||||||||||||||||||||||
458 | - | |||||||||||||||||||||||||
459 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
460 | SSL_error_internal(s, 255, __FILE__, 619); | - | ||||||||||||||||||||||||
461 | ret = -1; | - | ||||||||||||||||||||||||
462 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
463 | - | |||||||||||||||||||||||||
464 | } | - | ||||||||||||||||||||||||
465 | - | |||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||
467 | if (!(s->s3->internal)->tmp.reuse_message
| 10-781 | ||||||||||||||||||||||||
468 | if (s->internal->debug
| 0-771 | ||||||||||||||||||||||||
469 | if ((
| 0 | ||||||||||||||||||||||||
470 | ((void *)0)
| 0 | ||||||||||||||||||||||||
471 | )) <= 0
| 0 | ||||||||||||||||||||||||
472 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
473 | } never executed: end of block | 0 | ||||||||||||||||||||||||
474 | - | |||||||||||||||||||||||||
475 | if ((
| 0-771 | ||||||||||||||||||||||||
476 | ((void *)0)
| 0-771 | ||||||||||||||||||||||||
477 | )
| 0-771 | ||||||||||||||||||||||||
478 | new_state = (s->s3->internal)->hs.state; | - | ||||||||||||||||||||||||
479 | (s->s3->internal)->hs.state = state; | - | ||||||||||||||||||||||||
480 | cb(s, (0x1000|0x01), 1); | - | ||||||||||||||||||||||||
481 | (s->s3->internal)->hs.state = new_state; | - | ||||||||||||||||||||||||
482 | } never executed: end of block | 0 | ||||||||||||||||||||||||
483 | } executed 771 times by 3 tests: end of block Executed by:
| 771 | ||||||||||||||||||||||||
484 | skip = 0; | - | ||||||||||||||||||||||||
485 | } executed 862 times by 3 tests: end of block Executed by:
| 862 | ||||||||||||||||||||||||
486 | - | |||||||||||||||||||||||||
487 | end: code before this statement never executed: end: | 0 | ||||||||||||||||||||||||
488 | s->internal->in_handshake--; | - | ||||||||||||||||||||||||
489 | if (cb !=
| 0-1332 | ||||||||||||||||||||||||
490 | ((void *)0)
| 0-1332 | ||||||||||||||||||||||||
491 | ) | - | ||||||||||||||||||||||||
492 | cb(s, (0x1000|0x02), ret); never executed: cb(s, (0x1000|0x02), ret); | 0 | ||||||||||||||||||||||||
493 | - | |||||||||||||||||||||||||
494 | return executed 1332 times by 3 tests: (ret);return (ret); Executed by:
executed 1332 times by 3 tests: return (ret); Executed by:
| 1332 | ||||||||||||||||||||||||
495 | } | - | ||||||||||||||||||||||||
496 | - | |||||||||||||||||||||||||
497 | int | - | ||||||||||||||||||||||||
498 | ssl3_send_client_hello(SSL *s) | - | ||||||||||||||||||||||||
499 | { | - | ||||||||||||||||||||||||
500 | CBB cbb, client_hello, session_id, cookie, cipher_suites; | - | ||||||||||||||||||||||||
501 | CBB compression_methods; | - | ||||||||||||||||||||||||
502 | uint16_t max_version; | - | ||||||||||||||||||||||||
503 | size_t sl; | - | ||||||||||||||||||||||||
504 | - | |||||||||||||||||||||||||
505 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
506 | - | |||||||||||||||||||||||||
507 | if ((
| 0-74 | ||||||||||||||||||||||||
508 | SSL_SESSION *sess = s->session; | - | ||||||||||||||||||||||||
509 | - | |||||||||||||||||||||||||
510 | if (ssl_supported_version_range(s,
| 0-74 | ||||||||||||||||||||||||
511 | ((void *)0)
| 0-74 | ||||||||||||||||||||||||
512 | , &max_version) != 1
| 0-74 | ||||||||||||||||||||||||
513 | SSL_error_internal(s, 191, __FILE__, 664); | - | ||||||||||||||||||||||||
514 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
515 | } | - | ||||||||||||||||||||||||
516 | s->client_version = s->version = max_version; | - | ||||||||||||||||||||||||
517 | - | |||||||||||||||||||||||||
518 | if (sess ==
| 0-74 | ||||||||||||||||||||||||
519 | ((void *)0)
| 0-74 | ||||||||||||||||||||||||
520 | || | - | ||||||||||||||||||||||||
521 | sess->ssl_version != s->version
| 0 | ||||||||||||||||||||||||
522 | (!sess->session_id_length
| 0 | ||||||||||||||||||||||||
523 | sess->internal->not_resumable
| 0 | ||||||||||||||||||||||||
524 | if (!ssl_get_new_session(s, 0)
| 0-74 | ||||||||||||||||||||||||
525 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
526 | } executed 74 times by 3 tests: end of block Executed by:
| 74 | ||||||||||||||||||||||||
527 | - | |||||||||||||||||||||||||
528 | - | |||||||||||||||||||||||||
529 | - | |||||||||||||||||||||||||
530 | - | |||||||||||||||||||||||||
531 | - | |||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||
533 | - | |||||||||||||||||||||||||
534 | if (!(s->method->internal->version == 0xFEFF)
| 0-62 | ||||||||||||||||||||||||
535 | arc4random_buf(s->s3->client_random, 32); executed 74 times by 3 tests: arc4random_buf(s->s3->client_random, 32); Executed by:
| 74 | ||||||||||||||||||||||||
536 | - | |||||||||||||||||||||||||
537 | if (!ssl3_handshake_msg_start(s, &cbb, &client_hello,
| 0-74 | ||||||||||||||||||||||||
538 | 1)
| 0-74 | ||||||||||||||||||||||||
539 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
540 | if (!CBB_add_u16(&client_hello, s->client_version)
| 0-74 | ||||||||||||||||||||||||
541 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
542 | - | |||||||||||||||||||||||||
543 | - | |||||||||||||||||||||||||
544 | if (!CBB_add_bytes(&client_hello, s->s3->client_random,
| 0-74 | ||||||||||||||||||||||||
545 | sizeof(s->s3->client_random))
| 0-74 | ||||||||||||||||||||||||
546 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
547 | - | |||||||||||||||||||||||||
548 | - | |||||||||||||||||||||||||
549 | if (!CBB_add_u8_length_prefixed(&client_hello, &session_id)
| 0-74 | ||||||||||||||||||||||||
550 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
551 | if (!s->internal->new_session
| 0-74 | ||||||||||||||||||||||||
552 | s->session->session_id_length > 0
| 0-74 | ||||||||||||||||||||||||
553 | sl = s->session->session_id_length; | - | ||||||||||||||||||||||||
554 | if (sl > sizeof(s->session->session_id)
| 0 | ||||||||||||||||||||||||
555 | SSL_error_internal(s, (4|64), __FILE__, 735); | - | ||||||||||||||||||||||||
556 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
557 | } | - | ||||||||||||||||||||||||
558 | if (!CBB_add_bytes(&session_id,
| 0 | ||||||||||||||||||||||||
559 | s->session->session_id, sl)
| 0 | ||||||||||||||||||||||||
560 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
561 | } never executed: end of block | 0 | ||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||
564 | if ((
| 12-62 | ||||||||||||||||||||||||
565 | if ((
| 0-12 | ||||||||||||||||||||||||
566 | SSL_error_internal(s, (4|64), __FILE__, 746); | - | ||||||||||||||||||||||||
567 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
568 | } | - | ||||||||||||||||||||||||
569 | if (!CBB_add_u8_length_prefixed(&client_hello, &cookie)
| 0-12 | ||||||||||||||||||||||||
570 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
571 | if (!CBB_add_bytes(&cookie, (s->d1->internal)->cookie,
| 0-12 | ||||||||||||||||||||||||
572 | (s->d1->internal)->cookie_len)
| 0-12 | ||||||||||||||||||||||||
573 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
574 | } executed 12 times by 2 tests: end of block Executed by:
| 12 | ||||||||||||||||||||||||
575 | - | |||||||||||||||||||||||||
576 | - | |||||||||||||||||||||||||
577 | if (!CBB_add_u16_length_prefixed(&client_hello, &cipher_suites)
| 0-74 | ||||||||||||||||||||||||
578 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
579 | if (!ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s),
| 0-74 | ||||||||||||||||||||||||
580 | &cipher_suites)
| 0-74 | ||||||||||||||||||||||||
581 | SSL_error_internal(s, 181, __FILE__, 761); | - | ||||||||||||||||||||||||
582 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
583 | } | - | ||||||||||||||||||||||||
584 | - | |||||||||||||||||||||||||
585 | - | |||||||||||||||||||||||||
586 | if (!CBB_add_u8_length_prefixed(&client_hello,
| 0-74 | ||||||||||||||||||||||||
587 | &compression_methods)
| 0-74 | ||||||||||||||||||||||||
588 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
589 | if (!CBB_add_u8(&compression_methods, 0)
| 0-74 | ||||||||||||||||||||||||
590 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
591 | - | |||||||||||||||||||||||||
592 | - | |||||||||||||||||||||||||
593 | if (!tlsext_clienthello_build(s, &client_hello)
| 0-74 | ||||||||||||||||||||||||
594 | SSL_error_internal(s, (4|64), __FILE__, 774); | - | ||||||||||||||||||||||||
595 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
596 | } | - | ||||||||||||||||||||||||
597 | - | |||||||||||||||||||||||||
598 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0-74 | ||||||||||||||||||||||||
599 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
600 | - | |||||||||||||||||||||||||
601 | (s->s3->internal)->hs.state = (0x111|0x1000); | - | ||||||||||||||||||||||||
602 | } executed 74 times by 3 tests: end of block Executed by:
| 74 | ||||||||||||||||||||||||
603 | - | |||||||||||||||||||||||||
604 | - | |||||||||||||||||||||||||
605 | return executed 74 times by 3 tests: (ssl3_handshake_write(s));return (ssl3_handshake_write(s)); Executed by:
executed 74 times by 3 tests: return (ssl3_handshake_write(s)); Executed by:
| 74 | ||||||||||||||||||||||||
606 | - | |||||||||||||||||||||||||
607 | err: | - | ||||||||||||||||||||||||
608 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
609 | - | |||||||||||||||||||||||||
610 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
611 | } | - | ||||||||||||||||||||||||
612 | - | |||||||||||||||||||||||||
613 | int | - | ||||||||||||||||||||||||
614 | ssl3_get_server_hello(SSL *s) | - | ||||||||||||||||||||||||
615 | { | - | ||||||||||||||||||||||||
616 | CBS cbs, server_random, session_id; | - | ||||||||||||||||||||||||
617 | uint16_t server_version, cipher_suite; | - | ||||||||||||||||||||||||
618 | uint16_t min_version, max_version; | - | ||||||||||||||||||||||||
619 | uint8_t compression_method; | - | ||||||||||||||||||||||||
620 | struct stack_st_SSL_CIPHER *sk; | - | ||||||||||||||||||||||||
621 | const SSL_CIPHER *cipher; | - | ||||||||||||||||||||||||
622 | const SSL_METHOD *method; | - | ||||||||||||||||||||||||
623 | unsigned long alg_k; | - | ||||||||||||||||||||||||
624 | size_t outlen; | - | ||||||||||||||||||||||||
625 | int i, al, ok; | - | ||||||||||||||||||||||||
626 | long n; | - | ||||||||||||||||||||||||
627 | - | |||||||||||||||||||||||||
628 | s->internal->first_packet = 1; | - | ||||||||||||||||||||||||
629 | n = s->method->internal->ssl_get_message(s, (0x120|0x1000), | - | ||||||||||||||||||||||||
630 | (0x121|0x1000), -1, 20000, &ok); | - | ||||||||||||||||||||||||
631 | if (!ok
| 63-290 | ||||||||||||||||||||||||
632 | return executed 290 times by 3 tests: ((int)n);return ((int)n); Executed by:
executed 290 times by 3 tests: return ((int)n); Executed by:
| 290 | ||||||||||||||||||||||||
633 | s->internal->first_packet = 0; | - | ||||||||||||||||||||||||
634 | - | |||||||||||||||||||||||||
635 | if (n < 0
| 0-63 | ||||||||||||||||||||||||
636 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
637 | - | |||||||||||||||||||||||||
638 | CBS_init(&cbs, s->internal->init_msg, n); | - | ||||||||||||||||||||||||
639 | - | |||||||||||||||||||||||||
640 | if ((
| 11-52 | ||||||||||||||||||||||||
641 | if ((
| 0-11 | ||||||||||||||||||||||||
642 | if ((
| 0 | ||||||||||||||||||||||||
643 | (s->s3->internal)->tmp.reuse_message = 1; | - | ||||||||||||||||||||||||
644 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
645 | } else { | - | ||||||||||||||||||||||||
646 | - | |||||||||||||||||||||||||
647 | al = 10; | - | ||||||||||||||||||||||||
648 | SSL_error_internal(s, 114, __FILE__, 828); | - | ||||||||||||||||||||||||
649 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
650 | } | - | ||||||||||||||||||||||||
651 | } | - | ||||||||||||||||||||||||
652 | } executed 11 times by 1 test: end of block Executed by:
| 11 | ||||||||||||||||||||||||
653 | - | |||||||||||||||||||||||||
654 | if ((
| 0-63 | ||||||||||||||||||||||||
655 | al = 10; | - | ||||||||||||||||||||||||
656 | SSL_error_internal(s, 114, __FILE__, 836); | - | ||||||||||||||||||||||||
657 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
658 | } | - | ||||||||||||||||||||||||
659 | - | |||||||||||||||||||||||||
660 | if (!CBS_get_u16(&cbs, &server_version)
| 0-63 | ||||||||||||||||||||||||
661 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
662 | - | |||||||||||||||||||||||||
663 | if (ssl_supported_version_range(s, &min_version, &max_version) != 1
| 0-63 | ||||||||||||||||||||||||
664 | SSL_error_internal(s, 191, __FILE__, 844); | - | ||||||||||||||||||||||||
665 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
666 | } | - | ||||||||||||||||||||||||
667 | - | |||||||||||||||||||||||||
668 | if (server_version < min_version
| 0-63 | ||||||||||||||||||||||||
669 | SSL_error_internal(s, 266, __FILE__, 849); | - | ||||||||||||||||||||||||
670 | s->version = (s->version & 0xff00) | (server_version & 0xff); | - | ||||||||||||||||||||||||
671 | al = 70; | - | ||||||||||||||||||||||||
672 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
673 | } | - | ||||||||||||||||||||||||
674 | s->version = server_version; | - | ||||||||||||||||||||||||
675 | - | |||||||||||||||||||||||||
676 | if ((
| 11-52 | ||||||||||||||||||||||||
677 | ((void *)0)
| 11-52 | ||||||||||||||||||||||||
678 | ) | - | ||||||||||||||||||||||||
679 | method = dtls1_get_client_method(server_version); executed 11 times by 1 test: method = dtls1_get_client_method(server_version); Executed by:
| 11 | ||||||||||||||||||||||||
680 | if (method ==
| 0-63 | ||||||||||||||||||||||||
681 | ((void *)0)
| 0-63 | ||||||||||||||||||||||||
682 | ) { | - | ||||||||||||||||||||||||
683 | SSL_error_internal(s, (4|64), __FILE__, 859); | - | ||||||||||||||||||||||||
684 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
685 | } | - | ||||||||||||||||||||||||
686 | s->method = method; | - | ||||||||||||||||||||||||
687 | - | |||||||||||||||||||||||||
688 | - | |||||||||||||||||||||||||
689 | if (!CBS_get_bytes(&cbs, &server_random, 32)
| 0-63 | ||||||||||||||||||||||||
690 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
691 | if (!CBS_write_bytes(&server_random, s->s3->server_random,
| 0-63 | ||||||||||||||||||||||||
692 | sizeof(s->s3->server_random),
| 0-63 | ||||||||||||||||||||||||
693 | ((void *)0)
| 0-63 | ||||||||||||||||||||||||
694 | )
| 0-63 | ||||||||||||||||||||||||
695 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
696 | - | |||||||||||||||||||||||||
697 | - | |||||||||||||||||||||||||
698 | if (!CBS_get_u8_length_prefixed(&cbs, &session_id)
| 0-63 | ||||||||||||||||||||||||
699 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
700 | - | |||||||||||||||||||||||||
701 | if ((
| 0-63 | ||||||||||||||||||||||||
702 | (
| 0-63 | ||||||||||||||||||||||||
703 | al = 47; | - | ||||||||||||||||||||||||
704 | SSL_error_internal(s, 300, __FILE__, 878); | - | ||||||||||||||||||||||||
705 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
706 | } | - | ||||||||||||||||||||||||
707 | - | |||||||||||||||||||||||||
708 | - | |||||||||||||||||||||||||
709 | if (!CBS_get_u16(&cbs, &cipher_suite)
| 0-63 | ||||||||||||||||||||||||
710 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
711 | - | |||||||||||||||||||||||||
712 | - | |||||||||||||||||||||||||
713 | - | |||||||||||||||||||||||||
714 | - | |||||||||||||||||||||||||
715 | - | |||||||||||||||||||||||||
716 | if (s->internal->tls_session_secret_cb
| 0-63 | ||||||||||||||||||||||||
717 | SSL_CIPHER *pref_cipher = | - | ||||||||||||||||||||||||
718 | ((void *)0) | - | ||||||||||||||||||||||||
719 | ; | - | ||||||||||||||||||||||||
720 | s->session->master_key_length = sizeof(s->session->master_key); | - | ||||||||||||||||||||||||
721 | if (s->internal->tls_session_secret_cb(s, s->session->master_key,
| 0 | ||||||||||||||||||||||||
722 | &s->session->master_key_length,
| 0 | ||||||||||||||||||||||||
723 | ((void *)0)
| 0 | ||||||||||||||||||||||||
724 | , &pref_cipher,
| 0 | ||||||||||||||||||||||||
725 | s->internal->tls_session_secret_cb_arg)
| 0 | ||||||||||||||||||||||||
726 | s->session->cipher = pref_cipher
| 0 | ||||||||||||||||||||||||
727 | ssl3_get_cipher_by_value(cipher_suite); | - | ||||||||||||||||||||||||
728 | s->s3->flags |= 0x0080; | - | ||||||||||||||||||||||||
729 | } never executed: end of block | 0 | ||||||||||||||||||||||||
730 | } never executed: end of block | 0 | ||||||||||||||||||||||||
731 | - | |||||||||||||||||||||||||
732 | if (s->session->session_id_length != 0
| 0-63 | ||||||||||||||||||||||||
733 | CBS_mem_equal(&session_id, s->session->session_id,
| 0 | ||||||||||||||||||||||||
734 | s->session->session_id_length)
| 0 | ||||||||||||||||||||||||
735 | if (s->sid_ctx_length != s->session->sid_ctx_length
| 0 | ||||||||||||||||||||||||
736 | timingsafe_memcmp(s->session->sid_ctx,
| 0 | ||||||||||||||||||||||||
737 | s->sid_ctx, s->sid_ctx_length) != 0
| 0 | ||||||||||||||||||||||||
738 | - | |||||||||||||||||||||||||
739 | al = 47; | - | ||||||||||||||||||||||||
740 | SSL_error_internal(s, 272, __FILE__, 910); | - | ||||||||||||||||||||||||
741 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
742 | } | - | ||||||||||||||||||||||||
743 | s->s3->flags |= 0x0080; | - | ||||||||||||||||||||||||
744 | s->internal->hit = 1; | - | ||||||||||||||||||||||||
745 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
746 | - | |||||||||||||||||||||||||
747 | - | |||||||||||||||||||||||||
748 | - | |||||||||||||||||||||||||
749 | - | |||||||||||||||||||||||||
750 | s->internal->hit = 0; | - | ||||||||||||||||||||||||
751 | if (s->session->session_id_length > 0
| 0-63 | ||||||||||||||||||||||||
752 | if (!ssl_get_new_session(s, 0)
| 0 | ||||||||||||||||||||||||
753 | al = 80; | - | ||||||||||||||||||||||||
754 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
755 | } | - | ||||||||||||||||||||||||
756 | } never executed: end of block | 0 | ||||||||||||||||||||||||
757 | - | |||||||||||||||||||||||||
758 | - | |||||||||||||||||||||||||
759 | - | |||||||||||||||||||||||||
760 | - | |||||||||||||||||||||||||
761 | - | |||||||||||||||||||||||||
762 | if (!CBS_write_bytes(&session_id, s->session->session_id,
| 0-63 | ||||||||||||||||||||||||
763 | sizeof(s->session->session_id), &outlen)
| 0-63 | ||||||||||||||||||||||||
764 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
765 | s->session->session_id_length = outlen; | - | ||||||||||||||||||||||||
766 | - | |||||||||||||||||||||||||
767 | s->session->ssl_version = s->version; | - | ||||||||||||||||||||||||
768 | } executed 63 times by 2 tests: end of block Executed by:
| 63 | ||||||||||||||||||||||||
769 | - | |||||||||||||||||||||||||
770 | if ((
| 0-63 | ||||||||||||||||||||||||
771 | ((void *)0)
| 0-63 | ||||||||||||||||||||||||
772 | ) { | - | ||||||||||||||||||||||||
773 | al = 47; | - | ||||||||||||||||||||||||
774 | SSL_error_internal(s, 248, __FILE__, 942); | - | ||||||||||||||||||||||||
775 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
776 | } | - | ||||||||||||||||||||||||
777 | - | |||||||||||||||||||||||||
778 | - | |||||||||||||||||||||||||
779 | if ((
| 29-34 | ||||||||||||||||||||||||
780 | (((
| 0-34 | ||||||||||||||||||||||||
781 | al = 47; | - | ||||||||||||||||||||||||
782 | SSL_error_internal(s, 261, __FILE__, 950); | - | ||||||||||||||||||||||||
783 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
784 | } | - | ||||||||||||||||||||||||
785 | - | |||||||||||||||||||||||||
786 | sk = ssl_get_ciphers_by_id(s); | - | ||||||||||||||||||||||||
787 | i = sk_find(((_STACK*) (1 ? (sk) : (struct stack_st_SSL_CIPHER*)0)), ((void*) (1 ? (cipher) : (SSL_CIPHER*)0))); | - | ||||||||||||||||||||||||
788 | if (i < 0
| 0-63 | ||||||||||||||||||||||||
789 | - | |||||||||||||||||||||||||
790 | al = 47; | - | ||||||||||||||||||||||||
791 | SSL_error_internal(s, 261, __FILE__, 959); | - | ||||||||||||||||||||||||
792 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
793 | } | - | ||||||||||||||||||||||||
794 | - | |||||||||||||||||||||||||
795 | - | |||||||||||||||||||||||||
796 | - | |||||||||||||||||||||||||
797 | - | |||||||||||||||||||||||||
798 | - | |||||||||||||||||||||||||
799 | - | |||||||||||||||||||||||||
800 | if (s->session->cipher
| 0-63 | ||||||||||||||||||||||||
801 | s->session->cipher_id = s->session->cipher->id; never executed: s->session->cipher_id = s->session->cipher->id; | 0 | ||||||||||||||||||||||||
802 | if (s->internal->hit
| 0-63 | ||||||||||||||||||||||||
803 | al = 47; | - | ||||||||||||||||||||||||
804 | SSL_error_internal(s, 197, __FILE__, 972); | - | ||||||||||||||||||||||||
805 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
806 | } | - | ||||||||||||||||||||||||
807 | (s->s3->internal)->hs.new_cipher = cipher; | - | ||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||
809 | if (!tls1_handshake_hash_init(s)
| 0-63 | ||||||||||||||||||||||||
810 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
811 | - | |||||||||||||||||||||||||
812 | - | |||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||
814 | - | |||||||||||||||||||||||||
815 | - | |||||||||||||||||||||||||
816 | alg_k = (s->s3->internal)->hs.new_cipher->algorithm_mkey; | - | ||||||||||||||||||||||||
817 | if (!((
| 0-34 | ||||||||||||||||||||||||
818 | !tls1_digest_cached_records(s)
| 0-29 | ||||||||||||||||||||||||
819 | al = 80; | - | ||||||||||||||||||||||||
820 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
821 | } | - | ||||||||||||||||||||||||
822 | - | |||||||||||||||||||||||||
823 | if (!CBS_get_u8(&cbs, &compression_method)
| 0-63 | ||||||||||||||||||||||||
824 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
825 | - | |||||||||||||||||||||||||
826 | if (compression_method != 0
| 0-63 | ||||||||||||||||||||||||
827 | al = 47; | - | ||||||||||||||||||||||||
828 | SSL_error_internal(s, 257, __FILE__, 996); | - | ||||||||||||||||||||||||
829 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
830 | } | - | ||||||||||||||||||||||||
831 | - | |||||||||||||||||||||||||
832 | if (!tlsext_serverhello_parse(s, &cbs, &al)
| 0-63 | ||||||||||||||||||||||||
833 | SSL_error_internal(s, 227, __FILE__, 1001); | - | ||||||||||||||||||||||||
834 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
835 | } | - | ||||||||||||||||||||||||
836 | if (!(s->s3->internal)->renegotiate_seen
| 0-63 | ||||||||||||||||||||||||
837 | !(s->internal->options & 0x00000004L)
| 0 | ||||||||||||||||||||||||
838 | al = 40; | - | ||||||||||||||||||||||||
839 | SSL_error_internal(s, 338, __FILE__, 1016); | - | ||||||||||||||||||||||||
840 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
841 | } | - | ||||||||||||||||||||||||
842 | - | |||||||||||||||||||||||||
843 | if (ssl_check_serverhello_tlsext(s) <= 0
| 0-63 | ||||||||||||||||||||||||
844 | SSL_error_internal(s, 275, __FILE__, 1021); | - | ||||||||||||||||||||||||
845 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
846 | } | - | ||||||||||||||||||||||||
847 | - | |||||||||||||||||||||||||
848 | return executed 63 times by 2 tests: (1);return (1); Executed by:
executed 63 times by 2 tests: return (1); Executed by:
| 63 | ||||||||||||||||||||||||
849 | - | |||||||||||||||||||||||||
850 | truncated: | - | ||||||||||||||||||||||||
851 | - | |||||||||||||||||||||||||
852 | al = 50; | - | ||||||||||||||||||||||||
853 | SSL_error_internal(s, 115, __FILE__, 1030); | - | ||||||||||||||||||||||||
854 | f_err: code before this statement never executed: f_err: | 0 | ||||||||||||||||||||||||
855 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
856 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
857 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
858 | } | - | ||||||||||||||||||||||||
859 | - | |||||||||||||||||||||||||
860 | int | - | ||||||||||||||||||||||||
861 | ssl3_get_server_certificate(SSL *s) | - | ||||||||||||||||||||||||
862 | { | - | ||||||||||||||||||||||||
863 | int al, i, ok, ret = -1; | - | ||||||||||||||||||||||||
864 | long n; | - | ||||||||||||||||||||||||
865 | CBS cbs, cert_list; | - | ||||||||||||||||||||||||
866 | X509 *x = | - | ||||||||||||||||||||||||
867 | ((void *)0) | - | ||||||||||||||||||||||||
868 | ; | - | ||||||||||||||||||||||||
869 | const unsigned char *q; | - | ||||||||||||||||||||||||
870 | struct stack_st_X509 *sk = | - | ||||||||||||||||||||||||
871 | ((void *)0) | - | ||||||||||||||||||||||||
872 | ; | - | ||||||||||||||||||||||||
873 | SESS_CERT *sc; | - | ||||||||||||||||||||||||
874 | EVP_PKEY *pkey = | - | ||||||||||||||||||||||||
875 | ((void *)0) | - | ||||||||||||||||||||||||
876 | ; | - | ||||||||||||||||||||||||
877 | - | |||||||||||||||||||||||||
878 | n = s->method->internal->ssl_get_message(s, (0x130|0x1000), | - | ||||||||||||||||||||||||
879 | (0x131|0x1000), -1, s->internal->max_cert_list, &ok); | - | ||||||||||||||||||||||||
880 | - | |||||||||||||||||||||||||
881 | if (!ok
| 53-162 | ||||||||||||||||||||||||
882 | return executed 162 times by 2 tests: ((int)n);return ((int)n); Executed by:
executed 162 times by 2 tests: return ((int)n); Executed by:
| 162 | ||||||||||||||||||||||||
883 | - | |||||||||||||||||||||||||
884 | if ((
| 0-53 | ||||||||||||||||||||||||
885 | (s->s3->internal)->tmp.reuse_message = 1; | - | ||||||||||||||||||||||||
886 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
887 | } | - | ||||||||||||||||||||||||
888 | - | |||||||||||||||||||||||||
889 | if ((
| 0-53 | ||||||||||||||||||||||||
890 | al = 10; | - | ||||||||||||||||||||||||
891 | SSL_error_internal(s, 114, __FILE__, 1062); | - | ||||||||||||||||||||||||
892 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
893 | } | - | ||||||||||||||||||||||||
894 | - | |||||||||||||||||||||||||
895 | - | |||||||||||||||||||||||||
896 | if ((
| 0-53 | ||||||||||||||||||||||||
897 | ((void *)0)
| 0-53 | ||||||||||||||||||||||||
898 | ) { | - | ||||||||||||||||||||||||
899 | SSL_error_internal(s, (1|64), __FILE__, 1068); | - | ||||||||||||||||||||||||
900 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
901 | } | - | ||||||||||||||||||||||||
902 | - | |||||||||||||||||||||||||
903 | if (n < 0
| 0-53 | ||||||||||||||||||||||||
904 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
905 | - | |||||||||||||||||||||||||
906 | CBS_init(&cbs, s->internal->init_msg, n); | - | ||||||||||||||||||||||||
907 | if (CBS_len(&cbs) < 3
| 0-53 | ||||||||||||||||||||||||
908 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||
910 | if (!CBS_get_u24_length_prefixed(&cbs, &cert_list)
| 0-53 | ||||||||||||||||||||||||
911 | CBS_len(&cbs) != 0
| 0-53 | ||||||||||||||||||||||||
912 | al = 50; | - | ||||||||||||||||||||||||
913 | SSL_error_internal(s, 159, __FILE__, 1082); | - | ||||||||||||||||||||||||
914 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
915 | } | - | ||||||||||||||||||||||||
916 | - | |||||||||||||||||||||||||
917 | while (CBS_len(&cert_list) > 0
| 53-73 | ||||||||||||||||||||||||
918 | CBS cert; | - | ||||||||||||||||||||||||
919 | - | |||||||||||||||||||||||||
920 | if (CBS_len(&cert_list) < 3
| 0-73 | ||||||||||||||||||||||||
921 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
922 | if (!CBS_get_u24_length_prefixed(&cert_list, &cert)
| 0-73 | ||||||||||||||||||||||||
923 | al = 50; | - | ||||||||||||||||||||||||
924 | SSL_error_internal(s, 135, __FILE__, 1093); | - | ||||||||||||||||||||||||
925 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
926 | } | - | ||||||||||||||||||||||||
927 | - | |||||||||||||||||||||||||
928 | q = CBS_data(&cert); | - | ||||||||||||||||||||||||
929 | x = d2i_X509( | - | ||||||||||||||||||||||||
930 | ((void *)0) | - | ||||||||||||||||||||||||
931 | , &q, CBS_len(&cert)); | - | ||||||||||||||||||||||||
932 | if (x ==
| 0-73 | ||||||||||||||||||||||||
933 | ((void *)0)
| 0-73 | ||||||||||||||||||||||||
934 | ) { | - | ||||||||||||||||||||||||
935 | al = 42; | - | ||||||||||||||||||||||||
936 | SSL_error_internal(s, 13, __FILE__, 1101); | - | ||||||||||||||||||||||||
937 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
938 | } | - | ||||||||||||||||||||||||
939 | if (q != CBS_data(&cert) + CBS_len(&cert)
| 0-73 | ||||||||||||||||||||||||
940 | al = 50; | - | ||||||||||||||||||||||||
941 | SSL_error_internal(s, 135, __FILE__, 1106); | - | ||||||||||||||||||||||||
942 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
943 | } | - | ||||||||||||||||||||||||
944 | if (!sk_push(((_STACK*) (1 ? (sk) : (struct stack_st_X509*)0)), ((void*) (1 ? (x) : (X509*)0)))
| 0-73 | ||||||||||||||||||||||||
945 | SSL_error_internal(s, (1|64), __FILE__, 1110); | - | ||||||||||||||||||||||||
946 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
947 | } | - | ||||||||||||||||||||||||
948 | x = | - | ||||||||||||||||||||||||
949 | ((void *)0) | - | ||||||||||||||||||||||||
950 | ; | - | ||||||||||||||||||||||||
951 | } executed 73 times by 2 tests: end of block Executed by:
| 73 | ||||||||||||||||||||||||
952 | - | |||||||||||||||||||||||||
953 | i = ssl_verify_cert_chain(s, sk); | - | ||||||||||||||||||||||||
954 | if ((
| 0-42 | ||||||||||||||||||||||||
955 | al = ssl_verify_alarm_type(s->verify_result); | - | ||||||||||||||||||||||||
956 | SSL_error_internal(s, 134, __FILE__, 1119); | - | ||||||||||||||||||||||||
957 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
958 | - | |||||||||||||||||||||||||
959 | } | - | ||||||||||||||||||||||||
960 | ERR_clear_error(); | - | ||||||||||||||||||||||||
961 | - | |||||||||||||||||||||||||
962 | sc = ssl_sess_cert_new(); | - | ||||||||||||||||||||||||
963 | if (sc ==
| 0-53 | ||||||||||||||||||||||||
964 | ((void *)0)
| 0-53 | ||||||||||||||||||||||||
965 | ) | - | ||||||||||||||||||||||||
966 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
967 | ssl_sess_cert_free((s->session->internal)->sess_cert); | - | ||||||||||||||||||||||||
968 | (s->session->internal)->sess_cert = sc; | - | ||||||||||||||||||||||||
969 | - | |||||||||||||||||||||||||
970 | sc->cert_chain = sk; | - | ||||||||||||||||||||||||
971 | - | |||||||||||||||||||||||||
972 | - | |||||||||||||||||||||||||
973 | - | |||||||||||||||||||||||||
974 | - | |||||||||||||||||||||||||
975 | x = ((X509 *)sk_value(((_STACK*) (1 ? (sk) : (struct stack_st_X509*)0)), (0))); | - | ||||||||||||||||||||||||
976 | sk = | - | ||||||||||||||||||||||||
977 | ((void *)0) | - | ||||||||||||||||||||||||
978 | ; | - | ||||||||||||||||||||||||
979 | - | |||||||||||||||||||||||||
980 | - | |||||||||||||||||||||||||
981 | pkey = X509_get_pubkey(x); | - | ||||||||||||||||||||||||
982 | - | |||||||||||||||||||||||||
983 | if (pkey ==
| 0-53 | ||||||||||||||||||||||||
984 | ((void *)0)
| 0-53 | ||||||||||||||||||||||||
985 | || EVP_PKEY_missing_parameters(pkey)
| 0-53 | ||||||||||||||||||||||||
986 | x = | - | ||||||||||||||||||||||||
987 | ((void *)0) | - | ||||||||||||||||||||||||
988 | ; | - | ||||||||||||||||||||||||
989 | al = 2; | - | ||||||||||||||||||||||||
990 | SSL_error_internal(s, 239, __FILE__, 1145); | - | ||||||||||||||||||||||||
991 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
992 | } | - | ||||||||||||||||||||||||
993 | - | |||||||||||||||||||||||||
994 | i = ssl_cert_type(x, pkey); | - | ||||||||||||||||||||||||
995 | if (i < 0
| 0-53 | ||||||||||||||||||||||||
996 | x = | - | ||||||||||||||||||||||||
997 | ((void *)0) | - | ||||||||||||||||||||||||
998 | ; | - | ||||||||||||||||||||||||
999 | al = 2; | - | ||||||||||||||||||||||||
1000 | SSL_error_internal(s, 247, __FILE__, 1153); | - | ||||||||||||||||||||||||
1001 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1002 | } | - | ||||||||||||||||||||||||
1003 | - | |||||||||||||||||||||||||
1004 | sc->peer_cert_type = i; | - | ||||||||||||||||||||||||
1005 | CRYPTO_add_lock(&x->references,1,3,__FILE__,1158); | - | ||||||||||||||||||||||||
1006 | - | |||||||||||||||||||||||||
1007 | - | |||||||||||||||||||||||||
1008 | - | |||||||||||||||||||||||||
1009 | - | |||||||||||||||||||||||||
1010 | X509_free(sc->peer_pkeys[i].x509); | - | ||||||||||||||||||||||||
1011 | sc->peer_pkeys[i].x509 = x; | - | ||||||||||||||||||||||||
1012 | sc->peer_key = &(sc->peer_pkeys[i]); | - | ||||||||||||||||||||||||
1013 | - | |||||||||||||||||||||||||
1014 | X509_free(s->session->peer); | - | ||||||||||||||||||||||||
1015 | CRYPTO_add_lock(&x->references,1,3,__FILE__,1168); | - | ||||||||||||||||||||||||
1016 | s->session->peer = x; | - | ||||||||||||||||||||||||
1017 | s->session->verify_result = s->verify_result; | - | ||||||||||||||||||||||||
1018 | - | |||||||||||||||||||||||||
1019 | x = | - | ||||||||||||||||||||||||
1020 | ((void *)0) | - | ||||||||||||||||||||||||
1021 | ; | - | ||||||||||||||||||||||||
1022 | ret = 1; | - | ||||||||||||||||||||||||
1023 | - | |||||||||||||||||||||||||
1024 | if (0) { | - | ||||||||||||||||||||||||
1025 | truncated: | - | ||||||||||||||||||||||||
1026 | - | |||||||||||||||||||||||||
1027 | al = 50; | - | ||||||||||||||||||||||||
1028 | SSL_error_internal(s, 115, __FILE__, 1179); | - | ||||||||||||||||||||||||
1029 | f_err: code before this statement never executed: f_err: | 0 | ||||||||||||||||||||||||
1030 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
1031 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1032 | err: code before this statement executed 53 times by 2 tests: err: Executed by:
| 53 | ||||||||||||||||||||||||
1033 | EVP_PKEY_free(pkey); | - | ||||||||||||||||||||||||
1034 | X509_free(x); | - | ||||||||||||||||||||||||
1035 | sk_pop_free(((_STACK*) (1 ? (sk) : (struct stack_st_X509*)0)), ((void (*)(void *)) ((1 ? (X509_free) : (void (*)(X509 *))0)))); | - | ||||||||||||||||||||||||
1036 | - | |||||||||||||||||||||||||
1037 | return executed 53 times by 2 tests: (ret);return (ret); Executed by:
executed 53 times by 2 tests: return (ret); Executed by:
| 53 | ||||||||||||||||||||||||
1038 | } | - | ||||||||||||||||||||||||
1039 | - | |||||||||||||||||||||||||
1040 | static int | - | ||||||||||||||||||||||||
1041 | ssl3_get_server_kex_dhe(SSL *s, EVP_PKEY **pkey, CBS *cbs) | - | ||||||||||||||||||||||||
1042 | { | - | ||||||||||||||||||||||||
1043 | CBS dhp, dhg, dhpk; | - | ||||||||||||||||||||||||
1044 | BN_CTX *bn_ctx = | - | ||||||||||||||||||||||||
1045 | ((void *)0) | - | ||||||||||||||||||||||||
1046 | ; | - | ||||||||||||||||||||||||
1047 | SESS_CERT *sc = | - | ||||||||||||||||||||||||
1048 | ((void *)0) | - | ||||||||||||||||||||||||
1049 | ; | - | ||||||||||||||||||||||||
1050 | DH *dh = | - | ||||||||||||||||||||||||
1051 | ((void *)0) | - | ||||||||||||||||||||||||
1052 | ; | - | ||||||||||||||||||||||||
1053 | long alg_a; | - | ||||||||||||||||||||||||
1054 | int al; | - | ||||||||||||||||||||||||
1055 | - | |||||||||||||||||||||||||
1056 | alg_a = (s->s3->internal)->hs.new_cipher->algorithm_auth; | - | ||||||||||||||||||||||||
1057 | sc = (s->session->internal)->sess_cert; | - | ||||||||||||||||||||||||
1058 | - | |||||||||||||||||||||||||
1059 | if ((
| 0-21 | ||||||||||||||||||||||||
1060 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
1061 | ) { | - | ||||||||||||||||||||||||
1062 | SSL_error_internal(s, 5, __FILE__, 1205); | - | ||||||||||||||||||||||||
1063 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1064 | } | - | ||||||||||||||||||||||||
1065 | - | |||||||||||||||||||||||||
1066 | if (!CBS_get_u16_length_prefixed(cbs, &dhp)
| 0-21 | ||||||||||||||||||||||||
1067 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
1068 | if ((
| 0-21 | ||||||||||||||||||||||||
1069 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
1070 | )) ==
| 0-21 | ||||||||||||||||||||||||
1071 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
1072 | ) { | - | ||||||||||||||||||||||||
1073 | SSL_error_internal(s, 3, __FILE__, 1212); | - | ||||||||||||||||||||||||
1074 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1075 | } | - | ||||||||||||||||||||||||
1076 | - | |||||||||||||||||||||||||
1077 | if (!CBS_get_u16_length_prefixed(cbs, &dhg)
| 0-21 | ||||||||||||||||||||||||
1078 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
1079 | if ((
| 0-21 | ||||||||||||||||||||||||
1080 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
1081 | )) ==
| 0-21 | ||||||||||||||||||||||||
1082 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
1083 | ) { | - | ||||||||||||||||||||||||
1084 | SSL_error_internal(s, 3, __FILE__, 1219); | - | ||||||||||||||||||||||||
1085 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1086 | } | - | ||||||||||||||||||||||||
1087 | - | |||||||||||||||||||||||||
1088 | if (!CBS_get_u16_length_prefixed(cbs, &dhpk)
| 0-21 | ||||||||||||||||||||||||
1089 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
1090 | if ((
| 0-21 | ||||||||||||||||||||||||
1091 |
| 0-21 | ||||||||||||||||||||||||
1092 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
1093 | )) ==
| 0-21 | ||||||||||||||||||||||||
1094 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
1095 | ) { | - | ||||||||||||||||||||||||
1096 | SSL_error_internal(s, 3, __FILE__, 1227); | - | ||||||||||||||||||||||||
1097 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1098 | } | - | ||||||||||||||||||||||||
1099 | - | |||||||||||||||||||||||||
1100 | - | |||||||||||||||||||||||||
1101 | - | |||||||||||||||||||||||||
1102 | - | |||||||||||||||||||||||||
1103 | - | |||||||||||||||||||||||||
1104 | if (DH_size(dh) < 1024 / 8
| 0-21 | ||||||||||||||||||||||||
1105 | SSL_error_internal(s, 110, __FILE__, 1236); | - | ||||||||||||||||||||||||
1106 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1107 | } | - | ||||||||||||||||||||||||
1108 | - | |||||||||||||||||||||||||
1109 | if (alg_a & 0x00000001L
| 10-11 | ||||||||||||||||||||||||
1110 | * executed 11 times by 1 test: pkey = X509_get_pubkey(sc->peer_pkeys[0].x509);*pkey = X509_get_pubkey(sc->peer_pkeys[0].x509); Executed by:
executed 11 times by 1 test: *pkey = X509_get_pubkey(sc->peer_pkeys[0].x509); Executed by:
| 11 | ||||||||||||||||||||||||
1111 | else | - | ||||||||||||||||||||||||
1112 | - | |||||||||||||||||||||||||
1113 | * executed 10 times by 1 test: pkey = *pkey = ((void *)0) ; Executed by:
executed 10 times by 1 test: *pkey = ((void *)0) ; Executed by:
| 10 | ||||||||||||||||||||||||
1114 | ((void *)0) executed 10 times by 1 test: *pkey = ((void *)0) ; Executed by:
| 10 | ||||||||||||||||||||||||
1115 | ; executed 10 times by 1 test: *pkey = ((void *)0) ; Executed by:
| 10 | ||||||||||||||||||||||||
1116 | - | |||||||||||||||||||||||||
1117 | sc->peer_dh_tmp = dh; | - | ||||||||||||||||||||||||
1118 | - | |||||||||||||||||||||||||
1119 | return executed 21 times by 1 test: (1);return (1); Executed by:
executed 21 times by 1 test: return (1); Executed by:
| 21 | ||||||||||||||||||||||||
1120 | - | |||||||||||||||||||||||||
1121 | truncated: | - | ||||||||||||||||||||||||
1122 | al = 50; | - | ||||||||||||||||||||||||
1123 | SSL_error_internal(s, 115, __FILE__, 1252); | - | ||||||||||||||||||||||||
1124 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
1125 | - | |||||||||||||||||||||||||
1126 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
1127 | DH_free(dh); | - | ||||||||||||||||||||||||
1128 | BN_CTX_free(bn_ctx); | - | ||||||||||||||||||||||||
1129 | - | |||||||||||||||||||||||||
1130 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
1131 | } | - | ||||||||||||||||||||||||
1132 | - | |||||||||||||||||||||||||
1133 | static int | - | ||||||||||||||||||||||||
1134 | ssl3_get_server_kex_ecdhe_ecp(SSL *s, SESS_CERT *sc, int nid, CBS *public) | - | ||||||||||||||||||||||||
1135 | { | - | ||||||||||||||||||||||||
1136 | const EC_GROUP *group; | - | ||||||||||||||||||||||||
1137 | EC_GROUP *ngroup = | - | ||||||||||||||||||||||||
1138 | ((void *)0) | - | ||||||||||||||||||||||||
1139 | ; | - | ||||||||||||||||||||||||
1140 | EC_POINT *point = | - | ||||||||||||||||||||||||
1141 | ((void *)0) | - | ||||||||||||||||||||||||
1142 | ; | - | ||||||||||||||||||||||||
1143 | BN_CTX *bn_ctx = | - | ||||||||||||||||||||||||
1144 | ((void *)0) | - | ||||||||||||||||||||||||
1145 | ; | - | ||||||||||||||||||||||||
1146 | EC_KEY *ecdh = | - | ||||||||||||||||||||||||
1147 | ((void *)0) | - | ||||||||||||||||||||||||
1148 | ; | - | ||||||||||||||||||||||||
1149 | int ret = -1; | - | ||||||||||||||||||||||||
1150 | - | |||||||||||||||||||||||||
1151 | - | |||||||||||||||||||||||||
1152 | - | |||||||||||||||||||||||||
1153 | - | |||||||||||||||||||||||||
1154 | - | |||||||||||||||||||||||||
1155 | if ((
| 0-23 | ||||||||||||||||||||||||
1156 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
1157 | ) { | - | ||||||||||||||||||||||||
1158 | SSL_error_internal(s, (1|64), __FILE__, 1277); | - | ||||||||||||||||||||||||
1159 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1160 | } | - | ||||||||||||||||||||||||
1161 | - | |||||||||||||||||||||||||
1162 | if ((
| 0-23 | ||||||||||||||||||||||||
1163 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
1164 | ) { | - | ||||||||||||||||||||||||
1165 | SSL_error_internal(s, 16, __FILE__, 1282); | - | ||||||||||||||||||||||||
1166 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1167 | } | - | ||||||||||||||||||||||||
1168 | if (EC_KEY_set_group(ecdh, ngroup) == 0
| 0-23 | ||||||||||||||||||||||||
1169 | SSL_error_internal(s, 16, __FILE__, 1286); | - | ||||||||||||||||||||||||
1170 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1171 | } | - | ||||||||||||||||||||||||
1172 | - | |||||||||||||||||||||||||
1173 | group = EC_KEY_get0_group(ecdh); | - | ||||||||||||||||||||||||
1174 | - | |||||||||||||||||||||||||
1175 | if ((
| 0-23 | ||||||||||||||||||||||||
1176 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
1177 | || | - | ||||||||||||||||||||||||
1178 | (
| 0-23 | ||||||||||||||||||||||||
1179 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
1180 | ) { | - | ||||||||||||||||||||||||
1181 | SSL_error_internal(s, (1|64), __FILE__, 1294); | - | ||||||||||||||||||||||||
1182 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1183 | } | - | ||||||||||||||||||||||||
1184 | - | |||||||||||||||||||||||||
1185 | if (EC_POINT_oct2point(group, point, CBS_data(public),
| 0-23 | ||||||||||||||||||||||||
1186 | CBS_len(public), bn_ctx) == 0
| 0-23 | ||||||||||||||||||||||||
1187 | SSL_error_internal(s, 306, __FILE__, 1300); | - | ||||||||||||||||||||||||
1188 | ssl3_send_alert(s, 2, 50); | - | ||||||||||||||||||||||||
1189 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1190 | } | - | ||||||||||||||||||||||||
1191 | - | |||||||||||||||||||||||||
1192 | EC_KEY_set_public_key(ecdh, point); | - | ||||||||||||||||||||||||
1193 | sc->peer_ecdh_tmp = ecdh; | - | ||||||||||||||||||||||||
1194 | ecdh = | - | ||||||||||||||||||||||||
1195 | ((void *)0) | - | ||||||||||||||||||||||||
1196 | ; | - | ||||||||||||||||||||||||
1197 | - | |||||||||||||||||||||||||
1198 | ret = 1; | - | ||||||||||||||||||||||||
1199 | - | |||||||||||||||||||||||||
1200 | err: code before this statement executed 23 times by 1 test: err: Executed by:
| 23 | ||||||||||||||||||||||||
1201 | BN_CTX_free(bn_ctx); | - | ||||||||||||||||||||||||
1202 | EC_GROUP_free(ngroup); | - | ||||||||||||||||||||||||
1203 | EC_POINT_free(point); | - | ||||||||||||||||||||||||
1204 | EC_KEY_free(ecdh); | - | ||||||||||||||||||||||||
1205 | - | |||||||||||||||||||||||||
1206 | return executed 23 times by 1 test: (ret);return (ret); Executed by:
executed 23 times by 1 test: return (ret); Executed by:
| 23 | ||||||||||||||||||||||||
1207 | } | - | ||||||||||||||||||||||||
1208 | - | |||||||||||||||||||||||||
1209 | static int | - | ||||||||||||||||||||||||
1210 | ssl3_get_server_kex_ecdhe_ecx(SSL *s, SESS_CERT *sc, int nid, CBS *public) | - | ||||||||||||||||||||||||
1211 | { | - | ||||||||||||||||||||||||
1212 | size_t outlen; | - | ||||||||||||||||||||||||
1213 | - | |||||||||||||||||||||||||
1214 | if (nid != 950
| 0-5 | ||||||||||||||||||||||||
1215 | SSL_error_internal(s, (4|64), __FILE__, 1326); | - | ||||||||||||||||||||||||
1216 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1217 | } | - | ||||||||||||||||||||||||
1218 | - | |||||||||||||||||||||||||
1219 | if (CBS_len(public) != 32
| 0-5 | ||||||||||||||||||||||||
1220 | SSL_error_internal(s, 306, __FILE__, 1331); | - | ||||||||||||||||||||||||
1221 | ssl3_send_alert(s, 2, 50); | - | ||||||||||||||||||||||||
1222 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1223 | } | - | ||||||||||||||||||||||||
1224 | - | |||||||||||||||||||||||||
1225 | if (!CBS_stow(public, &sc->peer_x25519_tmp, &outlen)
| 0-5 | ||||||||||||||||||||||||
1226 | SSL_error_internal(s, (1|64), __FILE__, 1337); | - | ||||||||||||||||||||||||
1227 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1228 | } | - | ||||||||||||||||||||||||
1229 | - | |||||||||||||||||||||||||
1230 | return executed 5 times by 2 tests: (1);return (1); Executed by:
executed 5 times by 2 tests: return (1); Executed by:
| 5 | ||||||||||||||||||||||||
1231 | - | |||||||||||||||||||||||||
1232 | err: | - | ||||||||||||||||||||||||
1233 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
1234 | } | - | ||||||||||||||||||||||||
1235 | - | |||||||||||||||||||||||||
1236 | static int | - | ||||||||||||||||||||||||
1237 | ssl3_get_server_kex_ecdhe(SSL *s, EVP_PKEY **pkey, CBS *cbs) | - | ||||||||||||||||||||||||
1238 | { | - | ||||||||||||||||||||||||
1239 | CBS public; | - | ||||||||||||||||||||||||
1240 | uint8_t curve_type; | - | ||||||||||||||||||||||||
1241 | uint16_t curve_id; | - | ||||||||||||||||||||||||
1242 | SESS_CERT *sc; | - | ||||||||||||||||||||||||
1243 | long alg_a; | - | ||||||||||||||||||||||||
1244 | int nid; | - | ||||||||||||||||||||||||
1245 | int al; | - | ||||||||||||||||||||||||
1246 | - | |||||||||||||||||||||||||
1247 | alg_a = (s->s3->internal)->hs.new_cipher->algorithm_auth; | - | ||||||||||||||||||||||||
1248 | sc = (s->session->internal)->sess_cert; | - | ||||||||||||||||||||||||
1249 | - | |||||||||||||||||||||||||
1250 | - | |||||||||||||||||||||||||
1251 | if (!CBS_get_u8(cbs, &curve_type)
| 0-28 | ||||||||||||||||||||||||
1252 | curve_type != 3
| 0-28 | ||||||||||||||||||||||||
1253 | !CBS_get_u16(cbs, &curve_id)
| 0-28 | ||||||||||||||||||||||||
1254 | al = 50; | - | ||||||||||||||||||||||||
1255 | SSL_error_internal(s, 160, __FILE__, 1366); | - | ||||||||||||||||||||||||
1256 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1257 | } | - | ||||||||||||||||||||||||
1258 | - | |||||||||||||||||||||||||
1259 | - | |||||||||||||||||||||||||
1260 | - | |||||||||||||||||||||||||
1261 | - | |||||||||||||||||||||||||
1262 | - | |||||||||||||||||||||||||
1263 | if (tls1_check_curve(s, curve_id) != 1
| 0-28 | ||||||||||||||||||||||||
1264 | al = 50; | - | ||||||||||||||||||||||||
1265 | SSL_error_internal(s, 378, __FILE__, 1376); | - | ||||||||||||||||||||||||
1266 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1267 | } | - | ||||||||||||||||||||||||
1268 | - | |||||||||||||||||||||||||
1269 | if ((
| 0-28 | ||||||||||||||||||||||||
1270 | al = 80; | - | ||||||||||||||||||||||||
1271 | SSL_error_internal(s, 314, __FILE__, 1382); | - | ||||||||||||||||||||||||
1272 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1273 | } | - | ||||||||||||||||||||||||
1274 | - | |||||||||||||||||||||||||
1275 | if (!CBS_get_u8_length_prefixed(cbs, &public)
| 0-28 | ||||||||||||||||||||||||
1276 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
1277 | - | |||||||||||||||||||||||||
1278 | if (nid == 950
| 5-23 | ||||||||||||||||||||||||
1279 | if (ssl3_get_server_kex_ecdhe_ecx(s, sc, nid, &public) != 1
| 0-5 | ||||||||||||||||||||||||
1280 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1281 | } executed 5 times by 2 tests: else {end of block Executed by:
| 5 | ||||||||||||||||||||||||
1282 | if (ssl3_get_server_kex_ecdhe_ecp(s, sc, nid, &public) != 1
| 0-23 | ||||||||||||||||||||||||
1283 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1284 | } executed 23 times by 1 test: end of block Executed by:
| 23 | ||||||||||||||||||||||||
1285 | - | |||||||||||||||||||||||||
1286 | - | |||||||||||||||||||||||||
1287 | - | |||||||||||||||||||||||||
1288 | - | |||||||||||||||||||||||||
1289 | - | |||||||||||||||||||||||||
1290 | - | |||||||||||||||||||||||||
1291 | if (alg_a & 0x00000001L
| 0-28 | ||||||||||||||||||||||||
1292 | * executed 28 times by 2 tests: pkey = X509_get_pubkey(sc->peer_pkeys[0].x509);*pkey = X509_get_pubkey(sc->peer_pkeys[0].x509); Executed by:
executed 28 times by 2 tests: *pkey = X509_get_pubkey(sc->peer_pkeys[0].x509); Executed by:
| 28 | ||||||||||||||||||||||||
1293 | else if (alg_a & 0x00000040L
| 0 | ||||||||||||||||||||||||
1294 | * never executed: pkey = X509_get_pubkey(sc->peer_pkeys[3].x509);*pkey = X509_get_pubkey(sc->peer_pkeys[3].x509); never executed: *pkey = X509_get_pubkey(sc->peer_pkeys[3].x509); | 0 | ||||||||||||||||||||||||
1295 | else | - | ||||||||||||||||||||||||
1296 | - | |||||||||||||||||||||||||
1297 | * never executed: pkey = *pkey = ((void *)0) ; never executed: *pkey = ((void *)0) ; | 0 | ||||||||||||||||||||||||
1298 | ((void *)0) never executed: *pkey = ((void *)0) ; | 0 | ||||||||||||||||||||||||
1299 | ; never executed: *pkey = ((void *)0) ; | 0 | ||||||||||||||||||||||||
1300 | - | |||||||||||||||||||||||||
1301 | return executed 28 times by 2 tests: (1);return (1); Executed by:
executed 28 times by 2 tests: return (1); Executed by:
| 28 | ||||||||||||||||||||||||
1302 | - | |||||||||||||||||||||||||
1303 | truncated: | - | ||||||||||||||||||||||||
1304 | al = 50; | - | ||||||||||||||||||||||||
1305 | SSL_error_internal(s, 115, __FILE__, 1414); | - | ||||||||||||||||||||||||
1306 | - | |||||||||||||||||||||||||
1307 | f_err: code before this statement never executed: f_err: | 0 | ||||||||||||||||||||||||
1308 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
1309 | - | |||||||||||||||||||||||||
1310 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
1311 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
1312 | } | - | ||||||||||||||||||||||||
1313 | - | |||||||||||||||||||||||||
1314 | int | - | ||||||||||||||||||||||||
1315 | ssl3_get_server_key_exchange(SSL *s) | - | ||||||||||||||||||||||||
1316 | { | - | ||||||||||||||||||||||||
1317 | CBS cbs, signature; | - | ||||||||||||||||||||||||
1318 | const EVP_MD *md = | - | ||||||||||||||||||||||||
1319 | ((void *)0) | - | ||||||||||||||||||||||||
1320 | ; | - | ||||||||||||||||||||||||
1321 | EVP_PKEY *pkey = | - | ||||||||||||||||||||||||
1322 | ((void *)0) | - | ||||||||||||||||||||||||
1323 | ; | - | ||||||||||||||||||||||||
1324 | EVP_MD_CTX md_ctx; | - | ||||||||||||||||||||||||
1325 | const unsigned char *param; | - | ||||||||||||||||||||||||
1326 | uint8_t hash_id, sig_id; | - | ||||||||||||||||||||||||
1327 | long n, alg_k, alg_a; | - | ||||||||||||||||||||||||
1328 | int al, ok, sigalg; | - | ||||||||||||||||||||||||
1329 | size_t param_len; | - | ||||||||||||||||||||||||
1330 | - | |||||||||||||||||||||||||
1331 | EVP_MD_CTX_init(&md_ctx); | - | ||||||||||||||||||||||||
1332 | - | |||||||||||||||||||||||||
1333 | alg_k = (s->s3->internal)->hs.new_cipher->algorithm_mkey; | - | ||||||||||||||||||||||||
1334 | alg_a = (s->s3->internal)->hs.new_cipher->algorithm_auth; | - | ||||||||||||||||||||||||
1335 | - | |||||||||||||||||||||||||
1336 | - | |||||||||||||||||||||||||
1337 | - | |||||||||||||||||||||||||
1338 | - | |||||||||||||||||||||||||
1339 | - | |||||||||||||||||||||||||
1340 | n = s->method->internal->ssl_get_message(s, (0x140|0x1000), | - | ||||||||||||||||||||||||
1341 | (0x141|0x1000), -1, s->internal->max_cert_list, &ok); | - | ||||||||||||||||||||||||
1342 | if (!ok
| 58-63 | ||||||||||||||||||||||||
1343 | return executed 58 times by 2 tests: ((int)n);return ((int)n); Executed by:
executed 58 times by 2 tests: return ((int)n); Executed by:
| 58 | ||||||||||||||||||||||||
1344 | - | |||||||||||||||||||||||||
1345 | if (n < 0
| 0-63 | ||||||||||||||||||||||||
1346 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1347 | - | |||||||||||||||||||||||||
1348 | CBS_init(&cbs, s->internal->init_msg, n); | - | ||||||||||||||||||||||||
1349 | - | |||||||||||||||||||||||||
1350 | if ((
| 14-49 | ||||||||||||||||||||||||
1351 | - | |||||||||||||||||||||||||
1352 | - | |||||||||||||||||||||||||
1353 | - | |||||||||||||||||||||||||
1354 | - | |||||||||||||||||||||||||
1355 | if (alg_k & (0x00000008L|0x00000080L)
| 0-14 | ||||||||||||||||||||||||
1356 | SSL_error_internal(s, 244, __FILE__, 1461); | - | ||||||||||||||||||||||||
1357 | al = 10; | - | ||||||||||||||||||||||||
1358 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1359 | } | - | ||||||||||||||||||||||||
1360 | - | |||||||||||||||||||||||||
1361 | (s->s3->internal)->tmp.reuse_message = 1; | - | ||||||||||||||||||||||||
1362 | EVP_MD_CTX_cleanup(&md_ctx); | - | ||||||||||||||||||||||||
1363 | return executed 14 times by 1 test: (1);return (1); Executed by:
executed 14 times by 1 test: return (1); Executed by:
| 14 | ||||||||||||||||||||||||
1364 | } | - | ||||||||||||||||||||||||
1365 | - | |||||||||||||||||||||||||
1366 | if ((
| 10-39 | ||||||||||||||||||||||||
1367 | ((void *)0)
| 10-39 | ||||||||||||||||||||||||
1368 | ) { | - | ||||||||||||||||||||||||
1369 | DH_free((s->session->internal)->sess_cert->peer_dh_tmp); | - | ||||||||||||||||||||||||
1370 | (s->session->internal)->sess_cert->peer_dh_tmp = | - | ||||||||||||||||||||||||
1371 | ((void *)0) | - | ||||||||||||||||||||||||
1372 | ; | - | ||||||||||||||||||||||||
1373 | - | |||||||||||||||||||||||||
1374 | EC_KEY_free((s->session->internal)->sess_cert->peer_ecdh_tmp); | - | ||||||||||||||||||||||||
1375 | (s->session->internal)->sess_cert->peer_ecdh_tmp = | - | ||||||||||||||||||||||||
1376 | ((void *)0) | - | ||||||||||||||||||||||||
1377 | ; | - | ||||||||||||||||||||||||
1378 | - | |||||||||||||||||||||||||
1379 | free((s->session->internal)->sess_cert->peer_x25519_tmp); | - | ||||||||||||||||||||||||
1380 | (s->session->internal)->sess_cert->peer_x25519_tmp = | - | ||||||||||||||||||||||||
1381 | ((void *)0) | - | ||||||||||||||||||||||||
1382 | ; | - | ||||||||||||||||||||||||
1383 | } executed 39 times by 2 tests: else {end of block Executed by:
| 39 | ||||||||||||||||||||||||
1384 | (s->session->internal)->sess_cert = ssl_sess_cert_new(); | - | ||||||||||||||||||||||||
1385 | if ((
| 0-10 | ||||||||||||||||||||||||
1386 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||
1387 | ) | - | ||||||||||||||||||||||||
1388 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1389 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||
1390 | - | |||||||||||||||||||||||||
1391 | param = CBS_data(&cbs); | - | ||||||||||||||||||||||||
1392 | param_len = CBS_len(&cbs); | - | ||||||||||||||||||||||||
1393 | - | |||||||||||||||||||||||||
1394 | if (alg_k & 0x00000008L
| 21-28 | ||||||||||||||||||||||||
1395 | if (ssl3_get_server_kex_dhe(s, &pkey, &cbs) != 1
| 0-21 | ||||||||||||||||||||||||
1396 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1397 | } executed 21 times by 1 test: else if (alg_k & 0x00000080Lend of block Executed by:
| 0-28 | ||||||||||||||||||||||||
1398 | if (ssl3_get_server_kex_ecdhe(s, &pkey, &cbs) != 1
| 0-28 | ||||||||||||||||||||||||
1399 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1400 | } executed 28 times by 2 tests: else if (alg_k != 0end of block Executed by:
| 0-28 | ||||||||||||||||||||||||
1401 | al = 10; | - | ||||||||||||||||||||||||
1402 | SSL_error_internal(s, 244, __FILE__, 1497); | - | ||||||||||||||||||||||||
1403 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1404 | } | - | ||||||||||||||||||||||||
1405 | - | |||||||||||||||||||||||||
1406 | param_len -= CBS_len(&cbs); | - | ||||||||||||||||||||||||
1407 | - | |||||||||||||||||||||||||
1408 | - | |||||||||||||||||||||||||
1409 | if (pkey !=
| 10-39 | ||||||||||||||||||||||||
1410 | ((void *)0)
| 10-39 | ||||||||||||||||||||||||
1411 | ) { | - | ||||||||||||||||||||||||
1412 | if ((
| 12-27 | ||||||||||||||||||||||||
1413 | if (!CBS_get_u8(&cbs, &hash_id)
| 0-27 | ||||||||||||||||||||||||
1414 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
1415 | if (!CBS_get_u8(&cbs, &sig_id)
| 0-27 | ||||||||||||||||||||||||
1416 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
1417 | - | |||||||||||||||||||||||||
1418 | if ((
| 0-27 | ||||||||||||||||||||||||
1419 | ((void *)0)
| 0-27 | ||||||||||||||||||||||||
1420 | ) { | - | ||||||||||||||||||||||||
1421 | SSL_error_internal(s, 368, __FILE__, 1512); | - | ||||||||||||||||||||||||
1422 | al = 50; | - | ||||||||||||||||||||||||
1423 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1424 | } | - | ||||||||||||||||||||||||
1425 | - | |||||||||||||||||||||||||
1426 | - | |||||||||||||||||||||||||
1427 | if ((
| 0-27 | ||||||||||||||||||||||||
1428 | - | |||||||||||||||||||||||||
1429 | SSL_error_internal(s, (4|64), __FILE__, 1520); | - | ||||||||||||||||||||||||
1430 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1431 | } | - | ||||||||||||||||||||||||
1432 | if (sigalg != sig_id
| 0-27 | ||||||||||||||||||||||||
1433 | SSL_error_internal(s, 370, __FILE__, 1524); | - | ||||||||||||||||||||||||
1434 | al = 50; | - | ||||||||||||||||||||||||
1435 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1436 | } | - | ||||||||||||||||||||||||
1437 | } executed 27 times by 2 tests: else if (pkey->type == 6end of block Executed by:
| 0-27 | ||||||||||||||||||||||||
1438 | md = EVP_md5_sha1(); | - | ||||||||||||||||||||||||
1439 | } executed 12 times by 1 test: else {end of block Executed by:
| 12 | ||||||||||||||||||||||||
1440 | md = EVP_sha1(); | - | ||||||||||||||||||||||||
1441 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1442 | - | |||||||||||||||||||||||||
1443 | if (!CBS_get_u16_length_prefixed(&cbs, &signature)
| 0-39 | ||||||||||||||||||||||||
1444 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
1445 | if (CBS_len(&signature) > EVP_PKEY_size(pkey)
| 0-39 | ||||||||||||||||||||||||
1446 | al = 50; | - | ||||||||||||||||||||||||
1447 | SSL_error_internal(s, 264, __FILE__, 1538); | - | ||||||||||||||||||||||||
1448 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1449 | } | - | ||||||||||||||||||||||||
1450 | - | |||||||||||||||||||||||||
1451 | if (!EVP_DigestInit_ex(&md_ctx,md,
| 0-39 | ||||||||||||||||||||||||
1452 | ((void *)0)
| 0-39 | ||||||||||||||||||||||||
1453 | )
| 0-39 | ||||||||||||||||||||||||
1454 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1455 | if (!EVP_DigestUpdate(&md_ctx,s->s3->client_random,32)
| 0-39 | ||||||||||||||||||||||||
1456 | ) | - | ||||||||||||||||||||||||
1457 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1458 | if (!EVP_DigestUpdate(&md_ctx,s->s3->server_random,32)
| 0-39 | ||||||||||||||||||||||||
1459 | ) | - | ||||||||||||||||||||||||
1460 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1461 | if (!EVP_DigestUpdate(&md_ctx,param,param_len)
| 0-39 | ||||||||||||||||||||||||
1462 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1463 | if (EVP_VerifyFinal(&md_ctx, CBS_data(&signature),
| 0-39 | ||||||||||||||||||||||||
1464 | CBS_len(&signature), pkey) <= 0
| 0-39 | ||||||||||||||||||||||||
1465 | al = 51; | - | ||||||||||||||||||||||||
1466 | SSL_error_internal(s, 123, __FILE__, 1555); | - | ||||||||||||||||||||||||
1467 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1468 | } | - | ||||||||||||||||||||||||
1469 | } executed 39 times by 2 tests: else {end of block Executed by:
| 39 | ||||||||||||||||||||||||
1470 | - | |||||||||||||||||||||||||
1471 | if (!(alg_a & 0x00000004L)
| 0-10 | ||||||||||||||||||||||||
1472 | SSL_error_internal(s, (4|64), __FILE__, 1561); | - | ||||||||||||||||||||||||
1473 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1474 | } | - | ||||||||||||||||||||||||
1475 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||
1476 | - | |||||||||||||||||||||||||
1477 | if (CBS_len(&cbs) != 0
| 0-49 | ||||||||||||||||||||||||
1478 | al = 50; | - | ||||||||||||||||||||||||
1479 | SSL_error_internal(s, 153, __FILE__, 1568); | - | ||||||||||||||||||||||||
1480 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1481 | } | - | ||||||||||||||||||||||||
1482 | - | |||||||||||||||||||||||||
1483 | EVP_PKEY_free(pkey); | - | ||||||||||||||||||||||||
1484 | EVP_MD_CTX_cleanup(&md_ctx); | - | ||||||||||||||||||||||||
1485 | - | |||||||||||||||||||||||||
1486 | return executed 49 times by 2 tests: (1);return (1); Executed by:
executed 49 times by 2 tests: return (1); Executed by:
| 49 | ||||||||||||||||||||||||
1487 | - | |||||||||||||||||||||||||
1488 | truncated: | - | ||||||||||||||||||||||||
1489 | al = 50; | - | ||||||||||||||||||||||||
1490 | SSL_error_internal(s, 115, __FILE__, 1579); | - | ||||||||||||||||||||||||
1491 | - | |||||||||||||||||||||||||
1492 | f_err: code before this statement never executed: f_err: | 0 | ||||||||||||||||||||||||
1493 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
1494 | - | |||||||||||||||||||||||||
1495 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
1496 | EVP_PKEY_free(pkey); | - | ||||||||||||||||||||||||
1497 | EVP_MD_CTX_cleanup(&md_ctx); | - | ||||||||||||||||||||||||
1498 | - | |||||||||||||||||||||||||
1499 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
1500 | } | - | ||||||||||||||||||||||||
1501 | - | |||||||||||||||||||||||||
1502 | int | - | ||||||||||||||||||||||||
1503 | ssl3_get_certificate_request(SSL *s) | - | ||||||||||||||||||||||||
1504 | { | - | ||||||||||||||||||||||||
1505 | int ok, ret = 0; | - | ||||||||||||||||||||||||
1506 | long n; | - | ||||||||||||||||||||||||
1507 | uint8_t ctype_num; | - | ||||||||||||||||||||||||
1508 | CBS cert_request, ctypes, rdn_list; | - | ||||||||||||||||||||||||
1509 | X509_NAME *xn = | - | ||||||||||||||||||||||||
1510 | ((void *)0) | - | ||||||||||||||||||||||||
1511 | ; | - | ||||||||||||||||||||||||
1512 | const unsigned char *q; | - | ||||||||||||||||||||||||
1513 | struct stack_st_X509_NAME *ca_sk = | - | ||||||||||||||||||||||||
1514 | ((void *)0) | - | ||||||||||||||||||||||||
1515 | ; | - | ||||||||||||||||||||||||
1516 | - | |||||||||||||||||||||||||
1517 | n = s->method->internal->ssl_get_message(s, (0x150|0x1000), | - | ||||||||||||||||||||||||
1518 | (0x151|0x1000), -1, s->internal->max_cert_list, &ok); | - | ||||||||||||||||||||||||
1519 | - | |||||||||||||||||||||||||
1520 | if (!ok
| 0-63 | ||||||||||||||||||||||||
1521 | return never executed: ((int)n);return ((int)n); never executed: return ((int)n); | 0 | ||||||||||||||||||||||||
1522 | - | |||||||||||||||||||||||||
1523 | (s->s3->internal)->tmp.cert_req = 0; | - | ||||||||||||||||||||||||
1524 | - | |||||||||||||||||||||||||
1525 | if ((
| 7-56 | ||||||||||||||||||||||||
1526 | (s->s3->internal)->tmp.reuse_message = 1; | - | ||||||||||||||||||||||||
1527 | - | |||||||||||||||||||||||||
1528 | - | |||||||||||||||||||||||||
1529 | - | |||||||||||||||||||||||||
1530 | - | |||||||||||||||||||||||||
1531 | if ((
| 27-29 | ||||||||||||||||||||||||
1532 | if (!tls1_digest_cached_records(s)
| 0-29 | ||||||||||||||||||||||||
1533 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1534 | } executed 29 times by 2 tests: end of block Executed by:
| 29 | ||||||||||||||||||||||||
1535 | return executed 56 times by 2 tests: (1);return (1); Executed by:
executed 56 times by 2 tests: return (1); Executed by:
| 56 | ||||||||||||||||||||||||
1536 | } | - | ||||||||||||||||||||||||
1537 | - | |||||||||||||||||||||||||
1538 | if ((
| 0-7 | ||||||||||||||||||||||||
1539 | ssl3_send_alert(s, 2, 10); | - | ||||||||||||||||||||||||
1540 | SSL_error_internal(s, 262, __FILE__, 1625); | - | ||||||||||||||||||||||||
1541 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1542 | } | - | ||||||||||||||||||||||||
1543 | - | |||||||||||||||||||||||||
1544 | - | |||||||||||||||||||||||||
1545 | if ((
| 0-7 | ||||||||||||||||||||||||
1546 | ssl3_send_alert(s, 2, 10); | - | ||||||||||||||||||||||||
1547 | SSL_error_internal(s, 232, __FILE__, 1632); | - | ||||||||||||||||||||||||
1548 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1549 | } | - | ||||||||||||||||||||||||
1550 | - | |||||||||||||||||||||||||
1551 | if (n < 0
| 0-7 | ||||||||||||||||||||||||
1552 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
1553 | CBS_init(&cert_request, s->internal->init_msg, n); | - | ||||||||||||||||||||||||
1554 | - | |||||||||||||||||||||||||
1555 | if ((
| 0-7 | ||||||||||||||||||||||||
1556 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
1557 | ) { | - | ||||||||||||||||||||||||
1558 | SSL_error_internal(s, (1|64), __FILE__, 1641); | - | ||||||||||||||||||||||||
1559 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1560 | } | - | ||||||||||||||||||||||||
1561 | - | |||||||||||||||||||||||||
1562 | - | |||||||||||||||||||||||||
1563 | if (!CBS_get_u8(&cert_request, &ctype_num)
| 0-7 | ||||||||||||||||||||||||
1564 | goto never executed: truncated;goto truncated; never executed: goto truncated; | 0 | ||||||||||||||||||||||||
1565 | - | |||||||||||||||||||||||||
1566 | if (ctype_num > 11
| 0-7 | ||||||||||||||||||||||||
1567 | ctype_num = 11; never executed: ctype_num = 11; | 0 | ||||||||||||||||||||||||
1568 | if (!CBS_get_bytes(&cert_request, &ctypes, ctype_num)
| 0-7 | ||||||||||||||||||||||||
1569 | !CBS_write_bytes(&ctypes, (uint8_t *)(s->s3->internal)->tmp.ctype,
| 0-7 | ||||||||||||||||||||||||
1570 | sizeof((s->s3->internal)->tmp.ctype),
| 0-7 | ||||||||||||||||||||||||
1571 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
1572 | )
| 0-7 | ||||||||||||||||||||||||
1573 | SSL_error_internal(s, 146, __FILE__, 1654); | - | ||||||||||||||||||||||||
1574 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1575 | } | - | ||||||||||||||||||||||||
1576 | - | |||||||||||||||||||||||||
1577 | if ((
| 2-5 | ||||||||||||||||||||||||
1578 | CBS sigalgs; | - | ||||||||||||||||||||||||
1579 | - | |||||||||||||||||||||||||
1580 | if (CBS_len(&cert_request) < 2
| 0-5 | ||||||||||||||||||||||||
1581 | SSL_error_internal(s, 146, __FILE__, 1662); | - | ||||||||||||||||||||||||
1582 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1583 | } | - | ||||||||||||||||||||||||
1584 | - | |||||||||||||||||||||||||
1585 | - | |||||||||||||||||||||||||
1586 | - | |||||||||||||||||||||||||
1587 | - | |||||||||||||||||||||||||
1588 | if (!CBS_get_u16_length_prefixed(&cert_request, &sigalgs)
| 0-5 | ||||||||||||||||||||||||
1589 | ssl3_send_alert(s, 2, 50); | - | ||||||||||||||||||||||||
1590 | SSL_error_internal(s, 146, __FILE__, 1671); | - | ||||||||||||||||||||||||
1591 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1592 | } | - | ||||||||||||||||||||||||
1593 | if (!tls1_process_sigalgs(s, &sigalgs)
| 0-5 | ||||||||||||||||||||||||
1594 | ssl3_send_alert(s, 2, 50); | - | ||||||||||||||||||||||||
1595 | SSL_error_internal(s, 360, __FILE__, 1676); | - | ||||||||||||||||||||||||
1596 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1597 | } | - | ||||||||||||||||||||||||
1598 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||
1599 | - | |||||||||||||||||||||||||
1600 | - | |||||||||||||||||||||||||
1601 | if (CBS_len(&cert_request) < 2
| 0-7 | ||||||||||||||||||||||||
1602 | SSL_error_internal(s, 146, __FILE__, 1683); | - | ||||||||||||||||||||||||
1603 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1604 | } | - | ||||||||||||||||||||||||
1605 | - | |||||||||||||||||||||||||
1606 | if (!CBS_get_u16_length_prefixed(&cert_request, &rdn_list)
| 0-7 | ||||||||||||||||||||||||
1607 | CBS_len(&cert_request) != 0
| 0-7 | ||||||||||||||||||||||||
1608 | ssl3_send_alert(s, 2, 50); | - | ||||||||||||||||||||||||
1609 | SSL_error_internal(s, 159, __FILE__, 1690); | - | ||||||||||||||||||||||||
1610 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1611 | } | - | ||||||||||||||||||||||||
1612 | - | |||||||||||||||||||||||||
1613 | while (CBS_len(&rdn_list) > 0
| 0-7 | ||||||||||||||||||||||||
1614 | CBS rdn; | - | ||||||||||||||||||||||||
1615 | - | |||||||||||||||||||||||||
1616 | if (CBS_len(&rdn_list) < 2
| 0 | ||||||||||||||||||||||||
1617 | SSL_error_internal(s, 146, __FILE__, 1698); | - | ||||||||||||||||||||||||
1618 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1619 | } | - | ||||||||||||||||||||||||
1620 | - | |||||||||||||||||||||||||
1621 | if (!CBS_get_u16_length_prefixed(&rdn_list, &rdn)
| 0 | ||||||||||||||||||||||||
1622 | ssl3_send_alert(s, 2, 50); | - | ||||||||||||||||||||||||
1623 | SSL_error_internal(s, 132, __FILE__, 1704); | - | ||||||||||||||||||||||||
1624 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1625 | } | - | ||||||||||||||||||||||||
1626 | - | |||||||||||||||||||||||||
1627 | q = CBS_data(&rdn); | - | ||||||||||||||||||||||||
1628 | if ((
| 0 | ||||||||||||||||||||||||
1629 | ((void *)0)
| 0 | ||||||||||||||||||||||||
1630 | , &q, CBS_len(&rdn))) ==
| 0 | ||||||||||||||||||||||||
1631 | ((void *)0)
| 0 | ||||||||||||||||||||||||
1632 | ) { | - | ||||||||||||||||||||||||
1633 | ssl3_send_alert(s, 2, | - | ||||||||||||||||||||||||
1634 | 50); | - | ||||||||||||||||||||||||
1635 | SSL_error_internal(s, 13, __FILE__, 1712); | - | ||||||||||||||||||||||||
1636 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1637 | } | - | ||||||||||||||||||||||||
1638 | - | |||||||||||||||||||||||||
1639 | if (q != CBS_data(&rdn) + CBS_len(&rdn)
| 0 | ||||||||||||||||||||||||
1640 | ssl3_send_alert(s, 2, 50); | - | ||||||||||||||||||||||||
1641 | SSL_error_internal(s, 131, __FILE__, 1718); | - | ||||||||||||||||||||||||
1642 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1643 | } | - | ||||||||||||||||||||||||
1644 | if (!sk_push(((_STACK*) (1 ? (ca_sk) : (struct stack_st_X509_NAME*)0)), ((void*) (1 ? (xn) : (X509_NAME*)0)))
| 0 | ||||||||||||||||||||||||
1645 | SSL_error_internal(s, (1|64), __FILE__, 1722); | - | ||||||||||||||||||||||||
1646 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1647 | } | - | ||||||||||||||||||||||||
1648 | xn = | - | ||||||||||||||||||||||||
1649 | ((void *)0) | - | ||||||||||||||||||||||||
1650 | ; | - | ||||||||||||||||||||||||
1651 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1652 | - | |||||||||||||||||||||||||
1653 | - | |||||||||||||||||||||||||
1654 | (s->s3->internal)->tmp.cert_req = 1; | - | ||||||||||||||||||||||||
1655 | (s->s3->internal)->tmp.ctype_num = ctype_num; | - | ||||||||||||||||||||||||
1656 | sk_pop_free(((_STACK*) (1 ? ((s->s3->internal)->tmp.ca_names) : (struct stack_st_X509_NAME*)0)), ((void (*)(void *)) ((1 ? (X509_NAME_free) : (void (*)(X509_NAME *))0)))); | - | ||||||||||||||||||||||||
1657 | (s->s3->internal)->tmp.ca_names = ca_sk; | - | ||||||||||||||||||||||||
1658 | ca_sk = | - | ||||||||||||||||||||||||
1659 | ((void *)0) | - | ||||||||||||||||||||||||
1660 | ; | - | ||||||||||||||||||||||||
1661 | - | |||||||||||||||||||||||||
1662 | ret = 1; | - | ||||||||||||||||||||||||
1663 | if (0) { | - | ||||||||||||||||||||||||
1664 | truncated: | - | ||||||||||||||||||||||||
1665 | SSL_error_internal(s, 115, __FILE__, 1738); | - | ||||||||||||||||||||||||
1666 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1667 | err: code before this statement executed 7 times by 1 test: err: Executed by:
| 7 | ||||||||||||||||||||||||
1668 | X509_NAME_free(xn); | - | ||||||||||||||||||||||||
1669 | sk_pop_free(((_STACK*) (1 ? (ca_sk) : (struct stack_st_X509_NAME*)0)), ((void (*)(void *)) ((1 ? (X509_NAME_free) : (void (*)(X509_NAME *))0)))); | - | ||||||||||||||||||||||||
1670 | return executed 7 times by 1 test: (ret);return (ret); Executed by:
executed 7 times by 1 test: return (ret); Executed by:
| 7 | ||||||||||||||||||||||||
1671 | } | - | ||||||||||||||||||||||||
1672 | - | |||||||||||||||||||||||||
1673 | static int | - | ||||||||||||||||||||||||
1674 | ca_dn_cmp(const X509_NAME * const *a, const X509_NAME * const *b) | - | ||||||||||||||||||||||||
1675 | { | - | ||||||||||||||||||||||||
1676 | return never executed: (X509_NAME_cmp(*a, *b));return (X509_NAME_cmp(*a, *b)); never executed: return (X509_NAME_cmp(*a, *b)); | 0 | ||||||||||||||||||||||||
1677 | } | - | ||||||||||||||||||||||||
1678 | - | |||||||||||||||||||||||||
1679 | int | - | ||||||||||||||||||||||||
1680 | ssl3_get_new_session_ticket(SSL *s) | - | ||||||||||||||||||||||||
1681 | { | - | ||||||||||||||||||||||||
1682 | int ok, al, ret = 0; | - | ||||||||||||||||||||||||
1683 | uint32_t lifetime_hint; | - | ||||||||||||||||||||||||
1684 | long n; | - | ||||||||||||||||||||||||
1685 | CBS cbs, session_ticket; | - | ||||||||||||||||||||||||
1686 | - | |||||||||||||||||||||||||
1687 | n = s->method->internal->ssl_get_message(s, (0x1E0|0x1000), | - | ||||||||||||||||||||||||
1688 | (0x1E1|0x1000), -1, 16384, &ok); | - | ||||||||||||||||||||||||
1689 | if (!ok
| 59-623 | ||||||||||||||||||||||||
1690 | return executed 623 times by 1 test: ((int)n);return ((int)n); Executed by:
executed 623 times by 1 test: return ((int)n); Executed by:
| 623 | ||||||||||||||||||||||||
1691 | - | |||||||||||||||||||||||||
1692 | if ((
| 0-59 | ||||||||||||||||||||||||
1693 | (s->s3->internal)->tmp.reuse_message = 1; | - | ||||||||||||||||||||||||
1694 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
1695 | } | - | ||||||||||||||||||||||||
1696 | if ((
| 0-59 | ||||||||||||||||||||||||
1697 | al = 10; | - | ||||||||||||||||||||||||
1698 | SSL_error_internal(s, 114, __FILE__, 1771); | - | ||||||||||||||||||||||||
1699 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1700 | } | - | ||||||||||||||||||||||||
1701 | - | |||||||||||||||||||||||||
1702 | if (n < 0
| 0-59 | ||||||||||||||||||||||||
1703 | al = 50; | - | ||||||||||||||||||||||||
1704 | SSL_error_internal(s, 159, __FILE__, 1777); | - | ||||||||||||||||||||||||
1705 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1706 | } | - | ||||||||||||||||||||||||
1707 | - | |||||||||||||||||||||||||
1708 | CBS_init(&cbs, s->internal->init_msg, n); | - | ||||||||||||||||||||||||
1709 | if (!CBS_get_u32(&cbs, &lifetime_hint)
| 0-59 | ||||||||||||||||||||||||
1710 | - | |||||||||||||||||||||||||
1711 | - | |||||||||||||||||||||||||
1712 | - | |||||||||||||||||||||||||
1713 | !CBS_get_u16_length_prefixed(&cbs, &session_ticket)
| 0-59 | ||||||||||||||||||||||||
1714 | CBS_len(&cbs) != 0
| 0-59 | ||||||||||||||||||||||||
1715 | al = 50; | - | ||||||||||||||||||||||||
1716 | SSL_error_internal(s, 159, __FILE__, 1789); | - | ||||||||||||||||||||||||
1717 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1718 | } | - | ||||||||||||||||||||||||
1719 | s->session->tlsext_tick_lifetime_hint = (long)lifetime_hint; | - | ||||||||||||||||||||||||
1720 | - | |||||||||||||||||||||||||
1721 | if (!CBS_stow(&session_ticket, &s->session->tlsext_tick,
| 0-59 | ||||||||||||||||||||||||
1722 | &s->session->tlsext_ticklen)
| 0-59 | ||||||||||||||||||||||||
1723 | SSL_error_internal(s, (1|64), __FILE__, 1796); | - | ||||||||||||||||||||||||
1724 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1725 | } | - | ||||||||||||||||||||||||
1726 | EVP_Digest(CBS_data(&session_ticket), CBS_len(&session_ticket), | - | ||||||||||||||||||||||||
1727 | s->session->session_id, &s->session->session_id_length, | - | ||||||||||||||||||||||||
1728 | EVP_sha256(), | - | ||||||||||||||||||||||||
1729 | ((void *)0) | - | ||||||||||||||||||||||||
1730 | ); | - | ||||||||||||||||||||||||
1731 | ret = 1; | - | ||||||||||||||||||||||||
1732 | return executed 59 times by 1 test: (ret);return (ret); Executed by:
executed 59 times by 1 test: return (ret); Executed by:
| 59 | ||||||||||||||||||||||||
1733 | f_err: | - | ||||||||||||||||||||||||
1734 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
1735 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
1736 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
1737 | } | - | ||||||||||||||||||||||||
1738 | - | |||||||||||||||||||||||||
1739 | int | - | ||||||||||||||||||||||||
1740 | ssl3_get_cert_status(SSL *s) | - | ||||||||||||||||||||||||
1741 | { | - | ||||||||||||||||||||||||
1742 | CBS cert_status, response; | - | ||||||||||||||||||||||||
1743 | size_t stow_len; | - | ||||||||||||||||||||||||
1744 | int ok, al; | - | ||||||||||||||||||||||||
1745 | long n; | - | ||||||||||||||||||||||||
1746 | uint8_t status_type; | - | ||||||||||||||||||||||||
1747 | - | |||||||||||||||||||||||||
1748 | n = s->method->internal->ssl_get_message(s, (0x1F0|0x1000), | - | ||||||||||||||||||||||||
1749 | (0x1F1|0x1000), 22, | - | ||||||||||||||||||||||||
1750 | 16384, &ok); | - | ||||||||||||||||||||||||
1751 | - | |||||||||||||||||||||||||
1752 | if (!ok
| 0 | ||||||||||||||||||||||||
1753 | return never executed: ((int)n);return ((int)n); never executed: return ((int)n); | 0 | ||||||||||||||||||||||||
1754 | - | |||||||||||||||||||||||||
1755 | if (n < 0
| 0 | ||||||||||||||||||||||||
1756 | - | |||||||||||||||||||||||||
1757 | al = 50; | - | ||||||||||||||||||||||||
1758 | SSL_error_internal(s, 159, __FILE__, 1846); | - | ||||||||||||||||||||||||
1759 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1760 | } | - | ||||||||||||||||||||||||
1761 | - | |||||||||||||||||||||||||
1762 | CBS_init(&cert_status, s->internal->init_msg, n); | - | ||||||||||||||||||||||||
1763 | if (!CBS_get_u8(&cert_status, &status_type)
| 0 | ||||||||||||||||||||||||
1764 | CBS_len(&cert_status) < 3
| 0 | ||||||||||||||||||||||||
1765 | - | |||||||||||||||||||||||||
1766 | al = 50; | - | ||||||||||||||||||||||||
1767 | SSL_error_internal(s, 159, __FILE__, 1855); | - | ||||||||||||||||||||||||
1768 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1769 | } | - | ||||||||||||||||||||||||
1770 | - | |||||||||||||||||||||||||
1771 | if (status_type != 1
| 0 | ||||||||||||||||||||||||
1772 | al = 50; | - | ||||||||||||||||||||||||
1773 | SSL_error_internal(s, 329, __FILE__, 1861); | - | ||||||||||||||||||||||||
1774 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1775 | } | - | ||||||||||||||||||||||||
1776 | - | |||||||||||||||||||||||||
1777 | if (!CBS_get_u24_length_prefixed(&cert_status, &response)
| 0 | ||||||||||||||||||||||||
1778 | CBS_len(&cert_status) != 0
| 0 | ||||||||||||||||||||||||
1779 | al = 50; | - | ||||||||||||||||||||||||
1780 | SSL_error_internal(s, 159, __FILE__, 1868); | - | ||||||||||||||||||||||||
1781 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1782 | } | - | ||||||||||||||||||||||||
1783 | - | |||||||||||||||||||||||||
1784 | if (!CBS_stow(&response, &s->internal->tlsext_ocsp_resp,
| 0 | ||||||||||||||||||||||||
1785 | &stow_len)
| 0 | ||||||||||||||||||||||||
1786 | s->internal->tlsext_ocsp_resplen = 0; | - | ||||||||||||||||||||||||
1787 | al = 80; | - | ||||||||||||||||||||||||
1788 | SSL_error_internal(s, (1|64), __FILE__, 1876); | - | ||||||||||||||||||||||||
1789 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1790 | } | - | ||||||||||||||||||||||||
1791 | s->internal->tlsext_ocsp_resplen = (int)stow_len; | - | ||||||||||||||||||||||||
1792 | - | |||||||||||||||||||||||||
1793 | if (s->ctx->internal->tlsext_status_cb
| 0 | ||||||||||||||||||||||||
1794 | int ret; | - | ||||||||||||||||||||||||
1795 | ret = s->ctx->internal->tlsext_status_cb(s, | - | ||||||||||||||||||||||||
1796 | s->ctx->internal->tlsext_status_arg); | - | ||||||||||||||||||||||||
1797 | if (ret == 0
| 0 | ||||||||||||||||||||||||
1798 | al = 113; | - | ||||||||||||||||||||||||
1799 | SSL_error_internal(s, 328, __FILE__, 1887); | - | ||||||||||||||||||||||||
1800 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1801 | } | - | ||||||||||||||||||||||||
1802 | if (ret < 0
| 0 | ||||||||||||||||||||||||
1803 | al = 80; | - | ||||||||||||||||||||||||
1804 | SSL_error_internal(s, (1|64), __FILE__, 1892); | - | ||||||||||||||||||||||||
1805 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
1806 | } | - | ||||||||||||||||||||||||
1807 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1808 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
1809 | f_err: | - | ||||||||||||||||||||||||
1810 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
1811 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
1812 | } | - | ||||||||||||||||||||||||
1813 | - | |||||||||||||||||||||||||
1814 | int | - | ||||||||||||||||||||||||
1815 | ssl3_get_server_done(SSL *s) | - | ||||||||||||||||||||||||
1816 | { | - | ||||||||||||||||||||||||
1817 | int ok, ret = 0; | - | ||||||||||||||||||||||||
1818 | long n; | - | ||||||||||||||||||||||||
1819 | - | |||||||||||||||||||||||||
1820 | n = s->method->internal->ssl_get_message(s, (0x160|0x1000), | - | ||||||||||||||||||||||||
1821 | (0x161|0x1000), 14, | - | ||||||||||||||||||||||||
1822 | 30, &ok); | - | ||||||||||||||||||||||||
1823 | - | |||||||||||||||||||||||||
1824 | if (!ok
| 0-63 | ||||||||||||||||||||||||
1825 | return never executed: ((int)n);return ((int)n); never executed: return ((int)n); | 0 | ||||||||||||||||||||||||
1826 | if (n > 0
| 0-63 | ||||||||||||||||||||||||
1827 | - | |||||||||||||||||||||||||
1828 | ssl3_send_alert(s, 2, 50); | - | ||||||||||||||||||||||||
1829 | SSL_error_internal(s, 159, __FILE__, 1917); | - | ||||||||||||||||||||||||
1830 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
1831 | } | - | ||||||||||||||||||||||||
1832 | ret = 1; | - | ||||||||||||||||||||||||
1833 | return executed 63 times by 2 tests: (ret);return (ret); Executed by:
executed 63 times by 2 tests: return (ret); Executed by:
| 63 | ||||||||||||||||||||||||
1834 | } | - | ||||||||||||||||||||||||
1835 | - | |||||||||||||||||||||||||
1836 | static int | - | ||||||||||||||||||||||||
1837 | ssl3_send_client_kex_rsa(SSL *s, SESS_CERT *sess_cert, CBB *cbb) | - | ||||||||||||||||||||||||
1838 | { | - | ||||||||||||||||||||||||
1839 | unsigned char pms[48]; | - | ||||||||||||||||||||||||
1840 | unsigned char *enc_pms = | - | ||||||||||||||||||||||||
1841 | ((void *)0) | - | ||||||||||||||||||||||||
1842 | ; | - | ||||||||||||||||||||||||
1843 | EVP_PKEY *pkey = | - | ||||||||||||||||||||||||
1844 | ((void *)0) | - | ||||||||||||||||||||||||
1845 | ; | - | ||||||||||||||||||||||||
1846 | int ret = -1; | - | ||||||||||||||||||||||||
1847 | int enc_len; | - | ||||||||||||||||||||||||
1848 | CBB epms; | - | ||||||||||||||||||||||||
1849 | - | |||||||||||||||||||||||||
1850 | - | |||||||||||||||||||||||||
1851 | - | |||||||||||||||||||||||||
1852 | - | |||||||||||||||||||||||||
1853 | - | |||||||||||||||||||||||||
1854 | pkey = X509_get_pubkey(sess_cert->peer_pkeys[0].x509); | - | ||||||||||||||||||||||||
1855 | if (pkey ==
| 0-14 | ||||||||||||||||||||||||
1856 | ((void *)0)
| 0-14 | ||||||||||||||||||||||||
1857 | || pkey->type != 6
| 0-14 | ||||||||||||||||||||||||
1858 | pkey->pkey.rsa ==
| 0-14 | ||||||||||||||||||||||||
1859 | ((void *)0)
| 0-14 | ||||||||||||||||||||||||
1860 | ) { | - | ||||||||||||||||||||||||
1861 | SSL_error_internal(s, (4|64), __FILE__, 1941); | - | ||||||||||||||||||||||||
1862 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1863 | } | - | ||||||||||||||||||||||||
1864 | - | |||||||||||||||||||||||||
1865 | pms[0] = s->client_version >> 8; | - | ||||||||||||||||||||||||
1866 | pms[1] = s->client_version & 0xff; | - | ||||||||||||||||||||||||
1867 | arc4random_buf(&pms[2], sizeof(pms) - 2); | - | ||||||||||||||||||||||||
1868 | - | |||||||||||||||||||||||||
1869 | if ((
| 0-14 | ||||||||||||||||||||||||
1870 | ((void *)0)
| 0-14 | ||||||||||||||||||||||||
1871 | ) { | - | ||||||||||||||||||||||||
1872 | SSL_error_internal(s, (1|64), __FILE__, 1950); | - | ||||||||||||||||||||||||
1873 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1874 | } | - | ||||||||||||||||||||||||
1875 | - | |||||||||||||||||||||||||
1876 | enc_len = RSA_public_encrypt(sizeof(pms), pms, enc_pms, pkey->pkey.rsa, | - | ||||||||||||||||||||||||
1877 | 1); | - | ||||||||||||||||||||||||
1878 | if (enc_len <= 0
| 0-14 | ||||||||||||||||||||||||
1879 | SSL_error_internal(s, 119, __FILE__, 1957); | - | ||||||||||||||||||||||||
1880 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1881 | } | - | ||||||||||||||||||||||||
1882 | - | |||||||||||||||||||||||||
1883 | if (!CBB_add_u16_length_prefixed(cbb, &epms)
| 0-14 | ||||||||||||||||||||||||
1884 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1885 | if (!CBB_add_bytes(&epms, enc_pms, enc_len)
| 0-14 | ||||||||||||||||||||||||
1886 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1887 | if (!CBB_flush(cbb)
| 0-14 | ||||||||||||||||||||||||
1888 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1889 | - | |||||||||||||||||||||||||
1890 | s->session->master_key_length = | - | ||||||||||||||||||||||||
1891 | tls1_generate_master_secret(s, | - | ||||||||||||||||||||||||
1892 | s->session->master_key, pms, sizeof(pms)); | - | ||||||||||||||||||||||||
1893 | - | |||||||||||||||||||||||||
1894 | ret = 1; | - | ||||||||||||||||||||||||
1895 | - | |||||||||||||||||||||||||
1896 | err: code before this statement executed 14 times by 1 test: err: Executed by:
| 14 | ||||||||||||||||||||||||
1897 | explicit_bzero(pms, sizeof(pms)); | - | ||||||||||||||||||||||||
1898 | EVP_PKEY_free(pkey); | - | ||||||||||||||||||||||||
1899 | free(enc_pms); | - | ||||||||||||||||||||||||
1900 | - | |||||||||||||||||||||||||
1901 | return executed 14 times by 1 test: (ret);return (ret); Executed by:
executed 14 times by 1 test: return (ret); Executed by:
| 14 | ||||||||||||||||||||||||
1902 | } | - | ||||||||||||||||||||||||
1903 | - | |||||||||||||||||||||||||
1904 | static int | - | ||||||||||||||||||||||||
1905 | ssl3_send_client_kex_dhe(SSL *s, SESS_CERT *sess_cert, CBB *cbb) | - | ||||||||||||||||||||||||
1906 | { | - | ||||||||||||||||||||||||
1907 | DH *dh_srvr = | - | ||||||||||||||||||||||||
1908 | ((void *)0) | - | ||||||||||||||||||||||||
1909 | , *dh_clnt = | - | ||||||||||||||||||||||||
1910 | ((void *)0) | - | ||||||||||||||||||||||||
1911 | ; | - | ||||||||||||||||||||||||
1912 | unsigned char *key = | - | ||||||||||||||||||||||||
1913 | ((void *)0) | - | ||||||||||||||||||||||||
1914 | ; | - | ||||||||||||||||||||||||
1915 | int key_size = 0, key_len; | - | ||||||||||||||||||||||||
1916 | unsigned char *data; | - | ||||||||||||||||||||||||
1917 | int ret = -1; | - | ||||||||||||||||||||||||
1918 | CBB dh_Yc; | - | ||||||||||||||||||||||||
1919 | - | |||||||||||||||||||||||||
1920 | - | |||||||||||||||||||||||||
1921 | if (sess_cert->peer_dh_tmp ==
| 0-21 | ||||||||||||||||||||||||
1922 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
1923 | ) { | - | ||||||||||||||||||||||||
1924 | ssl3_send_alert(s, 2, 40); | - | ||||||||||||||||||||||||
1925 | SSL_error_internal(s, 238, __FILE__, 1995); | - | ||||||||||||||||||||||||
1926 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1927 | } | - | ||||||||||||||||||||||||
1928 | dh_srvr = sess_cert->peer_dh_tmp; | - | ||||||||||||||||||||||||
1929 | - | |||||||||||||||||||||||||
1930 | - | |||||||||||||||||||||||||
1931 | if ((
| 0-21 | ||||||||||||||||||||||||
1932 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
1933 | ) { | - | ||||||||||||||||||||||||
1934 | SSL_error_internal(s, 5, __FILE__, 2002); | - | ||||||||||||||||||||||||
1935 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1936 | } | - | ||||||||||||||||||||||||
1937 | if (!DH_generate_key(dh_clnt)
| 0-21 | ||||||||||||||||||||||||
1938 | SSL_error_internal(s, 5, __FILE__, 2006); | - | ||||||||||||||||||||||||
1939 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1940 | } | - | ||||||||||||||||||||||||
1941 | if ((
| 0-21 | ||||||||||||||||||||||||
1942 | SSL_error_internal(s, 5, __FILE__, 2010); | - | ||||||||||||||||||||||||
1943 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1944 | } | - | ||||||||||||||||||||||||
1945 | if ((
| 0-21 | ||||||||||||||||||||||||
1946 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
1947 | ) { | - | ||||||||||||||||||||||||
1948 | SSL_error_internal(s, (1|64), __FILE__, 2014); | - | ||||||||||||||||||||||||
1949 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1950 | } | - | ||||||||||||||||||||||||
1951 | if ((
| 0-21 | ||||||||||||||||||||||||
1952 | SSL_error_internal(s, 5, __FILE__, 2018); | - | ||||||||||||||||||||||||
1953 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1954 | } | - | ||||||||||||||||||||||||
1955 | - | |||||||||||||||||||||||||
1956 | - | |||||||||||||||||||||||||
1957 | s->session->master_key_length = | - | ||||||||||||||||||||||||
1958 | tls1_generate_master_secret(s, | - | ||||||||||||||||||||||||
1959 | s->session->master_key, key, key_len); | - | ||||||||||||||||||||||||
1960 | - | |||||||||||||||||||||||||
1961 | if (!CBB_add_u16_length_prefixed(cbb, &dh_Yc)
| 0-21 | ||||||||||||||||||||||||
1962 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1963 | if (!CBB_add_space(&dh_Yc, &data, ((BN_num_bits(dh_clnt->pub_key)+7)/8))
| 0-21 | ||||||||||||||||||||||||
1964 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1965 | BN_bn2bin(dh_clnt->pub_key, data); | - | ||||||||||||||||||||||||
1966 | if (!CBB_flush(cbb)
| 0-21 | ||||||||||||||||||||||||
1967 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1968 | - | |||||||||||||||||||||||||
1969 | ret = 1; | - | ||||||||||||||||||||||||
1970 | - | |||||||||||||||||||||||||
1971 | err: code before this statement executed 21 times by 1 test: err: Executed by:
| 21 | ||||||||||||||||||||||||
1972 | DH_free(dh_clnt); | - | ||||||||||||||||||||||||
1973 | freezero(key, key_size); | - | ||||||||||||||||||||||||
1974 | - | |||||||||||||||||||||||||
1975 | return executed 21 times by 1 test: (ret);return (ret); Executed by:
executed 21 times by 1 test: return (ret); Executed by:
| 21 | ||||||||||||||||||||||||
1976 | } | - | ||||||||||||||||||||||||
1977 | - | |||||||||||||||||||||||||
1978 | static int | - | ||||||||||||||||||||||||
1979 | ssl3_send_client_kex_ecdhe_ecp(SSL *s, SESS_CERT *sc, CBB *cbb) | - | ||||||||||||||||||||||||
1980 | { | - | ||||||||||||||||||||||||
1981 | const EC_GROUP *group = | - | ||||||||||||||||||||||||
1982 | ((void *)0) | - | ||||||||||||||||||||||||
1983 | ; | - | ||||||||||||||||||||||||
1984 | const EC_POINT *point = | - | ||||||||||||||||||||||||
1985 | ((void *)0) | - | ||||||||||||||||||||||||
1986 | ; | - | ||||||||||||||||||||||||
1987 | EC_KEY *ecdh = | - | ||||||||||||||||||||||||
1988 | ((void *)0) | - | ||||||||||||||||||||||||
1989 | ; | - | ||||||||||||||||||||||||
1990 | BN_CTX *bn_ctx = | - | ||||||||||||||||||||||||
1991 | ((void *)0) | - | ||||||||||||||||||||||||
1992 | ; | - | ||||||||||||||||||||||||
1993 | unsigned char *key = | - | ||||||||||||||||||||||||
1994 | ((void *)0) | - | ||||||||||||||||||||||||
1995 | ; | - | ||||||||||||||||||||||||
1996 | unsigned char *data; | - | ||||||||||||||||||||||||
1997 | size_t encoded_len; | - | ||||||||||||||||||||||||
1998 | int key_size = 0, key_len; | - | ||||||||||||||||||||||||
1999 | int ret = -1; | - | ||||||||||||||||||||||||
2000 | CBB ecpoint; | - | ||||||||||||||||||||||||
2001 | - | |||||||||||||||||||||||||
2002 | if ((
| 0-23 | ||||||||||||||||||||||||
2003 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
2004 | || | - | ||||||||||||||||||||||||
2005 | (
| 0-23 | ||||||||||||||||||||||||
2006 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
2007 | ) { | - | ||||||||||||||||||||||||
2008 | SSL_error_internal(s, (4|64), __FILE__, 2060); | - | ||||||||||||||||||||||||
2009 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2010 | } | - | ||||||||||||||||||||||||
2011 | - | |||||||||||||||||||||||||
2012 | if ((
| 0-23 | ||||||||||||||||||||||||
2013 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
2014 | ) { | - | ||||||||||||||||||||||||
2015 | SSL_error_internal(s, (1|64), __FILE__, 2065); | - | ||||||||||||||||||||||||
2016 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2017 | } | - | ||||||||||||||||||||||||
2018 | - | |||||||||||||||||||||||||
2019 | if (!EC_KEY_set_group(ecdh, group)
| 0-23 | ||||||||||||||||||||||||
2020 | SSL_error_internal(s, 16, __FILE__, 2070); | - | ||||||||||||||||||||||||
2021 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2022 | } | - | ||||||||||||||||||||||||
2023 | - | |||||||||||||||||||||||||
2024 | - | |||||||||||||||||||||||||
2025 | if (!EC_KEY_generate_key(ecdh)
| 0-23 | ||||||||||||||||||||||||
2026 | SSL_error_internal(s, 43, __FILE__, 2076); | - | ||||||||||||||||||||||||
2027 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2028 | } | - | ||||||||||||||||||||||||
2029 | if ((
| 0-23 | ||||||||||||||||||||||||
2030 | SSL_error_internal(s, 43, __FILE__, 2080); | - | ||||||||||||||||||||||||
2031 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2032 | } | - | ||||||||||||||||||||||||
2033 | if ((
| 0-23 | ||||||||||||||||||||||||
2034 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
2035 | ) { | - | ||||||||||||||||||||||||
2036 | SSL_error_internal(s, (1|64), __FILE__, 2084); | - | ||||||||||||||||||||||||
2037 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2038 | } | - | ||||||||||||||||||||||||
2039 | key_len = ECDH_compute_key(key, key_size, point, ecdh, | - | ||||||||||||||||||||||||
2040 | ((void *)0) | - | ||||||||||||||||||||||||
2041 | ); | - | ||||||||||||||||||||||||
2042 | if (key_len <= 0
| 0-23 | ||||||||||||||||||||||||
2043 | SSL_error_internal(s, 43, __FILE__, 2089); | - | ||||||||||||||||||||||||
2044 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2045 | } | - | ||||||||||||||||||||||||
2046 | - | |||||||||||||||||||||||||
2047 | - | |||||||||||||||||||||||||
2048 | s->session->master_key_length = | - | ||||||||||||||||||||||||
2049 | tls1_generate_master_secret(s, | - | ||||||||||||||||||||||||
2050 | s->session->master_key, key, key_len); | - | ||||||||||||||||||||||||
2051 | - | |||||||||||||||||||||||||
2052 | encoded_len = EC_POINT_point2oct(group, EC_KEY_get0_public_key(ecdh), | - | ||||||||||||||||||||||||
2053 | POINT_CONVERSION_UNCOMPRESSED, | - | ||||||||||||||||||||||||
2054 | ((void *)0) | - | ||||||||||||||||||||||||
2055 | , 0, | - | ||||||||||||||||||||||||
2056 | ((void *)0) | - | ||||||||||||||||||||||||
2057 | ); | - | ||||||||||||||||||||||||
2058 | if (encoded_len == 0
| 0-23 | ||||||||||||||||||||||||
2059 | SSL_error_internal(s, 43, __FILE__, 2101); | - | ||||||||||||||||||||||||
2060 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2061 | } | - | ||||||||||||||||||||||||
2062 | - | |||||||||||||||||||||||||
2063 | if ((
| 0-23 | ||||||||||||||||||||||||
2064 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
2065 | ) { | - | ||||||||||||||||||||||||
2066 | SSL_error_internal(s, (1|64), __FILE__, 2106); | - | ||||||||||||||||||||||||
2067 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2068 | } | - | ||||||||||||||||||||||||
2069 | - | |||||||||||||||||||||||||
2070 | - | |||||||||||||||||||||||||
2071 | if (!CBB_add_u8_length_prefixed(cbb, &ecpoint)
| 0-23 | ||||||||||||||||||||||||
2072 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2073 | if (!CBB_add_space(&ecpoint, &data, encoded_len)
| 0-23 | ||||||||||||||||||||||||
2074 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2075 | if (EC_POINT_point2oct(group, EC_KEY_get0_public_key(ecdh),
| 0-23 | ||||||||||||||||||||||||
2076 | POINT_CONVERSION_UNCOMPRESSED, data, encoded_len,
| 0-23 | ||||||||||||||||||||||||
2077 | bn_ctx) == 0
| 0-23 | ||||||||||||||||||||||||
2078 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2079 | if (!CBB_flush(cbb)
| 0-23 | ||||||||||||||||||||||||
2080 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2081 | - | |||||||||||||||||||||||||
2082 | ret = 1; | - | ||||||||||||||||||||||||
2083 | - | |||||||||||||||||||||||||
2084 | err: code before this statement executed 23 times by 1 test: err: Executed by:
| 23 | ||||||||||||||||||||||||
2085 | freezero(key, key_size); | - | ||||||||||||||||||||||||
2086 | - | |||||||||||||||||||||||||
2087 | BN_CTX_free(bn_ctx); | - | ||||||||||||||||||||||||
2088 | EC_KEY_free(ecdh); | - | ||||||||||||||||||||||||
2089 | - | |||||||||||||||||||||||||
2090 | return executed 23 times by 1 test: (ret);return (ret); Executed by:
executed 23 times by 1 test: return (ret); Executed by:
| 23 | ||||||||||||||||||||||||
2091 | } | - | ||||||||||||||||||||||||
2092 | - | |||||||||||||||||||||||||
2093 | static int | - | ||||||||||||||||||||||||
2094 | ssl3_send_client_kex_ecdhe_ecx(SSL *s, SESS_CERT *sc, CBB *cbb) | - | ||||||||||||||||||||||||
2095 | { | - | ||||||||||||||||||||||||
2096 | uint8_t *public_key = | - | ||||||||||||||||||||||||
2097 | ((void *)0) | - | ||||||||||||||||||||||||
2098 | , *private_key = | - | ||||||||||||||||||||||||
2099 | ((void *)0) | - | ||||||||||||||||||||||||
2100 | , *shared_key = | - | ||||||||||||||||||||||||
2101 | ((void *)0) | - | ||||||||||||||||||||||||
2102 | ; | - | ||||||||||||||||||||||||
2103 | int ret = -1; | - | ||||||||||||||||||||||||
2104 | CBB ecpoint; | - | ||||||||||||||||||||||||
2105 | - | |||||||||||||||||||||||||
2106 | - | |||||||||||||||||||||||||
2107 | if ((
| 0-5 | ||||||||||||||||||||||||
2108 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
2109 | ) | - | ||||||||||||||||||||||||
2110 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2111 | if ((
| 0-5 | ||||||||||||||||||||||||
2112 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
2113 | ) | - | ||||||||||||||||||||||||
2114 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2115 | if ((
| 0-5 | ||||||||||||||||||||||||
2116 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
2117 | ) | - | ||||||||||||||||||||||||
2118 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2119 | X25519_keypair(public_key, private_key); | - | ||||||||||||||||||||||||
2120 | if (!X25519(shared_key, private_key, sc->peer_x25519_tmp)
| 0-5 | ||||||||||||||||||||||||
2121 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2122 | - | |||||||||||||||||||||||||
2123 | - | |||||||||||||||||||||||||
2124 | if (!CBB_add_u8_length_prefixed(cbb, &ecpoint)
| 0-5 | ||||||||||||||||||||||||
2125 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2126 | if (!CBB_add_bytes(&ecpoint, public_key, 32)
| 0-5 | ||||||||||||||||||||||||
2127 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2128 | if (!CBB_flush(cbb)
| 0-5 | ||||||||||||||||||||||||
2129 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2130 | - | |||||||||||||||||||||||||
2131 | - | |||||||||||||||||||||||||
2132 | s->session->master_key_length = | - | ||||||||||||||||||||||||
2133 | tls1_generate_master_secret(s, | - | ||||||||||||||||||||||||
2134 | s->session->master_key, shared_key, 32); | - | ||||||||||||||||||||||||
2135 | - | |||||||||||||||||||||||||
2136 | ret = 1; | - | ||||||||||||||||||||||||
2137 | - | |||||||||||||||||||||||||
2138 | err: code before this statement executed 5 times by 2 tests: err: Executed by:
| 5 | ||||||||||||||||||||||||
2139 | free(public_key); | - | ||||||||||||||||||||||||
2140 | freezero(private_key, 32); | - | ||||||||||||||||||||||||
2141 | freezero(shared_key, 32); | - | ||||||||||||||||||||||||
2142 | - | |||||||||||||||||||||||||
2143 | return executed 5 times by 2 tests: (ret);return (ret); Executed by:
executed 5 times by 2 tests: return (ret); Executed by:
| 5 | ||||||||||||||||||||||||
2144 | } | - | ||||||||||||||||||||||||
2145 | - | |||||||||||||||||||||||||
2146 | static int | - | ||||||||||||||||||||||||
2147 | ssl3_send_client_kex_ecdhe(SSL *s, SESS_CERT *sc, CBB *cbb) | - | ||||||||||||||||||||||||
2148 | { | - | ||||||||||||||||||||||||
2149 | if (sc->peer_x25519_tmp !=
| 5-23 | ||||||||||||||||||||||||
2150 | ((void *)0)
| 5-23 | ||||||||||||||||||||||||
2151 | ) { | - | ||||||||||||||||||||||||
2152 | if (ssl3_send_client_kex_ecdhe_ecx(s, sc, cbb) != 1
| 0-5 | ||||||||||||||||||||||||
2153 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2154 | } executed 5 times by 2 tests: else if (sc->peer_ecdh_tmp != end of block Executed by:
| 0-23 | ||||||||||||||||||||||||
2155 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
2156 | ) { | - | ||||||||||||||||||||||||
2157 | if (ssl3_send_client_kex_ecdhe_ecp(s, sc, cbb) != 1
| 0-23 | ||||||||||||||||||||||||
2158 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2159 | } executed 23 times by 1 test: else {end of block Executed by:
| 23 | ||||||||||||||||||||||||
2160 | ssl3_send_alert(s, 2, 40); | - | ||||||||||||||||||||||||
2161 | SSL_error_internal(s, (4|64), __FILE__, 2185); | - | ||||||||||||||||||||||||
2162 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2163 | } | - | ||||||||||||||||||||||||
2164 | - | |||||||||||||||||||||||||
2165 | return executed 28 times by 2 tests: (1);return (1); Executed by:
executed 28 times by 2 tests: return (1); Executed by:
| 28 | ||||||||||||||||||||||||
2166 | - | |||||||||||||||||||||||||
2167 | err: | - | ||||||||||||||||||||||||
2168 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
2169 | } | - | ||||||||||||||||||||||||
2170 | - | |||||||||||||||||||||||||
2171 | static int | - | ||||||||||||||||||||||||
2172 | ssl3_send_client_kex_gost(SSL *s, SESS_CERT *sess_cert, CBB *cbb) | - | ||||||||||||||||||||||||
2173 | { | - | ||||||||||||||||||||||||
2174 | unsigned char premaster_secret[32], shared_ukm[32], tmp[256]; | - | ||||||||||||||||||||||||
2175 | EVP_PKEY *pub_key = | - | ||||||||||||||||||||||||
2176 | ((void *)0) | - | ||||||||||||||||||||||||
2177 | ; | - | ||||||||||||||||||||||||
2178 | EVP_PKEY_CTX *pkey_ctx; | - | ||||||||||||||||||||||||
2179 | X509 *peer_cert; | - | ||||||||||||||||||||||||
2180 | size_t msglen; | - | ||||||||||||||||||||||||
2181 | unsigned int md_len; | - | ||||||||||||||||||||||||
2182 | EVP_MD_CTX *ukm_hash; | - | ||||||||||||||||||||||||
2183 | int ret = -1; | - | ||||||||||||||||||||||||
2184 | int nid; | - | ||||||||||||||||||||||||
2185 | CBB gostblob; | - | ||||||||||||||||||||||||
2186 | - | |||||||||||||||||||||||||
2187 | - | |||||||||||||||||||||||||
2188 | peer_cert = sess_cert->peer_pkeys[4].x509; | - | ||||||||||||||||||||||||
2189 | if (peer_cert ==
| 0 | ||||||||||||||||||||||||
2190 | ((void *)0)
| 0 | ||||||||||||||||||||||||
2191 | ) { | - | ||||||||||||||||||||||||
2192 | SSL_error_internal(s, 330, __FILE__, 2212); | - | ||||||||||||||||||||||||
2193 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2194 | } | - | ||||||||||||||||||||||||
2195 | - | |||||||||||||||||||||||||
2196 | pub_key = X509_get_pubkey(peer_cert); | - | ||||||||||||||||||||||||
2197 | pkey_ctx = EVP_PKEY_CTX_new(pub_key, | - | ||||||||||||||||||||||||
2198 | ((void *)0) | - | ||||||||||||||||||||||||
2199 | ); | - | ||||||||||||||||||||||||
2200 | - | |||||||||||||||||||||||||
2201 | - | |||||||||||||||||||||||||
2202 | - | |||||||||||||||||||||||||
2203 | - | |||||||||||||||||||||||||
2204 | - | |||||||||||||||||||||||||
2205 | - | |||||||||||||||||||||||||
2206 | EVP_PKEY_encrypt_init(pkey_ctx); | - | ||||||||||||||||||||||||
2207 | - | |||||||||||||||||||||||||
2208 | - | |||||||||||||||||||||||||
2209 | arc4random_buf(premaster_secret, 32); | - | ||||||||||||||||||||||||
2210 | - | |||||||||||||||||||||||||
2211 | - | |||||||||||||||||||||||||
2212 | - | |||||||||||||||||||||||||
2213 | - | |||||||||||||||||||||||||
2214 | if ((
| 0 | ||||||||||||||||||||||||
2215 | if (EVP_PKEY_derive_set_peer(pkey_ctx,
| 0 | ||||||||||||||||||||||||
2216 | s->cert->key->privatekey) <=0
| 0 | ||||||||||||||||||||||||
2217 | - | |||||||||||||||||||||||||
2218 | - | |||||||||||||||||||||||||
2219 | - | |||||||||||||||||||||||||
2220 | - | |||||||||||||||||||||||||
2221 | ERR_clear_error(); | - | ||||||||||||||||||||||||
2222 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2223 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2224 | - | |||||||||||||||||||||||||
2225 | - | |||||||||||||||||||||||||
2226 | - | |||||||||||||||||||||||||
2227 | - | |||||||||||||||||||||||||
2228 | ukm_hash = EVP_MD_CTX_new(); | - | ||||||||||||||||||||||||
2229 | if (ukm_hash ==
| 0 | ||||||||||||||||||||||||
2230 | ((void *)0)
| 0 | ||||||||||||||||||||||||
2231 | ) { | - | ||||||||||||||||||||||||
2232 | SSL_error_internal(s, (1|64), __FILE__, 2248); | - | ||||||||||||||||||||||||
2233 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2234 | } | - | ||||||||||||||||||||||||
2235 | - | |||||||||||||||||||||||||
2236 | if (ssl_get_algorithm2(s) & 0x040
| 0 | ||||||||||||||||||||||||
2237 | nid = 809; never executed: nid = 809; | 0 | ||||||||||||||||||||||||
2238 | else | - | ||||||||||||||||||||||||
2239 | nid = 941; never executed: nid = 941; | 0 | ||||||||||||||||||||||||
2240 | if (!EVP_DigestInit(ukm_hash, EVP_get_digestbyname(OBJ_nid2sn(nid)))
| 0 | ||||||||||||||||||||||||
2241 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2242 | EVP_DigestUpdate(ukm_hash, s->s3->client_random, 32); | - | ||||||||||||||||||||||||
2243 | EVP_DigestUpdate(ukm_hash, s->s3->server_random, 32); | - | ||||||||||||||||||||||||
2244 | EVP_DigestFinal_ex(ukm_hash, shared_ukm, &md_len); | - | ||||||||||||||||||||||||
2245 | EVP_MD_CTX_free(ukm_hash); | - | ||||||||||||||||||||||||
2246 | if (EVP_PKEY_CTX_ctrl(pkey_ctx, -1, (1<<8),
| 0 | ||||||||||||||||||||||||
2247 | 8, 8, shared_ukm) < 0
| 0 | ||||||||||||||||||||||||
2248 | SSL_error_internal(s, 274, __FILE__, 2264); | - | ||||||||||||||||||||||||
2249 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2250 | } | - | ||||||||||||||||||||||||
2251 | - | |||||||||||||||||||||||||
2252 | - | |||||||||||||||||||||||||
2253 | - | |||||||||||||||||||||||||
2254 | - | |||||||||||||||||||||||||
2255 | msglen = 255; | - | ||||||||||||||||||||||||
2256 | if (EVP_PKEY_encrypt(pkey_ctx, tmp, &msglen, premaster_secret,
| 0 | ||||||||||||||||||||||||
2257 | 32) < 0
| 0 | ||||||||||||||||||||||||
2258 | SSL_error_internal(s, 274, __FILE__, 2274); | - | ||||||||||||||||||||||||
2259 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2260 | } | - | ||||||||||||||||||||||||
2261 | - | |||||||||||||||||||||||||
2262 | if (!CBB_add_asn1(cbb, &gostblob, (0x00 | 0x20 | 0x10))
| 0 | ||||||||||||||||||||||||
2263 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2264 | if (!CBB_add_bytes(&gostblob, tmp, msglen)
| 0 | ||||||||||||||||||||||||
2265 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2266 | if (!CBB_flush(cbb)
| 0 | ||||||||||||||||||||||||
2267 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2268 | - | |||||||||||||||||||||||||
2269 | - | |||||||||||||||||||||||||
2270 | if (EVP_PKEY_CTX_ctrl(pkey_ctx, -1, -1, 2, 2,
| 0 | ||||||||||||||||||||||||
2271 |
| 0 | ||||||||||||||||||||||||
2272 | ((void *)0)
| 0 | ||||||||||||||||||||||||
2273 | ) > 0
| 0 | ||||||||||||||||||||||||
2274 | - | |||||||||||||||||||||||||
2275 | s->s3->flags |= 0x0010; | - | ||||||||||||||||||||||||
2276 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2277 | EVP_PKEY_CTX_free(pkey_ctx); | - | ||||||||||||||||||||||||
2278 | s->session->master_key_length = | - | ||||||||||||||||||||||||
2279 | tls1_generate_master_secret(s, | - | ||||||||||||||||||||||||
2280 | s->session->master_key, premaster_secret, 32); | - | ||||||||||||||||||||||||
2281 | - | |||||||||||||||||||||||||
2282 | ret = 1; | - | ||||||||||||||||||||||||
2283 | - | |||||||||||||||||||||||||
2284 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
2285 | explicit_bzero(premaster_secret, sizeof(premaster_secret)); | - | ||||||||||||||||||||||||
2286 | EVP_PKEY_free(pub_key); | - | ||||||||||||||||||||||||
2287 | - | |||||||||||||||||||||||||
2288 | return never executed: (ret);return (ret); never executed: return (ret); | 0 | ||||||||||||||||||||||||
2289 | } | - | ||||||||||||||||||||||||
2290 | - | |||||||||||||||||||||||||
2291 | int | - | ||||||||||||||||||||||||
2292 | ssl3_send_client_key_exchange(SSL *s) | - | ||||||||||||||||||||||||
2293 | { | - | ||||||||||||||||||||||||
2294 | SESS_CERT *sess_cert; | - | ||||||||||||||||||||||||
2295 | unsigned long alg_k; | - | ||||||||||||||||||||||||
2296 | CBB cbb, kex; | - | ||||||||||||||||||||||||
2297 | - | |||||||||||||||||||||||||
2298 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
2299 | - | |||||||||||||||||||||||||
2300 | if ((
| 0-63 | ||||||||||||||||||||||||
2301 | alg_k = (s->s3->internal)->hs.new_cipher->algorithm_mkey; | - | ||||||||||||||||||||||||
2302 | - | |||||||||||||||||||||||||
2303 | if ((
| 0-63 | ||||||||||||||||||||||||
2304 | ((void *)0)
| 0-63 | ||||||||||||||||||||||||
2305 | ) { | - | ||||||||||||||||||||||||
2306 | ssl3_send_alert(s, 2, | - | ||||||||||||||||||||||||
2307 | 10); | - | ||||||||||||||||||||||||
2308 | SSL_error_internal(s, (4|64), __FILE__, 2320); | - | ||||||||||||||||||||||||
2309 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2310 | } | - | ||||||||||||||||||||||||
2311 | - | |||||||||||||||||||||||||
2312 | if (!ssl3_handshake_msg_start(s, &cbb, &kex,
| 0-63 | ||||||||||||||||||||||||
2313 | 16)
| 0-63 | ||||||||||||||||||||||||
2314 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2315 | - | |||||||||||||||||||||||||
2316 | if (alg_k & 0x00000001L
| 14-49 | ||||||||||||||||||||||||
2317 | if (ssl3_send_client_kex_rsa(s, sess_cert, &kex) != 1
| 0-14 | ||||||||||||||||||||||||
2318 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2319 | } executed 14 times by 1 test: else if (alg_k & 0x00000008Lend of block Executed by:
| 14-28 | ||||||||||||||||||||||||
2320 | if (ssl3_send_client_kex_dhe(s, sess_cert, &kex) != 1
| 0-21 | ||||||||||||||||||||||||
2321 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2322 | } executed 21 times by 1 test: else if (alg_k & 0x00000080Lend of block Executed by:
| 0-28 | ||||||||||||||||||||||||
2323 | if (ssl3_send_client_kex_ecdhe(s, sess_cert, &kex) != 1
| 0-28 | ||||||||||||||||||||||||
2324 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2325 | } executed 28 times by 2 tests: else if (alg_k & 0x00000200Lend of block Executed by:
| 0-28 | ||||||||||||||||||||||||
2326 | if (ssl3_send_client_kex_gost(s, sess_cert, &kex) != 1
| 0 | ||||||||||||||||||||||||
2327 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2328 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2329 | ssl3_send_alert(s, 2, | - | ||||||||||||||||||||||||
2330 | 40); | - | ||||||||||||||||||||||||
2331 | SSL_error_internal(s, (4|64), __FILE__, 2343); | - | ||||||||||||||||||||||||
2332 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2333 | } | - | ||||||||||||||||||||||||
2334 | - | |||||||||||||||||||||||||
2335 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0-63 | ||||||||||||||||||||||||
2336 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2337 | - | |||||||||||||||||||||||||
2338 | (s->s3->internal)->hs.state = (0x181|0x1000); | - | ||||||||||||||||||||||||
2339 | } executed 63 times by 2 tests: end of block Executed by:
| 63 | ||||||||||||||||||||||||
2340 | - | |||||||||||||||||||||||||
2341 | - | |||||||||||||||||||||||||
2342 | return executed 63 times by 2 tests: (ssl3_handshake_write(s));return (ssl3_handshake_write(s)); Executed by:
executed 63 times by 2 tests: return (ssl3_handshake_write(s)); Executed by:
| 63 | ||||||||||||||||||||||||
2343 | - | |||||||||||||||||||||||||
2344 | err: | - | ||||||||||||||||||||||||
2345 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
2346 | - | |||||||||||||||||||||||||
2347 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
2348 | } | - | ||||||||||||||||||||||||
2349 | - | |||||||||||||||||||||||||
2350 | int | - | ||||||||||||||||||||||||
2351 | ssl3_send_client_verify(SSL *s) | - | ||||||||||||||||||||||||
2352 | { | - | ||||||||||||||||||||||||
2353 | CBB cbb, cert_verify, cbb_signature; | - | ||||||||||||||||||||||||
2354 | unsigned char data[16 + 20]; | - | ||||||||||||||||||||||||
2355 | unsigned char *signature = | - | ||||||||||||||||||||||||
2356 | ((void *)0) | - | ||||||||||||||||||||||||
2357 | ; | - | ||||||||||||||||||||||||
2358 | unsigned int signature_len; | - | ||||||||||||||||||||||||
2359 | EVP_PKEY_CTX *pctx = | - | ||||||||||||||||||||||||
2360 | ((void *)0) | - | ||||||||||||||||||||||||
2361 | ; | - | ||||||||||||||||||||||||
2362 | EVP_PKEY *pkey; | - | ||||||||||||||||||||||||
2363 | EVP_MD_CTX mctx; | - | ||||||||||||||||||||||||
2364 | const EVP_MD *md; | - | ||||||||||||||||||||||||
2365 | long hdatalen; | - | ||||||||||||||||||||||||
2366 | void *hdata; | - | ||||||||||||||||||||||||
2367 | - | |||||||||||||||||||||||||
2368 | EVP_MD_CTX_init(&mctx); | - | ||||||||||||||||||||||||
2369 | - | |||||||||||||||||||||||||
2370 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
2371 | - | |||||||||||||||||||||||||
2372 | if ((
| 0-7 | ||||||||||||||||||||||||
2373 | if (!ssl3_handshake_msg_start(s, &cbb, &cert_verify,
| 0-7 | ||||||||||||||||||||||||
2374 | 15)
| 0-7 | ||||||||||||||||||||||||
2375 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2376 | - | |||||||||||||||||||||||||
2377 | - | |||||||||||||||||||||||||
2378 | - | |||||||||||||||||||||||||
2379 | - | |||||||||||||||||||||||||
2380 | - | |||||||||||||||||||||||||
2381 | pkey = s->cert->key->privatekey; | - | ||||||||||||||||||||||||
2382 | pctx = EVP_PKEY_CTX_new(pkey, | - | ||||||||||||||||||||||||
2383 | ((void *)0) | - | ||||||||||||||||||||||||
2384 | ); | - | ||||||||||||||||||||||||
2385 | EVP_PKEY_sign_init(pctx); | - | ||||||||||||||||||||||||
2386 | - | |||||||||||||||||||||||||
2387 | - | |||||||||||||||||||||||||
2388 | if (EVP_PKEY_CTX_ctrl(pctx, -1, ((1<<3) | (1<<4) | (1<<5) | (1<<6) | (1<<7)), 1, 0, (void *)EVP_sha1()) <= 0
| 0-7 | ||||||||||||||||||||||||
2389 | ERR_clear_error(); never executed: ERR_clear_error(); | 0 | ||||||||||||||||||||||||
2390 | - | |||||||||||||||||||||||||
2391 | if ((
| 0-7 | ||||||||||||||||||||||||
2392 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
2393 | ) | - | ||||||||||||||||||||||||
2394 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2395 | - | |||||||||||||||||||||||||
2396 | if (!(s->method->internal->ssl3_enc->enc_flags & (1 << 1))
| 2-5 | ||||||||||||||||||||||||
2397 | if ((
| 0-2 | ||||||||||||||||||||||||
2398 | if (!tls1_digest_cached_records(s)
| 0 | ||||||||||||||||||||||||
2399 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2400 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2401 | if (!tls1_handshake_hash_value(s, data, sizeof(data),
| 0-2 | ||||||||||||||||||||||||
2402 |
| 0-2 | ||||||||||||||||||||||||
2403 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
2404 | )
| 0-2 | ||||||||||||||||||||||||
2405 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2406 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
2407 | - | |||||||||||||||||||||||||
2408 | - | |||||||||||||||||||||||||
2409 | - | |||||||||||||||||||||||||
2410 | - | |||||||||||||||||||||||||
2411 | - | |||||||||||||||||||||||||
2412 | if ((
| 2-5 | ||||||||||||||||||||||||
2413 | hdatalen = BIO_ctrl((s->s3->internal)->handshake_buffer,3,0,(char *)&hdata) | - | ||||||||||||||||||||||||
2414 | ; | - | ||||||||||||||||||||||||
2415 | md = s->cert->key->digest; | - | ||||||||||||||||||||||||
2416 | if (hdatalen <= 0
| 0-5 | ||||||||||||||||||||||||
2417 | !tls12_get_hashandsig(&cert_verify, pkey, md)
| 0-5 | ||||||||||||||||||||||||
2418 | SSL_error_internal(s, (4|64), __FILE__, 2420); | - | ||||||||||||||||||||||||
2419 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2420 | } | - | ||||||||||||||||||||||||
2421 | if (!EVP_DigestInit_ex(&mctx,md,
| 0-5 | ||||||||||||||||||||||||
2422 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
2423 | )
| 0-5 | ||||||||||||||||||||||||
2424 | !EVP_DigestUpdate(&mctx,hdata,hdatalen)
| 0-5 | ||||||||||||||||||||||||
2425 | !EVP_SignFinal(&mctx, signature, &signature_len,
| 0-5 | ||||||||||||||||||||||||
2426 | pkey)
| 0-5 | ||||||||||||||||||||||||
2427 | SSL_error_internal(s, 6, __FILE__, 2427); | - | ||||||||||||||||||||||||
2428 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2429 | } | - | ||||||||||||||||||||||||
2430 | if (!tls1_digest_cached_records(s)
| 0-5 | ||||||||||||||||||||||||
2431 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2432 | } executed 5 times by 1 test: else if (pkey->type == 6end of block Executed by:
| 0-5 | ||||||||||||||||||||||||
2433 | if (RSA_sign(114, data,
| 0-2 | ||||||||||||||||||||||||
2434 | 16 + 20, signature,
| 0-2 | ||||||||||||||||||||||||
2435 | &signature_len, pkey->pkey.rsa) <= 0
| 0-2 | ||||||||||||||||||||||||
2436 | SSL_error_internal(s, 4, __FILE__, 2436); | - | ||||||||||||||||||||||||
2437 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2438 | } | - | ||||||||||||||||||||||||
2439 | } executed 2 times by 1 test: else if (pkey->type == 408end of block Executed by:
| 0-2 | ||||||||||||||||||||||||
2440 | if (!ECDSA_sign(pkey->save_type,
| 0 | ||||||||||||||||||||||||
2441 | &data[16], 20,
| 0 | ||||||||||||||||||||||||
2442 | signature, &signature_len, pkey->pkey.ec)
| 0 | ||||||||||||||||||||||||
2443 | SSL_error_internal(s, 42, __FILE__, 2443); | - | ||||||||||||||||||||||||
2444 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2445 | } | - | ||||||||||||||||||||||||
2446 | - | |||||||||||||||||||||||||
2447 | } never executed: else if (pkey->type == 812end of block
| 0 | ||||||||||||||||||||||||
2448 | pkey->type == 811
| 0 | ||||||||||||||||||||||||
2449 | unsigned char signbuf[128]; | - | ||||||||||||||||||||||||
2450 | unsigned int u; | - | ||||||||||||||||||||||||
2451 | size_t sigsize; | - | ||||||||||||||||||||||||
2452 | int nid; | - | ||||||||||||||||||||||||
2453 | - | |||||||||||||||||||||||||
2454 | hdatalen = BIO_ctrl((s->s3->internal)->handshake_buffer,3,0,(char *)&hdata); | - | ||||||||||||||||||||||||
2455 | if (hdatalen <= 0
| 0 | ||||||||||||||||||||||||
2456 | SSL_error_internal(s, (4|64), __FILE__, 2456); | - | ||||||||||||||||||||||||
2457 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2458 | } | - | ||||||||||||||||||||||||
2459 | if (!EVP_PKEY_get_default_digest_nid(pkey, &nid)
| 0 | ||||||||||||||||||||||||
2460 | !(md = EVP_get_digestbyname(OBJ_nid2sn(nid)))
| 0 | ||||||||||||||||||||||||
2461 | SSL_error_internal(s, 6, __FILE__, 2461); | - | ||||||||||||||||||||||||
2462 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2463 | } | - | ||||||||||||||||||||||||
2464 | if (!EVP_DigestInit_ex(&mctx, md,
| 0 | ||||||||||||||||||||||||
2465 | ((void *)0)
| 0 | ||||||||||||||||||||||||
2466 | )
| 0 | ||||||||||||||||||||||||
2467 | !EVP_DigestUpdate(&mctx, hdata, hdatalen)
| 0 | ||||||||||||||||||||||||
2468 | !EVP_DigestFinal(&mctx, signbuf, &u)
| 0 | ||||||||||||||||||||||||
2469 | (
| 0 | ||||||||||||||||||||||||
2470 | (
| 0 | ||||||||||||||||||||||||
2471 | (0x1000 +2),
| 0 | ||||||||||||||||||||||||
2472 | 1,
| 0 | ||||||||||||||||||||||||
2473 | ((void *)0)
| 0 | ||||||||||||||||||||||||
2474 | ) <= 0)
| 0 | ||||||||||||||||||||||||
2475 | (
| 0 | ||||||||||||||||||||||||
2476 | signbuf, u) <= 0)
| 0 | ||||||||||||||||||||||||
2477 | SSL_error_internal(s, 6, __FILE__, 2473); | - | ||||||||||||||||||||||||
2478 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2479 | } | - | ||||||||||||||||||||||||
2480 | if (sigsize >
| 0 | ||||||||||||||||||||||||
2481 | (0x7fffffff * 2U + 1U)
| 0 | ||||||||||||||||||||||||
2482 | ) | - | ||||||||||||||||||||||||
2483 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2484 | signature_len = sigsize; | - | ||||||||||||||||||||||||
2485 | if (!tls1_digest_cached_records(s)
| 0 | ||||||||||||||||||||||||
2486 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2487 | - | |||||||||||||||||||||||||
2488 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
2489 | SSL_error_internal(s, (4|64), __FILE__, 2483); | - | ||||||||||||||||||||||||
2490 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2491 | } | - | ||||||||||||||||||||||||
2492 | - | |||||||||||||||||||||||||
2493 | if (!CBB_add_u16_length_prefixed(&cert_verify, &cbb_signature)
| 0-7 | ||||||||||||||||||||||||
2494 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2495 | if (!CBB_add_bytes(&cbb_signature, signature, signature_len)
| 0-7 | ||||||||||||||||||||||||
2496 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2497 | - | |||||||||||||||||||||||||
2498 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0-7 | ||||||||||||||||||||||||
2499 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2500 | - | |||||||||||||||||||||||||
2501 | (s->s3->internal)->hs.state = (0x191|0x1000); | - | ||||||||||||||||||||||||
2502 | } executed 7 times by 1 test: end of block Executed by:
| 7 | ||||||||||||||||||||||||
2503 | - | |||||||||||||||||||||||||
2504 | EVP_MD_CTX_cleanup(&mctx); | - | ||||||||||||||||||||||||
2505 | EVP_PKEY_CTX_free(pctx); | - | ||||||||||||||||||||||||
2506 | free(signature); | - | ||||||||||||||||||||||||
2507 | - | |||||||||||||||||||||||||
2508 | return executed 7 times by 1 test: (ssl3_handshake_write(s));return (ssl3_handshake_write(s)); Executed by:
executed 7 times by 1 test: return (ssl3_handshake_write(s)); Executed by:
| 7 | ||||||||||||||||||||||||
2509 | - | |||||||||||||||||||||||||
2510 | err: | - | ||||||||||||||||||||||||
2511 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
2512 | EVP_MD_CTX_cleanup(&mctx); | - | ||||||||||||||||||||||||
2513 | EVP_PKEY_CTX_free(pctx); | - | ||||||||||||||||||||||||
2514 | free(signature); | - | ||||||||||||||||||||||||
2515 | - | |||||||||||||||||||||||||
2516 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
2517 | } | - | ||||||||||||||||||||||||
2518 | - | |||||||||||||||||||||||||
2519 | int | - | ||||||||||||||||||||||||
2520 | ssl3_send_client_certificate(SSL *s) | - | ||||||||||||||||||||||||
2521 | { | - | ||||||||||||||||||||||||
2522 | EVP_PKEY *pkey = | - | ||||||||||||||||||||||||
2523 | ((void *)0) | - | ||||||||||||||||||||||||
2524 | ; | - | ||||||||||||||||||||||||
2525 | X509 *x509 = | - | ||||||||||||||||||||||||
2526 | ((void *)0) | - | ||||||||||||||||||||||||
2527 | ; | - | ||||||||||||||||||||||||
2528 | CBB cbb, client_cert; | - | ||||||||||||||||||||||||
2529 | int i; | - | ||||||||||||||||||||||||
2530 | - | |||||||||||||||||||||||||
2531 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
2532 | - | |||||||||||||||||||||||||
2533 | if ((
| 0-7 | ||||||||||||||||||||||||
2534 | if ((
| 0-7 | ||||||||||||||||||||||||
2535 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
2536 | )
| 0-7 | ||||||||||||||||||||||||
2537 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
2538 | )
| 0-7 | ||||||||||||||||||||||||
2539 | (
| 0-7 | ||||||||||||||||||||||||
2540 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
2541 | )
| 0-7 | ||||||||||||||||||||||||
2542 | ( never executed: s->s3->internal)->hs.state = (0x171|0x1000);(s->s3->internal)->hs.state = (0x171|0x1000); never executed: (s->s3->internal)->hs.state = (0x171|0x1000); | 0 | ||||||||||||||||||||||||
2543 | else | - | ||||||||||||||||||||||||
2544 | ( executed 7 times by 1 test: s->s3->internal)->hs.state = (0x172|0x1000);(s->s3->internal)->hs.state = (0x172|0x1000); Executed by:
executed 7 times by 1 test: (s->s3->internal)->hs.state = (0x172|0x1000); Executed by:
| 7 | ||||||||||||||||||||||||
2545 | } | - | ||||||||||||||||||||||||
2546 | - | |||||||||||||||||||||||||
2547 | - | |||||||||||||||||||||||||
2548 | if ((
| 0-7 | ||||||||||||||||||||||||
2549 | - | |||||||||||||||||||||||||
2550 | - | |||||||||||||||||||||||||
2551 | - | |||||||||||||||||||||||||
2552 | - | |||||||||||||||||||||||||
2553 | - | |||||||||||||||||||||||||
2554 | i = ssl_do_client_cert_cb(s, &x509, &pkey); | - | ||||||||||||||||||||||||
2555 | if (i < 0
| 0 | ||||||||||||||||||||||||
2556 | s->internal->rwstate = 4; | - | ||||||||||||||||||||||||
2557 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
2558 | } | - | ||||||||||||||||||||||||
2559 | s->internal->rwstate = 1; | - | ||||||||||||||||||||||||
2560 | if ((
| 0 | ||||||||||||||||||||||||
2561 | ((void *)0)
| 0 | ||||||||||||||||||||||||
2562 | )
| 0 | ||||||||||||||||||||||||
2563 | ((void *)0)
| 0 | ||||||||||||||||||||||||
2564 | )
| 0 | ||||||||||||||||||||||||
2565 | (s->s3->internal)->hs.state = (0x171|0x1000); | - | ||||||||||||||||||||||||
2566 | if (!SSL_use_certificate(s, x509)
| 0 | ||||||||||||||||||||||||
2567 | !SSL_use_PrivateKey(s, pkey)
| 0 | ||||||||||||||||||||||||
2568 | i = 0; never executed: i = 0; | 0 | ||||||||||||||||||||||||
2569 | } never executed: else if (i == 1end of block
| 0 | ||||||||||||||||||||||||
2570 | i = 0; | - | ||||||||||||||||||||||||
2571 | SSL_error_internal(s, 106, __FILE__, 2551); | - | ||||||||||||||||||||||||
2572 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2573 | - | |||||||||||||||||||||||||
2574 | X509_free(x509); | - | ||||||||||||||||||||||||
2575 | EVP_PKEY_free(pkey); | - | ||||||||||||||||||||||||
2576 | if (i == 0
| 0 | ||||||||||||||||||||||||
2577 | ( never executed: s->s3->internal)->tmp.cert_req = 2;(s->s3->internal)->tmp.cert_req = 2; never executed: (s->s3->internal)->tmp.cert_req = 2; | 0 | ||||||||||||||||||||||||
2578 | - | |||||||||||||||||||||||||
2579 | - | |||||||||||||||||||||||||
2580 | (s->s3->internal)->hs.state = (0x172|0x1000); | - | ||||||||||||||||||||||||
2581 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2582 | - | |||||||||||||||||||||||||
2583 | if ((
| 0-7 | ||||||||||||||||||||||||
2584 | if (!ssl3_handshake_msg_start(s, &cbb, &client_cert,
| 0-7 | ||||||||||||||||||||||||
2585 | 11)
| 0-7 | ||||||||||||||||||||||||
2586 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2587 | if (!ssl3_output_cert_chain(s, &client_cert,
| 0-7 | ||||||||||||||||||||||||
2588 | ((s->s3->internal)->tmp.cert_req == 2) ?
| 0-7 | ||||||||||||||||||||||||
2589 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
2590 | : s->cert->key->x509)
| 0-7 | ||||||||||||||||||||||||
2591 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2592 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0-7 | ||||||||||||||||||||||||
2593 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2594 | - | |||||||||||||||||||||||||
2595 | (s->s3->internal)->hs.state = (0x173|0x1000); | - | ||||||||||||||||||||||||
2596 | } executed 7 times by 1 test: end of block Executed by:
| 7 | ||||||||||||||||||||||||
2597 | - | |||||||||||||||||||||||||
2598 | - | |||||||||||||||||||||||||
2599 | return executed 7 times by 1 test: (ssl3_handshake_write(s));return (ssl3_handshake_write(s)); Executed by:
executed 7 times by 1 test: return (ssl3_handshake_write(s)); Executed by:
| 7 | ||||||||||||||||||||||||
2600 | - | |||||||||||||||||||||||||
2601 | err: | - | ||||||||||||||||||||||||
2602 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
2603 | - | |||||||||||||||||||||||||
2604 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
2605 | } | - | ||||||||||||||||||||||||
2606 | - | |||||||||||||||||||||||||
2607 | - | |||||||||||||||||||||||||
2608 | - | |||||||||||||||||||||||||
2609 | int | - | ||||||||||||||||||||||||
2610 | ssl3_check_cert_and_algorithm(SSL *s) | - | ||||||||||||||||||||||||
2611 | { | - | ||||||||||||||||||||||||
2612 | int i, idx; | - | ||||||||||||||||||||||||
2613 | long alg_k, alg_a; | - | ||||||||||||||||||||||||
2614 | EVP_PKEY *pkey = | - | ||||||||||||||||||||||||
2615 | ((void *)0) | - | ||||||||||||||||||||||||
2616 | ; | - | ||||||||||||||||||||||||
2617 | SESS_CERT *sc; | - | ||||||||||||||||||||||||
2618 | DH *dh; | - | ||||||||||||||||||||||||
2619 | - | |||||||||||||||||||||||||
2620 | alg_k = (s->s3->internal)->hs.new_cipher->algorithm_mkey; | - | ||||||||||||||||||||||||
2621 | alg_a = (s->s3->internal)->hs.new_cipher->algorithm_auth; | - | ||||||||||||||||||||||||
2622 | - | |||||||||||||||||||||||||
2623 | - | |||||||||||||||||||||||||
2624 | if (alg_a & 0x00000004L
| 10-53 | ||||||||||||||||||||||||
2625 | return executed 10 times by 1 test: (1);return (1); Executed by:
executed 10 times by 1 test: return (1); Executed by:
| 10 | ||||||||||||||||||||||||
2626 | - | |||||||||||||||||||||||||
2627 | sc = (s->session->internal)->sess_cert; | - | ||||||||||||||||||||||||
2628 | if (sc ==
| 0-53 | ||||||||||||||||||||||||
2629 | ((void *)0)
| 0-53 | ||||||||||||||||||||||||
2630 | ) { | - | ||||||||||||||||||||||||
2631 | SSL_error_internal(s, (4|64), __FILE__, 2605); | - | ||||||||||||||||||||||||
2632 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
2633 | } | - | ||||||||||||||||||||||||
2634 | dh = (s->session->internal)->sess_cert->peer_dh_tmp; | - | ||||||||||||||||||||||||
2635 | - | |||||||||||||||||||||||||
2636 | - | |||||||||||||||||||||||||
2637 | - | |||||||||||||||||||||||||
2638 | idx = sc->peer_cert_type; | - | ||||||||||||||||||||||||
2639 | if (idx == 3
| 0-53 | ||||||||||||||||||||||||
2640 | if (ssl_check_srvr_ecc_cert_and_alg(
| 0 | ||||||||||||||||||||||||
2641 | sc->peer_pkeys[idx].x509, s) == 0
| 0 | ||||||||||||||||||||||||
2642 | - | |||||||||||||||||||||||||
2643 | SSL_error_internal(s, 304, __FILE__, 2617); | - | ||||||||||||||||||||||||
2644 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
2645 | } else { | - | ||||||||||||||||||||||||
2646 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
2647 | } | - | ||||||||||||||||||||||||
2648 | } | - | ||||||||||||||||||||||||
2649 | pkey = X509_get_pubkey(sc->peer_pkeys[idx].x509); | - | ||||||||||||||||||||||||
2650 | i = X509_certificate_type(sc->peer_pkeys[idx].x509, pkey); | - | ||||||||||||||||||||||||
2651 | EVP_PKEY_free(pkey); | - | ||||||||||||||||||||||||
2652 | - | |||||||||||||||||||||||||
2653 | - | |||||||||||||||||||||||||
2654 | if ((
| 0-53 | ||||||||||||||||||||||||
2655 | SSL_error_internal(s, 170, __FILE__, 2629); | - | ||||||||||||||||||||||||
2656 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
2657 | } | - | ||||||||||||||||||||||||
2658 | if ((
| 0-39 | ||||||||||||||||||||||||
2659 | SSL_error_internal(s, 169, __FILE__, 2633); | - | ||||||||||||||||||||||||
2660 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
2661 | } | - | ||||||||||||||||||||||||
2662 | if ((
| 11-42 | ||||||||||||||||||||||||
2663 | !((((
| 0-11 | ||||||||||||||||||||||||
2664 | ((void *)0)
| 0-11 | ||||||||||||||||||||||||
2665 | )
| 0-11 | ||||||||||||||||||||||||
2666 | SSL_error_internal(s, 163, __FILE__, 2638); | - | ||||||||||||||||||||||||
2667 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
2668 | } | - | ||||||||||||||||||||||||
2669 | - | |||||||||||||||||||||||||
2670 | return executed 53 times by 2 tests: (1);return (1); Executed by:
executed 53 times by 2 tests: return (1); Executed by:
| 53 | ||||||||||||||||||||||||
2671 | f_err: | - | ||||||||||||||||||||||||
2672 | ssl3_send_alert(s, 2, 40); | - | ||||||||||||||||||||||||
2673 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
2674 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
2675 | } | - | ||||||||||||||||||||||||
2676 | - | |||||||||||||||||||||||||
2677 | - | |||||||||||||||||||||||||
2678 | - | |||||||||||||||||||||||||
2679 | - | |||||||||||||||||||||||||
2680 | - | |||||||||||||||||||||||||
2681 | - | |||||||||||||||||||||||||
2682 | - | |||||||||||||||||||||||||
2683 | int | - | ||||||||||||||||||||||||
2684 | ssl3_check_finished(SSL *s) | - | ||||||||||||||||||||||||
2685 | { | - | ||||||||||||||||||||||||
2686 | int ok; | - | ||||||||||||||||||||||||
2687 | long n; | - | ||||||||||||||||||||||||
2688 | - | |||||||||||||||||||||||||
2689 | - | |||||||||||||||||||||||||
2690 | if (!s->session->tlsext_tick
| 0-225 | ||||||||||||||||||||||||
2691 | return executed 225 times by 2 tests: (1);return (1); Executed by:
executed 225 times by 2 tests: return (1); Executed by:
| 225 | ||||||||||||||||||||||||
2692 | - | |||||||||||||||||||||||||
2693 | - | |||||||||||||||||||||||||
2694 | n = s->method->internal->ssl_get_message(s, (0x130|0x1000), | - | ||||||||||||||||||||||||
2695 | (0x131|0x1000), -1, s->internal->max_cert_list, &ok); | - | ||||||||||||||||||||||||
2696 | if (!ok
| 0 | ||||||||||||||||||||||||
2697 | return never executed: ((int)n);return ((int)n); never executed: return ((int)n); | 0 | ||||||||||||||||||||||||
2698 | (s->s3->internal)->tmp.reuse_message = 1; | - | ||||||||||||||||||||||||
2699 | if (((
| 0 | ||||||||||||||||||||||||
2700 | ((
| 0 | ||||||||||||||||||||||||
2701 | return never executed: (2);return (2); never executed: return (2); | 0 | ||||||||||||||||||||||||
2702 | - | |||||||||||||||||||||||||
2703 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
2704 | } | - | ||||||||||||||||||||||||
2705 | - | |||||||||||||||||||||||||
2706 | int | - | ||||||||||||||||||||||||
2707 | ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey) | - | ||||||||||||||||||||||||
2708 | { | - | ||||||||||||||||||||||||
2709 | int i = 0; | - | ||||||||||||||||||||||||
2710 | - | |||||||||||||||||||||||||
2711 | - | |||||||||||||||||||||||||
2712 | if (s->ctx->internal->client_cert_engine
| 0 | ||||||||||||||||||||||||
2713 | i = ENGINE_load_ssl_client_cert( | - | ||||||||||||||||||||||||
2714 | s->ctx->internal->client_cert_engine, s, | - | ||||||||||||||||||||||||
2715 | SSL_get_client_CA_list(s), px509, ppkey, | - | ||||||||||||||||||||||||
2716 | ((void *)0) | - | ||||||||||||||||||||||||
2717 | , | - | ||||||||||||||||||||||||
2718 | ((void *)0) | - | ||||||||||||||||||||||||
2719 | , | - | ||||||||||||||||||||||||
2720 | ((void *)0) | - | ||||||||||||||||||||||||
2721 | ); | - | ||||||||||||||||||||||||
2722 | if (i != 0
| 0 | ||||||||||||||||||||||||
2723 | return never executed: (i);return (i); never executed: return (i); | 0 | ||||||||||||||||||||||||
2724 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2725 | - | |||||||||||||||||||||||||
2726 | if (s->ctx->internal->client_cert_cb
| 0 | ||||||||||||||||||||||||
2727 | i = s->ctx->internal->client_cert_cb(s, px509, ppkey); never executed: i = s->ctx->internal->client_cert_cb(s, px509, ppkey); | 0 | ||||||||||||||||||||||||
2728 | return never executed: (i);return (i); never executed: return (i); | 0 | ||||||||||||||||||||||||
2729 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |