| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/ssl/d1_lib.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | static int dtls1_listen(SSL *s, struct sockaddr *client); | - | ||||||||||||
| 7 | - | |||||||||||||
| 8 | SSL3_ENC_METHOD DTLSv1_enc_data = { | - | ||||||||||||
| 9 | .enc = dtls1_enc, | - | ||||||||||||
| 10 | .enc_flags = (1 << 0), | - | ||||||||||||
| 11 | }; | - | ||||||||||||
| 12 | - | |||||||||||||
| 13 | long | - | ||||||||||||
| 14 | dtls1_default_timeout(void) | - | ||||||||||||
| 15 | { | - | ||||||||||||
| 16 | - | |||||||||||||
| 17 | - | |||||||||||||
| 18 | return executed 33 times by 5 tests: (60*60*2);return (60*60*2);Executed by:
executed 33 times by 5 tests: return (60*60*2);Executed by:
| 33 | ||||||||||||
| 19 | } | - | ||||||||||||
| 20 | - | |||||||||||||
| 21 | int | - | ||||||||||||
| 22 | dtls1_new(SSL *s) | - | ||||||||||||
| 23 | { | - | ||||||||||||
| 24 | DTLS1_STATE *d1; | - | ||||||||||||
| 25 | - | |||||||||||||
| 26 | if (!ssl3_new(s)
| 0-33 | ||||||||||||
| 27 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 28 | if ((
| 0-33 | ||||||||||||
| 29 | ((void *)0)
| 0-33 | ||||||||||||
| 30 | ) { | - | ||||||||||||
| 31 | ssl3_free(s); | - | ||||||||||||
| 32 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 33 | } | - | ||||||||||||
| 34 | if ((
| 0-33 | ||||||||||||
| 35 | ((void *)0)
| 0-33 | ||||||||||||
| 36 | ) { | - | ||||||||||||
| 37 | free(d1); | - | ||||||||||||
| 38 | ssl3_free(s); | - | ||||||||||||
| 39 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 40 | } | - | ||||||||||||
| 41 | - | |||||||||||||
| 42 | - | |||||||||||||
| 43 | - | |||||||||||||
| 44 | d1->internal->unprocessed_rcds.q = pqueue_new(); | - | ||||||||||||
| 45 | d1->internal->processed_rcds.q = pqueue_new(); | - | ||||||||||||
| 46 | d1->internal->buffered_messages = pqueue_new(); | - | ||||||||||||
| 47 | d1->sent_messages = pqueue_new(); | - | ||||||||||||
| 48 | d1->internal->buffered_app_data.q = pqueue_new(); | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 | if (s->server
| 0-33 | ||||||||||||
| 51 | d1->internal->cookie_len = sizeof((s->d1->internal)->cookie); | - | ||||||||||||
| 52 | } never executed: end of block | 0 | ||||||||||||
| 53 | - | |||||||||||||
| 54 | if (!d1->internal->unprocessed_rcds.q
| 0-33 | ||||||||||||
| 55 | !d1->internal->buffered_messages
| 0-33 | ||||||||||||
| 56 | !d1->internal->buffered_app_data.q
| 0-33 | ||||||||||||
| 57 | pqueue_free(d1->internal->unprocessed_rcds.q); | - | ||||||||||||
| 58 | pqueue_free(d1->internal->processed_rcds.q); | - | ||||||||||||
| 59 | pqueue_free(d1->internal->buffered_messages); | - | ||||||||||||
| 60 | pqueue_free(d1->sent_messages); | - | ||||||||||||
| 61 | pqueue_free(d1->internal->buffered_app_data.q); | - | ||||||||||||
| 62 | free(d1); | - | ||||||||||||
| 63 | ssl3_free(s); | - | ||||||||||||
| 64 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 65 | } | - | ||||||||||||
| 66 | - | |||||||||||||
| 67 | s->d1 = d1; | - | ||||||||||||
| 68 | s->method->internal->ssl_clear(s); | - | ||||||||||||
| 69 | return executed 33 times by 5 tests: (1);return (1);Executed by:
executed 33 times by 5 tests: return (1);Executed by:
| 33 | ||||||||||||
| 70 | } | - | ||||||||||||
| 71 | - | |||||||||||||
| 72 | static void | - | ||||||||||||
| 73 | dtls1_clear_queues(SSL *s) | - | ||||||||||||
| 74 | { | - | ||||||||||||
| 75 | pitem *item = | - | ||||||||||||
| 76 | ((void *)0) | - | ||||||||||||
| 77 | ; | - | ||||||||||||
| 78 | hm_fragment *frag = | - | ||||||||||||
| 79 | ((void *)0) | - | ||||||||||||
| 80 | ; | - | ||||||||||||
| 81 | DTLS1_RECORD_DATA *rdata; | - | ||||||||||||
| 82 | - | |||||||||||||
| 83 | while ((
| 0-121 | ||||||||||||
| 84 | ((void *)0)
| 0-121 | ||||||||||||
| 85 | ) { | - | ||||||||||||
| 86 | rdata = (DTLS1_RECORD_DATA *) item->data; | - | ||||||||||||
| 87 | free(rdata->rbuf.buf); | - | ||||||||||||
| 88 | free(item->data); | - | ||||||||||||
| 89 | pitem_free(item); | - | ||||||||||||
| 90 | } never executed: end of block | 0 | ||||||||||||
| 91 | - | |||||||||||||
| 92 | while ((
| 0-121 | ||||||||||||
| 93 | ((void *)0)
| 0-121 | ||||||||||||
| 94 | ) { | - | ||||||||||||
| 95 | rdata = (DTLS1_RECORD_DATA *) item->data; | - | ||||||||||||
| 96 | free(rdata->rbuf.buf); | - | ||||||||||||
| 97 | free(item->data); | - | ||||||||||||
| 98 | pitem_free(item); | - | ||||||||||||
| 99 | } never executed: end of block | 0 | ||||||||||||
| 100 | - | |||||||||||||
| 101 | while ((
| 0-121 | ||||||||||||
| 102 | ((void *)0)
| 0-121 | ||||||||||||
| 103 | ) { | - | ||||||||||||
| 104 | frag = (hm_fragment *)item->data; | - | ||||||||||||
| 105 | free(frag->fragment); | - | ||||||||||||
| 106 | free(frag); | - | ||||||||||||
| 107 | pitem_free(item); | - | ||||||||||||
| 108 | } never executed: end of block | 0 | ||||||||||||
| 109 | - | |||||||||||||
| 110 | while ((
| 34-121 | ||||||||||||
| 111 | ((void *)0)
| 34-121 | ||||||||||||
| 112 | ) { | - | ||||||||||||
| 113 | frag = (hm_fragment *)item->data; | - | ||||||||||||
| 114 | free(frag->fragment); | - | ||||||||||||
| 115 | free(frag); | - | ||||||||||||
| 116 | pitem_free(item); | - | ||||||||||||
| 117 | } executed 34 times by 2 tests: end of blockExecuted by:
| 34 | ||||||||||||
| 118 | - | |||||||||||||
| 119 | while ((
| 0-121 | ||||||||||||
| 120 | ((void *)0)
| 0-121 | ||||||||||||
| 121 | ) { | - | ||||||||||||
| 122 | rdata = (DTLS1_RECORD_DATA *) item->data; | - | ||||||||||||
| 123 | free(rdata->rbuf.buf); | - | ||||||||||||
| 124 | free(item->data); | - | ||||||||||||
| 125 | pitem_free(item); | - | ||||||||||||
| 126 | } never executed: end of block | 0 | ||||||||||||
| 127 | } executed 121 times by 5 tests: end of blockExecuted by:
| 121 | ||||||||||||
| 128 | - | |||||||||||||
| 129 | void | - | ||||||||||||
| 130 | dtls1_free(SSL *s) | - | ||||||||||||
| 131 | { | - | ||||||||||||
| 132 | if (s ==
| 0-32 | ||||||||||||
| 133 | ((void *)0)
| 0-32 | ||||||||||||
| 134 | ) | - | ||||||||||||
| 135 | return; never executed: return; | 0 | ||||||||||||
| 136 | - | |||||||||||||
| 137 | ssl3_free(s); | - | ||||||||||||
| 138 | - | |||||||||||||
| 139 | dtls1_clear_queues(s); | - | ||||||||||||
| 140 | - | |||||||||||||
| 141 | pqueue_free((s->d1->internal)->unprocessed_rcds.q); | - | ||||||||||||
| 142 | pqueue_free((s->d1->internal)->processed_rcds.q); | - | ||||||||||||
| 143 | pqueue_free((s->d1->internal)->buffered_messages); | - | ||||||||||||
| 144 | pqueue_free(s->d1->sent_messages); | - | ||||||||||||
| 145 | pqueue_free((s->d1->internal)->buffered_app_data.q); | - | ||||||||||||
| 146 | - | |||||||||||||
| 147 | freezero(s->d1->internal, sizeof(*s->d1->internal)); | - | ||||||||||||
| 148 | freezero(s->d1, sizeof(*s->d1)); | - | ||||||||||||
| 149 | - | |||||||||||||
| 150 | s->d1 = | - | ||||||||||||
| 151 | ((void *)0) | - | ||||||||||||
| 152 | ; | - | ||||||||||||
| 153 | } executed 32 times by 5 tests: end of blockExecuted by:
| 32 | ||||||||||||
| 154 | - | |||||||||||||
| 155 | void | - | ||||||||||||
| 156 | dtls1_clear(SSL *s) | - | ||||||||||||
| 157 | { | - | ||||||||||||
| 158 | struct dtls1_state_internal_st *internal; | - | ||||||||||||
| 159 | pqueue unprocessed_rcds; | - | ||||||||||||
| 160 | pqueue processed_rcds; | - | ||||||||||||
| 161 | pqueue buffered_messages; | - | ||||||||||||
| 162 | pqueue sent_messages; | - | ||||||||||||
| 163 | pqueue buffered_app_data; | - | ||||||||||||
| 164 | unsigned int mtu; | - | ||||||||||||
| 165 | - | |||||||||||||
| 166 | if (s->d1
| 33-89 | ||||||||||||
| 167 | unprocessed_rcds = (s->d1->internal)->unprocessed_rcds.q; | - | ||||||||||||
| 168 | processed_rcds = (s->d1->internal)->processed_rcds.q; | - | ||||||||||||
| 169 | buffered_messages = (s->d1->internal)->buffered_messages; | - | ||||||||||||
| 170 | sent_messages = s->d1->sent_messages; | - | ||||||||||||
| 171 | buffered_app_data = (s->d1->internal)->buffered_app_data.q; | - | ||||||||||||
| 172 | mtu = (s->d1->internal)->mtu; | - | ||||||||||||
| 173 | - | |||||||||||||
| 174 | dtls1_clear_queues(s); | - | ||||||||||||
| 175 | - | |||||||||||||
| 176 | memset(s->d1->internal, 0, sizeof(*s->d1->internal)); | - | ||||||||||||
| 177 | internal = s->d1->internal; | - | ||||||||||||
| 178 | memset(s->d1, 0, sizeof(*s->d1)); | - | ||||||||||||
| 179 | s->d1->internal = internal; | - | ||||||||||||
| 180 | - | |||||||||||||
| 181 | if (s->server
| 40-49 | ||||||||||||
| 182 | (s->d1->internal)->cookie_len = sizeof((s->d1->internal)->cookie); | - | ||||||||||||
| 183 | } executed 40 times by 3 tests: end of blockExecuted by:
| 40 | ||||||||||||
| 184 | - | |||||||||||||
| 185 | if (SSL_ctrl((s),32,0,
| 0-89 | ||||||||||||
| 186 | ((void *)0)
| 0-89 | ||||||||||||
| 187 | ) & 0x00001000L
| 0-89 | ||||||||||||
| 188 | (s->d1->internal)->mtu = mtu; | - | ||||||||||||
| 189 | } never executed: end of block | 0 | ||||||||||||
| 190 | - | |||||||||||||
| 191 | (s->d1->internal)->unprocessed_rcds.q = unprocessed_rcds; | - | ||||||||||||
| 192 | (s->d1->internal)->processed_rcds.q = processed_rcds; | - | ||||||||||||
| 193 | (s->d1->internal)->buffered_messages = buffered_messages; | - | ||||||||||||
| 194 | s->d1->sent_messages = sent_messages; | - | ||||||||||||
| 195 | (s->d1->internal)->buffered_app_data.q = buffered_app_data; | - | ||||||||||||
| 196 | } executed 89 times by 5 tests: end of blockExecuted by:
| 89 | ||||||||||||
| 197 | - | |||||||||||||
| 198 | ssl3_clear(s); | - | ||||||||||||
| 199 | - | |||||||||||||
| 200 | s->version = 0xFEFF; | - | ||||||||||||
| 201 | } executed 122 times by 5 tests: end of blockExecuted by:
| 122 | ||||||||||||
| 202 | - | |||||||||||||
| 203 | long | - | ||||||||||||
| 204 | dtls1_ctrl(SSL *s, int cmd, long larg, void *parg) | - | ||||||||||||
| 205 | { | - | ||||||||||||
| 206 | int ret = 0; | - | ||||||||||||
| 207 | - | |||||||||||||
| 208 | switch (cmd) { | - | ||||||||||||
| 209 | case never executed: 73:case 73:never executed: case 73: | 0 | ||||||||||||
| 210 | if (dtls1_get_timeout(s, (struct timeval*) parg) !=
| 0 | ||||||||||||
| 211 | ((void *)0)
| 0 | ||||||||||||
| 212 | ) { | - | ||||||||||||
| 213 | ret = 1; | - | ||||||||||||
| 214 | } never executed: end of block | 0 | ||||||||||||
| 215 | break; never executed: break; | 0 | ||||||||||||
| 216 | case never executed: 74:case 74:never executed: case 74: | 0 | ||||||||||||
| 217 | ret = dtls1_handle_timeout(s); | - | ||||||||||||
| 218 | break; never executed: break; | 0 | ||||||||||||
| 219 | case never executed: 75:case 75:never executed: case 75: | 0 | ||||||||||||
| 220 | ret = dtls1_listen(s, parg); | - | ||||||||||||
| 221 | break; never executed: break; | 0 | ||||||||||||
| 222 | - | |||||||||||||
| 223 | default never executed: :default:never executed: default: | 0 | ||||||||||||
| 224 | ret = ssl3_ctrl(s, cmd, larg, parg); | - | ||||||||||||
| 225 | break; never executed: break; | 0 | ||||||||||||
| 226 | } | - | ||||||||||||
| 227 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 228 | } | - | ||||||||||||
| 229 | const SSL_CIPHER * | - | ||||||||||||
| 230 | dtls1_get_cipher(unsigned int u) | - | ||||||||||||
| 231 | { | - | ||||||||||||
| 232 | const SSL_CIPHER *ciph = ssl3_get_cipher(u); | - | ||||||||||||
| 233 | - | |||||||||||||
| 234 | if (ciph !=
| 0-3243 | ||||||||||||
| 235 | ((void *)0)
| 0-3243 | ||||||||||||
| 236 | ) { | - | ||||||||||||
| 237 | if (ciph->algorithm_enc == 0x00000004L
| 282-2961 | ||||||||||||
| 238 | return executed 282 times by 5 tests: return ((void *)0) ;Executed by:
executed 282 times by 5 tests: return ((void *)0) ;Executed by:
| 282 | ||||||||||||
| 239 | ((void *)0) executed 282 times by 5 tests: return ((void *)0) ;Executed by:
| 282 | ||||||||||||
| 240 | ; executed 282 times by 5 tests: return ((void *)0) ;Executed by:
| 282 | ||||||||||||
| 241 | } executed 2961 times by 5 tests: end of blockExecuted by:
| 2961 | ||||||||||||
| 242 | - | |||||||||||||
| 243 | return executed 2961 times by 5 tests: ciph;return ciph;Executed by:
executed 2961 times by 5 tests: return ciph;Executed by:
| 2961 | ||||||||||||
| 244 | } | - | ||||||||||||
| 245 | - | |||||||||||||
| 246 | void | - | ||||||||||||
| 247 | dtls1_start_timer(SSL *s) | - | ||||||||||||
| 248 | { | - | ||||||||||||
| 249 | - | |||||||||||||
| 250 | - | |||||||||||||
| 251 | if (s->d1->next_timeout.tv_sec == 0
| 0-54 | ||||||||||||
| 252 | s->d1->timeout_duration = 1; | - | ||||||||||||
| 253 | } executed 34 times by 2 tests: end of blockExecuted by:
| 34 | ||||||||||||
| 254 | - | |||||||||||||
| 255 | - | |||||||||||||
| 256 | gettimeofday(&(s->d1->next_timeout), | - | ||||||||||||
| 257 | ((void *)0) | - | ||||||||||||
| 258 | ); | - | ||||||||||||
| 259 | - | |||||||||||||
| 260 | - | |||||||||||||
| 261 | s->d1->next_timeout.tv_sec += s->d1->timeout_duration; | - | ||||||||||||
| 262 | BIO_ctrl(SSL_get_rbio(s), 45, 0, | - | ||||||||||||
| 263 | &s->d1->next_timeout); | - | ||||||||||||
| 264 | } executed 88 times by 2 tests: end of blockExecuted by:
| 88 | ||||||||||||
| 265 | - | |||||||||||||
| 266 | struct timeval* | - | ||||||||||||
| 267 | dtls1_get_timeout(SSL *s, struct timeval* timeleft) | - | ||||||||||||
| 268 | { | - | ||||||||||||
| 269 | struct timeval timenow; | - | ||||||||||||
| 270 | - | |||||||||||||
| 271 | - | |||||||||||||
| 272 | if (s->d1->next_timeout.tv_sec == 0
| 0-250 | ||||||||||||
| 273 | return executed 91 times by 1 test: return ((void *)0) ;Executed by:
executed 91 times by 1 test: return ((void *)0) ;Executed by:
| 91 | ||||||||||||
| 274 | ((void *)0) executed 91 times by 1 test: return ((void *)0) ;Executed by:
| 91 | ||||||||||||
| 275 | ; executed 91 times by 1 test: return ((void *)0) ;Executed by:
| 91 | ||||||||||||
| 276 | } | - | ||||||||||||
| 277 | - | |||||||||||||
| 278 | - | |||||||||||||
| 279 | gettimeofday(&timenow, | - | ||||||||||||
| 280 | ((void *)0) | - | ||||||||||||
| 281 | ); | - | ||||||||||||
| 282 | - | |||||||||||||
| 283 | - | |||||||||||||
| 284 | if (s->d1->next_timeout.tv_sec < timenow.tv_sec
| 0-250 | ||||||||||||
| 285 | (s->d1->next_timeout.tv_sec == timenow.tv_sec
| 0-250 | ||||||||||||
| 286 | s->d1->next_timeout.tv_usec <= timenow.tv_usec
| 0 | ||||||||||||
| 287 | memset(timeleft, 0, sizeof(struct timeval)); | - | ||||||||||||
| 288 | return never executed: timeleft;return timeleft;never executed: return timeleft; | 0 | ||||||||||||
| 289 | } | - | ||||||||||||
| 290 | - | |||||||||||||
| 291 | - | |||||||||||||
| 292 | memcpy(timeleft, &(s->d1->next_timeout), sizeof(struct timeval)); | - | ||||||||||||
| 293 | timeleft->tv_sec -= timenow.tv_sec; | - | ||||||||||||
| 294 | timeleft->tv_usec -= timenow.tv_usec; | - | ||||||||||||
| 295 | if (timeleft->tv_usec < 0
| 0-250 | ||||||||||||
| 296 | timeleft->tv_sec--; | - | ||||||||||||
| 297 | timeleft->tv_usec += 1000000; | - | ||||||||||||
| 298 | } executed 250 times by 2 tests: end of blockExecuted by:
| 250 | ||||||||||||
| 299 | - | |||||||||||||
| 300 | - | |||||||||||||
| 301 | - | |||||||||||||
| 302 | - | |||||||||||||
| 303 | - | |||||||||||||
| 304 | if (timeleft->tv_sec == 0
| 0-250 | ||||||||||||
| 305 | memset(timeleft, 0, sizeof(struct timeval)); | - | ||||||||||||
| 306 | } never executed: end of block | 0 | ||||||||||||
| 307 | - | |||||||||||||
| 308 | - | |||||||||||||
| 309 | return executed 250 times by 2 tests: timeleft;return timeleft;Executed by:
executed 250 times by 2 tests: return timeleft;Executed by:
| 250 | ||||||||||||
| 310 | } | - | ||||||||||||
| 311 | - | |||||||||||||
| 312 | int | - | ||||||||||||
| 313 | dtls1_is_timer_expired(SSL *s) | - | ||||||||||||
| 314 | { | - | ||||||||||||
| 315 | struct timeval timeleft; | - | ||||||||||||
| 316 | - | |||||||||||||
| 317 | - | |||||||||||||
| 318 | if (dtls1_get_timeout(s, &timeleft) ==
| 91-250 | ||||||||||||
| 319 | ((void *)0)
| 91-250 | ||||||||||||
| 320 | ) { | - | ||||||||||||
| 321 | return executed 91 times by 1 test: 0;return 0;Executed by:
executed 91 times by 1 test: return 0;Executed by:
| 91 | ||||||||||||
| 322 | } | - | ||||||||||||
| 323 | - | |||||||||||||
| 324 | - | |||||||||||||
| 325 | if (timeleft.tv_sec > 0
| 0-250 | ||||||||||||
| 326 | return executed 250 times by 2 tests: 0;return 0;Executed by:
executed 250 times by 2 tests: return 0;Executed by:
| 250 | ||||||||||||
| 327 | } | - | ||||||||||||
| 328 | - | |||||||||||||
| 329 | - | |||||||||||||
| 330 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 331 | } | - | ||||||||||||
| 332 | - | |||||||||||||
| 333 | void | - | ||||||||||||
| 334 | dtls1_double_timeout(SSL *s) | - | ||||||||||||
| 335 | { | - | ||||||||||||
| 336 | s->d1->timeout_duration *= 2; | - | ||||||||||||
| 337 | if (s->d1->timeout_duration > 60
| 0 | ||||||||||||
| 338 | s->d1->timeout_duration = 60; never executed: s->d1->timeout_duration = 60; | 0 | ||||||||||||
| 339 | dtls1_start_timer(s); | - | ||||||||||||
| 340 | } never executed: end of block | 0 | ||||||||||||
| 341 | - | |||||||||||||
| 342 | void | - | ||||||||||||
| 343 | dtls1_stop_timer(SSL *s) | - | ||||||||||||
| 344 | { | - | ||||||||||||
| 345 | - | |||||||||||||
| 346 | memset(&((s->d1->internal)->timeout), 0, sizeof(struct dtls1_timeout_st)); | - | ||||||||||||
| 347 | memset(&(s->d1->next_timeout), 0, sizeof(struct timeval)); | - | ||||||||||||
| 348 | s->d1->timeout_duration = 1; | - | ||||||||||||
| 349 | BIO_ctrl(SSL_get_rbio(s), 45, 0, | - | ||||||||||||
| 350 | &(s->d1->next_timeout)); | - | ||||||||||||
| 351 | - | |||||||||||||
| 352 | dtls1_clear_record_buffer(s); | - | ||||||||||||
| 353 | } executed 55 times by 1 test: end of blockExecuted by:
| 55 | ||||||||||||
| 354 | - | |||||||||||||
| 355 | int | - | ||||||||||||
| 356 | dtls1_check_timeout_num(SSL *s) | - | ||||||||||||
| 357 | { | - | ||||||||||||
| 358 | (s->d1->internal)->timeout.num_alerts++; | - | ||||||||||||
| 359 | - | |||||||||||||
| 360 | - | |||||||||||||
| 361 | if ((
| 0 | ||||||||||||
| 362 | (s->d1->internal)->mtu = BIO_ctrl(SSL_get_wbio(s), | - | ||||||||||||
| 363 | 47, 0, | - | ||||||||||||
| 364 | ((void *)0) | - | ||||||||||||
| 365 | ); | - | ||||||||||||
| 366 | - | |||||||||||||
| 367 | } never executed: end of block | 0 | ||||||||||||
| 368 | - | |||||||||||||
| 369 | if ((
| 0 | ||||||||||||
| 370 | - | |||||||||||||
| 371 | SSL_error_internal(s, 312, __FILE__, 406); | - | ||||||||||||
| 372 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 373 | } | - | ||||||||||||
| 374 | - | |||||||||||||
| 375 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 376 | } | - | ||||||||||||
| 377 | - | |||||||||||||
| 378 | int | - | ||||||||||||
| 379 | dtls1_handle_timeout(SSL *s) | - | ||||||||||||
| 380 | { | - | ||||||||||||
| 381 | - | |||||||||||||
| 382 | if (!dtls1_is_timer_expired(s)
| 0-296 | ||||||||||||
| 383 | return executed 296 times by 2 tests: 0;return 0;Executed by:
executed 296 times by 2 tests: return 0;Executed by:
| 296 | ||||||||||||
| 384 | } | - | ||||||||||||
| 385 | - | |||||||||||||
| 386 | dtls1_double_timeout(s); | - | ||||||||||||
| 387 | - | |||||||||||||
| 388 | if (dtls1_check_timeout_num(s) < 0
| 0 | ||||||||||||
| 389 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 390 | - | |||||||||||||
| 391 | (s->d1->internal)->timeout.read_timeouts++; | - | ||||||||||||
| 392 | if ((
| 0 | ||||||||||||
| 393 | (s->d1->internal)->timeout.read_timeouts = 1; | - | ||||||||||||
| 394 | } never executed: end of block | 0 | ||||||||||||
| 395 | - | |||||||||||||
| 396 | dtls1_start_timer(s); | - | ||||||||||||
| 397 | return never executed: dtls1_retransmit_buffered_messages(s);return dtls1_retransmit_buffered_messages(s);never executed: return dtls1_retransmit_buffered_messages(s); | 0 | ||||||||||||
| 398 | } | - | ||||||||||||
| 399 | - | |||||||||||||
| 400 | int | - | ||||||||||||
| 401 | dtls1_listen(SSL *s, struct sockaddr *client) | - | ||||||||||||
| 402 | { | - | ||||||||||||
| 403 | int ret; | - | ||||||||||||
| 404 | - | |||||||||||||
| 405 | - | |||||||||||||
| 406 | SSL_clear(s); | - | ||||||||||||
| 407 | - | |||||||||||||
| 408 | SSL_ctrl((s),32,(0x00002000L), | - | ||||||||||||
| 409 | ((void *)0) | - | ||||||||||||
| 410 | ); | - | ||||||||||||
| 411 | (s->d1->internal)->listen = 1; | - | ||||||||||||
| 412 | - | |||||||||||||
| 413 | ret = SSL_accept(s); | - | ||||||||||||
| 414 | if (ret <= 0
| 0 | ||||||||||||
| 415 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||
| 416 | - | |||||||||||||
| 417 | (void)(int)BIO_ctrl(SSL_get_rbio(s), 46, 0, (char *)client); | - | ||||||||||||
| 418 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 419 | } | - | ||||||||||||
| 420 | - | |||||||||||||
| 421 | void | - | ||||||||||||
| 422 | dtls1_build_sequence_number(unsigned char *dst, unsigned char *seq, | - | ||||||||||||
| 423 | unsigned short epoch) | - | ||||||||||||
| 424 | { | - | ||||||||||||
| 425 | unsigned char dtlsseq[8]; | - | ||||||||||||
| 426 | unsigned char *p; | - | ||||||||||||
| 427 | - | |||||||||||||
| 428 | p = dtlsseq; | - | ||||||||||||
| 429 | ((p[0]=(unsigned char)(((epoch)>> 8)&0xff), p[1]=(unsigned char)(((epoch) )&0xff)),p+=2); | - | ||||||||||||
| 430 | memcpy(p, &seq[2], 8 - 2); | - | ||||||||||||
| 431 | memcpy(dst, dtlsseq, 8); | - | ||||||||||||
| 432 | } executed 110 times by 1 test: end of blockExecuted by:
| 110 | ||||||||||||
| Switch to Source code | Preprocessed file |