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