| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/record/rec_layer_d1.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | int DTLS_RECORD_LAYER_new(RECORD_LAYER *rl) | - | ||||||||||||||||||
| 5 | { | - | ||||||||||||||||||
| 6 | DTLS_RECORD_LAYER *d; | - | ||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | if ((
| 0-373 | ||||||||||||||||||
| 9 | ((void *)0)
| 0-373 | ||||||||||||||||||
| 10 | ) { | - | ||||||||||||||||||
| 11 | ERR_put_error(20,(635),((1|64)),__FILE__,24); | - | ||||||||||||||||||
| 12 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 13 | } | - | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | rl->d = d; | - | ||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | d->unprocessed_rcds.q = pqueue_new(); | - | ||||||||||||||||||
| 18 | d->processed_rcds.q = pqueue_new(); | - | ||||||||||||||||||
| 19 | d->buffered_app_data.q = pqueue_new(); | - | ||||||||||||||||||
| 20 | - | |||||||||||||||||||
| 21 | if (d->unprocessed_rcds.q ==
| 0-373 | ||||||||||||||||||
| 22 | ((void *)0)
| 0-373 | ||||||||||||||||||
| 23 | || d->processed_rcds.q ==
| 0-373 | ||||||||||||||||||
| 24 | ((void *)0)
| 0-373 | ||||||||||||||||||
| 25 | - | |||||||||||||||||||
| 26 | || d->buffered_app_data.q ==
| 0-373 | ||||||||||||||||||
| 27 | ((void *)0)
| 0-373 | ||||||||||||||||||
| 28 | ) { | - | ||||||||||||||||||
| 29 | pqueue_free(d->unprocessed_rcds.q); | - | ||||||||||||||||||
| 30 | pqueue_free(d->processed_rcds.q); | - | ||||||||||||||||||
| 31 | pqueue_free(d->buffered_app_data.q); | - | ||||||||||||||||||
| 32 | CRYPTO_free(d, __FILE__, 39); | - | ||||||||||||||||||
| 33 | rl->d = | - | ||||||||||||||||||
| 34 | ((void *)0) | - | ||||||||||||||||||
| 35 | ; | - | ||||||||||||||||||
| 36 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 37 | } | - | ||||||||||||||||||
| 38 | - | |||||||||||||||||||
| 39 | return executed 373 times by 1 test: 1;return 1;Executed by:
executed 373 times by 1 test: return 1;Executed by:
| 373 | ||||||||||||||||||
| 40 | } | - | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | void DTLS_RECORD_LAYER_free(RECORD_LAYER *rl) | - | ||||||||||||||||||
| 43 | { | - | ||||||||||||||||||
| 44 | DTLS_RECORD_LAYER_clear(rl); | - | ||||||||||||||||||
| 45 | pqueue_free(rl->d->unprocessed_rcds.q); | - | ||||||||||||||||||
| 46 | pqueue_free(rl->d->processed_rcds.q); | - | ||||||||||||||||||
| 47 | pqueue_free(rl->d->buffered_app_data.q); | - | ||||||||||||||||||
| 48 | CRYPTO_free(rl->d, __FILE__, 53); | - | ||||||||||||||||||
| 49 | rl->d = | - | ||||||||||||||||||
| 50 | ((void *)0) | - | ||||||||||||||||||
| 51 | ; | - | ||||||||||||||||||
| 52 | } executed 373 times by 1 test: end of blockExecuted by:
| 373 | ||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | void DTLS_RECORD_LAYER_clear(RECORD_LAYER *rl) | - | ||||||||||||||||||
| 55 | { | - | ||||||||||||||||||
| 56 | DTLS_RECORD_LAYER *d; | - | ||||||||||||||||||
| 57 | pitem *item = | - | ||||||||||||||||||
| 58 | ((void *)0) | - | ||||||||||||||||||
| 59 | ; | - | ||||||||||||||||||
| 60 | DTLS1_RECORD_DATA *rdata; | - | ||||||||||||||||||
| 61 | pqueue *unprocessed_rcds; | - | ||||||||||||||||||
| 62 | pqueue *processed_rcds; | - | ||||||||||||||||||
| 63 | pqueue *buffered_app_data; | - | ||||||||||||||||||
| 64 | - | |||||||||||||||||||
| 65 | d = rl->d; | - | ||||||||||||||||||
| 66 | - | |||||||||||||||||||
| 67 | while ((
| 2-2608 | ||||||||||||||||||
| 68 | ((void *)0)
| 2-2608 | ||||||||||||||||||
| 69 | ) { | - | ||||||||||||||||||
| 70 | rdata = (DTLS1_RECORD_DATA *)item->data; | - | ||||||||||||||||||
| 71 | CRYPTO_free(rdata->rbuf.buf, __FILE__, 70); | - | ||||||||||||||||||
| 72 | CRYPTO_free(item->data, __FILE__, 71); | - | ||||||||||||||||||
| 73 | pitem_free(item); | - | ||||||||||||||||||
| 74 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 75 | - | |||||||||||||||||||
| 76 | while ((
| 0-2608 | ||||||||||||||||||
| 77 | ((void *)0)
| 0-2608 | ||||||||||||||||||
| 78 | ) { | - | ||||||||||||||||||
| 79 | rdata = (DTLS1_RECORD_DATA *)item->data; | - | ||||||||||||||||||
| 80 | CRYPTO_free(rdata->rbuf.buf, __FILE__, 77); | - | ||||||||||||||||||
| 81 | CRYPTO_free(item->data, __FILE__, 78); | - | ||||||||||||||||||
| 82 | pitem_free(item); | - | ||||||||||||||||||
| 83 | } never executed: end of block | 0 | ||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | while ((
| 0-2608 | ||||||||||||||||||
| 86 | ((void *)0)
| 0-2608 | ||||||||||||||||||
| 87 | ) { | - | ||||||||||||||||||
| 88 | rdata = (DTLS1_RECORD_DATA *)item->data; | - | ||||||||||||||||||
| 89 | CRYPTO_free(rdata->rbuf.buf, __FILE__, 84); | - | ||||||||||||||||||
| 90 | CRYPTO_free(item->data, __FILE__, 85); | - | ||||||||||||||||||
| 91 | pitem_free(item); | - | ||||||||||||||||||
| 92 | } never executed: end of block | 0 | ||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | unprocessed_rcds = d->unprocessed_rcds.q; | - | ||||||||||||||||||
| 95 | processed_rcds = d->processed_rcds.q; | - | ||||||||||||||||||
| 96 | buffered_app_data = d->buffered_app_data.q; | - | ||||||||||||||||||
| 97 | memset(d, 0, sizeof(*d)); | - | ||||||||||||||||||
| 98 | d->unprocessed_rcds.q = unprocessed_rcds; | - | ||||||||||||||||||
| 99 | d->processed_rcds.q = processed_rcds; | - | ||||||||||||||||||
| 100 | d->buffered_app_data.q = buffered_app_data; | - | ||||||||||||||||||
| 101 | } executed 2608 times by 1 test: end of blockExecuted by:
| 2608 | ||||||||||||||||||
| 102 | - | |||||||||||||||||||
| 103 | void DTLS_RECORD_LAYER_set_saved_w_epoch(RECORD_LAYER *rl, unsigned short e) | - | ||||||||||||||||||
| 104 | { | - | ||||||||||||||||||
| 105 | if (e == rl->d->w_epoch - 1
| 34-210 | ||||||||||||||||||
| 106 | memcpy(rl->d->curr_write_sequence, | - | ||||||||||||||||||
| 107 | rl->write_sequence, sizeof(rl->write_sequence)); | - | ||||||||||||||||||
| 108 | memcpy(rl->write_sequence, | - | ||||||||||||||||||
| 109 | rl->d->last_write_sequence, sizeof(rl->write_sequence)); | - | ||||||||||||||||||
| 110 | } executed 34 times by 1 test: else if (e == rl->d->w_epoch + 1end of blockExecuted by:
| 34-176 | ||||||||||||||||||
| 111 | memcpy(rl->d->last_write_sequence, | - | ||||||||||||||||||
| 112 | rl->write_sequence, sizeof(unsigned char[8])); | - | ||||||||||||||||||
| 113 | memcpy(rl->write_sequence, | - | ||||||||||||||||||
| 114 | rl->d->curr_write_sequence, sizeof(rl->write_sequence)); | - | ||||||||||||||||||
| 115 | } executed 34 times by 1 test: end of blockExecuted by:
| 34 | ||||||||||||||||||
| 116 | rl->d->w_epoch = e; | - | ||||||||||||||||||
| 117 | } executed 244 times by 1 test: end of blockExecuted by:
| 244 | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | void DTLS_RECORD_LAYER_set_write_sequence(RECORD_LAYER *rl, unsigned char *seq) | - | ||||||||||||||||||
| 120 | { | - | ||||||||||||||||||
| 121 | memcpy(rl->write_sequence, seq, 8); | - | ||||||||||||||||||
| 122 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 123 | - | |||||||||||||||||||
| 124 | - | |||||||||||||||||||
| 125 | static int dtls1_copy_record(SSL *s, pitem *item) | - | ||||||||||||||||||
| 126 | { | - | ||||||||||||||||||
| 127 | DTLS1_RECORD_DATA *rdata; | - | ||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | rdata = (DTLS1_RECORD_DATA *)item->data; | - | ||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | SSL3_BUFFER_release(&s->rlayer.rbuf); | - | ||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | s->rlayer.packet = rdata->packet; | - | ||||||||||||||||||
| 134 | s->rlayer.packet_length = rdata->packet_length; | - | ||||||||||||||||||
| 135 | memcpy(&s->rlayer.rbuf, &(rdata->rbuf), sizeof(SSL3_BUFFER)); | - | ||||||||||||||||||
| 136 | memcpy(&s->rlayer.rrec, &(rdata->rrec), sizeof(SSL3_RECORD)); | - | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | memcpy(&(s->rlayer.read_sequence[2]), &(rdata->packet[5]), 6); | - | ||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | return executed 14 times by 1 test: 1;return 1;Executed by:
executed 14 times by 1 test: return 1;Executed by:
| 14 | ||||||||||||||||||
| 142 | } | - | ||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | int dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) | - | ||||||||||||||||||
| 145 | { | - | ||||||||||||||||||
| 146 | DTLS1_RECORD_DATA *rdata; | - | ||||||||||||||||||
| 147 | pitem *item; | - | ||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | if (pqueue_size(queue->q) >= 100
| 0-16 | ||||||||||||||||||
| 151 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | rdata = CRYPTO_malloc(sizeof(*rdata), __FILE__, 148); | - | ||||||||||||||||||
| 154 | item = pitem_new(priority, rdata); | - | ||||||||||||||||||
| 155 | if (rdata ==
| 0-16 | ||||||||||||||||||
| 156 | ((void *)0)
| 0-16 | ||||||||||||||||||
| 157 | || item ==
| 0-16 | ||||||||||||||||||
| 158 | ((void *)0)
| 0-16 | ||||||||||||||||||
| 159 | ) { | - | ||||||||||||||||||
| 160 | CRYPTO_free(rdata, __FILE__, 151); | - | ||||||||||||||||||
| 161 | pitem_free(item); | - | ||||||||||||||||||
| 162 | ossl_statem_fatal((s), (80), (247), ((4|64)), | - | ||||||||||||||||||
| 163 | __FILE__ | - | ||||||||||||||||||
| 164 | , | - | ||||||||||||||||||
| 165 | 154 | - | ||||||||||||||||||
| 166 | ) | - | ||||||||||||||||||
| 167 | ; | - | ||||||||||||||||||
| 168 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 169 | } | - | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | rdata->packet = s->rlayer.packet; | - | ||||||||||||||||||
| 172 | rdata->packet_length = s->rlayer.packet_length; | - | ||||||||||||||||||
| 173 | memcpy(&(rdata->rbuf), &s->rlayer.rbuf, sizeof(SSL3_BUFFER)); | - | ||||||||||||||||||
| 174 | memcpy(&(rdata->rrec), &s->rlayer.rrec, sizeof(SSL3_RECORD)); | - | ||||||||||||||||||
| 175 | - | |||||||||||||||||||
| 176 | item->data = rdata; | - | ||||||||||||||||||
| 177 | s->rlayer.packet = | - | ||||||||||||||||||
| 178 | ((void *)0) | - | ||||||||||||||||||
| 179 | ; | - | ||||||||||||||||||
| 180 | s->rlayer.packet_length = 0; | - | ||||||||||||||||||
| 181 | memset(&s->rlayer.rbuf, 0, sizeof(s->rlayer.rbuf)); | - | ||||||||||||||||||
| 182 | memset(&s->rlayer.rrec, 0, sizeof(s->rlayer.rrec)); | - | ||||||||||||||||||
| 183 | - | |||||||||||||||||||
| 184 | if (!ssl3_setup_buffers(s)
| 0-16 | ||||||||||||||||||
| 185 | - | |||||||||||||||||||
| 186 | CRYPTO_free(rdata->rbuf.buf, __FILE__, 182); | - | ||||||||||||||||||
| 187 | CRYPTO_free(rdata, __FILE__, 183); | - | ||||||||||||||||||
| 188 | pitem_free(item); | - | ||||||||||||||||||
| 189 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 190 | } | - | ||||||||||||||||||
| 191 | - | |||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | if (pqueue_insert(queue->q, item) ==
| 0-16 | ||||||||||||||||||
| 194 | ((void *)0)
| 0-16 | ||||||||||||||||||
| 195 | ) { | - | ||||||||||||||||||
| 196 | ossl_statem_fatal((s), (80), (247), ((4|64)), | - | ||||||||||||||||||
| 197 | __FILE__ | - | ||||||||||||||||||
| 198 | , | - | ||||||||||||||||||
| 199 | 191 | - | ||||||||||||||||||
| 200 | ) | - | ||||||||||||||||||
| 201 | ; | - | ||||||||||||||||||
| 202 | CRYPTO_free(rdata->rbuf.buf, __FILE__, 192); | - | ||||||||||||||||||
| 203 | CRYPTO_free(rdata, __FILE__, 193); | - | ||||||||||||||||||
| 204 | pitem_free(item); | - | ||||||||||||||||||
| 205 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 206 | } | - | ||||||||||||||||||
| 207 | - | |||||||||||||||||||
| 208 | return executed 16 times by 1 test: 1;return 1;Executed by:
executed 16 times by 1 test: return 1;Executed by:
| 16 | ||||||||||||||||||
| 209 | } | - | ||||||||||||||||||
| 210 | - | |||||||||||||||||||
| 211 | int dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue) | - | ||||||||||||||||||
| 212 | { | - | ||||||||||||||||||
| 213 | pitem *item; | - | ||||||||||||||||||
| 214 | - | |||||||||||||||||||
| 215 | item = pqueue_pop(queue->q); | - | ||||||||||||||||||
| 216 | if (item
| 14-4698 | ||||||||||||||||||
| 217 | dtls1_copy_record(s, item); | - | ||||||||||||||||||
| 218 | - | |||||||||||||||||||
| 219 | CRYPTO_free(item->data, __FILE__, 209); | - | ||||||||||||||||||
| 220 | pitem_free(item); | - | ||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | return executed 14 times by 1 test: 1;return 1;Executed by:
executed 14 times by 1 test: return 1;Executed by:
| 14 | ||||||||||||||||||
| 223 | } | - | ||||||||||||||||||
| 224 | - | |||||||||||||||||||
| 225 | return executed 4698 times by 1 test: 0;return 0;Executed by:
executed 4698 times by 1 test: return 0;Executed by:
| 4698 | ||||||||||||||||||
| 226 | } | - | ||||||||||||||||||
| 227 | int dtls1_process_buffered_records(SSL *s) | - | ||||||||||||||||||
| 228 | { | - | ||||||||||||||||||
| 229 | pitem *item; | - | ||||||||||||||||||
| 230 | SSL3_BUFFER *rb; | - | ||||||||||||||||||
| 231 | SSL3_RECORD *rr; | - | ||||||||||||||||||
| 232 | DTLS1_BITMAP *bitmap; | - | ||||||||||||||||||
| 233 | unsigned int is_next_epoch; | - | ||||||||||||||||||
| 234 | int replayok = 1; | - | ||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | item = pqueue_peek(s->rlayer.d->unprocessed_rcds.q); | - | ||||||||||||||||||
| 237 | if (item
| 93-4612 | ||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | if (s->rlayer.d->unprocessed_rcds.epoch != s->rlayer.d->r_epoch
| 9-84 | ||||||||||||||||||
| 240 | return executed 84 times by 1 test: 1;return 1;Executed by:
executed 84 times by 1 test: return 1;Executed by:
| 84 | ||||||||||||||||||
| 241 | - | |||||||||||||||||||
| 242 | rr = ((&s->rlayer)->rrec); | - | ||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | rb = (&(&s->rlayer)->rbuf); | - | ||||||||||||||||||
| 245 | - | |||||||||||||||||||
| 246 | if (((
| 2-7 | ||||||||||||||||||
| 247 | - | |||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | - | |||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | - | |||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | return executed 2 times by 1 test: 1;return 1;Executed by:
executed 2 times by 1 test: return 1;Executed by:
| 2 | ||||||||||||||||||
| 254 | } | - | ||||||||||||||||||
| 255 | - | |||||||||||||||||||
| 256 | - | |||||||||||||||||||
| 257 | while (pqueue_peek(s->rlayer.d->unprocessed_rcds.q)
| 7 | ||||||||||||||||||
| 258 | dtls1_retrieve_buffered_record((s), &((s)->rlayer.d->unprocessed_rcds)); | - | ||||||||||||||||||
| 259 | bitmap = dtls1_get_bitmap(s, rr, &is_next_epoch); | - | ||||||||||||||||||
| 260 | if (bitmap ==
| 0-7 | ||||||||||||||||||
| 261 | ((void *)0)
| 0-7 | ||||||||||||||||||
| 262 | ) { | - | ||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | - | |||||||||||||||||||
| 265 | - | |||||||||||||||||||
| 266 | - | |||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | ossl_statem_fatal((s), (80), (424), ((4|64)), | - | ||||||||||||||||||
| 269 | - | |||||||||||||||||||
| 270 | __FILE__ | - | ||||||||||||||||||
| 271 | , | - | ||||||||||||||||||
| 272 | - | |||||||||||||||||||
| 273 | 267 | - | ||||||||||||||||||
| 274 | ) | - | ||||||||||||||||||
| 275 | - | |||||||||||||||||||
| 276 | ; | - | ||||||||||||||||||
| 277 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 278 | } | - | ||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | - | |||||||||||||||||||
| 282 | - | |||||||||||||||||||
| 283 | { | - | ||||||||||||||||||
| 284 | - | |||||||||||||||||||
| 285 | - | |||||||||||||||||||
| 286 | - | |||||||||||||||||||
| 287 | - | |||||||||||||||||||
| 288 | - | |||||||||||||||||||
| 289 | - | |||||||||||||||||||
| 290 | replayok = dtls1_record_replay_check(s, bitmap); | - | ||||||||||||||||||
| 291 | } | - | ||||||||||||||||||
| 292 | - | |||||||||||||||||||
| 293 | if (!replayok
| 0-7 | ||||||||||||||||||
| 294 | if (ossl_statem_in_error(s)
| 0 | ||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 297 | } | - | ||||||||||||||||||
| 298 | - | |||||||||||||||||||
| 299 | rr->length = 0; | - | ||||||||||||||||||
| 300 | ((&s->rlayer)->packet_length = 0); | - | ||||||||||||||||||
| 301 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 302 | } | - | ||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 | if (dtls1_buffer_record(s, &(s->rlayer.d->processed_rcds),
| 0-7 | ||||||||||||||||||
| 305 | ((s->rlayer.rrec)->seq_num)) < 0
| 0-7 | ||||||||||||||||||
| 306 | - | |||||||||||||||||||
| 307 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 308 | } | - | ||||||||||||||||||
| 309 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||
| 310 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | - | |||||||||||||||||||
| 313 | - | |||||||||||||||||||
| 314 | - | |||||||||||||||||||
| 315 | - | |||||||||||||||||||
| 316 | s->rlayer.d->processed_rcds.epoch = s->rlayer.d->r_epoch; | - | ||||||||||||||||||
| 317 | s->rlayer.d->unprocessed_rcds.epoch = s->rlayer.d->r_epoch + 1; | - | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | return executed 4619 times by 1 test: 1;return 1;Executed by:
executed 4619 times by 1 test: return 1;Executed by:
| 4619 | ||||||||||||||||||
| 320 | } | - | ||||||||||||||||||
| 321 | int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, | - | ||||||||||||||||||
| 322 | size_t len, int peek, size_t *readbytes) | - | ||||||||||||||||||
| 323 | { | - | ||||||||||||||||||
| 324 | int i, j, iret; | - | ||||||||||||||||||
| 325 | size_t n; | - | ||||||||||||||||||
| 326 | SSL3_RECORD *rr; | - | ||||||||||||||||||
| 327 | void (*cb) (const SSL *ssl, int type2, int val) = | - | ||||||||||||||||||
| 328 | ((void *)0) | - | ||||||||||||||||||
| 329 | ; | - | ||||||||||||||||||
| 330 | - | |||||||||||||||||||
| 331 | if (!((&s->rlayer.rbuf)->buf !=
| 0-6999 | ||||||||||||||||||
| 332 | ((void *)0)
| 0-6999 | ||||||||||||||||||
| 333 | )
| 0-6999 | ||||||||||||||||||
| 334 | - | |||||||||||||||||||
| 335 | if (!ssl3_setup_buffers(s)
| 0 | ||||||||||||||||||
| 336 | - | |||||||||||||||||||
| 337 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 338 | } | - | ||||||||||||||||||
| 339 | } never executed: end of block | 0 | ||||||||||||||||||
| 340 | - | |||||||||||||||||||
| 341 | if ((type
| 212-6787 | ||||||||||||||||||
| 342 | (
| 0-6274 | ||||||||||||||||||
| 343 | (peek
| 0-6999 | ||||||||||||||||||
| 344 | ossl_statem_fatal((s), (80), (258), ((4|64)), | - | ||||||||||||||||||
| 345 | __FILE__ | - | ||||||||||||||||||
| 346 | , | - | ||||||||||||||||||
| 347 | 362 | - | ||||||||||||||||||
| 348 | ) | - | ||||||||||||||||||
| 349 | ; | - | ||||||||||||||||||
| 350 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 351 | } | - | ||||||||||||||||||
| 352 | - | |||||||||||||||||||
| 353 | if (!ossl_statem_get_in_handshake(s)
| 0-6274 | ||||||||||||||||||
| 354 | - | |||||||||||||||||||
| 355 | i = s->handshake_func(s); | - | ||||||||||||||||||
| 356 | - | |||||||||||||||||||
| 357 | if (i < 0
| 0 | ||||||||||||||||||
| 358 | return never executed: i;return i;never executed: return i; | 0 | ||||||||||||||||||
| 359 | if (i == 0
| 0 | ||||||||||||||||||
| 360 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 361 | } never executed: end of block | 0 | ||||||||||||||||||
| 362 | - | |||||||||||||||||||
| 363 | start: code before this statement executed 6999 times by 1 test: start:Executed by:
| 6999 | ||||||||||||||||||
| 364 | s->rwstate = 1; | - | ||||||||||||||||||
| 365 | - | |||||||||||||||||||
| 366 | - | |||||||||||||||||||
| 367 | - | |||||||||||||||||||
| 368 | - | |||||||||||||||||||
| 369 | - | |||||||||||||||||||
| 370 | - | |||||||||||||||||||
| 371 | - | |||||||||||||||||||
| 372 | rr = s->rlayer.rrec; | - | ||||||||||||||||||
| 373 | - | |||||||||||||||||||
| 374 | - | |||||||||||||||||||
| 375 | - | |||||||||||||||||||
| 376 | - | |||||||||||||||||||
| 377 | - | |||||||||||||||||||
| 378 | if (SSL_is_init_finished(s)
| 0-6314 | ||||||||||||||||||
| 379 | pitem *item; | - | ||||||||||||||||||
| 380 | item = pqueue_pop(s->rlayer.d->buffered_app_data.q); | - | ||||||||||||||||||
| 381 | if (item
| 0-731 | ||||||||||||||||||
| 382 | dtls1_copy_record(s, item); | - | ||||||||||||||||||
| 383 | - | |||||||||||||||||||
| 384 | CRYPTO_free(item->data, __FILE__, 406); | - | ||||||||||||||||||
| 385 | pitem_free(item); | - | ||||||||||||||||||
| 386 | } never executed: end of block | 0 | ||||||||||||||||||
| 387 | } executed 731 times by 1 test: end of blockExecuted by:
| 731 | ||||||||||||||||||
| 388 | - | |||||||||||||||||||
| 389 | - | |||||||||||||||||||
| 390 | if (dtls1_handle_timeout(s) > 0
| 40-7005 | ||||||||||||||||||
| 391 | goto executed 40 times by 1 test: start;goto start;Executed by:
executed 40 times by 1 test: goto start;Executed by:
| 40 | ||||||||||||||||||
| 392 | } else if (ossl_statem_in_error(s)
| 0-7005 | ||||||||||||||||||
| 393 | - | |||||||||||||||||||
| 394 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 395 | } | - | ||||||||||||||||||
| 396 | - | |||||||||||||||||||
| 397 | - | |||||||||||||||||||
| 398 | if ((((
| 2392-4613 | ||||||||||||||||||
| 399 | || (
| 0-2392 | ||||||||||||||||||
| 400 | ((&s->rlayer)->numrpipes = (0)); | - | ||||||||||||||||||
| 401 | iret = dtls1_get_record(s); | - | ||||||||||||||||||
| 402 | if (iret <= 0
| 1204-3409 | ||||||||||||||||||
| 403 | iret = dtls1_read_failed(s, iret); | - | ||||||||||||||||||
| 404 | - | |||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | - | |||||||||||||||||||
| 407 | - | |||||||||||||||||||
| 408 | if (iret <= 0
| 0-1204 | ||||||||||||||||||
| 409 | return executed 1204 times by 1 test: iret;return iret;Executed by:
executed 1204 times by 1 test: return iret;Executed by:
| 1204 | ||||||||||||||||||
| 410 | else | - | ||||||||||||||||||
| 411 | goto never executed: start;goto start;never executed: goto start; | 0 | ||||||||||||||||||
| 412 | } | - | ||||||||||||||||||
| 413 | ((&s->rlayer)->numrpipes = (1)); | - | ||||||||||||||||||
| 414 | } executed 3409 times by 1 test: end of blockExecuted by:
| 3409 | ||||||||||||||||||
| 415 | - | |||||||||||||||||||
| 416 | - | |||||||||||||||||||
| 417 | - | |||||||||||||||||||
| 418 | - | |||||||||||||||||||
| 419 | - | |||||||||||||||||||
| 420 | if (((
| 225-5576 | ||||||||||||||||||
| 421 | && ((
| 0-5576 | ||||||||||||||||||
| 422 | s->rlayer.alert_count = 0; executed 5576 times by 1 test: s->rlayer.alert_count = 0;Executed by:
| 5576 | ||||||||||||||||||
| 423 | - | |||||||||||||||||||
| 424 | if (((
| 842-4959 | ||||||||||||||||||
| 425 | && ((
| 358-484 | ||||||||||||||||||
| 426 | && !SSL_in_init(s)
| 13-471 | ||||||||||||||||||
| 427 | && (s->d1->next_timeout.tv_sec != 0
| 116-355 | ||||||||||||||||||
| 428 | || s->d1->next_timeout.tv_usec != 0
| 0-355 | ||||||||||||||||||
| 429 | - | |||||||||||||||||||
| 430 | - | |||||||||||||||||||
| 431 | - | |||||||||||||||||||
| 432 | - | |||||||||||||||||||
| 433 | - | |||||||||||||||||||
| 434 | dtls1_stop_timer(s); | - | ||||||||||||||||||
| 435 | } executed 116 times by 1 test: end of blockExecuted by:
| 116 | ||||||||||||||||||
| 436 | - | |||||||||||||||||||
| 437 | - | |||||||||||||||||||
| 438 | - | |||||||||||||||||||
| 439 | if (s->s3->change_cipher_spec
| 728-5073 | ||||||||||||||||||
| 440 | - | |||||||||||||||||||
| 441 | && (((
| 0-728 | ||||||||||||||||||
| 442 | - | |||||||||||||||||||
| 443 | - | |||||||||||||||||||
| 444 | - | |||||||||||||||||||
| 445 | - | |||||||||||||||||||
| 446 | - | |||||||||||||||||||
| 447 | if (dtls1_buffer_record(s, &(s->rlayer.d->buffered_app_data),
| 0 | ||||||||||||||||||
| 448 | ((rr)->seq_num)) < 0
| 0 | ||||||||||||||||||
| 449 | - | |||||||||||||||||||
| 450 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 451 | } | - | ||||||||||||||||||
| 452 | ((rr)->length = (0)); | - | ||||||||||||||||||
| 453 | ((rr)->read = 1); | - | ||||||||||||||||||
| 454 | goto never executed: start;goto start;never executed: goto start; | 0 | ||||||||||||||||||
| 455 | } | - | ||||||||||||||||||
| 456 | - | |||||||||||||||||||
| 457 | - | |||||||||||||||||||
| 458 | - | |||||||||||||||||||
| 459 | - | |||||||||||||||||||
| 460 | - | |||||||||||||||||||
| 461 | if (s->shutdown & 2
| 0-5801 | ||||||||||||||||||
| 462 | ((rr)->length = (0)); | - | ||||||||||||||||||
| 463 | ((rr)->read = 1); | - | ||||||||||||||||||
| 464 | s->rwstate = 1; | - | ||||||||||||||||||
| 465 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 466 | } | - | ||||||||||||||||||
| 467 | - | |||||||||||||||||||
| 468 | if (type == ((rr)->type)
| 601-5200 | ||||||||||||||||||
| 469 | || (((
| 243-358 | ||||||||||||||||||
| 470 | && type == 22
| 0-358 | ||||||||||||||||||
| 471 | ((void *)0)
| 0-358 | ||||||||||||||||||
| 472 | )) { | - | ||||||||||||||||||
| 473 | if (SSL_in_init(s)
| 0-5299 | ||||||||||||||||||
| 474 | (
| 0 | ||||||||||||||||||
| 475 | ((void *)0)
| 0 | ||||||||||||||||||
| 476 | )
| 0 | ||||||||||||||||||
| 477 | ossl_statem_fatal((s), (10), (258), (100), | - | ||||||||||||||||||
| 478 | __FILE__ | - | ||||||||||||||||||
| 479 | , | - | ||||||||||||||||||
| 480 | 505 | - | ||||||||||||||||||
| 481 | ) | - | ||||||||||||||||||
| 482 | ; | - | ||||||||||||||||||
| 483 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 484 | } | - | ||||||||||||||||||
| 485 | - | |||||||||||||||||||
| 486 | if (recvd_type !=
| 2639-2919 | ||||||||||||||||||
| 487 | ((void *)0)
| 2639-2919 | ||||||||||||||||||
| 488 | ) | - | ||||||||||||||||||
| 489 | * executed 2919 times by 1 test: recvd_type = ((rr)->type);*recvd_type = ((rr)->type);Executed by:
executed 2919 times by 1 test: *recvd_type = ((rr)->type);Executed by:
| 2919 | ||||||||||||||||||
| 490 | - | |||||||||||||||||||
| 491 | if (len == 0
| 0-5558 | ||||||||||||||||||
| 492 | - | |||||||||||||||||||
| 493 | - | |||||||||||||||||||
| 494 | - | |||||||||||||||||||
| 495 | - | |||||||||||||||||||
| 496 | - | |||||||||||||||||||
| 497 | if (((
| 0 | ||||||||||||||||||
| 498 | (( never executed: rr)->read = 1);((rr)->read = 1);never executed: ((rr)->read = 1); | 0 | ||||||||||||||||||
| 499 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 500 | } | - | ||||||||||||||||||
| 501 | - | |||||||||||||||||||
| 502 | if (len > ((rr)->length)
| 616-4942 | ||||||||||||||||||
| 503 | n = ((rr)->length); executed 616 times by 1 test: n = ((rr)->length);Executed by:
| 616 | ||||||||||||||||||
| 504 | else | - | ||||||||||||||||||
| 505 | n = len; executed 4942 times by 1 test: n = len;Executed by:
| 4942 | ||||||||||||||||||
| 506 | - | |||||||||||||||||||
| 507 | memcpy(buf, &(((rr)->data)[((rr)->off)]), n); | - | ||||||||||||||||||
| 508 | if (peek
| 0-5558 | ||||||||||||||||||
| 509 | if (((
| 0 | ||||||||||||||||||
| 510 | (( never executed: rr)->read = 1);((rr)->read = 1);never executed: ((rr)->read = 1); | 0 | ||||||||||||||||||
| 511 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 512 | ((rr)->length -= (n)); | - | ||||||||||||||||||
| 513 | ((rr)->off += (n)); | - | ||||||||||||||||||
| 514 | if (((
| 2381-3177 | ||||||||||||||||||
| 515 | s->rlayer.rstate = 0xF0; | - | ||||||||||||||||||
| 516 | ((rr)->off = (0)); | - | ||||||||||||||||||
| 517 | ((rr)->read = 1); | - | ||||||||||||||||||
| 518 | } executed 3177 times by 1 test: end of blockExecuted by:
| 3177 | ||||||||||||||||||
| 519 | } executed 5558 times by 1 test: end of blockExecuted by:
| 5558 | ||||||||||||||||||
| 520 | *readbytes = n; | - | ||||||||||||||||||
| 521 | return executed 5558 times by 1 test: 1;return 1;Executed by:
executed 5558 times by 1 test: return 1;Executed by:
| 5558 | ||||||||||||||||||
| 522 | } | - | ||||||||||||||||||
| 523 | - | |||||||||||||||||||
| 524 | - | |||||||||||||||||||
| 525 | - | |||||||||||||||||||
| 526 | - | |||||||||||||||||||
| 527 | - | |||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | if (((
| 18-225 | ||||||||||||||||||
| 530 | unsigned int alert_level, alert_descr; | - | ||||||||||||||||||
| 531 | unsigned char *alert_bytes = ((rr)->data) | - | ||||||||||||||||||
| 532 | + ((rr)->off); | - | ||||||||||||||||||
| 533 | PACKET alert; | - | ||||||||||||||||||
| 534 | - | |||||||||||||||||||
| 535 | if (!PACKET_buf_init(&alert, alert_bytes, ((rr)->length))
| 0-225 | ||||||||||||||||||
| 536 | || !PACKET_get_1(&alert, &alert_level)
| 0-225 | ||||||||||||||||||
| 537 | || !PACKET_get_1(&alert, &alert_descr)
| 0-225 | ||||||||||||||||||
| 538 | || PACKET_remaining(&alert) != 0
| 0-225 | ||||||||||||||||||
| 539 | ossl_statem_fatal((s), (10), (258), (205), | - | ||||||||||||||||||
| 540 | __FILE__ | - | ||||||||||||||||||
| 541 | , | - | ||||||||||||||||||
| 542 | 574 | - | ||||||||||||||||||
| 543 | ) | - | ||||||||||||||||||
| 544 | ; | - | ||||||||||||||||||
| 545 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 546 | } | - | ||||||||||||||||||
| 547 | - | |||||||||||||||||||
| 548 | if (s->msg_callback
| 0-225 | ||||||||||||||||||
| 549 | s->msg_callback(0, s->version, 21, alert_bytes, 2, s, never executed: s->msg_callback(0, s->version, 21, alert_bytes, 2, s, s->msg_callback_arg); | 0 | ||||||||||||||||||
| 550 | s->msg_callback_arg); never executed: s->msg_callback(0, s->version, 21, alert_bytes, 2, s, s->msg_callback_arg); | 0 | ||||||||||||||||||
| 551 | - | |||||||||||||||||||
| 552 | if (s->info_callback !=
| 0-225 | ||||||||||||||||||
| 553 | ((void *)0)
| 0-225 | ||||||||||||||||||
| 554 | ) | - | ||||||||||||||||||
| 555 | cb = s->info_callback; executed 225 times by 1 test: cb = s->info_callback;Executed by:
| 225 | ||||||||||||||||||
| 556 | else if (s->ctx->info_callback !=
| 0 | ||||||||||||||||||
| 557 | ((void *)0)
| 0 | ||||||||||||||||||
| 558 | ) | - | ||||||||||||||||||
| 559 | cb = s->ctx->info_callback; never executed: cb = s->ctx->info_callback; | 0 | ||||||||||||||||||
| 560 | - | |||||||||||||||||||
| 561 | if (cb !=
| 0-225 | ||||||||||||||||||
| 562 | ((void *)0)
| 0-225 | ||||||||||||||||||
| 563 | ) { | - | ||||||||||||||||||
| 564 | j = (alert_level << 8) | alert_descr; | - | ||||||||||||||||||
| 565 | cb(s, (0x4000|0x04), j); | - | ||||||||||||||||||
| 566 | } executed 225 times by 1 test: end of blockExecuted by:
| 225 | ||||||||||||||||||
| 567 | - | |||||||||||||||||||
| 568 | if (alert_level == 1
| 13-212 | ||||||||||||||||||
| 569 | s->s3->warn_alert = alert_descr; | - | ||||||||||||||||||
| 570 | ((rr)->read = 1); | - | ||||||||||||||||||
| 571 | - | |||||||||||||||||||
| 572 | s->rlayer.alert_count++; | - | ||||||||||||||||||
| 573 | if (s->rlayer.alert_count == 5
| 0-212 | ||||||||||||||||||
| 574 | ossl_statem_fatal((s), (10), (258), (409), | - | ||||||||||||||||||
| 575 | __FILE__ | - | ||||||||||||||||||
| 576 | , | - | ||||||||||||||||||
| 577 | 599 | - | ||||||||||||||||||
| 578 | ) | - | ||||||||||||||||||
| 579 | ; | - | ||||||||||||||||||
| 580 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 581 | } | - | ||||||||||||||||||
| 582 | - | |||||||||||||||||||
| 583 | if (alert_descr == 0
| 0-212 | ||||||||||||||||||
| 584 | s->shutdown |= 2; | - | ||||||||||||||||||
| 585 | return executed 212 times by 1 test: 0;return 0;Executed by:
executed 212 times by 1 test: return 0;Executed by:
| 212 | ||||||||||||||||||
| 586 | } | - | ||||||||||||||||||
| 587 | } never executed: else if (alert_level == 2end of block
| 0-13 | ||||||||||||||||||
| 588 | char tmp[16]; | - | ||||||||||||||||||
| 589 | - | |||||||||||||||||||
| 590 | s->rwstate = 1; | - | ||||||||||||||||||
| 591 | s->s3->fatal_alert = alert_descr; | - | ||||||||||||||||||
| 592 | ossl_statem_fatal((s), (-1), (258), (1000 + alert_descr), | - | ||||||||||||||||||
| 593 | __FILE__ | - | ||||||||||||||||||
| 594 | , | - | ||||||||||||||||||
| 595 | 628 | - | ||||||||||||||||||
| 596 | ) | - | ||||||||||||||||||
| 597 | ; | - | ||||||||||||||||||
| 598 | BIO_snprintf(tmp, sizeof tmp, "%d", alert_descr); | - | ||||||||||||||||||
| 599 | ERR_add_error_data(2, "SSL alert number ", tmp); | - | ||||||||||||||||||
| 600 | s->shutdown |= 2; | - | ||||||||||||||||||
| 601 | ((rr)->read = 1); | - | ||||||||||||||||||
| 602 | SSL_CTX_remove_session(s->session_ctx, s->session); | - | ||||||||||||||||||
| 603 | return executed 13 times by 1 test: 0;return 0;Executed by:
executed 13 times by 1 test: return 0;Executed by:
| 13 | ||||||||||||||||||
| 604 | } else { | - | ||||||||||||||||||
| 605 | ossl_statem_fatal((s), (47), (258), (246), | - | ||||||||||||||||||
| 606 | __FILE__ | - | ||||||||||||||||||
| 607 | , | - | ||||||||||||||||||
| 608 | 637 | - | ||||||||||||||||||
| 609 | ) | - | ||||||||||||||||||
| 610 | ; | - | ||||||||||||||||||
| 611 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 612 | } | - | ||||||||||||||||||
| 613 | - | |||||||||||||||||||
| 614 | goto never executed: start;goto start;never executed: goto start; | 0 | ||||||||||||||||||
| 615 | } | - | ||||||||||||||||||
| 616 | - | |||||||||||||||||||
| 617 | if (s->shutdown & 1
| 0-18 | ||||||||||||||||||
| 618 | - | |||||||||||||||||||
| 619 | s->rwstate = 1; | - | ||||||||||||||||||
| 620 | ((rr)->length = (0)); | - | ||||||||||||||||||
| 621 | ((rr)->read = 1); | - | ||||||||||||||||||
| 622 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 623 | } | - | ||||||||||||||||||
| 624 | - | |||||||||||||||||||
| 625 | if (((
| 0-18 | ||||||||||||||||||
| 626 | - | |||||||||||||||||||
| 627 | - | |||||||||||||||||||
| 628 | - | |||||||||||||||||||
| 629 | - | |||||||||||||||||||
| 630 | ((rr)->length = (0)); | - | ||||||||||||||||||
| 631 | ((rr)->read = 1); | - | ||||||||||||||||||
| 632 | goto never executed: start;goto start;never executed: goto start; | 0 | ||||||||||||||||||
| 633 | } | - | ||||||||||||||||||
| 634 | - | |||||||||||||||||||
| 635 | - | |||||||||||||||||||
| 636 | - | |||||||||||||||||||
| 637 | - | |||||||||||||||||||
| 638 | if ((((
| 0-18 | ||||||||||||||||||
| 639 | !ossl_statem_get_in_handshake(s)
| 0-18 | ||||||||||||||||||
| 640 | struct hm_header_st msg_hdr; | - | ||||||||||||||||||
| 641 | - | |||||||||||||||||||
| 642 | - | |||||||||||||||||||
| 643 | - | |||||||||||||||||||
| 644 | - | |||||||||||||||||||
| 645 | - | |||||||||||||||||||
| 646 | if (((
| 0-18 | ||||||||||||||||||
| 647 | || ((
| 0-18 | ||||||||||||||||||
| 648 | ((rr)->length = (0)); | - | ||||||||||||||||||
| 649 | ((rr)->read = 1); | - | ||||||||||||||||||
| 650 | goto never executed: start;goto start;never executed: goto start; | 0 | ||||||||||||||||||
| 651 | } | - | ||||||||||||||||||
| 652 | - | |||||||||||||||||||
| 653 | dtls1_get_message_header(rr->data, &msg_hdr); | - | ||||||||||||||||||
| 654 | - | |||||||||||||||||||
| 655 | - | |||||||||||||||||||
| 656 | - | |||||||||||||||||||
| 657 | - | |||||||||||||||||||
| 658 | - | |||||||||||||||||||
| 659 | if (msg_hdr.type == 20
| 6-12 | ||||||||||||||||||
| 660 | if (dtls1_check_timeout_num(s) < 0
| 0-6 | ||||||||||||||||||
| 661 | - | |||||||||||||||||||
| 662 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 663 | } | - | ||||||||||||||||||
| 664 | - | |||||||||||||||||||
| 665 | if (dtls1_retransmit_buffered_messages(s) <= 0
| 0-6 | ||||||||||||||||||
| 666 | - | |||||||||||||||||||
| 667 | if (ossl_statem_in_error(s)
| 0 | ||||||||||||||||||
| 668 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 669 | } never executed: end of block | 0 | ||||||||||||||||||
| 670 | ((rr)->length = (0)); | - | ||||||||||||||||||
| 671 | ((rr)->read = 1); | - | ||||||||||||||||||
| 672 | if (!(s->mode & 0x00000004U)
| 0-6 | ||||||||||||||||||
| 673 | if (((
| 0 | ||||||||||||||||||
| 674 | - | |||||||||||||||||||
| 675 | BIO *bio; | - | ||||||||||||||||||
| 676 | - | |||||||||||||||||||
| 677 | s->rwstate = 3; | - | ||||||||||||||||||
| 678 | bio = SSL_get_rbio(s); | - | ||||||||||||||||||
| 679 | BIO_clear_flags(bio, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||
| 680 | BIO_set_flags(bio, (0x01|0x08)); | - | ||||||||||||||||||
| 681 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 682 | } | - | ||||||||||||||||||
| 683 | } never executed: end of block | 0 | ||||||||||||||||||
| 684 | goto executed 6 times by 1 test: start;goto start;Executed by:
executed 6 times by 1 test: goto start;Executed by:
| 6 | ||||||||||||||||||
| 685 | } | - | ||||||||||||||||||
| 686 | - | |||||||||||||||||||
| 687 | - | |||||||||||||||||||
| 688 | - | |||||||||||||||||||
| 689 | - | |||||||||||||||||||
| 690 | - | |||||||||||||||||||
| 691 | - | |||||||||||||||||||
| 692 | - | |||||||||||||||||||
| 693 | if (!((SSL_is_init_finished(s)) != 0)
| 0-12 | ||||||||||||||||||
| 694 | ossl_statem_fatal((s), (80), (258), ((4|64)), | - | ||||||||||||||||||
| 695 | __FILE__ | - | ||||||||||||||||||
| 696 | , | - | ||||||||||||||||||
| 697 | 722 | - | ||||||||||||||||||
| 698 | ) | - | ||||||||||||||||||
| 699 | ; | - | ||||||||||||||||||
| 700 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 701 | } | - | ||||||||||||||||||
| 702 | - | |||||||||||||||||||
| 703 | - | |||||||||||||||||||
| 704 | ossl_statem_set_in_init(s, 1); | - | ||||||||||||||||||
| 705 | - | |||||||||||||||||||
| 706 | i = s->handshake_func(s); | - | ||||||||||||||||||
| 707 | - | |||||||||||||||||||
| 708 | if (i < 0
| 0-12 | ||||||||||||||||||
| 709 | return executed 12 times by 1 test: i;return i;Executed by:
executed 12 times by 1 test: return i;Executed by:
| 12 | ||||||||||||||||||
| 710 | if (i == 0
| 0 | ||||||||||||||||||
| 711 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 712 | - | |||||||||||||||||||
| 713 | if (!(s->mode & 0x00000004U)
| 0 | ||||||||||||||||||
| 714 | if (((
| 0 | ||||||||||||||||||
| 715 | - | |||||||||||||||||||
| 716 | BIO *bio; | - | ||||||||||||||||||
| 717 | - | |||||||||||||||||||
| 718 | - | |||||||||||||||||||
| 719 | - | |||||||||||||||||||
| 720 | - | |||||||||||||||||||
| 721 | - | |||||||||||||||||||
| 722 | - | |||||||||||||||||||
| 723 | s->rwstate = 3; | - | ||||||||||||||||||
| 724 | bio = SSL_get_rbio(s); | - | ||||||||||||||||||
| 725 | BIO_clear_flags(bio, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||
| 726 | BIO_set_flags(bio, (0x01|0x08)); | - | ||||||||||||||||||
| 727 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 728 | } | - | ||||||||||||||||||
| 729 | } never executed: end of block | 0 | ||||||||||||||||||
| 730 | goto never executed: start;goto start;never executed: goto start; | 0 | ||||||||||||||||||
| 731 | } | - | ||||||||||||||||||
| 732 | - | |||||||||||||||||||
| 733 | switch (((rr)->type)) { | - | ||||||||||||||||||
| 734 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 735 | ossl_statem_fatal((s), (10), (258), (245), | - | ||||||||||||||||||
| 736 | __FILE__ | - | ||||||||||||||||||
| 737 | , | - | ||||||||||||||||||
| 738 | 759 | - | ||||||||||||||||||
| 739 | ) | - | ||||||||||||||||||
| 740 | ; | - | ||||||||||||||||||
| 741 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 742 | case never executed: 20:case 20:never executed: case 20: | 0 | ||||||||||||||||||
| 743 | case never executed: 21:case 21:never executed: case 21: | 0 | ||||||||||||||||||
| 744 | case never executed: 22:case 22:never executed: case 22: | 0 | ||||||||||||||||||
| 745 | - | |||||||||||||||||||
| 746 | - | |||||||||||||||||||
| 747 | - | |||||||||||||||||||
| 748 | - | |||||||||||||||||||
| 749 | - | |||||||||||||||||||
| 750 | ossl_statem_fatal((s), (10), (258), ((4|64)), | - | ||||||||||||||||||
| 751 | __FILE__ | - | ||||||||||||||||||
| 752 | , | - | ||||||||||||||||||
| 753 | 770 | - | ||||||||||||||||||
| 754 | ) | - | ||||||||||||||||||
| 755 | ; | - | ||||||||||||||||||
| 756 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 757 | case never executed: 23:case 23:never executed: case 23: | 0 | ||||||||||||||||||
| 758 | - | |||||||||||||||||||
| 759 | - | |||||||||||||||||||
| 760 | - | |||||||||||||||||||
| 761 | - | |||||||||||||||||||
| 762 | - | |||||||||||||||||||
| 763 | - | |||||||||||||||||||
| 764 | - | |||||||||||||||||||
| 765 | if (s->s3->in_read_app_data
| 0 | ||||||||||||||||||
| 766 | (
| 0 | ||||||||||||||||||
| 767 | ossl_statem_app_data_allowed(s)
| 0 | ||||||||||||||||||
| 768 | s->s3->in_read_app_data = 2; | - | ||||||||||||||||||
| 769 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 770 | } else { | - | ||||||||||||||||||
| 771 | ossl_statem_fatal((s), (10), (258), (245), | - | ||||||||||||||||||
| 772 | __FILE__ | - | ||||||||||||||||||
| 773 | , | - | ||||||||||||||||||
| 774 | 787 | - | ||||||||||||||||||
| 775 | ) | - | ||||||||||||||||||
| 776 | ; | - | ||||||||||||||||||
| 777 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 778 | } | - | ||||||||||||||||||
| 779 | } | - | ||||||||||||||||||
| 780 | - | |||||||||||||||||||
| 781 | } | - | ||||||||||||||||||
| 782 | - | |||||||||||||||||||
| 783 | - | |||||||||||||||||||
| 784 | - | |||||||||||||||||||
| 785 | - | |||||||||||||||||||
| 786 | - | |||||||||||||||||||
| 787 | int dtls1_write_bytes(SSL *s, int type, const void *buf, size_t len, | - | ||||||||||||||||||
| 788 | size_t *written) | - | ||||||||||||||||||
| 789 | { | - | ||||||||||||||||||
| 790 | int i; | - | ||||||||||||||||||
| 791 | - | |||||||||||||||||||
| 792 | if (!((len <= 16384) != 0)
| 0-4107 | ||||||||||||||||||
| 793 | ossl_statem_fatal((s), (80), (545), ((4|64)), | - | ||||||||||||||||||
| 794 | __FILE__ | - | ||||||||||||||||||
| 795 | , | - | ||||||||||||||||||
| 796 | 805 | - | ||||||||||||||||||
| 797 | ) | - | ||||||||||||||||||
| 798 | ; | - | ||||||||||||||||||
| 799 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 800 | } | - | ||||||||||||||||||
| 801 | s->rwstate = 1; | - | ||||||||||||||||||
| 802 | i = do_dtls1_write(s, type, buf, len, 0, written); | - | ||||||||||||||||||
| 803 | return executed 4107 times by 1 test: i;return i;Executed by:
executed 4107 times by 1 test: return i;Executed by:
| 4107 | ||||||||||||||||||
| 804 | } | - | ||||||||||||||||||
| 805 | - | |||||||||||||||||||
| 806 | int do_dtls1_write(SSL *s, int type, const unsigned char *buf, | - | ||||||||||||||||||
| 807 | size_t len, int create_empty_fragment, size_t *written) | - | ||||||||||||||||||
| 808 | { | - | ||||||||||||||||||
| 809 | unsigned char *p, *pseq; | - | ||||||||||||||||||
| 810 | int i, mac_size, clear = 0; | - | ||||||||||||||||||
| 811 | size_t prefix_len = 0; | - | ||||||||||||||||||
| 812 | int eivlen; | - | ||||||||||||||||||
| 813 | SSL3_RECORD wr; | - | ||||||||||||||||||
| 814 | SSL3_BUFFER *wb; | - | ||||||||||||||||||
| 815 | SSL_SESSION *sess; | - | ||||||||||||||||||
| 816 | - | |||||||||||||||||||
| 817 | wb = &s->rlayer.wbuf[0]; | - | ||||||||||||||||||
| 818 | - | |||||||||||||||||||
| 819 | - | |||||||||||||||||||
| 820 | - | |||||||||||||||||||
| 821 | - | |||||||||||||||||||
| 822 | - | |||||||||||||||||||
| 823 | if (!((((wb)->left) == 0) != 0)
| 0-4346 | ||||||||||||||||||
| 824 | ossl_statem_fatal((s), (80), (245), ((4|64)), | - | ||||||||||||||||||
| 825 | __FILE__ | - | ||||||||||||||||||
| 826 | , | - | ||||||||||||||||||
| 827 | 832 | - | ||||||||||||||||||
| 828 | ) | - | ||||||||||||||||||
| 829 | ; | - | ||||||||||||||||||
| 830 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 831 | } | - | ||||||||||||||||||
| 832 | - | |||||||||||||||||||
| 833 | - | |||||||||||||||||||
| 834 | if (s->s3->alert_dispatch
| 0-4346 | ||||||||||||||||||
| 835 | i = s->method->ssl_dispatch_alert(s); | - | ||||||||||||||||||
| 836 | if (i <= 0
| 0 | ||||||||||||||||||
| 837 | return never executed: i;return i;never executed: return i; | 0 | ||||||||||||||||||
| 838 | - | |||||||||||||||||||
| 839 | } never executed: end of block | 0 | ||||||||||||||||||
| 840 | - | |||||||||||||||||||
| 841 | if (len == 0
| 0-4346 | ||||||||||||||||||
| 842 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 843 | - | |||||||||||||||||||
| 844 | if (len > ssl_get_max_send_fragment(s)
| 0-4346 | ||||||||||||||||||
| 845 | ossl_statem_fatal((s), (80), (245), (194), | - | ||||||||||||||||||
| 846 | __FILE__ | - | ||||||||||||||||||
| 847 | , | - | ||||||||||||||||||
| 848 | 849 | - | ||||||||||||||||||
| 849 | ) | - | ||||||||||||||||||
| 850 | ; | - | ||||||||||||||||||
| 851 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 852 | } | - | ||||||||||||||||||
| 853 | - | |||||||||||||||||||
| 854 | sess = s->session; | - | ||||||||||||||||||
| 855 | - | |||||||||||||||||||
| 856 | if ((
| 4-4342 | ||||||||||||||||||
| 857 | ((void *)0)
| 4-4342 | ||||||||||||||||||
| 858 | )
| 4-4342 | ||||||||||||||||||
| 859 | (
| 1821-2521 | ||||||||||||||||||
| 860 | ((void *)0)
| 1821-2521 | ||||||||||||||||||
| 861 | )
| 905-2521 | ||||||||||||||||||
| 862 | ((void *)0)
| 905-916 | ||||||||||||||||||
| 863 | )
| 905-916 | ||||||||||||||||||
| 864 | clear = 1; executed 3441 times by 1 test: clear = 1;Executed by:
| 3441 | ||||||||||||||||||
| 865 | - | |||||||||||||||||||
| 866 | if (clear
| 905-3441 | ||||||||||||||||||
| 867 | mac_size = 0; executed 3441 times by 1 test: mac_size = 0;Executed by:
| 3441 | ||||||||||||||||||
| 868 | else { | - | ||||||||||||||||||
| 869 | mac_size = EVP_MD_size(EVP_MD_CTX_md(s->write_hash)); | - | ||||||||||||||||||
| 870 | if (mac_size < 0
| 0-905 | ||||||||||||||||||
| 871 | ossl_statem_fatal((s), (80), (245), (194), | - | ||||||||||||||||||
| 872 | __FILE__ | - | ||||||||||||||||||
| 873 | , | - | ||||||||||||||||||
| 874 | 865 | - | ||||||||||||||||||
| 875 | ) | - | ||||||||||||||||||
| 876 | ; | - | ||||||||||||||||||
| 877 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 878 | } | - | ||||||||||||||||||
| 879 | } executed 905 times by 1 test: end of blockExecuted by:
| 905 | ||||||||||||||||||
| 880 | - | |||||||||||||||||||
| 881 | p = ((wb)->buf) + prefix_len; | - | ||||||||||||||||||
| 882 | - | |||||||||||||||||||
| 883 | - | |||||||||||||||||||
| 884 | - | |||||||||||||||||||
| 885 | *(p++) = type & 0xff; | - | ||||||||||||||||||
| 886 | ((&wr)->type = (type)); | - | ||||||||||||||||||
| 887 | - | |||||||||||||||||||
| 888 | - | |||||||||||||||||||
| 889 | - | |||||||||||||||||||
| 890 | - | |||||||||||||||||||
| 891 | - | |||||||||||||||||||
| 892 | if (s->method->version == 0x1FFFF
| 213-4133 | ||||||||||||||||||
| 893 | s->max_proto_version != 0x0100
| 2-211 | ||||||||||||||||||
| 894 | *(p++) = 0xFEFF >> 8; | - | ||||||||||||||||||
| 895 | *(p++) = 0xFEFF & 0xff; | - | ||||||||||||||||||
| 896 | } executed 211 times by 1 test: else {end of blockExecuted by:
| 211 | ||||||||||||||||||
| 897 | *(p++) = s->version >> 8; | - | ||||||||||||||||||
| 898 | *(p++) = s->version & 0xff; | - | ||||||||||||||||||
| 899 | } executed 4135 times by 1 test: end of blockExecuted by:
| 4135 | ||||||||||||||||||
| 900 | - | |||||||||||||||||||
| 901 | - | |||||||||||||||||||
| 902 | pseq = p; | - | ||||||||||||||||||
| 903 | p += 10; | - | ||||||||||||||||||
| 904 | - | |||||||||||||||||||
| 905 | - | |||||||||||||||||||
| 906 | if (s->enc_write_ctx
| 1821-2525 | ||||||||||||||||||
| 907 | int mode = (EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(s->enc_write_ctx)) & 0xF0007); | - | ||||||||||||||||||
| 908 | if (mode == 0x2
| 713-1108 | ||||||||||||||||||
| 909 | eivlen = EVP_CIPHER_CTX_iv_length(s->enc_write_ctx); | - | ||||||||||||||||||
| 910 | if (eivlen <= 1
| 0-713 | ||||||||||||||||||
| 911 | eivlen = 0; never executed: eivlen = 0; | 0 | ||||||||||||||||||
| 912 | } executed 713 times by 1 test: end of blockExecuted by:
| 713 | ||||||||||||||||||
| 913 | - | |||||||||||||||||||
| 914 | else if (mode == 0x6
| 357-751 | ||||||||||||||||||
| 915 | eivlen = 8; executed 751 times by 1 test: eivlen = 8;Executed by:
| 751 | ||||||||||||||||||
| 916 | else if (mode == 0x7
| 132-225 | ||||||||||||||||||
| 917 | eivlen = 8; executed 132 times by 1 test: eivlen = 8;Executed by:
| 132 | ||||||||||||||||||
| 918 | else | - | ||||||||||||||||||
| 919 | eivlen = 0; executed 225 times by 1 test: eivlen = 0;Executed by:
| 225 | ||||||||||||||||||
| 920 | } else | - | ||||||||||||||||||
| 921 | eivlen = 0; executed 2525 times by 1 test: eivlen = 0;Executed by:
| 2525 | ||||||||||||||||||
| 922 | - | |||||||||||||||||||
| 923 | - | |||||||||||||||||||
| 924 | ((&wr)->data = (p + eivlen)); | - | ||||||||||||||||||
| 925 | ((&wr)->length = (len)); | - | ||||||||||||||||||
| 926 | ((&wr)->input = ((unsigned char *)buf)); | - | ||||||||||||||||||
| 927 | - | |||||||||||||||||||
| 928 | - | |||||||||||||||||||
| 929 | - | |||||||||||||||||||
| 930 | - | |||||||||||||||||||
| 931 | - | |||||||||||||||||||
| 932 | - | |||||||||||||||||||
| 933 | if (s->compress !=
| 0-4346 | ||||||||||||||||||
| 934 | ((void *)0)
| 0-4346 | ||||||||||||||||||
| 935 | ) { | - | ||||||||||||||||||
| 936 | if (!ssl3_do_compress(s, &wr)
| 0 | ||||||||||||||||||
| 937 | ossl_statem_fatal((s), (80), (245), (141), | - | ||||||||||||||||||
| 938 | __FILE__ | - | ||||||||||||||||||
| 939 | , | - | ||||||||||||||||||
| 940 | 925 | - | ||||||||||||||||||
| 941 | ) | - | ||||||||||||||||||
| 942 | ; | - | ||||||||||||||||||
| 943 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 944 | } | - | ||||||||||||||||||
| 945 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 946 | memcpy(((&wr)->data), ((&wr)->input), | - | ||||||||||||||||||
| 947 | ((&wr)->length)); | - | ||||||||||||||||||
| 948 | ((&wr)->input = (&wr)->data); | - | ||||||||||||||||||
| 949 | } executed 4346 times by 1 test: end of blockExecuted by:
| 4346 | ||||||||||||||||||
| 950 | - | |||||||||||||||||||
| 951 | - | |||||||||||||||||||
| 952 | - | |||||||||||||||||||
| 953 | - | |||||||||||||||||||
| 954 | - | |||||||||||||||||||
| 955 | - | |||||||||||||||||||
| 956 | - | |||||||||||||||||||
| 957 | if (!(s->s3->flags & 0x0400)
| 307-3748 | ||||||||||||||||||
| 958 | if (!s->method->ssl3_enc->mac(s, &wr,
| 0-307 | ||||||||||||||||||
| 959 | &(p[((&wr)->length) + eivlen]),
| 0-307 | ||||||||||||||||||
| 960 | 1)
| 0-307 | ||||||||||||||||||
| 961 | ossl_statem_fatal((s), (80), (245), ((4|64)), | - | ||||||||||||||||||
| 962 | __FILE__ | - | ||||||||||||||||||
| 963 | , | - | ||||||||||||||||||
| 964 | 945 | - | ||||||||||||||||||
| 965 | ) | - | ||||||||||||||||||
| 966 | ; | - | ||||||||||||||||||
| 967 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 968 | } | - | ||||||||||||||||||
| 969 | ((&wr)->length += (mac_size)); | - | ||||||||||||||||||
| 970 | } executed 307 times by 1 test: end of blockExecuted by:
| 307 | ||||||||||||||||||
| 971 | - | |||||||||||||||||||
| 972 | - | |||||||||||||||||||
| 973 | ((&wr)->data = (p)); | - | ||||||||||||||||||
| 974 | ((&wr)->input = (&wr)->data); | - | ||||||||||||||||||
| 975 | - | |||||||||||||||||||
| 976 | if (eivlen
| 1596-2750 | ||||||||||||||||||
| 977 | (( executed 1596 times by 1 test: &wr)->length += (eivlen));((&wr)->length += (eivlen));Executed by:
executed 1596 times by 1 test: ((&wr)->length += (eivlen));Executed by:
| 1596 | ||||||||||||||||||
| 978 | - | |||||||||||||||||||
| 979 | if (s->method->ssl3_enc->enc(s, &wr, 1, 1) < 1
| 0-4346 | ||||||||||||||||||
| 980 | if (!ossl_statem_in_error(s)
| 0 | ||||||||||||||||||
| 981 | ossl_statem_fatal((s), (80), (245), ((4|64)), | - | ||||||||||||||||||
| 982 | __FILE__ | - | ||||||||||||||||||
| 983 | , | - | ||||||||||||||||||
| 984 | 961 | - | ||||||||||||||||||
| 985 | ) | - | ||||||||||||||||||
| 986 | ; | - | ||||||||||||||||||
| 987 | } never executed: end of block | 0 | ||||||||||||||||||
| 988 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 989 | } | - | ||||||||||||||||||
| 990 | - | |||||||||||||||||||
| 991 | if ((
| 0-3748 | ||||||||||||||||||
| 992 | if (!s->method->ssl3_enc->mac(s, &wr,
| 0-598 | ||||||||||||||||||
| 993 | &(p[((&wr)->length)]), 1)
| 0-598 | ||||||||||||||||||
| 994 | ossl_statem_fatal((s), (80), (245), ((4|64)), | - | ||||||||||||||||||
| 995 | __FILE__ | - | ||||||||||||||||||
| 996 | , | - | ||||||||||||||||||
| 997 | 970 | - | ||||||||||||||||||
| 998 | ) | - | ||||||||||||||||||
| 999 | ; | - | ||||||||||||||||||
| 1000 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 1001 | } | - | ||||||||||||||||||
| 1002 | ((&wr)->length += (mac_size)); | - | ||||||||||||||||||
| 1003 | } executed 598 times by 1 test: end of blockExecuted by:
| 598 | ||||||||||||||||||
| 1004 | - | |||||||||||||||||||
| 1005 | - | |||||||||||||||||||
| 1006 | - | |||||||||||||||||||
| 1007 | - | |||||||||||||||||||
| 1008 | - | |||||||||||||||||||
| 1009 | (((pseq)[0]=(unsigned char)(((s->rlayer.d->w_epoch)>> 8)&0xff), (pseq)[1]=(unsigned char)(((s->rlayer.d->w_epoch) )&0xff)),(pseq)+=2); | - | ||||||||||||||||||
| 1010 | - | |||||||||||||||||||
| 1011 | memcpy(pseq, &(s->rlayer.write_sequence[2]), 6); | - | ||||||||||||||||||
| 1012 | pseq += 6; | - | ||||||||||||||||||
| 1013 | (((pseq)[0]=(unsigned char)(((((&wr)->length))>> 8)&0xff), (pseq)[1]=(unsigned char)(((((&wr)->length)) )&0xff)),(pseq)+=2); | - | ||||||||||||||||||
| 1014 | - | |||||||||||||||||||
| 1015 | if (s->msg_callback
| 0-4346 | ||||||||||||||||||
| 1016 | s->msg_callback(1, 0, 0x100, pseq - 13, never executed: s->msg_callback(1, 0, 0x100, pseq - 13, 13, s, s->msg_callback_arg); | 0 | ||||||||||||||||||
| 1017 | 13, s, s->msg_callback_arg); never executed: s->msg_callback(1, 0, 0x100, pseq - 13, 13, s, s->msg_callback_arg); | 0 | ||||||||||||||||||
| 1018 | - | |||||||||||||||||||
| 1019 | - | |||||||||||||||||||
| 1020 | - | |||||||||||||||||||
| 1021 | - | |||||||||||||||||||
| 1022 | - | |||||||||||||||||||
| 1023 | ((&wr)->type = (type)); | - | ||||||||||||||||||
| 1024 | ((&wr)->length += (13)); | - | ||||||||||||||||||
| 1025 | - | |||||||||||||||||||
| 1026 | ssl3_record_sequence_update(&(s->rlayer.write_sequence[0])); | - | ||||||||||||||||||
| 1027 | - | |||||||||||||||||||
| 1028 | if (create_empty_fragment
| 0-4346 | ||||||||||||||||||
| 1029 | - | |||||||||||||||||||
| 1030 | - | |||||||||||||||||||
| 1031 | - | |||||||||||||||||||
| 1032 | - | |||||||||||||||||||
| 1033 | *written = wr.length; | - | ||||||||||||||||||
| 1034 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 1035 | } | - | ||||||||||||||||||
| 1036 | - | |||||||||||||||||||
| 1037 | - | |||||||||||||||||||
| 1038 | ((wb)->left = (prefix_len + ((&wr)->length))); | - | ||||||||||||||||||
| 1039 | ((wb)->offset = (0)); | - | ||||||||||||||||||
| 1040 | - | |||||||||||||||||||
| 1041 | - | |||||||||||||||||||
| 1042 | - | |||||||||||||||||||
| 1043 | - | |||||||||||||||||||
| 1044 | - | |||||||||||||||||||
| 1045 | s->rlayer.wpend_tot = len; | - | ||||||||||||||||||
| 1046 | s->rlayer.wpend_buf = buf; | - | ||||||||||||||||||
| 1047 | s->rlayer.wpend_type = type; | - | ||||||||||||||||||
| 1048 | s->rlayer.wpend_ret = len; | - | ||||||||||||||||||
| 1049 | - | |||||||||||||||||||
| 1050 | - | |||||||||||||||||||
| 1051 | return executed 4346 times by 1 test: ssl3_write_pending(s, type, buf, len, written);return ssl3_write_pending(s, type, buf, len, written);Executed by:
executed 4346 times by 1 test: return ssl3_write_pending(s, type, buf, len, written);Executed by:
| 4346 | ||||||||||||||||||
| 1052 | } | - | ||||||||||||||||||
| 1053 | - | |||||||||||||||||||
| 1054 | DTLS1_BITMAP *dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr, | - | ||||||||||||||||||
| 1055 | unsigned int *is_next_epoch) | - | ||||||||||||||||||
| 1056 | { | - | ||||||||||||||||||
| 1057 | - | |||||||||||||||||||
| 1058 | *is_next_epoch = 0; | - | ||||||||||||||||||
| 1059 | - | |||||||||||||||||||
| 1060 | - | |||||||||||||||||||
| 1061 | if (rr->epoch == s->rlayer.d->r_epoch
| 20-3416 | ||||||||||||||||||
| 1062 | return executed 3416 times by 1 test: &s->rlayer.d->bitmap;return &s->rlayer.d->bitmap;Executed by:
executed 3416 times by 1 test: return &s->rlayer.d->bitmap;Executed by:
| 3416 | ||||||||||||||||||
| 1063 | - | |||||||||||||||||||
| 1064 | - | |||||||||||||||||||
| 1065 | - | |||||||||||||||||||
| 1066 | - | |||||||||||||||||||
| 1067 | - | |||||||||||||||||||
| 1068 | - | |||||||||||||||||||
| 1069 | else if (rr->epoch == (unsigned long)(s->rlayer.d->r_epoch + 1)
| 9-11 | ||||||||||||||||||
| 1070 | s->rlayer.d->unprocessed_rcds.epoch != s->rlayer.d->r_epoch
| 0-9 | ||||||||||||||||||
| 1071 | (rr->type == 22
| 0-9 | ||||||||||||||||||
| 1072 | *is_next_epoch = 1; | - | ||||||||||||||||||
| 1073 | return executed 9 times by 1 test: &s->rlayer.d->next_bitmap;return &s->rlayer.d->next_bitmap;Executed by:
executed 9 times by 1 test: return &s->rlayer.d->next_bitmap;Executed by:
| 9 | ||||||||||||||||||
| 1074 | } | - | ||||||||||||||||||
| 1075 | - | |||||||||||||||||||
| 1076 | return executed 11 times by 1 test: return ((void *)0) ;Executed by:
executed 11 times by 1 test: return ((void *)0) ;Executed by:
| 11 | ||||||||||||||||||
| 1077 | ((void *)0) executed 11 times by 1 test: return ((void *)0) ;Executed by:
| 11 | ||||||||||||||||||
| 1078 | ; executed 11 times by 1 test: return ((void *)0) ;Executed by:
| 11 | ||||||||||||||||||
| 1079 | } | - | ||||||||||||||||||
| 1080 | - | |||||||||||||||||||
| 1081 | void dtls1_reset_seq_numbers(SSL *s, int rw) | - | ||||||||||||||||||
| 1082 | { | - | ||||||||||||||||||
| 1083 | unsigned char *seq; | - | ||||||||||||||||||
| 1084 | unsigned int seq_bytes = sizeof(s->rlayer.read_sequence); | - | ||||||||||||||||||
| 1085 | - | |||||||||||||||||||
| 1086 | if (rw & 0x001
| 355-359 | ||||||||||||||||||
| 1087 | seq = s->rlayer.read_sequence; | - | ||||||||||||||||||
| 1088 | s->rlayer.d->r_epoch++; | - | ||||||||||||||||||
| 1089 | memcpy(&s->rlayer.d->bitmap, &s->rlayer.d->next_bitmap, | - | ||||||||||||||||||
| 1090 | sizeof(s->rlayer.d->bitmap)); | - | ||||||||||||||||||
| 1091 | memset(&s->rlayer.d->next_bitmap, 0, sizeof(s->rlayer.d->next_bitmap)); | - | ||||||||||||||||||
| 1092 | - | |||||||||||||||||||
| 1093 | - | |||||||||||||||||||
| 1094 | - | |||||||||||||||||||
| 1095 | - | |||||||||||||||||||
| 1096 | - | |||||||||||||||||||
| 1097 | dtls1_clear_received_buffer(s); | - | ||||||||||||||||||
| 1098 | } executed 355 times by 1 test: else {end of blockExecuted by:
| 355 | ||||||||||||||||||
| 1099 | seq = s->rlayer.write_sequence; | - | ||||||||||||||||||
| 1100 | memcpy(s->rlayer.d->last_write_sequence, seq, | - | ||||||||||||||||||
| 1101 | sizeof(s->rlayer.write_sequence)); | - | ||||||||||||||||||
| 1102 | s->rlayer.d->w_epoch++; | - | ||||||||||||||||||
| 1103 | } executed 359 times by 1 test: end of blockExecuted by:
| 359 | ||||||||||||||||||
| 1104 | - | |||||||||||||||||||
| 1105 | memset(seq, 0, seq_bytes); | - | ||||||||||||||||||
| 1106 | } executed 714 times by 1 test: end of blockExecuted by:
| 714 | ||||||||||||||||||
| Switch to Source code | Preprocessed file |