Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/ssl/d1_pkt.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||
9 | static int do_dtls1_write(SSL *s, int type, const unsigned char *buf, | - | ||||||||||||||||||||||||
10 | unsigned int len); | - | ||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||
14 | static int | - | ||||||||||||||||||||||||
15 | satsub64be(const unsigned char *v1, const unsigned char *v2) | - | ||||||||||||||||||||||||
16 | { | - | ||||||||||||||||||||||||
17 | int ret, sat, brw, i; | - | ||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||
19 | if (sizeof(long) == 8
| 0-306 | ||||||||||||||||||||||||
20 | do { | - | ||||||||||||||||||||||||
21 | long l; | - | ||||||||||||||||||||||||
22 | - | |||||||||||||||||||||||||
23 | if ( | - | ||||||||||||||||||||||||
24 | 1234
| 0-306 | ||||||||||||||||||||||||
25 | ==
| 0-306 | ||||||||||||||||||||||||
26 | 1234
| 0-306 | ||||||||||||||||||||||||
27 | ) | - | ||||||||||||||||||||||||
28 | break; executed 306 times by 1 test: break; Executed by:
| 306 | ||||||||||||||||||||||||
29 | - | |||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||
32 | if (((
| 0 | ||||||||||||||||||||||||
33 | break; never executed: break; | 0 | ||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||
35 | l = *((long *)v1); | - | ||||||||||||||||||||||||
36 | l -= *((long *)v2); | - | ||||||||||||||||||||||||
37 | if (l > 128
| 0 | ||||||||||||||||||||||||
38 | return never executed: 128;return 128; never executed: return 128; | 0 | ||||||||||||||||||||||||
39 | else if (l<-128
| 0 | ||||||||||||||||||||||||
40 | return never executed: -128;return -128; never executed: return -128; | 0 | ||||||||||||||||||||||||
41 | else | - | ||||||||||||||||||||||||
42 | return never executed: (int)l;return (int)l; never executed: return (int)l; | 0 | ||||||||||||||||||||||||
43 | } never executed: while (0);end of block | 0 | ||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||
45 | ret = (int)v1[7] - (int)v2[7]; | - | ||||||||||||||||||||||||
46 | sat = 0; | - | ||||||||||||||||||||||||
47 | brw = ret >> 8; | - | ||||||||||||||||||||||||
48 | if (ret & 0x80
| 0-306 | ||||||||||||||||||||||||
49 | for (i = 6; i >= 0
| 0 | ||||||||||||||||||||||||
50 | brw += (int)v1[i]-(int)v2[i]; | - | ||||||||||||||||||||||||
51 | sat |= ~brw; | - | ||||||||||||||||||||||||
52 | brw >>= 8; | - | ||||||||||||||||||||||||
53 | } never executed: end of block | 0 | ||||||||||||||||||||||||
54 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
55 | for (i = 6; i >= 0
| 306-2142 | ||||||||||||||||||||||||
56 | brw += (int)v1[i]-(int)v2[i]; | - | ||||||||||||||||||||||||
57 | sat |= brw; | - | ||||||||||||||||||||||||
58 | brw >>= 8; | - | ||||||||||||||||||||||||
59 | } executed 2142 times by 1 test: end of block Executed by:
| 2142 | ||||||||||||||||||||||||
60 | } executed 306 times by 1 test: end of block Executed by:
| 306 | ||||||||||||||||||||||||
61 | brw <<= 8; | - | ||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||
63 | if (sat & 0xff
| 0-306 | ||||||||||||||||||||||||
64 | return never executed: brw | 0x80;return brw | 0x80; never executed: return brw | 0x80; | 0 | ||||||||||||||||||||||||
65 | else | - | ||||||||||||||||||||||||
66 | return executed 306 times by 1 test: brw + (ret & 0xFF);return brw + (ret & 0xFF); Executed by:
executed 306 times by 1 test: return brw + (ret & 0xFF); Executed by:
| 306 | ||||||||||||||||||||||||
67 | } | - | ||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||
69 | static int have_handshake_fragment(SSL *s, int type, unsigned char *buf, | - | ||||||||||||||||||||||||
70 | int len, int peek); | - | ||||||||||||||||||||||||
71 | static int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap); | - | ||||||||||||||||||||||||
72 | static void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap); | - | ||||||||||||||||||||||||
73 | static DTLS1_BITMAP *dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr, | - | ||||||||||||||||||||||||
74 | unsigned int *is_next_epoch); | - | ||||||||||||||||||||||||
75 | static int dtls1_buffer_record(SSL *s, record_pqueue *q, | - | ||||||||||||||||||||||||
76 | unsigned char *priority); | - | ||||||||||||||||||||||||
77 | static int dtls1_process_record(SSL *s); | - | ||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||
80 | static int | - | ||||||||||||||||||||||||
81 | dtls1_copy_record(SSL *s, pitem *item) | - | ||||||||||||||||||||||||
82 | { | - | ||||||||||||||||||||||||
83 | DTLS1_RECORD_DATA *rdata; | - | ||||||||||||||||||||||||
84 | - | |||||||||||||||||||||||||
85 | rdata = (DTLS1_RECORD_DATA *)item->data; | - | ||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||
87 | free(s->s3->rbuf.buf); | - | ||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||
89 | s->internal->packet = rdata->packet; | - | ||||||||||||||||||||||||
90 | s->internal->packet_length = rdata->packet_length; | - | ||||||||||||||||||||||||
91 | memcpy(&(s->s3->rbuf), &(rdata->rbuf), sizeof(SSL3_BUFFER)); | - | ||||||||||||||||||||||||
92 | memcpy(&((s->s3->internal)->rrec), &(rdata->rrec), sizeof(SSL3_RECORD)); | - | ||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||
94 | - | |||||||||||||||||||||||||
95 | memcpy(&((s->s3->internal)->read_sequence[2]), &(rdata->packet[5]), 6); | - | ||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||
97 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
98 | } | - | ||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | - | |||||||||||||||||||||||||
101 | static int | - | ||||||||||||||||||||||||
102 | dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) | - | ||||||||||||||||||||||||
103 | { | - | ||||||||||||||||||||||||
104 | DTLS1_RECORD_DATA *rdata; | - | ||||||||||||||||||||||||
105 | pitem *item; | - | ||||||||||||||||||||||||
106 | - | |||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||
108 | if (pqueue_size(queue->q) >= 100
| 0 | ||||||||||||||||||||||||
109 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
110 | - | |||||||||||||||||||||||||
111 | rdata = malloc(sizeof(DTLS1_RECORD_DATA)); | - | ||||||||||||||||||||||||
112 | item = pitem_new(priority, rdata); | - | ||||||||||||||||||||||||
113 | if (rdata ==
| 0 | ||||||||||||||||||||||||
114 | ((void *)0)
| 0 | ||||||||||||||||||||||||
115 | || item ==
| 0 | ||||||||||||||||||||||||
116 | ((void *)0)
| 0 | ||||||||||||||||||||||||
117 | ) | - | ||||||||||||||||||||||||
118 | goto never executed: init_err;goto init_err; never executed: goto init_err; | 0 | ||||||||||||||||||||||||
119 | - | |||||||||||||||||||||||||
120 | rdata->packet = s->internal->packet; | - | ||||||||||||||||||||||||
121 | rdata->packet_length = s->internal->packet_length; | - | ||||||||||||||||||||||||
122 | memcpy(&(rdata->rbuf), &(s->s3->rbuf), sizeof(SSL3_BUFFER)); | - | ||||||||||||||||||||||||
123 | memcpy(&(rdata->rrec), &((s->s3->internal)->rrec), sizeof(SSL3_RECORD)); | - | ||||||||||||||||||||||||
124 | - | |||||||||||||||||||||||||
125 | item->data = rdata; | - | ||||||||||||||||||||||||
126 | - | |||||||||||||||||||||||||
127 | - | |||||||||||||||||||||||||
128 | s->internal->packet = | - | ||||||||||||||||||||||||
129 | ((void *)0) | - | ||||||||||||||||||||||||
130 | ; | - | ||||||||||||||||||||||||
131 | s->internal->packet_length = 0; | - | ||||||||||||||||||||||||
132 | memset(&(s->s3->rbuf), 0, sizeof(SSL3_BUFFER)); | - | ||||||||||||||||||||||||
133 | memset(&((s->s3->internal)->rrec), 0, sizeof(SSL3_RECORD)); | - | ||||||||||||||||||||||||
134 | - | |||||||||||||||||||||||||
135 | if (!ssl3_setup_buffers(s)
| 0 | ||||||||||||||||||||||||
136 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
137 | - | |||||||||||||||||||||||||
138 | - | |||||||||||||||||||||||||
139 | if (pqueue_insert(queue->q, item) ==
| 0 | ||||||||||||||||||||||||
140 | ((void *)0)
| 0 | ||||||||||||||||||||||||
141 | ) | - | ||||||||||||||||||||||||
142 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||
144 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||
146 | err: | - | ||||||||||||||||||||||||
147 | free(rdata->rbuf.buf); | - | ||||||||||||||||||||||||
148 | - | |||||||||||||||||||||||||
149 | init_err: code before this statement never executed: init_err: | 0 | ||||||||||||||||||||||||
150 | SSL_error_internal(s, (4|64), __FILE__, 258); | - | ||||||||||||||||||||||||
151 | free(rdata); | - | ||||||||||||||||||||||||
152 | pitem_free(item); | - | ||||||||||||||||||||||||
153 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
154 | } | - | ||||||||||||||||||||||||
155 | - | |||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||
157 | static int | - | ||||||||||||||||||||||||
158 | dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue) | - | ||||||||||||||||||||||||
159 | { | - | ||||||||||||||||||||||||
160 | pitem *item; | - | ||||||||||||||||||||||||
161 | - | |||||||||||||||||||||||||
162 | item = pqueue_pop(queue->q); | - | ||||||||||||||||||||||||
163 | if (item
| 0-198 | ||||||||||||||||||||||||
164 | dtls1_copy_record(s, item); | - | ||||||||||||||||||||||||
165 | - | |||||||||||||||||||||||||
166 | free(item->data); | - | ||||||||||||||||||||||||
167 | pitem_free(item); | - | ||||||||||||||||||||||||
168 | - | |||||||||||||||||||||||||
169 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
170 | } | - | ||||||||||||||||||||||||
171 | - | |||||||||||||||||||||||||
172 | return executed 198 times by 2 tests: (0);return (0); Executed by:
executed 198 times by 2 tests: return (0); Executed by:
| 198 | ||||||||||||||||||||||||
173 | } | - | ||||||||||||||||||||||||
174 | static int | - | ||||||||||||||||||||||||
175 | dtls1_process_buffered_records(SSL *s) | - | ||||||||||||||||||||||||
176 | { | - | ||||||||||||||||||||||||
177 | pitem *item; | - | ||||||||||||||||||||||||
178 | - | |||||||||||||||||||||||||
179 | item = pqueue_peek((s->d1->internal)->unprocessed_rcds.q); | - | ||||||||||||||||||||||||
180 | if (item
| 0-198 | ||||||||||||||||||||||||
181 | - | |||||||||||||||||||||||||
182 | if ((
| 0 | ||||||||||||||||||||||||
183 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
184 | - | |||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||
186 | - | |||||||||||||||||||||||||
187 | while (pqueue_peek((s->d1->internal)->unprocessed_rcds.q)
| 0 | ||||||||||||||||||||||||
188 | dtls1_retrieve_buffered_record((s), &(((s->d1->internal))->unprocessed_rcds)); | - | ||||||||||||||||||||||||
189 | if (! dtls1_process_record(s)
| 0 | ||||||||||||||||||||||||
190 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
191 | if (dtls1_buffer_record(s, &((s->d1->internal)->processed_rcds),
| 0 | ||||||||||||||||||||||||
192 | (s->s3->internal)->rrec.seq_num) < 0
| 0 | ||||||||||||||||||||||||
193 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
194 | } never executed: end of block | 0 | ||||||||||||||||||||||||
195 | } never executed: end of block | 0 | ||||||||||||||||||||||||
196 | - | |||||||||||||||||||||||||
197 | - | |||||||||||||||||||||||||
198 | - | |||||||||||||||||||||||||
199 | (s->d1->internal)->processed_rcds.epoch = (s->d1->internal)->r_epoch; | - | ||||||||||||||||||||||||
200 | (s->d1->internal)->unprocessed_rcds.epoch = (s->d1->internal)->r_epoch + 1; | - | ||||||||||||||||||||||||
201 | - | |||||||||||||||||||||||||
202 | return executed 198 times by 2 tests: (1);return (1); Executed by:
executed 198 times by 2 tests: return (1); Executed by:
| 198 | ||||||||||||||||||||||||
203 | } | - | ||||||||||||||||||||||||
204 | - | |||||||||||||||||||||||||
205 | static int | - | ||||||||||||||||||||||||
206 | dtls1_process_record(SSL *s) | - | ||||||||||||||||||||||||
207 | { | - | ||||||||||||||||||||||||
208 | int i, al; | - | ||||||||||||||||||||||||
209 | int enc_err; | - | ||||||||||||||||||||||||
210 | SSL_SESSION *sess; | - | ||||||||||||||||||||||||
211 | SSL3_RECORD *rr; | - | ||||||||||||||||||||||||
212 | unsigned int mac_size, orig_len; | - | ||||||||||||||||||||||||
213 | unsigned char md[64]; | - | ||||||||||||||||||||||||
214 | - | |||||||||||||||||||||||||
215 | rr = &((s->s3->internal)->rrec); | - | ||||||||||||||||||||||||
216 | sess = s->session; | - | ||||||||||||||||||||||||
217 | - | |||||||||||||||||||||||||
218 | - | |||||||||||||||||||||||||
219 | - | |||||||||||||||||||||||||
220 | - | |||||||||||||||||||||||||
221 | rr->input = &(s->internal->packet[13]); | - | ||||||||||||||||||||||||
222 | if (rr->length > ((256 + 64)+16384)
| 0-153 | ||||||||||||||||||||||||
223 | al = 22; | - | ||||||||||||||||||||||||
224 | SSL_error_internal(s, 150, __FILE__, 357); | - | ||||||||||||||||||||||||
225 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
226 | } | - | ||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||
228 | - | |||||||||||||||||||||||||
229 | rr->data = rr->input; | - | ||||||||||||||||||||||||
230 | - | |||||||||||||||||||||||||
231 | enc_err = s->method->internal->ssl3_enc->enc(s, 0); | - | ||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||
233 | - | |||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||
236 | if (enc_err == 0
| 0-153 | ||||||||||||||||||||||||
237 | - | |||||||||||||||||||||||||
238 | rr->length = 0; | - | ||||||||||||||||||||||||
239 | s->internal->packet_length = 0; | - | ||||||||||||||||||||||||
240 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
241 | } | - | ||||||||||||||||||||||||
242 | - | |||||||||||||||||||||||||
243 | - | |||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||
245 | if ((
| 11-142 | ||||||||||||||||||||||||
246 | ((void *)0)
| 11-142 | ||||||||||||||||||||||||
247 | )
| 11-142 | ||||||||||||||||||||||||
248 | ((void *)0)
| 44-98 | ||||||||||||||||||||||||
249 | )
| 44-98 | ||||||||||||||||||||||||
250 | (
| 0-44 | ||||||||||||||||||||||||
251 | ((void *)0)
| 0-44 | ||||||||||||||||||||||||
252 | )
| 0-44 | ||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||
254 | unsigned char *mac = | - | ||||||||||||||||||||||||
255 | ((void *)0) | - | ||||||||||||||||||||||||
256 | ; | - | ||||||||||||||||||||||||
257 | unsigned char mac_tmp[64]; | - | ||||||||||||||||||||||||
258 | mac_size = EVP_MD_size(EVP_MD_CTX_md(s->read_hash)); | - | ||||||||||||||||||||||||
259 | (void)((mac_size <= 64) ? 0 : (OpenSSLDie(__FILE__, 384, "mac_size <= EVP_MAX_MD_SIZE"),1)); | - | ||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||
262 | orig_len = rr->length + ((unsigned int)rr->type >> 8); | - | ||||||||||||||||||||||||
263 | - | |||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | - | |||||||||||||||||||||||||
268 | - | |||||||||||||||||||||||||
269 | if (orig_len < mac_size
| 0-44 | ||||||||||||||||||||||||
270 | - | |||||||||||||||||||||||||
271 | ((
| 8-36 | ||||||||||||||||||||||||
272 | orig_len < mac_size + 1
| 0-36 | ||||||||||||||||||||||||
273 | al = 50; | - | ||||||||||||||||||||||||
274 | SSL_error_internal(s, 160, __FILE__, 399); | - | ||||||||||||||||||||||||
275 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
276 | } | - | ||||||||||||||||||||||||
277 | - | |||||||||||||||||||||||||
278 | if ((
| 8-36 | ||||||||||||||||||||||||
279 | - | |||||||||||||||||||||||||
280 | - | |||||||||||||||||||||||||
281 | - | |||||||||||||||||||||||||
282 | - | |||||||||||||||||||||||||
283 | - | |||||||||||||||||||||||||
284 | mac = mac_tmp; | - | ||||||||||||||||||||||||
285 | ssl3_cbc_copy_mac(mac_tmp, rr, mac_size, orig_len); | - | ||||||||||||||||||||||||
286 | rr->length -= mac_size; | - | ||||||||||||||||||||||||
287 | } executed 36 times by 1 test: else {end of block Executed by:
| 36 | ||||||||||||||||||||||||
288 | - | |||||||||||||||||||||||||
289 | - | |||||||||||||||||||||||||
290 | - | |||||||||||||||||||||||||
291 | rr->length -= mac_size; | - | ||||||||||||||||||||||||
292 | mac = &rr->data[rr->length]; | - | ||||||||||||||||||||||||
293 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||
295 | i = tls1_mac(s, md, 0 ); | - | ||||||||||||||||||||||||
296 | if (i < 0
| 0-44 | ||||||||||||||||||||||||
297 | ((void *)0)
| 0-44 | ||||||||||||||||||||||||
298 | || timingsafe_memcmp(md, mac, (size_t)mac_size) != 0
| 0-44 | ||||||||||||||||||||||||
299 | enc_err = -1; never executed: enc_err = -1; | 0 | ||||||||||||||||||||||||
300 | if (rr->length > 16384 + mac_size
| 0-44 | ||||||||||||||||||||||||
301 | enc_err = -1; never executed: enc_err = -1; | 0 | ||||||||||||||||||||||||
302 | } executed 44 times by 1 test: end of block Executed by:
| 44 | ||||||||||||||||||||||||
303 | - | |||||||||||||||||||||||||
304 | if (enc_err < 0
| 0-153 | ||||||||||||||||||||||||
305 | - | |||||||||||||||||||||||||
306 | rr->length = 0; | - | ||||||||||||||||||||||||
307 | s->internal->packet_length = 0; | - | ||||||||||||||||||||||||
308 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
309 | } | - | ||||||||||||||||||||||||
310 | - | |||||||||||||||||||||||||
311 | if (rr->length > 16384
| 0-153 | ||||||||||||||||||||||||
312 | al = 22; | - | ||||||||||||||||||||||||
313 | SSL_error_internal(s, 146, __FILE__, 436); | - | ||||||||||||||||||||||||
314 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
315 | } | - | ||||||||||||||||||||||||
316 | - | |||||||||||||||||||||||||
317 | rr->off = 0; | - | ||||||||||||||||||||||||
318 | s->internal->packet_length = 0; | - | ||||||||||||||||||||||||
319 | return executed 153 times by 1 test: (1);return (1); Executed by:
executed 153 times by 1 test: return (1); Executed by:
| 153 | ||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||
321 | f_err: | - | ||||||||||||||||||||||||
322 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
323 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
324 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
325 | } | - | ||||||||||||||||||||||||
326 | int | - | ||||||||||||||||||||||||
327 | dtls1_get_record(SSL *s) | - | ||||||||||||||||||||||||
328 | { | - | ||||||||||||||||||||||||
329 | SSL3_RECORD *rr; | - | ||||||||||||||||||||||||
330 | unsigned char *p = | - | ||||||||||||||||||||||||
331 | ((void *)0) | - | ||||||||||||||||||||||||
332 | ; | - | ||||||||||||||||||||||||
333 | DTLS1_BITMAP *bitmap; | - | ||||||||||||||||||||||||
334 | unsigned int is_next_epoch; | - | ||||||||||||||||||||||||
335 | int n; | - | ||||||||||||||||||||||||
336 | - | |||||||||||||||||||||||||
337 | rr = &((s->s3->internal)->rrec); | - | ||||||||||||||||||||||||
338 | - | |||||||||||||||||||||||||
339 | - | |||||||||||||||||||||||||
340 | - | |||||||||||||||||||||||||
341 | if (dtls1_process_buffered_records(s) < 0
| 0-198 | ||||||||||||||||||||||||
342 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||
344 | - | |||||||||||||||||||||||||
345 | if (dtls1_retrieve_buffered_record((s), &(((s->d1->internal))->processed_rcds))
| 0-198 | ||||||||||||||||||||||||
346 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
347 | - | |||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||
349 | if (0) { | - | ||||||||||||||||||||||||
350 | again: | - | ||||||||||||||||||||||||
351 | - | |||||||||||||||||||||||||
352 | rr->length = 0; | - | ||||||||||||||||||||||||
353 | s->internal->packet_length = 0; | - | ||||||||||||||||||||||||
354 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||
356 | - | |||||||||||||||||||||||||
357 | if ((
| 0-199 | ||||||||||||||||||||||||
358 | (
| 0 | ||||||||||||||||||||||||
359 | CBS header, seq_no; | - | ||||||||||||||||||||||||
360 | uint16_t epoch, len, ssl_version; | - | ||||||||||||||||||||||||
361 | uint8_t type; | - | ||||||||||||||||||||||||
362 | - | |||||||||||||||||||||||||
363 | n = ssl3_packet_read(s, 13); | - | ||||||||||||||||||||||||
364 | if (n <= 0
| 45-154 | ||||||||||||||||||||||||
365 | return executed 45 times by 2 tests: (n);return (n); Executed by:
executed 45 times by 2 tests: return (n); Executed by:
| 45 | ||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||
367 | - | |||||||||||||||||||||||||
368 | if (n != 13
| 1-153 | ||||||||||||||||||||||||
369 | goto executed 1 time by 1 test: again;goto again; Executed by:
executed 1 time by 1 test: goto again; Executed by:
| 1 | ||||||||||||||||||||||||
370 | - | |||||||||||||||||||||||||
371 | s->internal->rstate = 0xF1; | - | ||||||||||||||||||||||||
372 | - | |||||||||||||||||||||||||
373 | CBS_init(&header, s->internal->packet, s->internal->packet_length); | - | ||||||||||||||||||||||||
374 | - | |||||||||||||||||||||||||
375 | - | |||||||||||||||||||||||||
376 | if (!CBS_get_u8(&header, &type)
| 0-153 | ||||||||||||||||||||||||
377 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
378 | if (!CBS_get_u16(&header, &ssl_version)
| 0-153 | ||||||||||||||||||||||||
379 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
380 | - | |||||||||||||||||||||||||
381 | - | |||||||||||||||||||||||||
382 | if (!CBS_get_u16(&header, &epoch)
| 0-153 | ||||||||||||||||||||||||
383 | !CBS_get_bytes(&header, &seq_no, 6)
| 0-153 | ||||||||||||||||||||||||
384 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
385 | - | |||||||||||||||||||||||||
386 | if (!CBS_write_bytes(&seq_no, &((s->s3->internal)->read_sequence[2]),
| 0-153 | ||||||||||||||||||||||||
387 | sizeof((s->s3->internal)->read_sequence) - 2,
| 0-153 | ||||||||||||||||||||||||
388 | ((void *)0)
| 0-153 | ||||||||||||||||||||||||
389 | )
| 0-153 | ||||||||||||||||||||||||
390 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
391 | if (!CBS_get_u16(&header, &len)
| 0-153 | ||||||||||||||||||||||||
392 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
393 | - | |||||||||||||||||||||||||
394 | rr->type = type; | - | ||||||||||||||||||||||||
395 | rr->epoch = epoch; | - | ||||||||||||||||||||||||
396 | rr->length = len; | - | ||||||||||||||||||||||||
397 | - | |||||||||||||||||||||||||
398 | - | |||||||||||||||||||||||||
399 | if (!s->internal->first_packet
| 0-131 | ||||||||||||||||||||||||
400 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
401 | - | |||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||
403 | if ((
| 0-153 | ||||||||||||||||||||||||
404 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
405 | - | |||||||||||||||||||||||||
406 | - | |||||||||||||||||||||||||
407 | if (rr->length > ((256 + 64)+16384)
| 0-153 | ||||||||||||||||||||||||
408 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
409 | - | |||||||||||||||||||||||||
410 | - | |||||||||||||||||||||||||
411 | p = (unsigned char *)CBS_data(&header); | - | ||||||||||||||||||||||||
412 | } executed 153 times by 1 test: end of block Executed by:
| 153 | ||||||||||||||||||||||||
413 | - | |||||||||||||||||||||||||
414 | - | |||||||||||||||||||||||||
415 | - | |||||||||||||||||||||||||
416 | n = ssl3_packet_extend(s, 13 + rr->length); | - | ||||||||||||||||||||||||
417 | if (n <= 0
| 0-153 | ||||||||||||||||||||||||
418 | return never executed: (n);return (n); never executed: return (n); | 0 | ||||||||||||||||||||||||
419 | - | |||||||||||||||||||||||||
420 | - | |||||||||||||||||||||||||
421 | if (n != 13 + rr->length
| 0-153 | ||||||||||||||||||||||||
422 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
423 | - | |||||||||||||||||||||||||
424 | s->internal->rstate = 0xF0; | - | ||||||||||||||||||||||||
425 | - | |||||||||||||||||||||||||
426 | - | |||||||||||||||||||||||||
427 | bitmap = dtls1_get_bitmap(s, rr, &is_next_epoch); | - | ||||||||||||||||||||||||
428 | if (bitmap ==
| 0-153 | ||||||||||||||||||||||||
429 | ((void *)0)
| 0-153 | ||||||||||||||||||||||||
430 | ) | - | ||||||||||||||||||||||||
431 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
432 | if (!((
| 0-153 | ||||||||||||||||||||||||
433 | p !=
| 0 | ||||||||||||||||||||||||
434 | ((void *)0)
| 0 | ||||||||||||||||||||||||
435 | && *
| 0 | ||||||||||||||||||||||||
436 | !dtls1_record_replay_check(s, bitmap)
| 0-153 | ||||||||||||||||||||||||
437 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
438 | - | |||||||||||||||||||||||||
439 | - | |||||||||||||||||||||||||
440 | if (rr->length == 0
| 0-153 | ||||||||||||||||||||||||
441 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
442 | - | |||||||||||||||||||||||||
443 | - | |||||||||||||||||||||||||
444 | - | |||||||||||||||||||||||||
445 | - | |||||||||||||||||||||||||
446 | - | |||||||||||||||||||||||||
447 | - | |||||||||||||||||||||||||
448 | if (is_next_epoch
| 0-153 | ||||||||||||||||||||||||
449 | if (((
| 0 | ||||||||||||||||||||||||
450 | if (dtls1_buffer_record(s, &((s->d1->internal)->unprocessed_rcds),
| 0 | ||||||||||||||||||||||||
451 | rr->seq_num) < 0
| 0 | ||||||||||||||||||||||||
452 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
453 | - | |||||||||||||||||||||||||
454 | dtls1_record_bitmap_update(s, bitmap); | - | ||||||||||||||||||||||||
455 | } never executed: end of block | 0 | ||||||||||||||||||||||||
456 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
457 | } | - | ||||||||||||||||||||||||
458 | - | |||||||||||||||||||||||||
459 | if (!dtls1_process_record(s)
| 0-153 | ||||||||||||||||||||||||
460 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||
461 | - | |||||||||||||||||||||||||
462 | - | |||||||||||||||||||||||||
463 | dtls1_record_bitmap_update(s, bitmap); | - | ||||||||||||||||||||||||
464 | - | |||||||||||||||||||||||||
465 | return executed 153 times by 1 test: (1);return (1); Executed by:
executed 153 times by 1 test: return (1); Executed by:
| 153 | ||||||||||||||||||||||||
466 | } | - | ||||||||||||||||||||||||
467 | int | - | ||||||||||||||||||||||||
468 | dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) | - | ||||||||||||||||||||||||
469 | { | - | ||||||||||||||||||||||||
470 | int al, i, j, ret; | - | ||||||||||||||||||||||||
471 | unsigned int n; | - | ||||||||||||||||||||||||
472 | SSL3_RECORD *rr; | - | ||||||||||||||||||||||||
473 | void (*cb)(const SSL *ssl, int type2, int val) = | - | ||||||||||||||||||||||||
474 | ((void *)0) | - | ||||||||||||||||||||||||
475 | ; | - | ||||||||||||||||||||||||
476 | - | |||||||||||||||||||||||||
477 | if (s->s3->rbuf.buf ==
| 11-274 | ||||||||||||||||||||||||
478 | ((void *)0)
| 11-274 | ||||||||||||||||||||||||
479 | ) | - | ||||||||||||||||||||||||
480 | if (!ssl3_setup_buffers(s)
| 0-11 | ||||||||||||||||||||||||
481 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
482 | - | |||||||||||||||||||||||||
483 | if ((type
| 0-285 | ||||||||||||||||||||||||
484 | type != 23
| 0-241 | ||||||||||||||||||||||||
485 | (peek
| 0-285 | ||||||||||||||||||||||||
486 | SSL_error_internal(s, (4|64), __FILE__, 653); | - | ||||||||||||||||||||||||
487 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
488 | } | - | ||||||||||||||||||||||||
489 | - | |||||||||||||||||||||||||
490 | - | |||||||||||||||||||||||||
491 | if ((
| 0-285 | ||||||||||||||||||||||||
492 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||
493 | - | |||||||||||||||||||||||||
494 | - | |||||||||||||||||||||||||
495 | - | |||||||||||||||||||||||||
496 | if (!s->internal->in_handshake
| 22-241 | ||||||||||||||||||||||||
497 | { | - | ||||||||||||||||||||||||
498 | - | |||||||||||||||||||||||||
499 | i = s->internal->handshake_func(s); | - | ||||||||||||||||||||||||
500 | if (i < 0
| 11 | ||||||||||||||||||||||||
501 | return executed 11 times by 1 test: (i);return (i); Executed by:
executed 11 times by 1 test: return (i); Executed by:
| 11 | ||||||||||||||||||||||||
502 | if (i == 0
| 0-11 | ||||||||||||||||||||||||
503 | SSL_error_internal(s, 229, __FILE__, 670); | - | ||||||||||||||||||||||||
504 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
505 | } | - | ||||||||||||||||||||||||
506 | } executed 11 times by 1 test: end of block Executed by:
| 11 | ||||||||||||||||||||||||
507 | - | |||||||||||||||||||||||||
508 | start: code before this statement executed 274 times by 2 tests: start: Executed by:
| 274 | ||||||||||||||||||||||||
509 | s->internal->rwstate = 1; | - | ||||||||||||||||||||||||
510 | - | |||||||||||||||||||||||||
511 | - | |||||||||||||||||||||||||
512 | - | |||||||||||||||||||||||||
513 | - | |||||||||||||||||||||||||
514 | - | |||||||||||||||||||||||||
515 | rr = &((s->s3->internal)->rrec); | - | ||||||||||||||||||||||||
516 | - | |||||||||||||||||||||||||
517 | - | |||||||||||||||||||||||||
518 | - | |||||||||||||||||||||||||
519 | - | |||||||||||||||||||||||||
520 | - | |||||||||||||||||||||||||
521 | if ((
| 0-263 | ||||||||||||||||||||||||
522 | pitem *item; | - | ||||||||||||||||||||||||
523 | item = pqueue_pop((s->d1->internal)->buffered_app_data.q); | - | ||||||||||||||||||||||||
524 | if (item
| 0-33 | ||||||||||||||||||||||||
525 | - | |||||||||||||||||||||||||
526 | dtls1_copy_record(s, item); | - | ||||||||||||||||||||||||
527 | - | |||||||||||||||||||||||||
528 | free(item->data); | - | ||||||||||||||||||||||||
529 | pitem_free(item); | - | ||||||||||||||||||||||||
530 | } never executed: end of block | 0 | ||||||||||||||||||||||||
531 | } executed 33 times by 1 test: end of block Executed by:
| 33 | ||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||
533 | - | |||||||||||||||||||||||||
534 | if (dtls1_handle_timeout(s) > 0
| 0-296 | ||||||||||||||||||||||||
535 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
536 | - | |||||||||||||||||||||||||
537 | - | |||||||||||||||||||||||||
538 | if ((
| 0-198 | ||||||||||||||||||||||||
539 | ret = dtls1_get_record(s); | - | ||||||||||||||||||||||||
540 | if (ret <= 0
| 45-153 | ||||||||||||||||||||||||
541 | ret = dtls1_read_failed(s, ret); | - | ||||||||||||||||||||||||
542 | - | |||||||||||||||||||||||||
543 | if (ret <= 0
| 0-45 | ||||||||||||||||||||||||
544 | return executed 45 times by 2 tests: (ret);return (ret); Executed by:
executed 45 times by 2 tests: return (ret); Executed by:
| 45 | ||||||||||||||||||||||||
545 | else | - | ||||||||||||||||||||||||
546 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
547 | } | - | ||||||||||||||||||||||||
548 | } executed 153 times by 1 test: end of block Executed by:
| 153 | ||||||||||||||||||||||||
549 | - | |||||||||||||||||||||||||
550 | if ((
| 0-251 | ||||||||||||||||||||||||
551 | rr->length = 0; | - | ||||||||||||||||||||||||
552 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
553 | } | - | ||||||||||||||||||||||||
554 | - | |||||||||||||||||||||||||
555 | - | |||||||||||||||||||||||||
556 | - | |||||||||||||||||||||||||
557 | if ((
| 44-207 | ||||||||||||||||||||||||
558 | - | |||||||||||||||||||||||||
559 | && (
| 0-44 | ||||||||||||||||||||||||
560 | - | |||||||||||||||||||||||||
561 | - | |||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||
564 | - | |||||||||||||||||||||||||
565 | if (dtls1_buffer_record(s, &((s->d1->internal)->buffered_app_data),
| 0 | ||||||||||||||||||||||||
566 | rr->seq_num) < 0
| 0 | ||||||||||||||||||||||||
567 | SSL_error_internal(s, (4|64), __FILE__, 734); | - | ||||||||||||||||||||||||
568 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
569 | } | - | ||||||||||||||||||||||||
570 | rr->length = 0; | - | ||||||||||||||||||||||||
571 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
572 | } | - | ||||||||||||||||||||||||
573 | - | |||||||||||||||||||||||||
574 | - | |||||||||||||||||||||||||
575 | - | |||||||||||||||||||||||||
576 | if (s->internal->shutdown & 2
| 0-251 | ||||||||||||||||||||||||
577 | rr->length = 0; | - | ||||||||||||||||||||||||
578 | s->internal->rwstate = 1; | - | ||||||||||||||||||||||||
579 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
580 | } | - | ||||||||||||||||||||||||
581 | - | |||||||||||||||||||||||||
582 | - | |||||||||||||||||||||||||
583 | if (type == rr->type
| 22-229 | ||||||||||||||||||||||||
584 | { | - | ||||||||||||||||||||||||
585 | - | |||||||||||||||||||||||||
586 | - | |||||||||||||||||||||||||
587 | if ((
| 0-207 | ||||||||||||||||||||||||
588 | (
| 0 | ||||||||||||||||||||||||
589 | ((void *)0)
| 0 | ||||||||||||||||||||||||
590 | )
| 0 | ||||||||||||||||||||||||
591 | al = 10; | - | ||||||||||||||||||||||||
592 | SSL_error_internal(s, 100, __FILE__, 757); | - | ||||||||||||||||||||||||
593 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
594 | } | - | ||||||||||||||||||||||||
595 | - | |||||||||||||||||||||||||
596 | if (len <= 0
| 0-229 | ||||||||||||||||||||||||
597 | return never executed: (len);return (len); never executed: return (len); | 0 | ||||||||||||||||||||||||
598 | - | |||||||||||||||||||||||||
599 | if ((
| 22-207 | ||||||||||||||||||||||||
600 | n = rr->length; executed 22 times by 1 test: n = rr->length; Executed by:
| 22 | ||||||||||||||||||||||||
601 | else | - | ||||||||||||||||||||||||
602 | n = (unsigned int)len; executed 207 times by 1 test: n = (unsigned int)len; Executed by:
| 207 | ||||||||||||||||||||||||
603 | - | |||||||||||||||||||||||||
604 | memcpy(buf, &(rr->data[rr->off]), n); | - | ||||||||||||||||||||||||
605 | if (!peek
| 0-229 | ||||||||||||||||||||||||
606 | rr->length -= n; | - | ||||||||||||||||||||||||
607 | rr->off += n; | - | ||||||||||||||||||||||||
608 | if (rr->length == 0
| 98-131 | ||||||||||||||||||||||||
609 | s->internal->rstate = 0xF0; | - | ||||||||||||||||||||||||
610 | rr->off = 0; | - | ||||||||||||||||||||||||
611 | } executed 131 times by 1 test: end of block Executed by:
| 131 | ||||||||||||||||||||||||
612 | } executed 229 times by 1 test: end of block Executed by:
| 229 | ||||||||||||||||||||||||
613 | - | |||||||||||||||||||||||||
614 | return executed 229 times by 1 test: (n);return (n); Executed by:
executed 229 times by 1 test: return (n); Executed by:
| 229 | ||||||||||||||||||||||||
615 | } | - | ||||||||||||||||||||||||
616 | { | - | ||||||||||||||||||||||||
617 | unsigned int k, dest_maxlen = 0; | - | ||||||||||||||||||||||||
618 | unsigned char *dest = | - | ||||||||||||||||||||||||
619 | ((void *)0) | - | ||||||||||||||||||||||||
620 | ; | - | ||||||||||||||||||||||||
621 | unsigned int *dest_len = | - | ||||||||||||||||||||||||
622 | ((void *)0) | - | ||||||||||||||||||||||||
623 | ; | - | ||||||||||||||||||||||||
624 | - | |||||||||||||||||||||||||
625 | if (rr->type == 22
| 0-22 | ||||||||||||||||||||||||
626 | dest_maxlen = sizeof (s->d1->internal)->handshake_fragment; | - | ||||||||||||||||||||||||
627 | dest = (s->d1->internal)->handshake_fragment; | - | ||||||||||||||||||||||||
628 | dest_len = &(s->d1->internal)->handshake_fragment_len; | - | ||||||||||||||||||||||||
629 | } never executed: else if (rr->type == 21end of block
| 0-22 | ||||||||||||||||||||||||
630 | dest_maxlen = sizeof((s->d1->internal)->alert_fragment); | - | ||||||||||||||||||||||||
631 | dest = (s->d1->internal)->alert_fragment; | - | ||||||||||||||||||||||||
632 | dest_len = &(s->d1->internal)->alert_fragment_len; | - | ||||||||||||||||||||||||
633 | } never executed: end of block | 0 | ||||||||||||||||||||||||
634 | - | |||||||||||||||||||||||||
635 | else if (rr->type != 20
| 0-22 | ||||||||||||||||||||||||
636 | - | |||||||||||||||||||||||||
637 | - | |||||||||||||||||||||||||
638 | - | |||||||||||||||||||||||||
639 | if (rr->type == 23
| 0 | ||||||||||||||||||||||||
640 | BIO *bio; | - | ||||||||||||||||||||||||
641 | (s->s3->internal)->in_read_app_data = 2; | - | ||||||||||||||||||||||||
642 | bio = SSL_get_rbio(s); | - | ||||||||||||||||||||||||
643 | s->internal->rwstate = 3; | - | ||||||||||||||||||||||||
644 | BIO_clear_flags(bio, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
645 | BIO_set_flags(bio, (0x01|0x08)); | - | ||||||||||||||||||||||||
646 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
647 | } | - | ||||||||||||||||||||||||
648 | - | |||||||||||||||||||||||||
649 | - | |||||||||||||||||||||||||
650 | al = 10; | - | ||||||||||||||||||||||||
651 | SSL_error_internal(s, 245, __FILE__, 820); | - | ||||||||||||||||||||||||
652 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
653 | } | - | ||||||||||||||||||||||||
654 | - | |||||||||||||||||||||||||
655 | if (dest_maxlen > 0
| 0-22 | ||||||||||||||||||||||||
656 | - | |||||||||||||||||||||||||
657 | - | |||||||||||||||||||||||||
658 | if (rr->length < dest_maxlen
| 0 | ||||||||||||||||||||||||
659 | s->internal->rstate = 0xF0; | - | ||||||||||||||||||||||||
660 | rr->length = 0; | - | ||||||||||||||||||||||||
661 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
662 | } | - | ||||||||||||||||||||||||
663 | - | |||||||||||||||||||||||||
664 | - | |||||||||||||||||||||||||
665 | for ( k = 0; k < dest_maxlen
| 0 | ||||||||||||||||||||||||
666 | dest[k] = rr->data[rr->off++]; | - | ||||||||||||||||||||||||
667 | rr->length--; | - | ||||||||||||||||||||||||
668 | } never executed: end of block | 0 | ||||||||||||||||||||||||
669 | *dest_len = dest_maxlen; | - | ||||||||||||||||||||||||
670 | } never executed: end of block | 0 | ||||||||||||||||||||||||
671 | } | - | ||||||||||||||||||||||||
672 | - | |||||||||||||||||||||||||
673 | - | |||||||||||||||||||||||||
674 | - | |||||||||||||||||||||||||
675 | - | |||||||||||||||||||||||||
676 | - | |||||||||||||||||||||||||
677 | - | |||||||||||||||||||||||||
678 | if ((
| 11 | ||||||||||||||||||||||||
679 | ((
| 0-11 | ||||||||||||||||||||||||
680 | ((
| 0 | ||||||||||||||||||||||||
681 | (
| 0 | ||||||||||||||||||||||||
682 | ((void *)0)
| 0 | ||||||||||||||||||||||||
683 | )
| 0 | ||||||||||||||||||||||||
684 | ((void *)0)
| 0 | ||||||||||||||||||||||||
685 | )
| 0 | ||||||||||||||||||||||||
686 | (s->d1->internal)->handshake_fragment_len = 0; | - | ||||||||||||||||||||||||
687 | - | |||||||||||||||||||||||||
688 | if (((
| 0 | ||||||||||||||||||||||||
689 | ((
| 0 | ||||||||||||||||||||||||
690 | ((
| 0 | ||||||||||||||||||||||||
691 | al = 50; | - | ||||||||||||||||||||||||
692 | SSL_error_internal(s, 105, __FILE__, 857); | - | ||||||||||||||||||||||||
693 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
694 | } | - | ||||||||||||||||||||||||
695 | - | |||||||||||||||||||||||||
696 | - | |||||||||||||||||||||||||
697 | - | |||||||||||||||||||||||||
698 | if (s->internal->msg_callback
| 0 | ||||||||||||||||||||||||
699 | s->internal->msg_callback(0, s->version, 22, never executed: s->internal->msg_callback(0, s->version, 22, (s->d1->internal)->handshake_fragment, 4, s, s->internal->msg_callback_arg); | 0 | ||||||||||||||||||||||||
700 | (s->d1->internal)->handshake_fragment, 4, s, s->internal->msg_callback_arg); never executed: s->internal->msg_callback(0, s->version, 22, (s->d1->internal)->handshake_fragment, 4, s, s->internal->msg_callback_arg); | 0 | ||||||||||||||||||||||||
701 | - | |||||||||||||||||||||||||
702 | if ((
| 0 | ||||||||||||||||||||||||
703 | !(s->s3->flags & 0x0001)
| 0 | ||||||||||||||||||||||||
704 | !(s->s3->internal)->renegotiate
| 0 | ||||||||||||||||||||||||
705 | (s->d1->internal)->handshake_read_seq++; | - | ||||||||||||||||||||||||
706 | s->internal->new_session = 1; | - | ||||||||||||||||||||||||
707 | ssl3_renegotiate(s); | - | ||||||||||||||||||||||||
708 | if (ssl3_renegotiate_check(s)
| 0 | ||||||||||||||||||||||||
709 | i = s->internal->handshake_func(s); | - | ||||||||||||||||||||||||
710 | if (i < 0
| 0 | ||||||||||||||||||||||||
711 | return never executed: (i);return (i); never executed: return (i); | 0 | ||||||||||||||||||||||||
712 | if (i == 0
| 0 | ||||||||||||||||||||||||
713 | SSL_error_internal(s, 229, __FILE__, 878); | - | ||||||||||||||||||||||||
714 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
715 | } | - | ||||||||||||||||||||||||
716 | - | |||||||||||||||||||||||||
717 | if (!(s->internal->mode & 0x00000004L)
| 0 | ||||||||||||||||||||||||
718 | if (s->s3->rbuf.left == 0
| 0 | ||||||||||||||||||||||||
719 | { | - | ||||||||||||||||||||||||
720 | BIO *bio; | - | ||||||||||||||||||||||||
721 | - | |||||||||||||||||||||||||
722 | - | |||||||||||||||||||||||||
723 | - | |||||||||||||||||||||||||
724 | - | |||||||||||||||||||||||||
725 | s->internal->rwstate = 3; | - | ||||||||||||||||||||||||
726 | bio = SSL_get_rbio(s); | - | ||||||||||||||||||||||||
727 | BIO_clear_flags(bio, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
728 | BIO_set_flags(bio, (0x01|0x08)); | - | ||||||||||||||||||||||||
729 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
730 | } | - | ||||||||||||||||||||||||
731 | } never executed: end of block | 0 | ||||||||||||||||||||||||
732 | } never executed: end of block | 0 | ||||||||||||||||||||||||
733 | } never executed: end of block | 0 | ||||||||||||||||||||||||
734 | - | |||||||||||||||||||||||||
735 | - | |||||||||||||||||||||||||
736 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
737 | } | - | ||||||||||||||||||||||||
738 | - | |||||||||||||||||||||||||
739 | if ((
| 0-22 | ||||||||||||||||||||||||
740 | int alert_level = (s->d1->internal)->alert_fragment[0]; | - | ||||||||||||||||||||||||
741 | int alert_descr = (s->d1->internal)->alert_fragment[1]; | - | ||||||||||||||||||||||||
742 | - | |||||||||||||||||||||||||
743 | (s->d1->internal)->alert_fragment_len = 0; | - | ||||||||||||||||||||||||
744 | - | |||||||||||||||||||||||||
745 | if (s->internal->msg_callback
| 0 | ||||||||||||||||||||||||
746 | s->internal->msg_callback(0, s->version, 21, never executed: s->internal->msg_callback(0, s->version, 21, (s->d1->internal)->alert_fragment, 2, s, s->internal->msg_callback_arg); | 0 | ||||||||||||||||||||||||
747 | (s->d1->internal)->alert_fragment, 2, s, s->internal->msg_callback_arg); never executed: s->internal->msg_callback(0, s->version, 21, (s->d1->internal)->alert_fragment, 2, s, s->internal->msg_callback_arg); | 0 | ||||||||||||||||||||||||
748 | - | |||||||||||||||||||||||||
749 | if (s->internal->info_callback !=
| 0 | ||||||||||||||||||||||||
750 | ((void *)0)
| 0 | ||||||||||||||||||||||||
751 | ) | - | ||||||||||||||||||||||||
752 | cb = s->internal->info_callback; never executed: cb = s->internal->info_callback; | 0 | ||||||||||||||||||||||||
753 | else if (s->ctx->internal->info_callback !=
| 0 | ||||||||||||||||||||||||
754 | ((void *)0)
| 0 | ||||||||||||||||||||||||
755 | ) | - | ||||||||||||||||||||||||
756 | cb = s->ctx->internal->info_callback; never executed: cb = s->ctx->internal->info_callback; | 0 | ||||||||||||||||||||||||
757 | - | |||||||||||||||||||||||||
758 | if (cb !=
| 0 | ||||||||||||||||||||||||
759 | ((void *)0)
| 0 | ||||||||||||||||||||||||
760 | ) { | - | ||||||||||||||||||||||||
761 | j = (alert_level << 8) | alert_descr; | - | ||||||||||||||||||||||||
762 | cb(s, (0x4000|0x04), j); | - | ||||||||||||||||||||||||
763 | } never executed: end of block | 0 | ||||||||||||||||||||||||
764 | - | |||||||||||||||||||||||||
765 | if (alert_level == 1
| 0 | ||||||||||||||||||||||||
766 | { | - | ||||||||||||||||||||||||
767 | (s->s3->internal)->warn_alert = alert_descr; | - | ||||||||||||||||||||||||
768 | if (alert_descr == 0
| 0 | ||||||||||||||||||||||||
769 | s->internal->shutdown |= 2; | - | ||||||||||||||||||||||||
770 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
771 | } | - | ||||||||||||||||||||||||
772 | } never executed: else if (alert_level == 2end of block
| 0 | ||||||||||||||||||||||||
773 | { | - | ||||||||||||||||||||||||
774 | s->internal->rwstate = 1; | - | ||||||||||||||||||||||||
775 | (s->s3->internal)->fatal_alert = alert_descr; | - | ||||||||||||||||||||||||
776 | SSL_error_internal(s, 1000 + alert_descr, __FILE__, 935); | - | ||||||||||||||||||||||||
777 | ERR_asprintf_error_data("SSL alert number %d", | - | ||||||||||||||||||||||||
778 | alert_descr); | - | ||||||||||||||||||||||||
779 | s->internal->shutdown|=2; | - | ||||||||||||||||||||||||
780 | SSL_CTX_remove_session(s->ctx, s->session); | - | ||||||||||||||||||||||||
781 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
782 | } else { | - | ||||||||||||||||||||||||
783 | al = 47; | - | ||||||||||||||||||||||||
784 | SSL_error_internal(s, 246, __FILE__, 943); | - | ||||||||||||||||||||||||
785 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
786 | } | - | ||||||||||||||||||||||||
787 | - | |||||||||||||||||||||||||
788 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
789 | } | - | ||||||||||||||||||||||||
790 | - | |||||||||||||||||||||||||
791 | if (s->internal->shutdown & 1
| 0-22 | ||||||||||||||||||||||||
792 | { | - | ||||||||||||||||||||||||
793 | s->internal->rwstate = 1; | - | ||||||||||||||||||||||||
794 | rr->length = 0; | - | ||||||||||||||||||||||||
795 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
796 | } | - | ||||||||||||||||||||||||
797 | - | |||||||||||||||||||||||||
798 | if (rr->type == 20
| 0-22 | ||||||||||||||||||||||||
799 | struct ccs_header_st ccs_hdr; | - | ||||||||||||||||||||||||
800 | unsigned int ccs_hdr_len = 1; | - | ||||||||||||||||||||||||
801 | - | |||||||||||||||||||||||||
802 | dtls1_get_ccs_header(rr->data, &ccs_hdr); | - | ||||||||||||||||||||||||
803 | - | |||||||||||||||||||||||||
804 | - | |||||||||||||||||||||||||
805 | - | |||||||||||||||||||||||||
806 | - | |||||||||||||||||||||||||
807 | if ((
| 0-22 | ||||||||||||||||||||||||
808 | (
| 0-22 | ||||||||||||||||||||||||
809 | i = 47; | - | ||||||||||||||||||||||||
810 | SSL_error_internal(s, 103, __FILE__, 969); | - | ||||||||||||||||||||||||
811 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
812 | } | - | ||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||
814 | rr->length = 0; | - | ||||||||||||||||||||||||
815 | - | |||||||||||||||||||||||||
816 | if (s->internal->msg_callback
| 0-22 | ||||||||||||||||||||||||
817 | s->internal->msg_callback(0, s->version, 20, never executed: s->internal->msg_callback(0, s->version, 20, rr->data, 1, s, s->internal->msg_callback_arg); | 0 | ||||||||||||||||||||||||
818 | rr->data, 1, s, s->internal->msg_callback_arg); never executed: s->internal->msg_callback(0, s->version, 20, rr->data, 1, s, s->internal->msg_callback_arg); | 0 | ||||||||||||||||||||||||
819 | - | |||||||||||||||||||||||||
820 | - | |||||||||||||||||||||||||
821 | - | |||||||||||||||||||||||||
822 | - | |||||||||||||||||||||||||
823 | if (!(s->d1->internal)->change_cipher_spec_ok
| 0-22 | ||||||||||||||||||||||||
824 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
825 | } | - | ||||||||||||||||||||||||
826 | - | |||||||||||||||||||||||||
827 | (s->d1->internal)->change_cipher_spec_ok = 0; | - | ||||||||||||||||||||||||
828 | - | |||||||||||||||||||||||||
829 | (s->s3->internal)->change_cipher_spec = 1; | - | ||||||||||||||||||||||||
830 | if (!ssl3_do_change_cipher_spec(s)
| 0-22 | ||||||||||||||||||||||||
831 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
832 | - | |||||||||||||||||||||||||
833 | - | |||||||||||||||||||||||||
834 | dtls1_reset_seq_numbers(s, 0x01); | - | ||||||||||||||||||||||||
835 | - | |||||||||||||||||||||||||
836 | goto executed 22 times by 1 test: start;goto start; Executed by:
executed 22 times by 1 test: goto start; Executed by:
| 22 | ||||||||||||||||||||||||
837 | } | - | ||||||||||||||||||||||||
838 | - | |||||||||||||||||||||||||
839 | - | |||||||||||||||||||||||||
840 | if (((
| 0 | ||||||||||||||||||||||||
841 | !s->internal->in_handshake
| 0 | ||||||||||||||||||||||||
842 | struct hm_header_st msg_hdr; | - | ||||||||||||||||||||||||
843 | - | |||||||||||||||||||||||||
844 | - | |||||||||||||||||||||||||
845 | if (!dtls1_get_message_header(rr->data, &msg_hdr)
| 0 | ||||||||||||||||||||||||
846 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
847 | if (rr->epoch != (s->d1->internal)->r_epoch
| 0 | ||||||||||||||||||||||||
848 | rr->length = 0; | - | ||||||||||||||||||||||||
849 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
850 | } | - | ||||||||||||||||||||||||
851 | - | |||||||||||||||||||||||||
852 | - | |||||||||||||||||||||||||
853 | - | |||||||||||||||||||||||||
854 | - | |||||||||||||||||||||||||
855 | if (msg_hdr.type == 20
| 0 | ||||||||||||||||||||||||
856 | if (dtls1_check_timeout_num(s) < 0
| 0 | ||||||||||||||||||||||||
857 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
858 | - | |||||||||||||||||||||||||
859 | dtls1_retransmit_buffered_messages(s); | - | ||||||||||||||||||||||||
860 | rr->length = 0; | - | ||||||||||||||||||||||||
861 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
862 | } | - | ||||||||||||||||||||||||
863 | - | |||||||||||||||||||||||||
864 | if ((((
| 0 | ||||||||||||||||||||||||
865 | !(s->s3->flags & 0x0001)
| 0 | ||||||||||||||||||||||||
866 | (s->s3->internal)->hs.state = s->server
| 0 | ||||||||||||||||||||||||
867 | s->internal->renegotiate = 1; | - | ||||||||||||||||||||||||
868 | s->internal->new_session = 1; | - | ||||||||||||||||||||||||
869 | } never executed: end of block | 0 | ||||||||||||||||||||||||
870 | i = s->internal->handshake_func(s); | - | ||||||||||||||||||||||||
871 | if (i < 0
| 0 | ||||||||||||||||||||||||
872 | return never executed: (i);return (i); never executed: return (i); | 0 | ||||||||||||||||||||||||
873 | if (i == 0
| 0 | ||||||||||||||||||||||||
874 | SSL_error_internal(s, 229, __FILE__, 1033); | - | ||||||||||||||||||||||||
875 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
876 | } | - | ||||||||||||||||||||||||
877 | - | |||||||||||||||||||||||||
878 | if (!(s->internal->mode & 0x00000004L)
| 0 | ||||||||||||||||||||||||
879 | if (s->s3->rbuf.left == 0
| 0 | ||||||||||||||||||||||||
880 | { | - | ||||||||||||||||||||||||
881 | BIO *bio; | - | ||||||||||||||||||||||||
882 | - | |||||||||||||||||||||||||
883 | - | |||||||||||||||||||||||||
884 | - | |||||||||||||||||||||||||
885 | - | |||||||||||||||||||||||||
886 | s->internal->rwstate = 3; | - | ||||||||||||||||||||||||
887 | bio = SSL_get_rbio(s); | - | ||||||||||||||||||||||||
888 | BIO_clear_flags(bio, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
889 | BIO_set_flags(bio, (0x01|0x08)); | - | ||||||||||||||||||||||||
890 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
891 | } | - | ||||||||||||||||||||||||
892 | } never executed: end of block | 0 | ||||||||||||||||||||||||
893 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
894 | } | - | ||||||||||||||||||||||||
895 | - | |||||||||||||||||||||||||
896 | switch (rr->type) { | - | ||||||||||||||||||||||||
897 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
898 | - | |||||||||||||||||||||||||
899 | if (s->version == 0x0301
| 0 | ||||||||||||||||||||||||
900 | rr->length = 0; | - | ||||||||||||||||||||||||
901 | goto never executed: start;goto start; never executed: goto start; | 0 | ||||||||||||||||||||||||
902 | } | - | ||||||||||||||||||||||||
903 | al = 10; | - | ||||||||||||||||||||||||
904 | SSL_error_internal(s, 245, __FILE__, 1063); | - | ||||||||||||||||||||||||
905 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
906 | case never executed: 20:case 20: never executed: case 20: | 0 | ||||||||||||||||||||||||
907 | case never executed: 21:case 21: never executed: case 21: | 0 | ||||||||||||||||||||||||
908 | case never executed: 22:case 22: never executed: case 22: | 0 | ||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||
910 | - | |||||||||||||||||||||||||
911 | - | |||||||||||||||||||||||||
912 | al = 10; | - | ||||||||||||||||||||||||
913 | SSL_error_internal(s, (4|64), __FILE__, 1072); | - | ||||||||||||||||||||||||
914 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
915 | case never executed: 23:case 23: never executed: case 23: | 0 | ||||||||||||||||||||||||
916 | - | |||||||||||||||||||||||||
917 | - | |||||||||||||||||||||||||
918 | - | |||||||||||||||||||||||||
919 | - | |||||||||||||||||||||||||
920 | - | |||||||||||||||||||||||||
921 | - | |||||||||||||||||||||||||
922 | - | |||||||||||||||||||||||||
923 | if ((
| 0 | ||||||||||||||||||||||||
924 | ((
| 0 | ||||||||||||||||||||||||
925 | ((((
| 0 | ||||||||||||||||||||||||
926 | ((
| 0 | ||||||||||||||||||||||||
927 | ((
| 0 | ||||||||||||||||||||||||
928 | ((
| 0 | ||||||||||||||||||||||||
929 | ((
| 0 | ||||||||||||||||||||||||
930 | ((
| 0 | ||||||||||||||||||||||||
931 | (s->s3->internal)->in_read_app_data = 2; | - | ||||||||||||||||||||||||
932 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
933 | } else { | - | ||||||||||||||||||||||||
934 | al = 10; | - | ||||||||||||||||||||||||
935 | SSL_error_internal(s, 245, __FILE__, 1094); | - | ||||||||||||||||||||||||
936 | goto never executed: f_err;goto f_err; never executed: goto f_err; | 0 | ||||||||||||||||||||||||
937 | } | - | ||||||||||||||||||||||||
938 | } | - | ||||||||||||||||||||||||
939 | - | |||||||||||||||||||||||||
940 | - | |||||||||||||||||||||||||
941 | f_err: code before this statement never executed: f_err: | 0 | ||||||||||||||||||||||||
942 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
943 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
944 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
945 | } | - | ||||||||||||||||||||||||
946 | - | |||||||||||||||||||||||||
947 | int | - | ||||||||||||||||||||||||
948 | dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, int len) | - | ||||||||||||||||||||||||
949 | { | - | ||||||||||||||||||||||||
950 | int i; | - | ||||||||||||||||||||||||
951 | - | |||||||||||||||||||||||||
952 | if ((
| 0-33 | ||||||||||||||||||||||||
953 | { | - | ||||||||||||||||||||||||
954 | i = s->internal->handshake_func(s); | - | ||||||||||||||||||||||||
955 | if (i < 0
| 11-22 | ||||||||||||||||||||||||
956 | return executed 22 times by 1 test: (i);return (i); Executed by:
executed 22 times by 1 test: return (i); Executed by:
| 22 | ||||||||||||||||||||||||
957 | if (i == 0
| 0-11 | ||||||||||||||||||||||||
958 | SSL_error_internal(s, 229, __FILE__, 1117); | - | ||||||||||||||||||||||||
959 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
960 | } | - | ||||||||||||||||||||||||
961 | } executed 11 times by 1 test: end of block Executed by:
| 11 | ||||||||||||||||||||||||
962 | - | |||||||||||||||||||||||||
963 | if (len > 16384
| 0-22 | ||||||||||||||||||||||||
964 | SSL_error_internal(s, 334, __FILE__, 1123); | - | ||||||||||||||||||||||||
965 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
966 | } | - | ||||||||||||||||||||||||
967 | - | |||||||||||||||||||||||||
968 | i = dtls1_write_bytes(s, type, buf_, len); | - | ||||||||||||||||||||||||
969 | return executed 22 times by 1 test: i;return i; Executed by:
executed 22 times by 1 test: return i; Executed by:
| 22 | ||||||||||||||||||||||||
970 | } | - | ||||||||||||||||||||||||
971 | - | |||||||||||||||||||||||||
972 | - | |||||||||||||||||||||||||
973 | - | |||||||||||||||||||||||||
974 | - | |||||||||||||||||||||||||
975 | static int | - | ||||||||||||||||||||||||
976 | have_handshake_fragment(SSL *s, int type, unsigned char *buf, | - | ||||||||||||||||||||||||
977 | int len, int peek) | - | ||||||||||||||||||||||||
978 | { | - | ||||||||||||||||||||||||
979 | - | |||||||||||||||||||||||||
980 | if ((
| 0-241 | ||||||||||||||||||||||||
981 | - | |||||||||||||||||||||||||
982 | { | - | ||||||||||||||||||||||||
983 | unsigned char *src = (s->d1->internal)->handshake_fragment; | - | ||||||||||||||||||||||||
984 | unsigned char *dst = buf; | - | ||||||||||||||||||||||||
985 | unsigned int k, n; | - | ||||||||||||||||||||||||
986 | - | |||||||||||||||||||||||||
987 | - | |||||||||||||||||||||||||
988 | n = 0; | - | ||||||||||||||||||||||||
989 | while ((
| 0 | ||||||||||||||||||||||||
990 | *dst++ = *src++; | - | ||||||||||||||||||||||||
991 | len--; | - | ||||||||||||||||||||||||
992 | (s->d1->internal)->handshake_fragment_len--; | - | ||||||||||||||||||||||||
993 | n++; | - | ||||||||||||||||||||||||
994 | } never executed: end of block | 0 | ||||||||||||||||||||||||
995 | - | |||||||||||||||||||||||||
996 | for (k = 0; k < (s->d1->internal)->handshake_fragment_len
| 0 | ||||||||||||||||||||||||
997 | ( never executed: s->d1->internal)->handshake_fragment[k] = *src++;(s->d1->internal)->handshake_fragment[k] = *src++; never executed: (s->d1->internal)->handshake_fragment[k] = *src++; | 0 | ||||||||||||||||||||||||
998 | return never executed: n;return n; never executed: return n; | 0 | ||||||||||||||||||||||||
999 | } | - | ||||||||||||||||||||||||
1000 | - | |||||||||||||||||||||||||
1001 | return executed 285 times by 2 tests: 0;return 0; Executed by:
executed 285 times by 2 tests: return 0; Executed by:
| 285 | ||||||||||||||||||||||||
1002 | } | - | ||||||||||||||||||||||||
1003 | - | |||||||||||||||||||||||||
1004 | - | |||||||||||||||||||||||||
1005 | - | |||||||||||||||||||||||||
1006 | - | |||||||||||||||||||||||||
1007 | - | |||||||||||||||||||||||||
1008 | int | - | ||||||||||||||||||||||||
1009 | dtls1_write_bytes(SSL *s, int type, const void *buf, int len) | - | ||||||||||||||||||||||||
1010 | { | - | ||||||||||||||||||||||||
1011 | int i; | - | ||||||||||||||||||||||||
1012 | - | |||||||||||||||||||||||||
1013 | (void)((len <= 16384) ? 0 : (OpenSSLDie(__FILE__, 1172, "len <= SSL3_RT_MAX_PLAIN_LENGTH"),1)); | - | ||||||||||||||||||||||||
1014 | s->internal->rwstate = 1; | - | ||||||||||||||||||||||||
1015 | i = do_dtls1_write(s, type, buf, len); | - | ||||||||||||||||||||||||
1016 | return executed 154 times by 2 tests: i;return i; Executed by:
executed 154 times by 2 tests: return i; Executed by:
| 154 | ||||||||||||||||||||||||
1017 | } | - | ||||||||||||||||||||||||
1018 | - | |||||||||||||||||||||||||
1019 | int | - | ||||||||||||||||||||||||
1020 | do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len) | - | ||||||||||||||||||||||||
1021 | { | - | ||||||||||||||||||||||||
1022 | unsigned char *p, *pseq; | - | ||||||||||||||||||||||||
1023 | int i, mac_size, clear = 0; | - | ||||||||||||||||||||||||
1024 | int prefix_len = 0; | - | ||||||||||||||||||||||||
1025 | SSL3_RECORD *wr; | - | ||||||||||||||||||||||||
1026 | SSL3_BUFFER *wb; | - | ||||||||||||||||||||||||
1027 | SSL_SESSION *sess; | - | ||||||||||||||||||||||||
1028 | int bs; | - | ||||||||||||||||||||||||
1029 | - | |||||||||||||||||||||||||
1030 | - | |||||||||||||||||||||||||
1031 | - | |||||||||||||||||||||||||
1032 | if (s->s3->wbuf.left != 0
| 0-176 | ||||||||||||||||||||||||
1033 | (void)((0) ? 0 : (OpenSSLDie(__FILE__, 1192, "0"),1)); | - | ||||||||||||||||||||||||
1034 | return never executed: (ssl3_write_pending(s, type, buf, len));return (ssl3_write_pending(s, type, buf, len)); never executed: return (ssl3_write_pending(s, type, buf, len)); | 0 | ||||||||||||||||||||||||
1035 | } | - | ||||||||||||||||||||||||
1036 | - | |||||||||||||||||||||||||
1037 | - | |||||||||||||||||||||||||
1038 | if (s->s3->alert_dispatch
| 0-176 | ||||||||||||||||||||||||
1039 | i = s->method->ssl_dispatch_alert(s); | - | ||||||||||||||||||||||||
1040 | if (i <= 0
| 0 | ||||||||||||||||||||||||
1041 | return never executed: (i);return (i); never executed: return (i); | 0 | ||||||||||||||||||||||||
1042 | - | |||||||||||||||||||||||||
1043 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1044 | - | |||||||||||||||||||||||||
1045 | if (len == 0
| 0-176 | ||||||||||||||||||||||||
1046 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1047 | - | |||||||||||||||||||||||||
1048 | wr = &((s->s3->internal)->wrec); | - | ||||||||||||||||||||||||
1049 | wb = &(s->s3->wbuf); | - | ||||||||||||||||||||||||
1050 | sess = s->session; | - | ||||||||||||||||||||||||
1051 | - | |||||||||||||||||||||||||
1052 | if ((
| 0-176 | ||||||||||||||||||||||||
1053 | ((void *)0)
| 0-176 | ||||||||||||||||||||||||
1054 | )
| 0-176 | ||||||||||||||||||||||||
1055 | ((void *)0)
| 66-110 | ||||||||||||||||||||||||
1056 | )
| 66-110 | ||||||||||||||||||||||||
1057 | (
| 0-66 | ||||||||||||||||||||||||
1058 | ((void *)0)
| 0-66 | ||||||||||||||||||||||||
1059 | )
| 0-66 | ||||||||||||||||||||||||
1060 | clear = 1; executed 110 times by 2 tests: clear = 1; Executed by:
| 110 | ||||||||||||||||||||||||
1061 | - | |||||||||||||||||||||||||
1062 | if (clear
| 66-110 | ||||||||||||||||||||||||
1063 | mac_size = 0; executed 110 times by 2 tests: mac_size = 0; Executed by:
| 110 | ||||||||||||||||||||||||
1064 | else { | - | ||||||||||||||||||||||||
1065 | mac_size = EVP_MD_size(EVP_MD_CTX_md(s->internal->write_hash)); | - | ||||||||||||||||||||||||
1066 | if (mac_size < 0
| 0-66 | ||||||||||||||||||||||||
1067 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1068 | } executed 66 times by 1 test: end of block Executed by:
| 66 | ||||||||||||||||||||||||
1069 | - | |||||||||||||||||||||||||
1070 | - | |||||||||||||||||||||||||
1071 | - | |||||||||||||||||||||||||
1072 | p = wb->buf + prefix_len; | - | ||||||||||||||||||||||||
1073 | - | |||||||||||||||||||||||||
1074 | - | |||||||||||||||||||||||||
1075 | - | |||||||||||||||||||||||||
1076 | *(p++) = type&0xff; | - | ||||||||||||||||||||||||
1077 | wr->type = type; | - | ||||||||||||||||||||||||
1078 | - | |||||||||||||||||||||||||
1079 | *(p++) = (s->version >> 8); | - | ||||||||||||||||||||||||
1080 | *(p++) = s->version&0xff; | - | ||||||||||||||||||||||||
1081 | - | |||||||||||||||||||||||||
1082 | - | |||||||||||||||||||||||||
1083 | pseq = p; | - | ||||||||||||||||||||||||
1084 | - | |||||||||||||||||||||||||
1085 | p += 10; | - | ||||||||||||||||||||||||
1086 | - | |||||||||||||||||||||||||
1087 | - | |||||||||||||||||||||||||
1088 | - | |||||||||||||||||||||||||
1089 | - | |||||||||||||||||||||||||
1090 | - | |||||||||||||||||||||||||
1091 | - | |||||||||||||||||||||||||
1092 | if (s->internal->enc_write_ctx
| 66-110 | ||||||||||||||||||||||||
1093 | ((
| 12-54 | ||||||||||||||||||||||||
1094 | bs = EVP_CIPHER_block_size(s->internal->enc_write_ctx->cipher); executed 54 times by 1 test: bs = EVP_CIPHER_block_size(s->internal->enc_write_ctx->cipher); Executed by:
| 54 | ||||||||||||||||||||||||
1095 | else | - | ||||||||||||||||||||||||
1096 | bs = 0; executed 122 times by 2 tests: bs = 0; Executed by:
| 122 | ||||||||||||||||||||||||
1097 | - | |||||||||||||||||||||||||
1098 | wr->data = p + bs; | - | ||||||||||||||||||||||||
1099 | - | |||||||||||||||||||||||||
1100 | wr->length = (int)len; | - | ||||||||||||||||||||||||
1101 | wr->input = (unsigned char *)buf; | - | ||||||||||||||||||||||||
1102 | - | |||||||||||||||||||||||||
1103 | - | |||||||||||||||||||||||||
1104 | - | |||||||||||||||||||||||||
1105 | - | |||||||||||||||||||||||||
1106 | memcpy(wr->data, wr->input, wr->length); | - | ||||||||||||||||||||||||
1107 | wr->input = wr->data; | - | ||||||||||||||||||||||||
1108 | - | |||||||||||||||||||||||||
1109 | - | |||||||||||||||||||||||||
1110 | - | |||||||||||||||||||||||||
1111 | - | |||||||||||||||||||||||||
1112 | - | |||||||||||||||||||||||||
1113 | if (mac_size != 0
| 66-110 | ||||||||||||||||||||||||
1114 | if (tls1_mac(s, &(p[wr->length + bs]), 1) < 0
| 0-66 | ||||||||||||||||||||||||
1115 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1116 | wr->length += mac_size; | - | ||||||||||||||||||||||||
1117 | } executed 66 times by 1 test: end of block Executed by:
| 66 | ||||||||||||||||||||||||
1118 | - | |||||||||||||||||||||||||
1119 | - | |||||||||||||||||||||||||
1120 | wr->input = p; | - | ||||||||||||||||||||||||
1121 | wr->data = p; | - | ||||||||||||||||||||||||
1122 | - | |||||||||||||||||||||||||
1123 | - | |||||||||||||||||||||||||
1124 | - | |||||||||||||||||||||||||
1125 | if (bs
| 54-122 | ||||||||||||||||||||||||
1126 | { | - | ||||||||||||||||||||||||
1127 | arc4random_buf(p, bs); | - | ||||||||||||||||||||||||
1128 | - | |||||||||||||||||||||||||
1129 | - | |||||||||||||||||||||||||
1130 | wr->length += bs; | - | ||||||||||||||||||||||||
1131 | } executed 54 times by 1 test: end of block Executed by:
| 54 | ||||||||||||||||||||||||
1132 | - | |||||||||||||||||||||||||
1133 | s->method->internal->ssl3_enc->enc(s, 1); | - | ||||||||||||||||||||||||
1134 | - | |||||||||||||||||||||||||
1135 | - | |||||||||||||||||||||||||
1136 | - | |||||||||||||||||||||||||
1137 | - | |||||||||||||||||||||||||
1138 | - | |||||||||||||||||||||||||
1139 | - | |||||||||||||||||||||||||
1140 | - | |||||||||||||||||||||||||
1141 | ((pseq[0]=(unsigned char)((((s->d1->internal)->w_epoch)>> 8)&0xff), pseq[1]=(unsigned char)((((s->d1->internal)->w_epoch) )&0xff)),pseq+=2); | - | ||||||||||||||||||||||||
1142 | - | |||||||||||||||||||||||||
1143 | - | |||||||||||||||||||||||||
1144 | - | |||||||||||||||||||||||||
1145 | - | |||||||||||||||||||||||||
1146 | - | |||||||||||||||||||||||||
1147 | - | |||||||||||||||||||||||||
1148 | memcpy(pseq, &((s->s3->internal)->write_sequence[2]), 6); | - | ||||||||||||||||||||||||
1149 | pseq += 6; | - | ||||||||||||||||||||||||
1150 | ((pseq[0]=(unsigned char)(((wr->length)>> 8)&0xff), pseq[1]=(unsigned char)(((wr->length) )&0xff)),pseq+=2); | - | ||||||||||||||||||||||||
1151 | - | |||||||||||||||||||||||||
1152 | - | |||||||||||||||||||||||||
1153 | - | |||||||||||||||||||||||||
1154 | - | |||||||||||||||||||||||||
1155 | wr->type=type; | - | ||||||||||||||||||||||||
1156 | wr->length += 13; | - | ||||||||||||||||||||||||
1157 | - | |||||||||||||||||||||||||
1158 | tls1_record_sequence_increment((s->s3->internal)->write_sequence); | - | ||||||||||||||||||||||||
1159 | - | |||||||||||||||||||||||||
1160 | - | |||||||||||||||||||||||||
1161 | wb->left = prefix_len + wr->length; | - | ||||||||||||||||||||||||
1162 | wb->offset = 0; | - | ||||||||||||||||||||||||
1163 | - | |||||||||||||||||||||||||
1164 | - | |||||||||||||||||||||||||
1165 | (s->s3->internal)->wpend_tot = len; | - | ||||||||||||||||||||||||
1166 | (s->s3->internal)->wpend_buf = buf; | - | ||||||||||||||||||||||||
1167 | (s->s3->internal)->wpend_type = type; | - | ||||||||||||||||||||||||
1168 | (s->s3->internal)->wpend_ret = len; | - | ||||||||||||||||||||||||
1169 | - | |||||||||||||||||||||||||
1170 | - | |||||||||||||||||||||||||
1171 | return executed 176 times by 2 tests: ssl3_write_pending(s, type, buf, len);return ssl3_write_pending(s, type, buf, len); Executed by:
executed 176 times by 2 tests: return ssl3_write_pending(s, type, buf, len); Executed by:
| 176 | ||||||||||||||||||||||||
1172 | err: | - | ||||||||||||||||||||||||
1173 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1174 | } | - | ||||||||||||||||||||||||
1175 | - | |||||||||||||||||||||||||
1176 | - | |||||||||||||||||||||||||
1177 | - | |||||||||||||||||||||||||
1178 | static int | - | ||||||||||||||||||||||||
1179 | dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap) | - | ||||||||||||||||||||||||
1180 | { | - | ||||||||||||||||||||||||
1181 | int cmp; | - | ||||||||||||||||||||||||
1182 | unsigned int shift; | - | ||||||||||||||||||||||||
1183 | const unsigned char *seq = (s->s3->internal)->read_sequence; | - | ||||||||||||||||||||||||
1184 | - | |||||||||||||||||||||||||
1185 | cmp = satsub64be(seq, bitmap->max_seq_num); | - | ||||||||||||||||||||||||
1186 | if (cmp > 0
| 44-109 | ||||||||||||||||||||||||
1187 | memcpy ((s->s3->internal)->rrec.seq_num, seq, 8); | - | ||||||||||||||||||||||||
1188 | return executed 109 times by 1 test: 1;return 1; Executed by:
executed 109 times by 1 test: return 1; Executed by:
| 109 | ||||||||||||||||||||||||
1189 | } | - | ||||||||||||||||||||||||
1190 | shift = -cmp; | - | ||||||||||||||||||||||||
1191 | if (shift >= sizeof(bitmap->map)*8
| 0-44 | ||||||||||||||||||||||||
1192 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1193 | else if (bitmap->map & (1UL << shift)
| 0-44 | ||||||||||||||||||||||||
1194 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1195 | - | |||||||||||||||||||||||||
1196 | memcpy((s->s3->internal)->rrec.seq_num, seq, 8); | - | ||||||||||||||||||||||||
1197 | return executed 44 times by 1 test: 1;return 1; Executed by:
executed 44 times by 1 test: return 1; Executed by:
| 44 | ||||||||||||||||||||||||
1198 | } | - | ||||||||||||||||||||||||
1199 | - | |||||||||||||||||||||||||
1200 | - | |||||||||||||||||||||||||
1201 | static void | - | ||||||||||||||||||||||||
1202 | dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap) | - | ||||||||||||||||||||||||
1203 | { | - | ||||||||||||||||||||||||
1204 | int cmp; | - | ||||||||||||||||||||||||
1205 | unsigned int shift; | - | ||||||||||||||||||||||||
1206 | const unsigned char *seq = (s->s3->internal)->read_sequence; | - | ||||||||||||||||||||||||
1207 | - | |||||||||||||||||||||||||
1208 | cmp = satsub64be(seq, bitmap->max_seq_num); | - | ||||||||||||||||||||||||
1209 | if (cmp > 0
| 44-109 | ||||||||||||||||||||||||
1210 | shift = cmp; | - | ||||||||||||||||||||||||
1211 | if (shift < sizeof(bitmap->map)*8
| 0-109 | ||||||||||||||||||||||||
1212 | bitmap->map <<= shift, bitmap->map |= 1UL; executed 109 times by 1 test: bitmap->map <<= shift, bitmap->map |= 1UL; Executed by:
| 109 | ||||||||||||||||||||||||
1213 | else | - | ||||||||||||||||||||||||
1214 | bitmap->map = 1UL; never executed: bitmap->map = 1UL; | 0 | ||||||||||||||||||||||||
1215 | memcpy(bitmap->max_seq_num, seq, 8); | - | ||||||||||||||||||||||||
1216 | } executed 109 times by 1 test: else {end of block Executed by:
| 109 | ||||||||||||||||||||||||
1217 | shift = -cmp; | - | ||||||||||||||||||||||||
1218 | if (shift < sizeof(bitmap->map) * 8
| 0-44 | ||||||||||||||||||||||||
1219 | bitmap->map |= 1UL << shift; executed 44 times by 1 test: bitmap->map |= 1UL << shift; Executed by:
| 44 | ||||||||||||||||||||||||
1220 | } executed 44 times by 1 test: end of block Executed by:
| 44 | ||||||||||||||||||||||||
1221 | } | - | ||||||||||||||||||||||||
1222 | - | |||||||||||||||||||||||||
1223 | - | |||||||||||||||||||||||||
1224 | int | - | ||||||||||||||||||||||||
1225 | dtls1_dispatch_alert(SSL *s) | - | ||||||||||||||||||||||||
1226 | { | - | ||||||||||||||||||||||||
1227 | int i, j; | - | ||||||||||||||||||||||||
1228 | void (*cb)(const SSL *ssl, int type, int val) = | - | ||||||||||||||||||||||||
1229 | ((void *)0) | - | ||||||||||||||||||||||||
1230 | ; | - | ||||||||||||||||||||||||
1231 | unsigned char buf[2]; | - | ||||||||||||||||||||||||
1232 | unsigned char *ptr = &buf[0]; | - | ||||||||||||||||||||||||
1233 | - | |||||||||||||||||||||||||
1234 | s->s3->alert_dispatch = 0; | - | ||||||||||||||||||||||||
1235 | - | |||||||||||||||||||||||||
1236 | memset(buf, 0x00, sizeof(buf)); | - | ||||||||||||||||||||||||
1237 | *ptr++ = s->s3->send_alert[0]; | - | ||||||||||||||||||||||||
1238 | *ptr++ = s->s3->send_alert[1]; | - | ||||||||||||||||||||||||
1239 | - | |||||||||||||||||||||||||
1240 | i = do_dtls1_write(s, 21, &buf[0], sizeof(buf)); | - | ||||||||||||||||||||||||
1241 | if (i <= 0
| 0-22 | ||||||||||||||||||||||||
1242 | s->s3->alert_dispatch = 1; | - | ||||||||||||||||||||||||
1243 | - | |||||||||||||||||||||||||
1244 | } executed 22 times by 1 test: else {end of block Executed by:
| 22 | ||||||||||||||||||||||||
1245 | if (s->s3->send_alert[0] == 2
| 0 | ||||||||||||||||||||||||
1246 | ( never executed: void)(int)BIO_ctrl(s->wbio,11,0,(void)(int)BIO_ctrl(s->wbio,11,0, ((void *)0) ); never executed: (void)(int)BIO_ctrl(s->wbio,11,0, ((void *)0) ); | 0 | ||||||||||||||||||||||||
1247 | ((void *)0) never executed: (void)(int)BIO_ctrl(s->wbio,11,0, ((void *)0) ); | 0 | ||||||||||||||||||||||||
1248 | ); never executed: (void)(int)BIO_ctrl(s->wbio,11,0, ((void *)0) ); | 0 | ||||||||||||||||||||||||
1249 | - | |||||||||||||||||||||||||
1250 | if (s->internal->msg_callback
| 0 | ||||||||||||||||||||||||
1251 | s->internal->msg_callback(1, s->version, 21, never executed: s->internal->msg_callback(1, s->version, 21, s->s3->send_alert, 2, s, s->internal->msg_callback_arg); | 0 | ||||||||||||||||||||||||
1252 | s->s3->send_alert, 2, s, s->internal->msg_callback_arg); never executed: s->internal->msg_callback(1, s->version, 21, s->s3->send_alert, 2, s, s->internal->msg_callback_arg); | 0 | ||||||||||||||||||||||||
1253 | - | |||||||||||||||||||||||||
1254 | if (s->internal->info_callback !=
| 0 | ||||||||||||||||||||||||
1255 | ((void *)0)
| 0 | ||||||||||||||||||||||||
1256 | ) | - | ||||||||||||||||||||||||
1257 | cb = s->internal->info_callback; never executed: cb = s->internal->info_callback; | 0 | ||||||||||||||||||||||||
1258 | else if (s->ctx->internal->info_callback !=
| 0 | ||||||||||||||||||||||||
1259 | ((void *)0)
| 0 | ||||||||||||||||||||||||
1260 | ) | - | ||||||||||||||||||||||||
1261 | cb = s->ctx->internal->info_callback; never executed: cb = s->ctx->internal->info_callback; | 0 | ||||||||||||||||||||||||
1262 | - | |||||||||||||||||||||||||
1263 | if (cb !=
| 0 | ||||||||||||||||||||||||
1264 | ((void *)0)
| 0 | ||||||||||||||||||||||||
1265 | ) { | - | ||||||||||||||||||||||||
1266 | j = (s->s3->send_alert[0]<<8)|s->s3->send_alert[1]; | - | ||||||||||||||||||||||||
1267 | cb(s, (0x4000|0x08), j); | - | ||||||||||||||||||||||||
1268 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1269 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1270 | return executed 22 times by 1 test: (i);return (i); Executed by:
executed 22 times by 1 test: return (i); Executed by:
| 22 | ||||||||||||||||||||||||
1271 | } | - | ||||||||||||||||||||||||
1272 | - | |||||||||||||||||||||||||
1273 | - | |||||||||||||||||||||||||
1274 | static DTLS1_BITMAP * | - | ||||||||||||||||||||||||
1275 | dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr, unsigned int *is_next_epoch) | - | ||||||||||||||||||||||||
1276 | { | - | ||||||||||||||||||||||||
1277 | - | |||||||||||||||||||||||||
1278 | *is_next_epoch = 0; | - | ||||||||||||||||||||||||
1279 | - | |||||||||||||||||||||||||
1280 | - | |||||||||||||||||||||||||
1281 | if (rr->epoch == (s->d1->internal)->r_epoch
| 0-153 | ||||||||||||||||||||||||
1282 | return executed 153 times by 1 test: &(s->d1->internal)->bitmap;return &(s->d1->internal)->bitmap; Executed by:
executed 153 times by 1 test: return &(s->d1->internal)->bitmap; Executed by:
| 153 | ||||||||||||||||||||||||
1283 | - | |||||||||||||||||||||||||
1284 | - | |||||||||||||||||||||||||
1285 | else if (rr->epoch == (unsigned long)((s->d1->internal)->r_epoch + 1)
| 0 | ||||||||||||||||||||||||
1286 | (rr->type == 22
| 0 | ||||||||||||||||||||||||
1287 | *is_next_epoch = 1; | - | ||||||||||||||||||||||||
1288 | return never executed: &(s->d1->internal)->next_bitmap;return &(s->d1->internal)->next_bitmap; never executed: return &(s->d1->internal)->next_bitmap; | 0 | ||||||||||||||||||||||||
1289 | } | - | ||||||||||||||||||||||||
1290 | - | |||||||||||||||||||||||||
1291 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
1292 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
1293 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
1294 | } | - | ||||||||||||||||||||||||
1295 | - | |||||||||||||||||||||||||
1296 | void | - | ||||||||||||||||||||||||
1297 | dtls1_reset_seq_numbers(SSL *s, int rw) | - | ||||||||||||||||||||||||
1298 | { | - | ||||||||||||||||||||||||
1299 | unsigned char *seq; | - | ||||||||||||||||||||||||
1300 | unsigned int seq_bytes = sizeof((s->s3->internal)->read_sequence); | - | ||||||||||||||||||||||||
1301 | - | |||||||||||||||||||||||||
1302 | if (rw & 0x01
| 22 | ||||||||||||||||||||||||
1303 | seq = (s->s3->internal)->read_sequence; | - | ||||||||||||||||||||||||
1304 | (s->d1->internal)->r_epoch++; | - | ||||||||||||||||||||||||
1305 | memcpy(&((s->d1->internal)->bitmap), &((s->d1->internal)->next_bitmap), sizeof(DTLS1_BITMAP)); | - | ||||||||||||||||||||||||
1306 | memset(&((s->d1->internal)->next_bitmap), 0x00, sizeof(DTLS1_BITMAP)); | - | ||||||||||||||||||||||||
1307 | } executed 22 times by 1 test: else {end of block Executed by:
| 22 | ||||||||||||||||||||||||
1308 | seq = (s->s3->internal)->write_sequence; | - | ||||||||||||||||||||||||
1309 | memcpy((s->d1->internal)->last_write_sequence, seq, sizeof((s->s3->internal)->write_sequence)); | - | ||||||||||||||||||||||||
1310 | (s->d1->internal)->w_epoch++; | - | ||||||||||||||||||||||||
1311 | } executed 22 times by 1 test: end of block Executed by:
| 22 | ||||||||||||||||||||||||
1312 | - | |||||||||||||||||||||||||
1313 | memset(seq, 0x00, seq_bytes); | - | ||||||||||||||||||||||||
1314 | } executed 44 times by 1 test: end of block Executed by:
| 44 | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |