| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/ssl/ssl_srvr.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | int | - | ||||||||||||||||||||||||
| 16 | ssl3_accept(SSL *s) | - | ||||||||||||||||||||||||
| 17 | { | - | ||||||||||||||||||||||||
| 18 | void (*cb)(const SSL *ssl, int type, int val) = | - | ||||||||||||||||||||||||
| 19 | ((void *)0) | - | ||||||||||||||||||||||||
| 20 | ; | - | ||||||||||||||||||||||||
| 21 | unsigned long alg_k; | - | ||||||||||||||||||||||||
| 22 | int ret = -1; | - | ||||||||||||||||||||||||
| 23 | int new_state, state, skip = 0; | - | ||||||||||||||||||||||||
| 24 | int listen = 0; | - | ||||||||||||||||||||||||
| 25 | - | |||||||||||||||||||||||||
| 26 | ERR_clear_error(); | - | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | (*__errno_location ()) | - | ||||||||||||||||||||||||
| 29 | = 0; | - | ||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | if (s->internal->info_callback !=
| 0-1236 | ||||||||||||||||||||||||
| 32 | ((void *)0)
| 0-1236 | ||||||||||||||||||||||||
| 33 | ) | - | ||||||||||||||||||||||||
| 34 | cb = s->internal->info_callback; never executed: cb = s->internal->info_callback; | 0 | ||||||||||||||||||||||||
| 35 | else if (s->ctx->internal->info_callback !=
| 0-1236 | ||||||||||||||||||||||||
| 36 | ((void *)0)
| 0-1236 | ||||||||||||||||||||||||
| 37 | ) | - | ||||||||||||||||||||||||
| 38 | cb = s->ctx->internal->info_callback; never executed: cb = s->ctx->internal->info_callback; | 0 | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | if ((
| 22-1214 | ||||||||||||||||||||||||
| 41 | listen = (s->d1->internal)->listen; executed 22 times by 1 test: listen = (s->d1->internal)->listen;Executed by:
| 22 | ||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||
| 44 | s->internal->in_handshake++; | - | ||||||||||||||||||||||||
| 45 | if (!(SSL_state((s))&(0x1000|0x2000))
| 0-1236 | ||||||||||||||||||||||||
| 46 | SSL_clear(s); executed 65 times by 3 tests: SSL_clear(s);Executed by:
| 65 | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | if ((
| 22-1214 | ||||||||||||||||||||||||
| 49 | ( executed 22 times by 1 test: s->d1->internal)->listen = listen;(s->d1->internal)->listen = listen;Executed by:
executed 22 times by 1 test: (s->d1->internal)->listen = listen;Executed by:
| 22 | ||||||||||||||||||||||||
| 50 | - | |||||||||||||||||||||||||
| 51 | if (s->cert ==
| 0-1236 | ||||||||||||||||||||||||
| 52 | ((void *)0)
| 0-1236 | ||||||||||||||||||||||||
| 53 | ) { | - | ||||||||||||||||||||||||
| 54 | SSL_error_internal(s, 179, __FILE__, 200); | - | ||||||||||||||||||||||||
| 55 | ret = -1; | - | ||||||||||||||||||||||||
| 56 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 57 | } | - | ||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | for (;;) { | - | ||||||||||||||||||||||||
| 60 | state = (s->s3->internal)->hs.state; | - | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | switch ((s->s3->internal)->hs.state) { | - | ||||||||||||||||||||||||
| 63 | case never executed: (0x04|(0x1000|0x2000)):case (0x04|(0x1000|0x2000)):never executed: case (0x04|(0x1000|0x2000)): | 0 | ||||||||||||||||||||||||
| 64 | s->internal->renegotiate = 1; | - | ||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | case never executed: 0x4000:case 0x4000:never executed: case 0x4000:code before this statement never executed: case 0x4000: | 0 | ||||||||||||||||||||||||
| 68 | case never executed: 0x2000:case 0x2000:never executed: case 0x2000: | 0 | ||||||||||||||||||||||||
| 69 | case executed 65 times by 3 tests: 0x4000|0x2000:case 0x4000|0x2000:Executed by:
executed 65 times by 3 tests: case 0x4000|0x2000:Executed by:
| 65 | ||||||||||||||||||||||||
| 70 | case never executed: 0x03|0x2000:case 0x03|0x2000:never executed: case 0x03|0x2000: | 0 | ||||||||||||||||||||||||
| 71 | s->server = 1; | - | ||||||||||||||||||||||||
| 72 | if (cb !=
| 0-65 | ||||||||||||||||||||||||
| 73 | ((void *)0)
| 0-65 | ||||||||||||||||||||||||
| 74 | ) | - | ||||||||||||||||||||||||
| 75 | cb(s, 0x10, 1); never executed: cb(s, 0x10, 1); | 0 | ||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | if ((
| 11-54 | ||||||||||||||||||||||||
| 78 | if ((
| 0-11 | ||||||||||||||||||||||||
| 79 | SSL_error_internal(s, (4|64), __FILE__, 223); | - | ||||||||||||||||||||||||
| 80 | ret = -1; | - | ||||||||||||||||||||||||
| 81 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 82 | } | - | ||||||||||||||||||||||||
| 83 | } executed 11 times by 1 test: else {end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 84 | if ((
| 0-54 | ||||||||||||||||||||||||
| 85 | SSL_error_internal(s, (4|64), __FILE__, 229); | - | ||||||||||||||||||||||||
| 86 | ret = -1; | - | ||||||||||||||||||||||||
| 87 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 88 | } | - | ||||||||||||||||||||||||
| 89 | } executed 54 times by 3 tests: end of blockExecuted by:
| 54 | ||||||||||||||||||||||||
| 90 | s->internal->type = 0x2000; | - | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | if (!ssl3_setup_init_buffer(s)
| 0-65 | ||||||||||||||||||||||||
| 93 | ret = -1; | - | ||||||||||||||||||||||||
| 94 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 95 | } | - | ||||||||||||||||||||||||
| 96 | if (!ssl3_setup_buffers(s)
| 0-65 | ||||||||||||||||||||||||
| 97 | ret = -1; | - | ||||||||||||||||||||||||
| 98 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 99 | } | - | ||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | if ((
| 0-65 | ||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||
| 109 | if (!ssl_init_wbio_buffer(s, 1)
| 0-65 | ||||||||||||||||||||||||
| 110 | ret = -1; | - | ||||||||||||||||||||||||
| 111 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 112 | } | - | ||||||||||||||||||||||||
| 113 | if (!tls1_init_finished_mac(s)
| 0-65 | ||||||||||||||||||||||||
| 114 | ret = -1; | - | ||||||||||||||||||||||||
| 115 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 116 | } | - | ||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | (s->s3->internal)->hs.state = (0x110|0x2000); | - | ||||||||||||||||||||||||
| 119 | s->ctx->internal->stats.sess_accept++; | - | ||||||||||||||||||||||||
| 120 | } executed 65 times by 3 tests: else if (!(s->method->internal->version == 0xFEFF)end of blockExecuted by:
| 0-65 | ||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||
| 126 | SSL_error_internal(s, 338, __FILE__, 270); | - | ||||||||||||||||||||||||
| 127 | ssl3_send_alert(s, 2, | - | ||||||||||||||||||||||||
| 128 | 40); | - | ||||||||||||||||||||||||
| 129 | ret = -1; | - | ||||||||||||||||||||||||
| 130 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 131 | } else { | - | ||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | s->ctx->internal->stats.sess_accept_renegotiate++; | - | ||||||||||||||||||||||||
| 137 | (s->s3->internal)->hs.state = (0x120|0x2000); | - | ||||||||||||||||||||||||
| 138 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 139 | break; executed 65 times by 3 tests: break;Executed by:
| 65 | ||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | case never executed: (0x120|0x2000):case (0x120|0x2000):never executed: case (0x120|0x2000): | 0 | ||||||||||||||||||||||||
| 142 | case never executed: (0x121|0x2000):case (0x121|0x2000):never executed: case (0x121|0x2000): | 0 | ||||||||||||||||||||||||
| 143 | s->internal->shutdown = 0; | - | ||||||||||||||||||||||||
| 144 | if ((
| 0 | ||||||||||||||||||||||||
| 145 | dtls1_clear_record_buffer(s); | - | ||||||||||||||||||||||||
| 146 | dtls1_start_timer(s); | - | ||||||||||||||||||||||||
| 147 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 148 | ret = ssl3_send_hello_request(s); | - | ||||||||||||||||||||||||
| 149 | if (ret <= 0
| 0 | ||||||||||||||||||||||||
| 150 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 151 | if ((
| 0 | ||||||||||||||||||||||||
| 152 | ( never executed: s->s3->internal)->hs.next_state = (0x110|0x2000);(s->s3->internal)->hs.next_state = (0x110|0x2000);never executed: (s->s3->internal)->hs.next_state = (0x110|0x2000); | 0 | ||||||||||||||||||||||||
| 153 | else | - | ||||||||||||||||||||||||
| 154 | ( never executed: s->s3->internal)->hs.next_state = (0x122|0x2000);(s->s3->internal)->hs.next_state = (0x122|0x2000);never executed: (s->s3->internal)->hs.next_state = (0x122|0x2000); | 0 | ||||||||||||||||||||||||
| 155 | (s->s3->internal)->hs.state = (0x100|0x2000); | - | ||||||||||||||||||||||||
| 156 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||
| 158 | if (!tls1_init_finished_mac(s)
| 0 | ||||||||||||||||||||||||
| 159 | ret = -1; | - | ||||||||||||||||||||||||
| 160 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 161 | } | - | ||||||||||||||||||||||||
| 162 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | case never executed: (0x122|0x2000):case (0x122|0x2000):never executed: case (0x122|0x2000): | 0 | ||||||||||||||||||||||||
| 165 | (s->s3->internal)->hs.state = 0x03; | - | ||||||||||||||||||||||||
| 166 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||
| 168 | case executed 65 times by 3 tests: (0x110|0x2000):case (0x110|0x2000):Executed by:
executed 65 times by 3 tests: case (0x110|0x2000):Executed by:
| 65 | ||||||||||||||||||||||||
| 169 | case executed 192 times by 1 test: (0x111|0x2000):case (0x111|0x2000):Executed by:
executed 192 times by 1 test: case (0x111|0x2000):Executed by:
| 192 | ||||||||||||||||||||||||
| 170 | case never executed: (0x112|0x2000):case (0x112|0x2000):never executed: case (0x112|0x2000): | 0 | ||||||||||||||||||||||||
| 171 | s->internal->shutdown = 0; | - | ||||||||||||||||||||||||
| 172 | if ((
| 11-246 | ||||||||||||||||||||||||
| 173 | ret = ssl3_get_client_hello(s); | - | ||||||||||||||||||||||||
| 174 | if (ret <= 0
| 0-11 | ||||||||||||||||||||||||
| 175 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 176 | dtls1_stop_timer(s); | - | ||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | if (ret == 1
| 0-11 | ||||||||||||||||||||||||
| 179 | (
| 0-11 | ||||||||||||||||||||||||
| 180 | ((void *)0)
| 0-11 | ||||||||||||||||||||||||
| 181 | ) & 0x00002000L)
| 0-11 | ||||||||||||||||||||||||
| 182 | ( never executed: s->s3->internal)->hs.state = (0x113|0x2000);(s->s3->internal)->hs.state = (0x113|0x2000);never executed: (s->s3->internal)->hs.state = (0x113|0x2000); | 0 | ||||||||||||||||||||||||
| 183 | else | - | ||||||||||||||||||||||||
| 184 | ( executed 11 times by 1 test: s->s3->internal)->hs.state = (0x130|0x2000);(s->s3->internal)->hs.state = (0x130|0x2000);Executed by:
executed 11 times by 1 test: (s->s3->internal)->hs.state = (0x130|0x2000);Executed by:
| 11 | ||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||
| 186 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||
| 192 | if (listen
| 0-11 | ||||||||||||||||||||||||
| 193 | memcpy((s->s3->internal)->write_sequence, | - | ||||||||||||||||||||||||
| 194 | (s->s3->internal)->read_sequence, | - | ||||||||||||||||||||||||
| 195 | sizeof((s->s3->internal)->write_sequence)); | - | ||||||||||||||||||||||||
| 196 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||
| 199 | if (listen
| 0-11 | ||||||||||||||||||||||||
| 200 | ret = 2; | - | ||||||||||||||||||||||||
| 201 | (s->d1->internal)->listen = 0; | - | ||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||
| 206 | (s->d1->internal)->handshake_read_seq = 2; | - | ||||||||||||||||||||||||
| 207 | (s->d1->internal)->handshake_write_seq = 1; | - | ||||||||||||||||||||||||
| 208 | (s->d1->internal)->next_handshake_write_seq = 1; | - | ||||||||||||||||||||||||
| 209 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 210 | } | - | ||||||||||||||||||||||||
| 211 | } executed 11 times by 1 test: else {end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 212 | if (s->internal->rwstate != 4
| 0-246 | ||||||||||||||||||||||||
| 213 | ret = ssl3_get_client_hello(s); | - | ||||||||||||||||||||||||
| 214 | if (ret <= 0
| 54-192 | ||||||||||||||||||||||||
| 215 | goto executed 192 times by 1 test: end;goto end;Executed by:
executed 192 times by 1 test: goto end;Executed by:
| 192 | ||||||||||||||||||||||||
| 216 | } executed 54 times by 3 tests: end of blockExecuted by:
| 54 | ||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | s->internal->renegotiate = 2; | - | ||||||||||||||||||||||||
| 219 | (s->s3->internal)->hs.state = (0x130|0x2000); | - | ||||||||||||||||||||||||
| 220 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 221 | } executed 54 times by 3 tests: end of blockExecuted by:
| 54 | ||||||||||||||||||||||||
| 222 | break; executed 65 times by 3 tests: break;Executed by:
| 65 | ||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | case never executed: (0x113|0x2000):case (0x113|0x2000):never executed: case (0x113|0x2000): | 0 | ||||||||||||||||||||||||
| 225 | case never executed: (0x114|0x2000):case (0x114|0x2000):never executed: case (0x114|0x2000): | 0 | ||||||||||||||||||||||||
| 226 | ret = dtls1_send_hello_verify_request(s); | - | ||||||||||||||||||||||||
| 227 | if (ret <= 0
| 0 | ||||||||||||||||||||||||
| 228 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 229 | (s->s3->internal)->hs.state = (0x100|0x2000); | - | ||||||||||||||||||||||||
| 230 | (s->s3->internal)->hs.next_state = (0x110|0x2000); | - | ||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||
| 233 | if (!tls1_init_finished_mac(s)
| 0 | ||||||||||||||||||||||||
| 234 | ret = -1; | - | ||||||||||||||||||||||||
| 235 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 236 | } | - | ||||||||||||||||||||||||
| 237 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | case executed 65 times by 3 tests: (0x130|0x2000):case (0x130|0x2000):Executed by:
executed 65 times by 3 tests: case (0x130|0x2000):Executed by:
| 65 | ||||||||||||||||||||||||
| 240 | case never executed: (0x131|0x2000):case (0x131|0x2000):never executed: case (0x131|0x2000): | 0 | ||||||||||||||||||||||||
| 241 | if ((
| 11-54 | ||||||||||||||||||||||||
| 242 | s->internal->renegotiate = 2; | - | ||||||||||||||||||||||||
| 243 | dtls1_start_timer(s); | - | ||||||||||||||||||||||||
| 244 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 245 | ret = ssl3_send_server_hello(s); | - | ||||||||||||||||||||||||
| 246 | if (ret <= 0
| 0-65 | ||||||||||||||||||||||||
| 247 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 248 | if (s->internal->hit
| 0-65 | ||||||||||||||||||||||||
| 249 | if (s->internal->tlsext_ticket_expected
| 0 | ||||||||||||||||||||||||
| 250 | ( never executed: s->s3->internal)->hs.state = (0x1F0|0x2000);(s->s3->internal)->hs.state = (0x1F0|0x2000);never executed: (s->s3->internal)->hs.state = (0x1F0|0x2000); | 0 | ||||||||||||||||||||||||
| 251 | else | - | ||||||||||||||||||||||||
| 252 | ( never executed: s->s3->internal)->hs.state = (0x1D0|0x2000);(s->s3->internal)->hs.state = (0x1D0|0x2000);never executed: (s->s3->internal)->hs.state = (0x1D0|0x2000); | 0 | ||||||||||||||||||||||||
| 253 | } else { | - | ||||||||||||||||||||||||
| 254 | (s->s3->internal)->hs.state = (0x140|0x2000); | - | ||||||||||||||||||||||||
| 255 | } executed 65 times by 3 tests: end of blockExecuted by:
| 65 | ||||||||||||||||||||||||
| 256 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 257 | break; executed 65 times by 3 tests: break;Executed by:
| 65 | ||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||
| 259 | case executed 65 times by 3 tests: (0x140|0x2000):case (0x140|0x2000):Executed by:
executed 65 times by 3 tests: case (0x140|0x2000):Executed by:
| 65 | ||||||||||||||||||||||||
| 260 | case never executed: (0x141|0x2000):case (0x141|0x2000):never executed: case (0x141|0x2000): | 0 | ||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | if (!((s->s3->internal)->hs.new_cipher->algorithm_auth &
| 10-55 | ||||||||||||||||||||||||
| 263 | 0x00000004L)
| 10-55 | ||||||||||||||||||||||||
| 264 | if ((
| 11-44 | ||||||||||||||||||||||||
| 265 | dtls1_start_timer(s); executed 11 times by 1 test: dtls1_start_timer(s);Executed by:
| 11 | ||||||||||||||||||||||||
| 266 | ret = ssl3_send_server_certificate(s); | - | ||||||||||||||||||||||||
| 267 | if (ret <= 0
| 0-55 | ||||||||||||||||||||||||
| 268 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 269 | if (s->internal->tlsext_status_expected
| 0-55 | ||||||||||||||||||||||||
| 270 | ( never executed: s->s3->internal)->hs.state = (0x200|0x2000);(s->s3->internal)->hs.state = (0x200|0x2000);never executed: (s->s3->internal)->hs.state = (0x200|0x2000); | 0 | ||||||||||||||||||||||||
| 271 | else | - | ||||||||||||||||||||||||
| 272 | ( executed 55 times by 3 tests: s->s3->internal)->hs.state = (0x150|0x2000);(s->s3->internal)->hs.state = (0x150|0x2000);Executed by:
executed 55 times by 3 tests: (s->s3->internal)->hs.state = (0x150|0x2000);Executed by:
| 55 | ||||||||||||||||||||||||
| 273 | } else { | - | ||||||||||||||||||||||||
| 274 | skip = 1; | - | ||||||||||||||||||||||||
| 275 | (s->s3->internal)->hs.state = (0x150|0x2000); | - | ||||||||||||||||||||||||
| 276 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 277 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 278 | break; executed 65 times by 3 tests: break;Executed by:
| 65 | ||||||||||||||||||||||||
| 279 | - | |||||||||||||||||||||||||
| 280 | case executed 65 times by 3 tests: (0x150|0x2000):case (0x150|0x2000):Executed by:
executed 65 times by 3 tests: case (0x150|0x2000):Executed by:
| 65 | ||||||||||||||||||||||||
| 281 | case never executed: (0x151|0x2000):case (0x151|0x2000):never executed: case (0x151|0x2000): | 0 | ||||||||||||||||||||||||
| 282 | alg_k = (s->s3->internal)->hs.new_cipher->algorithm_mkey; | - | ||||||||||||||||||||||||
| 283 | if (alg_k & (0x00000008L|0x00000080L)
| 14-51 | ||||||||||||||||||||||||
| 284 | if ((
| 4-47 | ||||||||||||||||||||||||
| 285 | dtls1_start_timer(s); executed 4 times by 1 test: dtls1_start_timer(s);Executed by:
| 4 | ||||||||||||||||||||||||
| 286 | ret = ssl3_send_server_key_exchange(s); | - | ||||||||||||||||||||||||
| 287 | if (ret <= 0
| 0-51 | ||||||||||||||||||||||||
| 288 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 289 | } executed 51 times by 3 tests: elseend of blockExecuted by:
| 51 | ||||||||||||||||||||||||
| 290 | skip = 1; executed 14 times by 1 test: skip = 1;Executed by:
| 14 | ||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||
| 292 | (s->s3->internal)->hs.state = (0x160|0x2000); | - | ||||||||||||||||||||||||
| 293 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 294 | break; executed 65 times by 3 tests: break;Executed by:
| 65 | ||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||
| 296 | case executed 65 times by 3 tests: (0x160|0x2000):case (0x160|0x2000):Executed by:
executed 65 times by 3 tests: case (0x160|0x2000):Executed by:
| 65 | ||||||||||||||||||||||||
| 297 | case never executed: (0x161|0x2000):case (0x161|0x2000):never executed: case (0x161|0x2000): | 0 | ||||||||||||||||||||||||
| 298 | if (!(s->verify_mode & 0x01)
| 7-58 | ||||||||||||||||||||||||
| 299 | ((
| 0-7 | ||||||||||||||||||||||||
| 300 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
| 301 | )
| 0-7 | ||||||||||||||||||||||||
| 302 | (
| 0 | ||||||||||||||||||||||||
| 303 | (((
| 0-7 | ||||||||||||||||||||||||
| 304 | 0x00000004L)
| 0-7 | ||||||||||||||||||||||||
| 305 | 0x02)
| 0 | ||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||
| 307 | skip = 1; | - | ||||||||||||||||||||||||
| 308 | (s->s3->internal)->tmp.cert_request = 0; | - | ||||||||||||||||||||||||
| 309 | (s->s3->internal)->hs.state = (0x170|0x2000); | - | ||||||||||||||||||||||||
| 310 | if (!(s->method->internal->version == 0xFEFF)
| 0-49 | ||||||||||||||||||||||||
| 311 | if (!tls1_digest_cached_records(s)
| 0 | ||||||||||||||||||||||||
| 312 | ret = -1; | - | ||||||||||||||||||||||||
| 313 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 314 | } | - | ||||||||||||||||||||||||
| 315 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 316 | } executed 58 times by 3 tests: else {end of blockExecuted by:
| 58 | ||||||||||||||||||||||||
| 317 | (s->s3->internal)->tmp.cert_request = 1; | - | ||||||||||||||||||||||||
| 318 | if ((
| 2-5 | ||||||||||||||||||||||||
| 319 | dtls1_start_timer(s); executed 2 times by 1 test: dtls1_start_timer(s);Executed by:
| 2 | ||||||||||||||||||||||||
| 320 | ret = ssl3_send_certificate_request(s); | - | ||||||||||||||||||||||||
| 321 | if (ret <= 0
| 0-7 | ||||||||||||||||||||||||
| 322 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 323 | (s->s3->internal)->hs.state = (0x170|0x2000); | - | ||||||||||||||||||||||||
| 324 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 325 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||
| 326 | break; executed 65 times by 3 tests: break;Executed by:
| 65 | ||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||
| 328 | case executed 65 times by 3 tests: (0x170|0x2000):case (0x170|0x2000):Executed by:
executed 65 times by 3 tests: case (0x170|0x2000):Executed by:
| 65 | ||||||||||||||||||||||||
| 329 | case never executed: (0x171|0x2000):case (0x171|0x2000):never executed: case (0x171|0x2000): | 0 | ||||||||||||||||||||||||
| 330 | if ((
| 11-54 | ||||||||||||||||||||||||
| 331 | dtls1_start_timer(s); executed 11 times by 1 test: dtls1_start_timer(s);Executed by:
| 11 | ||||||||||||||||||||||||
| 332 | ret = ssl3_send_server_done(s); | - | ||||||||||||||||||||||||
| 333 | if (ret <= 0
| 0-65 | ||||||||||||||||||||||||
| 334 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 335 | (s->s3->internal)->hs.next_state = (0x180|0x2000); | - | ||||||||||||||||||||||||
| 336 | (s->s3->internal)->hs.state = (0x100|0x2000); | - | ||||||||||||||||||||||||
| 337 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 338 | break; executed 65 times by 3 tests: break;Executed by:
| 65 | ||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||
| 340 | case executed 372 times by 3 tests: (0x100|0x2000):case (0x100|0x2000):Executed by:
executed 372 times by 3 tests: case (0x100|0x2000):Executed by:
| 372 | ||||||||||||||||||||||||
| 341 | s->internal->rwstate = 2; | - | ||||||||||||||||||||||||
| 342 | if ((
| 128-244 | ||||||||||||||||||||||||
| 343 | ((void *)0)
| 128-244 | ||||||||||||||||||||||||
| 344 | ) <= 0
| 128-244 | ||||||||||||||||||||||||
| 345 | if ((
| 0-244 | ||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | if (!BIO_test_flags(s->wbio, 0x08)
| 0 | ||||||||||||||||||||||||
| 348 | s->internal->rwstate = 1; | - | ||||||||||||||||||||||||
| 349 | (s->s3->internal)->hs.state = (s->s3->internal)->hs.next_state; | - | ||||||||||||||||||||||||
| 350 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 351 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 352 | ret = -1; | - | ||||||||||||||||||||||||
| 353 | goto executed 244 times by 2 tests: end;goto end;Executed by:
executed 244 times by 2 tests: goto end;Executed by:
| 244 | ||||||||||||||||||||||||
| 354 | } | - | ||||||||||||||||||||||||
| 355 | s->internal->rwstate = 1; | - | ||||||||||||||||||||||||
| 356 | (s->s3->internal)->hs.state = (s->s3->internal)->hs.next_state; | - | ||||||||||||||||||||||||
| 357 | break; executed 128 times by 3 tests: break;Executed by:
| 128 | ||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 | case executed 165 times by 3 tests: (0x180|0x2000):case (0x180|0x2000):Executed by:
executed 165 times by 3 tests: case (0x180|0x2000):Executed by:
| 165 | ||||||||||||||||||||||||
| 360 | case never executed: (0x181|0x2000):case (0x181|0x2000):never executed: case (0x181|0x2000): | 0 | ||||||||||||||||||||||||
| 361 | if ((
| 58-107 | ||||||||||||||||||||||||
| 362 | ret = ssl3_get_client_certificate(s); | - | ||||||||||||||||||||||||
| 363 | if (ret <= 0
| 7-100 | ||||||||||||||||||||||||
| 364 | goto executed 100 times by 1 test: end;goto end;Executed by:
executed 100 times by 1 test: goto end;Executed by:
| 100 | ||||||||||||||||||||||||
| 365 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||
| 366 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 367 | (s->s3->internal)->hs.state = (0x190|0x2000); | - | ||||||||||||||||||||||||
| 368 | break; executed 65 times by 3 tests: break;Executed by:
| 65 | ||||||||||||||||||||||||
| 369 | - | |||||||||||||||||||||||||
| 370 | case executed 334 times by 3 tests: (0x190|0x2000):case (0x190|0x2000):Executed by:
executed 334 times by 3 tests: case (0x190|0x2000):Executed by:
| 334 | ||||||||||||||||||||||||
| 371 | case never executed: (0x191|0x2000):case (0x191|0x2000):never executed: case (0x191|0x2000): | 0 | ||||||||||||||||||||||||
| 372 | ret = ssl3_get_client_key_exchange(s); | - | ||||||||||||||||||||||||
| 373 | if (ret <= 0
| 63-271 | ||||||||||||||||||||||||
| 374 | goto executed 271 times by 3 tests: end;goto end;Executed by:
executed 271 times by 3 tests: goto end;Executed by:
| 271 | ||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||
| 376 | if ((
| 11-52 | ||||||||||||||||||||||||
| 377 | (s->s3->internal)->hs.state = (0x1A0|0x2000); | - | ||||||||||||||||||||||||
| 378 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 379 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||
| 381 | alg_k = (s->s3->internal)->hs.new_cipher->algorithm_mkey; | - | ||||||||||||||||||||||||
| 382 | if (ret == 2
| 0-63 | ||||||||||||||||||||||||
| 383 | (s->s3->internal)->hs.state = (0x1C0|0x2000); | - | ||||||||||||||||||||||||
| 384 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 385 | } never executed: else if ((end of block
| 0-34 | ||||||||||||||||||||||||
| 386 | (s->s3->internal)->hs.state = (0x1A0|0x2000); | - | ||||||||||||||||||||||||
| 387 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 388 | if (!s->session->peer
| 5-29 | ||||||||||||||||||||||||
| 389 | break; executed 29 times by 2 tests: break;Executed by:
| 29 | ||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||
| 394 | if (!(s->s3->internal)->handshake_buffer
| 0-5 | ||||||||||||||||||||||||
| 395 | SSL_error_internal(s, (4|64), __FILE__, 578); | - | ||||||||||||||||||||||||
| 396 | ret = -1; | - | ||||||||||||||||||||||||
| 397 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 398 | } | - | ||||||||||||||||||||||||
| 399 | s->s3->flags |= 0x0020; | - | ||||||||||||||||||||||||
| 400 | if (!tls1_digest_cached_records(s)
| 0-5 | ||||||||||||||||||||||||
| 401 | ret = -1; | - | ||||||||||||||||||||||||
| 402 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 403 | } | - | ||||||||||||||||||||||||
| 404 | } executed 5 times by 1 test: else {end of blockExecuted by:
| 5 | ||||||||||||||||||||||||
| 405 | (s->s3->internal)->hs.state = (0x1A0|0x2000); | - | ||||||||||||||||||||||||
| 406 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | - | |||||||||||||||||||||||||
| 411 | - | |||||||||||||||||||||||||
| 412 | if ((
| 0-29 | ||||||||||||||||||||||||
| 413 | if (!tls1_digest_cached_records(s)
| 0 | ||||||||||||||||||||||||
| 414 | ret = -1; | - | ||||||||||||||||||||||||
| 415 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 416 | } | - | ||||||||||||||||||||||||
| 417 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 418 | if (!tls1_handshake_hash_value(s,
| 0-29 | ||||||||||||||||||||||||
| 419 | (s->s3->internal)->tmp.cert_verify_md,
| 0-29 | ||||||||||||||||||||||||
| 420 | sizeof((s->s3->internal)->tmp.cert_verify_md),
| 0-29 | ||||||||||||||||||||||||
| 421 |
| 0-29 | ||||||||||||||||||||||||
| 422 | ((void *)0)
| 0-29 | ||||||||||||||||||||||||
| 423 | )
| 0-29 | ||||||||||||||||||||||||
| 424 | ret = -1; | - | ||||||||||||||||||||||||
| 425 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 426 | } | - | ||||||||||||||||||||||||
| 427 | } executed 29 times by 1 test: end of blockExecuted by:
| 29 | ||||||||||||||||||||||||
| 428 | break; executed 34 times by 1 test: break;Executed by:
| 34 | ||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||
| 430 | case executed 387 times by 2 tests: (0x1A0|0x2000):case (0x1A0|0x2000):Executed by:
executed 387 times by 2 tests: case (0x1A0|0x2000):Executed by:
| 387 | ||||||||||||||||||||||||
| 431 | case never executed: (0x1A1|0x2000):case (0x1A1|0x2000):never executed: case (0x1A1|0x2000): | 0 | ||||||||||||||||||||||||
| 432 | if ((
| 11-376 | ||||||||||||||||||||||||
| 433 | ( executed 11 times by 1 test: s->d1->internal)->change_cipher_spec_ok = 1;(s->d1->internal)->change_cipher_spec_ok = 1;Executed by:
executed 11 times by 1 test: (s->d1->internal)->change_cipher_spec_ok = 1;Executed by:
| 11 | ||||||||||||||||||||||||
| 434 | else | - | ||||||||||||||||||||||||
| 435 | s->s3->flags |= 0x0080; executed 376 times by 2 tests: s->s3->flags |= 0x0080;Executed by:
| 376 | ||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||
| 438 | ret = ssl3_get_cert_verify(s); | - | ||||||||||||||||||||||||
| 439 | if (ret <= 0
| 63-324 | ||||||||||||||||||||||||
| 440 | goto executed 324 times by 1 test: end;goto end;Executed by:
executed 324 times by 1 test: goto end;Executed by:
| 324 | ||||||||||||||||||||||||
| 441 | (s->s3->internal)->hs.state = (0x1C0|0x2000); | - | ||||||||||||||||||||||||
| 442 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 443 | break; executed 63 times by 2 tests: break;Executed by:
| 63 | ||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | case executed 105 times by 2 tests: (0x1C0|0x2000):case (0x1C0|0x2000):Executed by:
executed 105 times by 2 tests: case (0x1C0|0x2000):Executed by:
| 105 | ||||||||||||||||||||||||
| 446 | case never executed: (0x1C1|0x2000):case (0x1C1|0x2000):never executed: case (0x1C1|0x2000): | 0 | ||||||||||||||||||||||||
| 447 | if ((
| 11-94 | ||||||||||||||||||||||||
| 448 | ( executed 11 times by 1 test: s->d1->internal)->change_cipher_spec_ok = 1;(s->d1->internal)->change_cipher_spec_ok = 1;Executed by:
executed 11 times by 1 test: (s->d1->internal)->change_cipher_spec_ok = 1;Executed by:
| 11 | ||||||||||||||||||||||||
| 449 | else | - | ||||||||||||||||||||||||
| 450 | s->s3->flags |= 0x0080; executed 94 times by 2 tests: s->s3->flags |= 0x0080;Executed by:
| 94 | ||||||||||||||||||||||||
| 451 | ret = ssl3_get_finished(s, (0x1C0|0x2000), | - | ||||||||||||||||||||||||
| 452 | (0x1C1|0x2000)); | - | ||||||||||||||||||||||||
| 453 | if (ret <= 0
| 42-63 | ||||||||||||||||||||||||
| 454 | goto executed 42 times by 1 test: end;goto end;Executed by:
executed 42 times by 1 test: goto end;Executed by:
| 42 | ||||||||||||||||||||||||
| 455 | if ((
| 11-52 | ||||||||||||||||||||||||
| 456 | dtls1_stop_timer(s); executed 11 times by 1 test: dtls1_stop_timer(s);Executed by:
| 11 | ||||||||||||||||||||||||
| 457 | if (s->internal->hit
| 0-63 | ||||||||||||||||||||||||
| 458 | ( never executed: s->s3->internal)->hs.state = 0x03;(s->s3->internal)->hs.state = 0x03;never executed: (s->s3->internal)->hs.state = 0x03; | 0 | ||||||||||||||||||||||||
| 459 | else if (s->internal->tlsext_ticket_expected
| 4-59 | ||||||||||||||||||||||||
| 460 | ( executed 59 times by 1 test: s->s3->internal)->hs.state = (0x1F0|0x2000);(s->s3->internal)->hs.state = (0x1F0|0x2000);Executed by:
executed 59 times by 1 test: (s->s3->internal)->hs.state = (0x1F0|0x2000);Executed by:
| 59 | ||||||||||||||||||||||||
| 461 | else | - | ||||||||||||||||||||||||
| 462 | ( executed 4 times by 1 test: s->s3->internal)->hs.state = (0x1D0|0x2000);(s->s3->internal)->hs.state = (0x1D0|0x2000);Executed by:
executed 4 times by 1 test: (s->s3->internal)->hs.state = (0x1D0|0x2000);Executed by:
| 4 | ||||||||||||||||||||||||
| 463 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 464 | break; executed 63 times by 2 tests: break;Executed by:
| 63 | ||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 | case executed 59 times by 1 test: (0x1F0|0x2000):case (0x1F0|0x2000):Executed by:
executed 59 times by 1 test: case (0x1F0|0x2000):Executed by:
| 59 | ||||||||||||||||||||||||
| 467 | case never executed: (0x1F1|0x2000):case (0x1F1|0x2000):never executed: case (0x1F1|0x2000): | 0 | ||||||||||||||||||||||||
| 468 | ret = ssl3_send_newsession_ticket(s); | - | ||||||||||||||||||||||||
| 469 | if (ret <= 0
| 0-59 | ||||||||||||||||||||||||
| 470 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 471 | (s->s3->internal)->hs.state = (0x1D0|0x2000); | - | ||||||||||||||||||||||||
| 472 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 473 | break; executed 59 times by 1 test: break;Executed by:
| 59 | ||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | case never executed: (0x200|0x2000):case (0x200|0x2000):never executed: case (0x200|0x2000): | 0 | ||||||||||||||||||||||||
| 476 | case never executed: (0x201|0x2000):case (0x201|0x2000):never executed: case (0x201|0x2000): | 0 | ||||||||||||||||||||||||
| 477 | ret = ssl3_send_cert_status(s); | - | ||||||||||||||||||||||||
| 478 | if (ret <= 0
| 0 | ||||||||||||||||||||||||
| 479 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 480 | (s->s3->internal)->hs.state = (0x150|0x2000); | - | ||||||||||||||||||||||||
| 481 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 482 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | case executed 63 times by 2 tests: (0x1D0|0x2000):case (0x1D0|0x2000):Executed by:
executed 63 times by 2 tests: case (0x1D0|0x2000):Executed by:
| 63 | ||||||||||||||||||||||||
| 485 | case never executed: (0x1D1|0x2000):case (0x1D1|0x2000):never executed: case (0x1D1|0x2000): | 0 | ||||||||||||||||||||||||
| 486 | s->session->cipher = (s->s3->internal)->hs.new_cipher; | - | ||||||||||||||||||||||||
| 487 | if (!tls1_setup_key_block(s)
| 0-63 | ||||||||||||||||||||||||
| 488 | ret = -1; | - | ||||||||||||||||||||||||
| 489 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 490 | } | - | ||||||||||||||||||||||||
| 491 | - | |||||||||||||||||||||||||
| 492 | ret = ssl3_send_change_cipher_spec(s, | - | ||||||||||||||||||||||||
| 493 | (0x1D0|0x2000), (0x1D1|0x2000)); | - | ||||||||||||||||||||||||
| 494 | if (ret <= 0
| 0-63 | ||||||||||||||||||||||||
| 495 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 496 | (s->s3->internal)->hs.state = (0x1E0|0x2000); | - | ||||||||||||||||||||||||
| 497 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | if (!tls1_change_cipher_state(s,
| 0-63 | ||||||||||||||||||||||||
| 500 | (0x20|0x02))
| 0-63 | ||||||||||||||||||||||||
| 501 | ret = -1; | - | ||||||||||||||||||||||||
| 502 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 503 | } | - | ||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||
| 505 | if ((
| 11-52 | ||||||||||||||||||||||||
| 506 | dtls1_reset_seq_numbers(s, 0x02); executed 11 times by 1 test: dtls1_reset_seq_numbers(s, 0x02);Executed by:
| 11 | ||||||||||||||||||||||||
| 507 | break; executed 63 times by 2 tests: break;Executed by:
| 63 | ||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||
| 509 | case executed 63 times by 2 tests: (0x1E0|0x2000):case (0x1E0|0x2000):Executed by:
executed 63 times by 2 tests: case (0x1E0|0x2000):Executed by:
| 63 | ||||||||||||||||||||||||
| 510 | case never executed: (0x1E1|0x2000):case (0x1E1|0x2000):never executed: case (0x1E1|0x2000): | 0 | ||||||||||||||||||||||||
| 511 | ret = ssl3_send_finished(s, | - | ||||||||||||||||||||||||
| 512 | (0x1E0|0x2000), (0x1E1|0x2000), | - | ||||||||||||||||||||||||
| 513 | "server finished", | - | ||||||||||||||||||||||||
| 514 | 15); | - | ||||||||||||||||||||||||
| 515 | if (ret <= 0
| 0-63 | ||||||||||||||||||||||||
| 516 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 517 | (s->s3->internal)->hs.state = (0x100|0x2000); | - | ||||||||||||||||||||||||
| 518 | if (s->internal->hit
| 0-63 | ||||||||||||||||||||||||
| 519 | ( never executed: s->s3->internal)->hs.next_state = (0x1C0|0x2000);(s->s3->internal)->hs.next_state = (0x1C0|0x2000);never executed: (s->s3->internal)->hs.next_state = (0x1C0|0x2000); | 0 | ||||||||||||||||||||||||
| 520 | else | - | ||||||||||||||||||||||||
| 521 | ( executed 63 times by 2 tests: s->s3->internal)->hs.next_state = 0x03;(s->s3->internal)->hs.next_state = 0x03;Executed by:
executed 63 times by 2 tests: (s->s3->internal)->hs.next_state = 0x03;Executed by:
| 63 | ||||||||||||||||||||||||
| 522 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 523 | break; executed 63 times by 2 tests: break;Executed by:
| 63 | ||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||
| 525 | case executed 63 times by 2 tests: 0x03:case 0x03:Executed by:
executed 63 times by 2 tests: case 0x03:Executed by:
| 63 | ||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | tls1_cleanup_key_block(s); | - | ||||||||||||||||||||||||
| 528 | - | |||||||||||||||||||||||||
| 529 | if (!(s->method->internal->version == 0xFEFF)
| 11-52 | ||||||||||||||||||||||||
| 530 | BUF_MEM_free(s->internal->init_buf); | - | ||||||||||||||||||||||||
| 531 | s->internal->init_buf = | - | ||||||||||||||||||||||||
| 532 | ((void *)0) | - | ||||||||||||||||||||||||
| 533 | ; | - | ||||||||||||||||||||||||
| 534 | } executed 52 times by 2 tests: end of blockExecuted by:
| 52 | ||||||||||||||||||||||||
| 535 | - | |||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||
| 537 | ssl_free_wbio_buffer(s); | - | ||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||
| 539 | s->internal->init_num = 0; | - | ||||||||||||||||||||||||
| 540 | - | |||||||||||||||||||||||||
| 541 | - | |||||||||||||||||||||||||
| 542 | if (s->internal->renegotiate == 2
| 0-63 | ||||||||||||||||||||||||
| 543 | s->internal->renegotiate = 0; | - | ||||||||||||||||||||||||
| 544 | s->internal->new_session = 0; | - | ||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||
| 546 | ssl_update_cache(s, 0x0002); | - | ||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||
| 548 | s->ctx->internal->stats.sess_accept_good++; | - | ||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||
| 550 | s->internal->handshake_func = ssl3_accept; | - | ||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||
| 552 | if (cb !=
| 0-63 | ||||||||||||||||||||||||
| 553 | ((void *)0)
| 0-63 | ||||||||||||||||||||||||
| 554 | ) | - | ||||||||||||||||||||||||
| 555 | cb(s, 0x20, 1); never executed: cb(s, 0x20, 1); | 0 | ||||||||||||||||||||||||
| 556 | } executed 63 times by 2 tests: end of blockExecuted by:
| 63 | ||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | ret = 1; | - | ||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||
| 560 | if ((
| 11-52 | ||||||||||||||||||||||||
| 561 | - | |||||||||||||||||||||||||
| 562 | (s->d1->internal)->handshake_read_seq = 0; | - | ||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||
| 564 | (s->d1->internal)->handshake_write_seq = 0; | - | ||||||||||||||||||||||||
| 565 | (s->d1->internal)->next_handshake_write_seq = 0; | - | ||||||||||||||||||||||||
| 566 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 567 | goto executed 63 times by 2 tests: end;goto end;Executed by:
executed 63 times by 2 tests: goto end;Executed by:
| 63 | ||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||
| 570 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 571 | SSL_error_internal(s, 255, __FILE__, 748); | - | ||||||||||||||||||||||||
| 572 | ret = -1; | - | ||||||||||||||||||||||||
| 573 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| 575 | } | - | ||||||||||||||||||||||||
| 576 | - | |||||||||||||||||||||||||
| 577 | if (!(s->s3->internal)->tmp.reuse_message
| 56-966 | ||||||||||||||||||||||||
| 578 | if (s->internal->debug
| 0-884 | ||||||||||||||||||||||||
| 579 | if ((
| 0 | ||||||||||||||||||||||||
| 580 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 581 | )) <= 0
| 0 | ||||||||||||||||||||||||
| 582 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 583 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 584 | - | |||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||
| 586 | if ((
| 0-884 | ||||||||||||||||||||||||
| 587 | ((void *)0)
| 0-884 | ||||||||||||||||||||||||
| 588 | )
| 0-884 | ||||||||||||||||||||||||
| 589 | new_state = (s->s3->internal)->hs.state; | - | ||||||||||||||||||||||||
| 590 | (s->s3->internal)->hs.state = state; | - | ||||||||||||||||||||||||
| 591 | cb(s, (0x2000|0x01), 1); | - | ||||||||||||||||||||||||
| 592 | (s->s3->internal)->hs.state = new_state; | - | ||||||||||||||||||||||||
| 593 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 594 | } executed 884 times by 3 tests: end of blockExecuted by:
| 884 | ||||||||||||||||||||||||
| 595 | skip = 0; | - | ||||||||||||||||||||||||
| 596 | } executed 1022 times by 3 tests: end of blockExecuted by:
| 1022 | ||||||||||||||||||||||||
| 597 | end: code before this statement never executed: end: | 0 | ||||||||||||||||||||||||
| 598 | - | |||||||||||||||||||||||||
| 599 | s->internal->in_handshake--; | - | ||||||||||||||||||||||||
| 600 | if (cb !=
| 0-1236 | ||||||||||||||||||||||||
| 601 | ((void *)0)
| 0-1236 | ||||||||||||||||||||||||
| 602 | ) | - | ||||||||||||||||||||||||
| 603 | cb(s, (0x2000|0x02), ret); never executed: cb(s, (0x2000|0x02), ret); | 0 | ||||||||||||||||||||||||
| 604 | - | |||||||||||||||||||||||||
| 605 | return executed 1236 times by 3 tests: (ret);return (ret);Executed by:
executed 1236 times by 3 tests: return (ret);Executed by:
| 1236 | ||||||||||||||||||||||||
| 606 | } | - | ||||||||||||||||||||||||
| 607 | - | |||||||||||||||||||||||||
| 608 | int | - | ||||||||||||||||||||||||
| 609 | ssl3_send_hello_request(SSL *s) | - | ||||||||||||||||||||||||
| 610 | { | - | ||||||||||||||||||||||||
| 611 | CBB cbb, hello; | - | ||||||||||||||||||||||||
| 612 | - | |||||||||||||||||||||||||
| 613 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||
| 615 | if ((
| 0 | ||||||||||||||||||||||||
| 616 | if (!ssl3_handshake_msg_start(s, &cbb, &hello,
| 0 | ||||||||||||||||||||||||
| 617 | 0)
| 0 | ||||||||||||||||||||||||
| 618 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 619 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0 | ||||||||||||||||||||||||
| 620 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | (s->s3->internal)->hs.state = (0x121|0x2000); | - | ||||||||||||||||||||||||
| 623 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 624 | - | |||||||||||||||||||||||||
| 625 | - | |||||||||||||||||||||||||
| 626 | return never executed: (ssl3_handshake_write(s));return (ssl3_handshake_write(s));never executed: return (ssl3_handshake_write(s)); | 0 | ||||||||||||||||||||||||
| 627 | - | |||||||||||||||||||||||||
| 628 | err: | - | ||||||||||||||||||||||||
| 629 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
| 630 | - | |||||||||||||||||||||||||
| 631 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 632 | } | - | ||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||
| 634 | int | - | ||||||||||||||||||||||||
| 635 | ssl3_get_client_hello(SSL *s) | - | ||||||||||||||||||||||||
| 636 | { | - | ||||||||||||||||||||||||
| 637 | CBS cbs, client_random, session_id, cookie, cipher_suites; | - | ||||||||||||||||||||||||
| 638 | CBS compression_methods; | - | ||||||||||||||||||||||||
| 639 | uint16_t client_version; | - | ||||||||||||||||||||||||
| 640 | uint8_t comp_method; | - | ||||||||||||||||||||||||
| 641 | int comp_null; | - | ||||||||||||||||||||||||
| 642 | int i, j, ok, al, ret = -1, cookie_valid = 0; | - | ||||||||||||||||||||||||
| 643 | long n; | - | ||||||||||||||||||||||||
| 644 | unsigned long id; | - | ||||||||||||||||||||||||
| 645 | SSL_CIPHER *c; | - | ||||||||||||||||||||||||
| 646 | struct stack_st_SSL_CIPHER *ciphers = | - | ||||||||||||||||||||||||
| 647 | ((void *)0) | - | ||||||||||||||||||||||||
| 648 | ; | - | ||||||||||||||||||||||||
| 649 | unsigned long alg_k; | - | ||||||||||||||||||||||||
| 650 | const SSL_METHOD *method; | - | ||||||||||||||||||||||||
| 651 | uint16_t shared_version; | - | ||||||||||||||||||||||||
| 652 | if ((
| 65-192 | ||||||||||||||||||||||||
| 653 | (s->s3->internal)->hs.state = (0x111|0x2000); | - | ||||||||||||||||||||||||
| 654 | } executed 65 times by 3 tests: end of blockExecuted by:
| 65 | ||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||
| 656 | s->internal->first_packet = 1; | - | ||||||||||||||||||||||||
| 657 | n = s->method->internal->ssl_get_message(s, (0x111|0x2000), | - | ||||||||||||||||||||||||
| 658 | (0x112|0x2000), 1, | - | ||||||||||||||||||||||||
| 659 | 16384, &ok); | - | ||||||||||||||||||||||||
| 660 | if (!ok
| 65-192 | ||||||||||||||||||||||||
| 661 | return executed 192 times by 1 test: ((int)n);return ((int)n);Executed by:
executed 192 times by 1 test: return ((int)n);Executed by:
| 192 | ||||||||||||||||||||||||
| 662 | s->internal->first_packet = 0; | - | ||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||
| 664 | if (n < 0
| 0-65 | ||||||||||||||||||||||||
| 665 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 666 | - | |||||||||||||||||||||||||
| 667 | CBS_init(&cbs, s->internal->init_msg, n); | - | ||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||
| 670 | if (!CBS_get_u16(&cbs, &client_version)
| 0-65 | ||||||||||||||||||||||||
| 671 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 672 | if (!CBS_get_bytes(&cbs, &client_random, 32)
| 0-65 | ||||||||||||||||||||||||
| 673 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 674 | if (!CBS_get_u8_length_prefixed(&cbs, &session_id)
| 0-65 | ||||||||||||||||||||||||
| 675 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 676 | if ((
| 11-54 | ||||||||||||||||||||||||
| 677 | if (!CBS_get_u8_length_prefixed(&cbs, &cookie)
| 0-11 | ||||||||||||||||||||||||
| 678 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 679 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 680 | if (!CBS_get_u16_length_prefixed(&cbs, &cipher_suites)
| 0-65 | ||||||||||||||||||||||||
| 681 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 682 | if (!CBS_get_u8_length_prefixed(&cbs, &compression_methods)
| 0-65 | ||||||||||||||||||||||||
| 683 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||
| 685 | - | |||||||||||||||||||||||||
| 686 | - | |||||||||||||||||||||||||
| 687 | - | |||||||||||||||||||||||||
| 688 | - | |||||||||||||||||||||||||
| 689 | if (ssl_max_shared_version(s, client_version, &shared_version) != 1
| 0-65 | ||||||||||||||||||||||||
| 690 | SSL_error_internal(s, 267, __FILE__, 867); | - | ||||||||||||||||||||||||
| 691 | if ((
| 0 | ||||||||||||||||||||||||
| 692 | !s->internal->enc_write_ctx
| 0 | ||||||||||||||||||||||||
| 693 | - | |||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||
| 695 | - | |||||||||||||||||||||||||
| 696 | - | |||||||||||||||||||||||||
| 697 | s->version = s->client_version; | - | ||||||||||||||||||||||||
| 698 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 699 | al = 70; | - | ||||||||||||||||||||||||
| 700 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 701 | } | - | ||||||||||||||||||||||||
| 702 | s->client_version = client_version; | - | ||||||||||||||||||||||||
| 703 | s->version = shared_version; | - | ||||||||||||||||||||||||
| 704 | - | |||||||||||||||||||||||||
| 705 | if ((
| 11-54 | ||||||||||||||||||||||||
| 706 | ((void *)0)
| 11-54 | ||||||||||||||||||||||||
| 707 | ) | - | ||||||||||||||||||||||||
| 708 | method = dtls1_get_server_method(shared_version); executed 11 times by 1 test: method = dtls1_get_server_method(shared_version);Executed by:
| 11 | ||||||||||||||||||||||||
| 709 | if (method ==
| 0-65 | ||||||||||||||||||||||||
| 710 | ((void *)0)
| 0-65 | ||||||||||||||||||||||||
| 711 | ) { | - | ||||||||||||||||||||||||
| 712 | SSL_error_internal(s, (4|64), __FILE__, 885); | - | ||||||||||||||||||||||||
| 713 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 714 | } | - | ||||||||||||||||||||||||
| 715 | s->method = method; | - | ||||||||||||||||||||||||
| 716 | - | |||||||||||||||||||||||||
| 717 | - | |||||||||||||||||||||||||
| 718 | - | |||||||||||||||||||||||||
| 719 | - | |||||||||||||||||||||||||
| 720 | - | |||||||||||||||||||||||||
| 721 | - | |||||||||||||||||||||||||
| 722 | if ((
| 11-54 | ||||||||||||||||||||||||
| 723 | if (SSL_ctrl((s),32,0,
| 0-11 | ||||||||||||||||||||||||
| 724 | ((void *)0)
| 0-11 | ||||||||||||||||||||||||
| 725 | ) & 0x00002000L
| 0-11 | ||||||||||||||||||||||||
| 726 | if (CBS_len(&cookie) == 0
| 0 | ||||||||||||||||||||||||
| 727 | return never executed: (1);return (1);never executed: return (1); | 0 | ||||||||||||||||||||||||
| 728 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 729 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||
| 731 | if (!CBS_write_bytes(&client_random, s->s3->client_random,
| 0-65 | ||||||||||||||||||||||||
| 732 | sizeof(s->s3->client_random),
| 0-65 | ||||||||||||||||||||||||
| 733 | ((void *)0)
| 0-65 | ||||||||||||||||||||||||
| 734 | )
| 0-65 | ||||||||||||||||||||||||
| 735 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 736 | - | |||||||||||||||||||||||||
| 737 | s->internal->hit = 0; | - | ||||||||||||||||||||||||
| 738 | if ((s->internal->new_session
| 0-65 | ||||||||||||||||||||||||
| 739 | 0x00010000L)
| 0 | ||||||||||||||||||||||||
| 740 | if (!ssl_get_new_session(s, 1)
| 0 | ||||||||||||||||||||||||
| 741 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 742 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 743 | CBS ext_block; | - | ||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||
| 745 | CBS_dup(&cbs, &ext_block); | - | ||||||||||||||||||||||||
| 746 | - | |||||||||||||||||||||||||
| 747 | i = ssl_get_prev_session(s, CBS_data(&session_id), | - | ||||||||||||||||||||||||
| 748 | CBS_len(&session_id), &ext_block); | - | ||||||||||||||||||||||||
| 749 | if (i == 1
| 0-65 | ||||||||||||||||||||||||
| 750 | s->internal->hit = 1; | - | ||||||||||||||||||||||||
| 751 | } never executed: else if (i == -1end of block
| 0-65 | ||||||||||||||||||||||||
| 752 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 753 | else { | - | ||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||
| 755 | if (!ssl_get_new_session(s, 1)
| 0-65 | ||||||||||||||||||||||||
| 756 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 757 | } executed 65 times by 3 tests: end of blockExecuted by:
| 65 | ||||||||||||||||||||||||
| 758 | } | - | ||||||||||||||||||||||||
| 759 | - | |||||||||||||||||||||||||
| 760 | if ((
| 11-54 | ||||||||||||||||||||||||
| 761 | - | |||||||||||||||||||||||||
| 762 | - | |||||||||||||||||||||||||
| 763 | - | |||||||||||||||||||||||||
| 764 | - | |||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||
| 766 | if (CBS_len(&cookie) > sizeof((s->d1->internal)->rcvd_cookie)
| 0-11 | ||||||||||||||||||||||||
| 767 | al = 50; | - | ||||||||||||||||||||||||
| 768 | SSL_error_internal(s, 308, __FILE__, 953); | - | ||||||||||||||||||||||||
| 769 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 770 | } | - | ||||||||||||||||||||||||
| 771 | - | |||||||||||||||||||||||||
| 772 | - | |||||||||||||||||||||||||
| 773 | if ((
| 0-11 | ||||||||||||||||||||||||
| 774 | ((void *)0)
| 0-11 | ||||||||||||||||||||||||
| 775 | ) & 0x00002000L)
| 0-11 | ||||||||||||||||||||||||
| 776 | CBS_len(&cookie) > 0
| 0 | ||||||||||||||||||||||||
| 777 | size_t cookie_len; | - | ||||||||||||||||||||||||
| 778 | - | |||||||||||||||||||||||||
| 779 | - | |||||||||||||||||||||||||
| 780 | if (!CBS_write_bytes(&cookie, (s->d1->internal)->rcvd_cookie,
| 0 | ||||||||||||||||||||||||
| 781 | sizeof((s->d1->internal)->rcvd_cookie), &cookie_len)
| 0 | ||||||||||||||||||||||||
| 782 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||
| 784 | if (s->ctx->internal->app_verify_cookie_cb !=
| 0 | ||||||||||||||||||||||||
| 785 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 786 | ) { | - | ||||||||||||||||||||||||
| 787 | if (s->ctx->internal->app_verify_cookie_cb(s,
| 0 | ||||||||||||||||||||||||
| 788 | (s->d1->internal)->rcvd_cookie, cookie_len) == 0
| 0 | ||||||||||||||||||||||||
| 789 | al = 40; | - | ||||||||||||||||||||||||
| 790 | SSL_error_internal(s, 308, __FILE__, 971); | - | ||||||||||||||||||||||||
| 791 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 792 | } | - | ||||||||||||||||||||||||
| 793 | - | |||||||||||||||||||||||||
| 794 | - | |||||||||||||||||||||||||
| 795 | } never executed: else if (timingsafe_memcmp((s->d1->internal)->rcvd_cookie,end of block
| 0 | ||||||||||||||||||||||||
| 796 | (s->d1->internal)->cookie, (s->d1->internal)->cookie_len) != 0
| 0 | ||||||||||||||||||||||||
| 797 | - | |||||||||||||||||||||||||
| 798 | al = 40; | - | ||||||||||||||||||||||||
| 799 | SSL_error_internal(s, 308, __FILE__, 980); | - | ||||||||||||||||||||||||
| 800 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 801 | } | - | ||||||||||||||||||||||||
| 802 | cookie_valid = 1; | - | ||||||||||||||||||||||||
| 803 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 804 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||||||||
| 805 | - | |||||||||||||||||||||||||
| 806 | - | |||||||||||||||||||||||||
| 807 | if (CBS_len(&cipher_suites) == 0
| 0-65 | ||||||||||||||||||||||||
| 808 | - | |||||||||||||||||||||||||
| 809 | al = 47; | - | ||||||||||||||||||||||||
| 810 | SSL_error_internal(s, 183, __FILE__, 991); | - | ||||||||||||||||||||||||
| 811 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 812 | } | - | ||||||||||||||||||||||||
| 813 | - | |||||||||||||||||||||||||
| 814 | if (CBS_len(&cipher_suites) > 0
| 0-65 | ||||||||||||||||||||||||
| 815 | if ((
| 0-65 | ||||||||||||||||||||||||
| 816 | &cipher_suites)) ==
| 0-65 | ||||||||||||||||||||||||
| 817 | ((void *)0)
| 0-65 | ||||||||||||||||||||||||
| 818 | ) | - | ||||||||||||||||||||||||
| 819 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 820 | } executed 65 times by 3 tests: end of blockExecuted by:
| 65 | ||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||
| 822 | - | |||||||||||||||||||||||||
| 823 | - | |||||||||||||||||||||||||
| 824 | if (s->internal->hit
| 0-65 | ||||||||||||||||||||||||
| 825 | j = 0; | - | ||||||||||||||||||||||||
| 826 | id = s->session->cipher->id; | - | ||||||||||||||||||||||||
| 827 | - | |||||||||||||||||||||||||
| 828 | for (i = 0; i < sk_num(((_STACK*) (1 ? (ciphers) : (struct stack_st_SSL_CIPHER*)0)))
| 0 | ||||||||||||||||||||||||
| 829 | c = ((SSL_CIPHER *)sk_value(((_STACK*) (1 ? (ciphers) : (struct stack_st_SSL_CIPHER*)0)), (i))); | - | ||||||||||||||||||||||||
| 830 | if (c->id == id
| 0 | ||||||||||||||||||||||||
| 831 | j = 1; | - | ||||||||||||||||||||||||
| 832 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 833 | } | - | ||||||||||||||||||||||||
| 834 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 835 | if (j == 0
| 0 | ||||||||||||||||||||||||
| 836 | - | |||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||
| 838 | - | |||||||||||||||||||||||||
| 839 | - | |||||||||||||||||||||||||
| 840 | al = 47; | - | ||||||||||||||||||||||||
| 841 | SSL_error_internal(s, 215, __FILE__, 1020); | - | ||||||||||||||||||||||||
| 842 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 843 | } | - | ||||||||||||||||||||||||
| 844 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 845 | - | |||||||||||||||||||||||||
| 846 | comp_null = 0; | - | ||||||||||||||||||||||||
| 847 | while (CBS_len(&compression_methods) > 0
| 65 | ||||||||||||||||||||||||
| 848 | if (!CBS_get_u8(&compression_methods, &comp_method)
| 0-65 | ||||||||||||||||||||||||
| 849 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 850 | if (comp_method == 0
| 0-65 | ||||||||||||||||||||||||
| 851 | comp_null = 1; executed 65 times by 3 tests: comp_null = 1;Executed by:
| 65 | ||||||||||||||||||||||||
| 852 | } executed 65 times by 3 tests: end of blockExecuted by:
| 65 | ||||||||||||||||||||||||
| 853 | if (comp_null == 0
| 0-65 | ||||||||||||||||||||||||
| 854 | al = 50; | - | ||||||||||||||||||||||||
| 855 | SSL_error_internal(s, 187, __FILE__, 1034); | - | ||||||||||||||||||||||||
| 856 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 857 | } | - | ||||||||||||||||||||||||
| 858 | - | |||||||||||||||||||||||||
| 859 | if (!tlsext_clienthello_parse(s, &cbs, &al)
| 0-65 | ||||||||||||||||||||||||
| 860 | SSL_error_internal(s, 227, __FILE__, 1039); | - | ||||||||||||||||||||||||
| 861 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 862 | } | - | ||||||||||||||||||||||||
| 863 | - | |||||||||||||||||||||||||
| 864 | if (!(s->s3->internal)->renegotiate_seen
| 0-65 | ||||||||||||||||||||||||
| 865 | al = 40; | - | ||||||||||||||||||||||||
| 866 | SSL_error_internal(s, 338, __FILE__, 1045); | - | ||||||||||||||||||||||||
| 867 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 868 | } | - | ||||||||||||||||||||||||
| 869 | - | |||||||||||||||||||||||||
| 870 | if (ssl_check_clienthello_tlsext_early(s) <= 0
| 0-65 | ||||||||||||||||||||||||
| 871 | SSL_error_internal(s, 226, __FILE__, 1050); | - | ||||||||||||||||||||||||
| 872 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 873 | } | - | ||||||||||||||||||||||||
| 874 | - | |||||||||||||||||||||||||
| 875 | - | |||||||||||||||||||||||||
| 876 | - | |||||||||||||||||||||||||
| 877 | - | |||||||||||||||||||||||||
| 878 | - | |||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||
| 880 | - | |||||||||||||||||||||||||
| 881 | arc4random_buf(s->s3->server_random, 32); | - | ||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||
| 883 | if (!s->internal->hit
| 0-65 | ||||||||||||||||||||||||
| 884 | SSL_CIPHER *pref_cipher = | - | ||||||||||||||||||||||||
| 885 | ((void *)0) | - | ||||||||||||||||||||||||
| 886 | ; | - | ||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||
| 888 | s->session->master_key_length = sizeof(s->session->master_key); | - | ||||||||||||||||||||||||
| 889 | if (s->internal->tls_session_secret_cb(s, s->session->master_key,
| 0 | ||||||||||||||||||||||||
| 890 | &s->session->master_key_length, ciphers, &pref_cipher,
| 0 | ||||||||||||||||||||||||
| 891 | s->internal->tls_session_secret_cb_arg)
| 0 | ||||||||||||||||||||||||
| 892 | s->internal->hit = 1; | - | ||||||||||||||||||||||||
| 893 | s->session->ciphers = ciphers; | - | ||||||||||||||||||||||||
| 894 | s->session->verify_result = 0; | - | ||||||||||||||||||||||||
| 895 | - | |||||||||||||||||||||||||
| 896 | ciphers = | - | ||||||||||||||||||||||||
| 897 | ((void *)0) | - | ||||||||||||||||||||||||
| 898 | ; | - | ||||||||||||||||||||||||
| 899 | - | |||||||||||||||||||||||||
| 900 | - | |||||||||||||||||||||||||
| 901 | pref_cipher = pref_cipher
| 0 | ||||||||||||||||||||||||
| 902 | ssl3_choose_cipher(s, s->session->ciphers, | - | ||||||||||||||||||||||||
| 903 | SSL_get_ciphers(s)); | - | ||||||||||||||||||||||||
| 904 | if (pref_cipher ==
| 0 | ||||||||||||||||||||||||
| 905 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 906 | ) { | - | ||||||||||||||||||||||||
| 907 | al = 40; | - | ||||||||||||||||||||||||
| 908 | SSL_error_internal(s, 193, __FILE__, 1081); | - | ||||||||||||||||||||||||
| 909 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 910 | } | - | ||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||
| 912 | s->session->cipher = pref_cipher; | - | ||||||||||||||||||||||||
| 913 | - | |||||||||||||||||||||||||
| 914 | sk_free(((_STACK*) (1 ? (s->cipher_list) : (struct stack_st_SSL_CIPHER*)0))); | - | ||||||||||||||||||||||||
| 915 | sk_free(((_STACK*) (1 ? (s->internal->cipher_list_by_id) : (struct stack_st_SSL_CIPHER*)0))); | - | ||||||||||||||||||||||||
| 916 | - | |||||||||||||||||||||||||
| 917 | s->cipher_list = (struct stack_st_SSL_CIPHER *)sk_dup(((_STACK*) (1 ? s->session->ciphers : (struct stack_st_SSL_CIPHER*)0))); | - | ||||||||||||||||||||||||
| 918 | s->internal->cipher_list_by_id = | - | ||||||||||||||||||||||||
| 919 | (struct stack_st_SSL_CIPHER *)sk_dup(((_STACK*) (1 ? s->session->ciphers : (struct stack_st_SSL_CIPHER*)0))); | - | ||||||||||||||||||||||||
| 920 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 921 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 922 | - | |||||||||||||||||||||||||
| 923 | - | |||||||||||||||||||||||||
| 924 | - | |||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||
| 926 | - | |||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||
| 928 | if (!s->internal->hit
| 0-65 | ||||||||||||||||||||||||
| 929 | sk_free(((_STACK*) (1 ? (s->session->ciphers) : (struct stack_st_SSL_CIPHER*)0))); | - | ||||||||||||||||||||||||
| 930 | s->session->ciphers = ciphers; | - | ||||||||||||||||||||||||
| 931 | if (ciphers ==
| 0-65 | ||||||||||||||||||||||||
| 932 | ((void *)0)
| 0-65 | ||||||||||||||||||||||||
| 933 | ) { | - | ||||||||||||||||||||||||
| 934 | al = 47; | - | ||||||||||||||||||||||||
| 935 | SSL_error_internal(s, 182, __FILE__, 1106); | - | ||||||||||||||||||||||||
| 936 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 937 | } | - | ||||||||||||||||||||||||
| 938 | ciphers = | - | ||||||||||||||||||||||||
| 939 | ((void *)0) | - | ||||||||||||||||||||||||
| 940 | ; | - | ||||||||||||||||||||||||
| 941 | c = ssl3_choose_cipher(s, s->session->ciphers, | - | ||||||||||||||||||||||||
| 942 | SSL_get_ciphers(s)); | - | ||||||||||||||||||||||||
| 943 | - | |||||||||||||||||||||||||
| 944 | if (c ==
| 0-65 | ||||||||||||||||||||||||
| 945 | ((void *)0)
| 0-65 | ||||||||||||||||||||||||
| 946 | ) { | - | ||||||||||||||||||||||||
| 947 | al = 40; | - | ||||||||||||||||||||||||
| 948 | SSL_error_internal(s, 193, __FILE__, 1115); | - | ||||||||||||||||||||||||
| 949 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 950 | } | - | ||||||||||||||||||||||||
| 951 | (s->s3->internal)->hs.new_cipher = c; | - | ||||||||||||||||||||||||
| 952 | } executed 65 times by 3 tests: else {end of blockExecuted by:
| 65 | ||||||||||||||||||||||||
| 953 | (s->s3->internal)->hs.new_cipher = s->session->cipher; | - | ||||||||||||||||||||||||
| 954 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 955 | - | |||||||||||||||||||||||||
| 956 | if (!tls1_handshake_hash_init(s)
| 0-65 | ||||||||||||||||||||||||
| 957 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 958 | - | |||||||||||||||||||||||||
| 959 | alg_k = (s->s3->internal)->hs.new_cipher->algorithm_mkey; | - | ||||||||||||||||||||||||
| 960 | if (!((
| 0-35 | ||||||||||||||||||||||||
| 961 | !(s->verify_mode & 0x01)
| 5-30 | ||||||||||||||||||||||||
| 962 | if (!tls1_digest_cached_records(s)
| 0-60 | ||||||||||||||||||||||||
| 963 | al = 80; | - | ||||||||||||||||||||||||
| 964 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 965 | } | - | ||||||||||||||||||||||||
| 966 | } executed 60 times by 3 tests: end of blockExecuted by:
| 60 | ||||||||||||||||||||||||
| 967 | if (ssl_check_clienthello_tlsext_late(s) <= 0
| 0-65 | ||||||||||||||||||||||||
| 968 | SSL_error_internal(s, 226, __FILE__, 1149); | - | ||||||||||||||||||||||||
| 969 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 970 | } | - | ||||||||||||||||||||||||
| 971 | - | |||||||||||||||||||||||||
| 972 | ret = cookie_valid
| 0-65 | ||||||||||||||||||||||||
| 973 | - | |||||||||||||||||||||||||
| 974 | if (0) { | - | ||||||||||||||||||||||||
| 975 | truncated: | - | ||||||||||||||||||||||||
| 976 | al = 50; | - | ||||||||||||||||||||||||
| 977 | SSL_error_internal(s, 115, __FILE__, 1158); | - | ||||||||||||||||||||||||
| 978 | f_err: code before this statement never executed: f_err: | 0 | ||||||||||||||||||||||||
| 979 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
| 980 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 981 | err: code before this statement executed 65 times by 3 tests: err:Executed by:
| 65 | ||||||||||||||||||||||||
| 982 | sk_free(((_STACK*) (1 ? (ciphers) : (struct stack_st_SSL_CIPHER*)0))); | - | ||||||||||||||||||||||||
| 983 | - | |||||||||||||||||||||||||
| 984 | return executed 65 times by 3 tests: (ret);return (ret);Executed by:
executed 65 times by 3 tests: return (ret);Executed by:
| 65 | ||||||||||||||||||||||||
| 985 | } | - | ||||||||||||||||||||||||
| 986 | - | |||||||||||||||||||||||||
| 987 | int | - | ||||||||||||||||||||||||
| 988 | ssl3_send_server_hello(SSL *s) | - | ||||||||||||||||||||||||
| 989 | { | - | ||||||||||||||||||||||||
| 990 | CBB cbb, server_hello, session_id; | - | ||||||||||||||||||||||||
| 991 | size_t sl; | - | ||||||||||||||||||||||||
| 992 | - | |||||||||||||||||||||||||
| 993 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
| 994 | - | |||||||||||||||||||||||||
| 995 | if ((
| 0-65 | ||||||||||||||||||||||||
| 996 | if (!ssl3_handshake_msg_start(s, &cbb, &server_hello,
| 0-65 | ||||||||||||||||||||||||
| 997 | 2)
| 0-65 | ||||||||||||||||||||||||
| 998 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||
| 1000 | if (!CBB_add_u16(&server_hello, s->version)
| 0-65 | ||||||||||||||||||||||||
| 1001 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1002 | if (!CBB_add_bytes(&server_hello, s->s3->server_random,
| 0-65 | ||||||||||||||||||||||||
| 1003 | sizeof(s->s3->server_random))
| 0-65 | ||||||||||||||||||||||||
| 1004 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1005 | if (!(s->ctx->internal->session_cache_mode & 0x0002)
| 4-61 | ||||||||||||||||||||||||
| 1006 | && !s->internal->hit
| 0-4 | ||||||||||||||||||||||||
| 1007 | s->session->session_id_length = 0; executed 4 times by 1 test: s->session->session_id_length = 0;Executed by:
| 4 | ||||||||||||||||||||||||
| 1008 | - | |||||||||||||||||||||||||
| 1009 | sl = s->session->session_id_length; | - | ||||||||||||||||||||||||
| 1010 | if (sl > sizeof(s->session->session_id)
| 0-65 | ||||||||||||||||||||||||
| 1011 | SSL_error_internal(s, (4|64), __FILE__, 1211); | - | ||||||||||||||||||||||||
| 1012 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1013 | } | - | ||||||||||||||||||||||||
| 1014 | if (!CBB_add_u8_length_prefixed(&server_hello, &session_id)
| 0-65 | ||||||||||||||||||||||||
| 1015 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1016 | if (!CBB_add_bytes(&session_id, s->session->session_id, sl)
| 0-65 | ||||||||||||||||||||||||
| 1017 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1018 | - | |||||||||||||||||||||||||
| 1019 | - | |||||||||||||||||||||||||
| 1020 | if (!CBB_add_u16(&server_hello,
| 0-65 | ||||||||||||||||||||||||
| 1021 | ssl3_cipher_get_value((s->s3->internal)->hs.new_cipher))
| 0-65 | ||||||||||||||||||||||||
| 1022 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1023 | - | |||||||||||||||||||||||||
| 1024 | - | |||||||||||||||||||||||||
| 1025 | if (!CBB_add_u8(&server_hello, 0)
| 0-65 | ||||||||||||||||||||||||
| 1026 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1027 | - | |||||||||||||||||||||||||
| 1028 | - | |||||||||||||||||||||||||
| 1029 | if (!tlsext_serverhello_build(s, &server_hello)
| 0-65 | ||||||||||||||||||||||||
| 1030 | SSL_error_internal(s, (4|64), __FILE__, 1230); | - | ||||||||||||||||||||||||
| 1031 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1032 | } | - | ||||||||||||||||||||||||
| 1033 | - | |||||||||||||||||||||||||
| 1034 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0-65 | ||||||||||||||||||||||||
| 1035 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1036 | } executed 65 times by 3 tests: end of blockExecuted by:
| 65 | ||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||
| 1038 | - | |||||||||||||||||||||||||
| 1039 | return executed 65 times by 3 tests: (ssl3_handshake_write(s));return (ssl3_handshake_write(s));Executed by:
executed 65 times by 3 tests: return (ssl3_handshake_write(s));Executed by:
| 65 | ||||||||||||||||||||||||
| 1040 | - | |||||||||||||||||||||||||
| 1041 | err: | - | ||||||||||||||||||||||||
| 1042 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
| 1043 | - | |||||||||||||||||||||||||
| 1044 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 1045 | } | - | ||||||||||||||||||||||||
| 1046 | - | |||||||||||||||||||||||||
| 1047 | int | - | ||||||||||||||||||||||||
| 1048 | ssl3_send_server_done(SSL *s) | - | ||||||||||||||||||||||||
| 1049 | { | - | ||||||||||||||||||||||||
| 1050 | CBB cbb, done; | - | ||||||||||||||||||||||||
| 1051 | - | |||||||||||||||||||||||||
| 1052 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
| 1053 | - | |||||||||||||||||||||||||
| 1054 | if ((
| 0-65 | ||||||||||||||||||||||||
| 1055 | if (!ssl3_handshake_msg_start(s, &cbb, &done,
| 0-65 | ||||||||||||||||||||||||
| 1056 | 14)
| 0-65 | ||||||||||||||||||||||||
| 1057 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1058 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0-65 | ||||||||||||||||||||||||
| 1059 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1060 | - | |||||||||||||||||||||||||
| 1061 | (s->s3->internal)->hs.state = (0x171|0x2000); | - | ||||||||||||||||||||||||
| 1062 | } executed 65 times by 3 tests: end of blockExecuted by:
| 65 | ||||||||||||||||||||||||
| 1063 | - | |||||||||||||||||||||||||
| 1064 | - | |||||||||||||||||||||||||
| 1065 | return executed 65 times by 3 tests: (ssl3_handshake_write(s));return (ssl3_handshake_write(s));Executed by:
executed 65 times by 3 tests: return (ssl3_handshake_write(s));Executed by:
| 65 | ||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||
| 1067 | err: | - | ||||||||||||||||||||||||
| 1068 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
| 1069 | - | |||||||||||||||||||||||||
| 1070 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 1071 | } | - | ||||||||||||||||||||||||
| 1072 | - | |||||||||||||||||||||||||
| 1073 | static int | - | ||||||||||||||||||||||||
| 1074 | ssl3_send_server_kex_dhe(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
| 1075 | { | - | ||||||||||||||||||||||||
| 1076 | CBB dh_p, dh_g, dh_Ys; | - | ||||||||||||||||||||||||
| 1077 | DH *dh = | - | ||||||||||||||||||||||||
| 1078 | ((void *)0) | - | ||||||||||||||||||||||||
| 1079 | , *dhp; | - | ||||||||||||||||||||||||
| 1080 | unsigned char *data; | - | ||||||||||||||||||||||||
| 1081 | int al; | - | ||||||||||||||||||||||||
| 1082 | - | |||||||||||||||||||||||||
| 1083 | if (s->cert->dh_tmp_auto != 0
| 2-21 | ||||||||||||||||||||||||
| 1084 | if ((
| 0-2 | ||||||||||||||||||||||||
| 1085 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
| 1086 | ) { | - | ||||||||||||||||||||||||
| 1087 | al = 80; | - | ||||||||||||||||||||||||
| 1088 | SSL_error_internal(s, (4|64), __FILE__, 1284); | - | ||||||||||||||||||||||||
| 1089 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1090 | } | - | ||||||||||||||||||||||||
| 1091 | } executed 2 times by 1 test: elseend of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1092 | dhp = s->cert->dh_tmp; executed 21 times by 1 test: dhp = s->cert->dh_tmp;Executed by:
| 21 | ||||||||||||||||||||||||
| 1093 | - | |||||||||||||||||||||||||
| 1094 | if (dhp ==
| 0-23 | ||||||||||||||||||||||||
| 1095 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1096 | && s->cert->dh_tmp_cb !=
| 0 | ||||||||||||||||||||||||
| 1097 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 1098 | ) | - | ||||||||||||||||||||||||
| 1099 | dhp = s->cert->dh_tmp_cb(s, 0, never executed: dhp = s->cert->dh_tmp_cb(s, 0, 1024); | 0 | ||||||||||||||||||||||||
| 1100 | 1024); never executed: dhp = s->cert->dh_tmp_cb(s, 0, 1024); | 0 | ||||||||||||||||||||||||
| 1101 | - | |||||||||||||||||||||||||
| 1102 | if (dhp ==
| 0-23 | ||||||||||||||||||||||||
| 1103 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1104 | ) { | - | ||||||||||||||||||||||||
| 1105 | al = 40; | - | ||||||||||||||||||||||||
| 1106 | SSL_error_internal(s, 171, __FILE__, 1296); | - | ||||||||||||||||||||||||
| 1107 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1108 | } | - | ||||||||||||||||||||||||
| 1109 | - | |||||||||||||||||||||||||
| 1110 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1111 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1112 | ) { | - | ||||||||||||||||||||||||
| 1113 | SSL_error_internal(s, (4|64), __FILE__, 1301); | - | ||||||||||||||||||||||||
| 1114 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1115 | } | - | ||||||||||||||||||||||||
| 1116 | - | |||||||||||||||||||||||||
| 1117 | if (s->cert->dh_tmp_auto != 0
| 2-21 | ||||||||||||||||||||||||
| 1118 | dh = dhp; | - | ||||||||||||||||||||||||
| 1119 | } executed 2 times by 1 test: else if ((end of blockExecuted by:
| 0-21 | ||||||||||||||||||||||||
| 1120 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
| 1121 | ) { | - | ||||||||||||||||||||||||
| 1122 | SSL_error_internal(s, 5, __FILE__, 1308); | - | ||||||||||||||||||||||||
| 1123 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1124 | } | - | ||||||||||||||||||||||||
| 1125 | (s->s3->internal)->tmp.dh = dh; | - | ||||||||||||||||||||||||
| 1126 | if (!DH_generate_key(dh)
| 0-23 | ||||||||||||||||||||||||
| 1127 | SSL_error_internal(s, 5, __FILE__, 1313); | - | ||||||||||||||||||||||||
| 1128 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1129 | } | - | ||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||
| 1131 | - | |||||||||||||||||||||||||
| 1132 | - | |||||||||||||||||||||||||
| 1133 | - | |||||||||||||||||||||||||
| 1134 | if (!CBB_add_u16_length_prefixed(cbb, &dh_p)
| 0-23 | ||||||||||||||||||||||||
| 1135 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1136 | if (!CBB_add_space(&dh_p, &data, ((BN_num_bits(dh->p)+7)/8))
| 0-23 | ||||||||||||||||||||||||
| 1137 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1138 | BN_bn2bin(dh->p, data); | - | ||||||||||||||||||||||||
| 1139 | - | |||||||||||||||||||||||||
| 1140 | if (!CBB_add_u16_length_prefixed(cbb, &dh_g)
| 0-23 | ||||||||||||||||||||||||
| 1141 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1142 | if (!CBB_add_space(&dh_g, &data, ((BN_num_bits(dh->g)+7)/8))
| 0-23 | ||||||||||||||||||||||||
| 1143 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1144 | BN_bn2bin(dh->g, data); | - | ||||||||||||||||||||||||
| 1145 | - | |||||||||||||||||||||||||
| 1146 | if (!CBB_add_u16_length_prefixed(cbb, &dh_Ys)
| 0-23 | ||||||||||||||||||||||||
| 1147 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1148 | if (!CBB_add_space(&dh_Ys, &data, ((BN_num_bits(dh->pub_key)+7)/8))
| 0-23 | ||||||||||||||||||||||||
| 1149 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1150 | BN_bn2bin(dh->pub_key, data); | - | ||||||||||||||||||||||||
| 1151 | - | |||||||||||||||||||||||||
| 1152 | if (!CBB_flush(cbb)
| 0-23 | ||||||||||||||||||||||||
| 1153 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||
| 1155 | return executed 23 times by 2 tests: (1);return (1);Executed by:
executed 23 times by 2 tests: return (1);Executed by:
| 23 | ||||||||||||||||||||||||
| 1156 | - | |||||||||||||||||||||||||
| 1157 | f_err: | - | ||||||||||||||||||||||||
| 1158 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
| 1159 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
| 1160 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 1161 | } | - | ||||||||||||||||||||||||
| 1162 | - | |||||||||||||||||||||||||
| 1163 | static int | - | ||||||||||||||||||||||||
| 1164 | ssl3_send_server_kex_ecdhe_ecp(SSL *s, int nid, CBB *cbb) | - | ||||||||||||||||||||||||
| 1165 | { | - | ||||||||||||||||||||||||
| 1166 | const EC_GROUP *group; | - | ||||||||||||||||||||||||
| 1167 | const EC_POINT *pubkey; | - | ||||||||||||||||||||||||
| 1168 | unsigned char *data; | - | ||||||||||||||||||||||||
| 1169 | int encoded_len = 0; | - | ||||||||||||||||||||||||
| 1170 | int curve_id = 0; | - | ||||||||||||||||||||||||
| 1171 | BN_CTX *bn_ctx = | - | ||||||||||||||||||||||||
| 1172 | ((void *)0) | - | ||||||||||||||||||||||||
| 1173 | ; | - | ||||||||||||||||||||||||
| 1174 | EC_KEY *ecdh; | - | ||||||||||||||||||||||||
| 1175 | CBB ecpoint; | - | ||||||||||||||||||||||||
| 1176 | int al; | - | ||||||||||||||||||||||||
| 1177 | - | |||||||||||||||||||||||||
| 1178 | - | |||||||||||||||||||||||||
| 1179 | - | |||||||||||||||||||||||||
| 1180 | - | |||||||||||||||||||||||||
| 1181 | - | |||||||||||||||||||||||||
| 1182 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1183 | SSL_error_internal(s, 315, __FILE__, 1367); | - | ||||||||||||||||||||||||
| 1184 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1185 | } | - | ||||||||||||||||||||||||
| 1186 | - | |||||||||||||||||||||||||
| 1187 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1188 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1189 | ) { | - | ||||||||||||||||||||||||
| 1190 | SSL_error_internal(s, (4|64), __FILE__, 1372); | - | ||||||||||||||||||||||||
| 1191 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1192 | } | - | ||||||||||||||||||||||||
| 1193 | - | |||||||||||||||||||||||||
| 1194 | if (((
| 0-23 | ||||||||||||||||||||||||
| 1195 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1196 | ) { | - | ||||||||||||||||||||||||
| 1197 | al = 40; | - | ||||||||||||||||||||||||
| 1198 | SSL_error_internal(s, 311, __FILE__, 1378); | - | ||||||||||||||||||||||||
| 1199 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1200 | } | - | ||||||||||||||||||||||||
| 1201 | ecdh = (s->s3->internal)->tmp.ecdh; | - | ||||||||||||||||||||||||
| 1202 | - | |||||||||||||||||||||||||
| 1203 | if (!EC_KEY_generate_key(ecdh)
| 0-23 | ||||||||||||||||||||||||
| 1204 | SSL_error_internal(s, 43, __FILE__, 1384); | - | ||||||||||||||||||||||||
| 1205 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1206 | } | - | ||||||||||||||||||||||||
| 1207 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1208 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1209 | || | - | ||||||||||||||||||||||||
| 1210 | (
| 0-23 | ||||||||||||||||||||||||
| 1211 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1212 | || | - | ||||||||||||||||||||||||
| 1213 | EC_KEY_get0_private_key(ecdh) ==
| 0-23 | ||||||||||||||||||||||||
| 1214 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1215 | ) { | - | ||||||||||||||||||||||||
| 1216 | SSL_error_internal(s, 43, __FILE__, 1390); | - | ||||||||||||||||||||||||
| 1217 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1218 | } | - | ||||||||||||||||||||||||
| 1219 | - | |||||||||||||||||||||||||
| 1220 | - | |||||||||||||||||||||||||
| 1221 | - | |||||||||||||||||||||||||
| 1222 | - | |||||||||||||||||||||||||
| 1223 | encoded_len = EC_POINT_point2oct(group, pubkey, | - | ||||||||||||||||||||||||
| 1224 | POINT_CONVERSION_UNCOMPRESSED, | - | ||||||||||||||||||||||||
| 1225 | ((void *)0) | - | ||||||||||||||||||||||||
| 1226 | , 0, | - | ||||||||||||||||||||||||
| 1227 | ((void *)0) | - | ||||||||||||||||||||||||
| 1228 | ); | - | ||||||||||||||||||||||||
| 1229 | if (encoded_len == 0
| 0-23 | ||||||||||||||||||||||||
| 1230 | SSL_error_internal(s, 43, __FILE__, 1400); | - | ||||||||||||||||||||||||
| 1231 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1232 | } | - | ||||||||||||||||||||||||
| 1233 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1234 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1235 | ) { | - | ||||||||||||||||||||||||
| 1236 | SSL_error_internal(s, (1|64), __FILE__, 1404); | - | ||||||||||||||||||||||||
| 1237 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1238 | } | - | ||||||||||||||||||||||||
| 1239 | if (!CBB_add_u8(cbb, 3)
| 0-23 | ||||||||||||||||||||||||
| 1240 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1241 | if (!CBB_add_u16(cbb, curve_id)
| 0-23 | ||||||||||||||||||||||||
| 1242 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1243 | if (!CBB_add_u8_length_prefixed(cbb, &ecpoint)
| 0-23 | ||||||||||||||||||||||||
| 1244 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1245 | if (!CBB_add_space(&ecpoint, &data, encoded_len)
| 0-23 | ||||||||||||||||||||||||
| 1246 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1247 | if (EC_POINT_point2oct(group, pubkey, POINT_CONVERSION_UNCOMPRESSED,
| 0-23 | ||||||||||||||||||||||||
| 1248 | data, encoded_len, bn_ctx) == 0
| 0-23 | ||||||||||||||||||||||||
| 1249 | SSL_error_internal(s, 43, __FILE__, 1425); | - | ||||||||||||||||||||||||
| 1250 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1251 | } | - | ||||||||||||||||||||||||
| 1252 | if (!CBB_flush(cbb)
| 0-23 | ||||||||||||||||||||||||
| 1253 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1254 | - | |||||||||||||||||||||||||
| 1255 | BN_CTX_free(bn_ctx); | - | ||||||||||||||||||||||||
| 1256 | - | |||||||||||||||||||||||||
| 1257 | return executed 23 times by 1 test: (1);return (1);Executed by:
executed 23 times by 1 test: return (1);Executed by:
| 23 | ||||||||||||||||||||||||
| 1258 | - | |||||||||||||||||||||||||
| 1259 | f_err: | - | ||||||||||||||||||||||||
| 1260 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
| 1261 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
| 1262 | BN_CTX_free(bn_ctx); | - | ||||||||||||||||||||||||
| 1263 | - | |||||||||||||||||||||||||
| 1264 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 1265 | } | - | ||||||||||||||||||||||||
| 1266 | - | |||||||||||||||||||||||||
| 1267 | static int | - | ||||||||||||||||||||||||
| 1268 | ssl3_send_server_kex_ecdhe_ecx(SSL *s, int nid, CBB *cbb) | - | ||||||||||||||||||||||||
| 1269 | { | - | ||||||||||||||||||||||||
| 1270 | uint8_t *public_key = | - | ||||||||||||||||||||||||
| 1271 | ((void *)0) | - | ||||||||||||||||||||||||
| 1272 | ; | - | ||||||||||||||||||||||||
| 1273 | int curve_id; | - | ||||||||||||||||||||||||
| 1274 | CBB ecpoint; | - | ||||||||||||||||||||||||
| 1275 | int ret = -1; | - | ||||||||||||||||||||||||
| 1276 | - | |||||||||||||||||||||||||
| 1277 | - | |||||||||||||||||||||||||
| 1278 | if ((
| 0-5 | ||||||||||||||||||||||||
| 1279 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
| 1280 | ) { | - | ||||||||||||||||||||||||
| 1281 | SSL_error_internal(s, (4|64), __FILE__, 1453); | - | ||||||||||||||||||||||||
| 1282 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1283 | } | - | ||||||||||||||||||||||||
| 1284 | if (((
| 0-5 | ||||||||||||||||||||||||
| 1285 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
| 1286 | ) | - | ||||||||||||||||||||||||
| 1287 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1288 | if ((
| 0-5 | ||||||||||||||||||||||||
| 1289 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
| 1290 | ) | - | ||||||||||||||||||||||||
| 1291 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1292 | X25519_keypair(public_key, (s->s3->internal)->tmp.x25519); | - | ||||||||||||||||||||||||
| 1293 | - | |||||||||||||||||||||||||
| 1294 | - | |||||||||||||||||||||||||
| 1295 | if ((
| 0-5 | ||||||||||||||||||||||||
| 1296 | SSL_error_internal(s, 315, __FILE__, 1464); | - | ||||||||||||||||||||||||
| 1297 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1298 | } | - | ||||||||||||||||||||||||
| 1299 | - | |||||||||||||||||||||||||
| 1300 | if (!CBB_add_u8(cbb, 3)
| 0-5 | ||||||||||||||||||||||||
| 1301 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1302 | if (!CBB_add_u16(cbb, curve_id)
| 0-5 | ||||||||||||||||||||||||
| 1303 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1304 | if (!CBB_add_u8_length_prefixed(cbb, &ecpoint)
| 0-5 | ||||||||||||||||||||||||
| 1305 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1306 | if (!CBB_add_bytes(&ecpoint, public_key, 32)
| 0-5 | ||||||||||||||||||||||||
| 1307 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1308 | if (!CBB_flush(cbb)
| 0-5 | ||||||||||||||||||||||||
| 1309 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1310 | - | |||||||||||||||||||||||||
| 1311 | ret = 1; | - | ||||||||||||||||||||||||
| 1312 | - | |||||||||||||||||||||||||
| 1313 | err: code before this statement executed 5 times by 2 tests: err:Executed by:
| 5 | ||||||||||||||||||||||||
| 1314 | free(public_key); | - | ||||||||||||||||||||||||
| 1315 | - | |||||||||||||||||||||||||
| 1316 | return executed 5 times by 2 tests: (ret);return (ret);Executed by:
executed 5 times by 2 tests: return (ret);Executed by:
| 5 | ||||||||||||||||||||||||
| 1317 | } | - | ||||||||||||||||||||||||
| 1318 | - | |||||||||||||||||||||||||
| 1319 | static int | - | ||||||||||||||||||||||||
| 1320 | ssl3_send_server_kex_ecdhe(SSL *s, CBB *cbb) | - | ||||||||||||||||||||||||
| 1321 | { | - | ||||||||||||||||||||||||
| 1322 | int nid; | - | ||||||||||||||||||||||||
| 1323 | - | |||||||||||||||||||||||||
| 1324 | nid = tls1_get_shared_curve(s); | - | ||||||||||||||||||||||||
| 1325 | - | |||||||||||||||||||||||||
| 1326 | if (nid == 950
| 5-23 | ||||||||||||||||||||||||
| 1327 | return executed 5 times by 2 tests: ssl3_send_server_kex_ecdhe_ecx(s, nid, cbb);return ssl3_send_server_kex_ecdhe_ecx(s, nid, cbb);Executed by:
executed 5 times by 2 tests: return ssl3_send_server_kex_ecdhe_ecx(s, nid, cbb);Executed by:
| 5 | ||||||||||||||||||||||||
| 1328 | - | |||||||||||||||||||||||||
| 1329 | return executed 23 times by 1 test: ssl3_send_server_kex_ecdhe_ecp(s, nid, cbb);return ssl3_send_server_kex_ecdhe_ecp(s, nid, cbb);Executed by:
executed 23 times by 1 test: return ssl3_send_server_kex_ecdhe_ecp(s, nid, cbb);Executed by:
| 23 | ||||||||||||||||||||||||
| 1330 | } | - | ||||||||||||||||||||||||
| 1331 | - | |||||||||||||||||||||||||
| 1332 | int | - | ||||||||||||||||||||||||
| 1333 | ssl3_send_server_key_exchange(SSL *s) | - | ||||||||||||||||||||||||
| 1334 | { | - | ||||||||||||||||||||||||
| 1335 | CBB cbb, cbb_params, cbb_signature, server_kex; | - | ||||||||||||||||||||||||
| 1336 | unsigned char *signature = | - | ||||||||||||||||||||||||
| 1337 | ((void *)0) | - | ||||||||||||||||||||||||
| 1338 | ; | - | ||||||||||||||||||||||||
| 1339 | unsigned int signature_len; | - | ||||||||||||||||||||||||
| 1340 | unsigned char *params = | - | ||||||||||||||||||||||||
| 1341 | ((void *)0) | - | ||||||||||||||||||||||||
| 1342 | ; | - | ||||||||||||||||||||||||
| 1343 | size_t params_len; | - | ||||||||||||||||||||||||
| 1344 | const EVP_MD *md = | - | ||||||||||||||||||||||||
| 1345 | ((void *)0) | - | ||||||||||||||||||||||||
| 1346 | ; | - | ||||||||||||||||||||||||
| 1347 | unsigned long type; | - | ||||||||||||||||||||||||
| 1348 | EVP_MD_CTX md_ctx; | - | ||||||||||||||||||||||||
| 1349 | EVP_PKEY *pkey; | - | ||||||||||||||||||||||||
| 1350 | int al; | - | ||||||||||||||||||||||||
| 1351 | - | |||||||||||||||||||||||||
| 1352 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
| 1353 | memset(&cbb_params, 0, sizeof(cbb_params)); | - | ||||||||||||||||||||||||
| 1354 | - | |||||||||||||||||||||||||
| 1355 | EVP_MD_CTX_init(&md_ctx); | - | ||||||||||||||||||||||||
| 1356 | - | |||||||||||||||||||||||||
| 1357 | if ((
| 0-51 | ||||||||||||||||||||||||
| 1358 | - | |||||||||||||||||||||||||
| 1359 | if (!ssl3_handshake_msg_start(s, &cbb, &server_kex,
| 0-51 | ||||||||||||||||||||||||
| 1360 | 12)
| 0-51 | ||||||||||||||||||||||||
| 1361 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1362 | - | |||||||||||||||||||||||||
| 1363 | if (!CBB_init(&cbb_params, 0)
| 0-51 | ||||||||||||||||||||||||
| 1364 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1365 | - | |||||||||||||||||||||||||
| 1366 | type = (s->s3->internal)->hs.new_cipher->algorithm_mkey; | - | ||||||||||||||||||||||||
| 1367 | if (type & 0x00000008L
| 23-28 | ||||||||||||||||||||||||
| 1368 | if (ssl3_send_server_kex_dhe(s, &cbb_params) != 1
| 0-23 | ||||||||||||||||||||||||
| 1369 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1370 | } executed 23 times by 2 tests: else if (type & 0x00000080Lend of blockExecuted by:
| 0-28 | ||||||||||||||||||||||||
| 1371 | if (ssl3_send_server_kex_ecdhe(s, &cbb_params) != 1
| 0-28 | ||||||||||||||||||||||||
| 1372 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1373 | } executed 28 times by 2 tests: else {end of blockExecuted by:
| 28 | ||||||||||||||||||||||||
| 1374 | al = 40; | - | ||||||||||||||||||||||||
| 1375 | SSL_error_internal(s, 250, __FILE__, 1537); | - | ||||||||||||||||||||||||
| 1376 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1377 | } | - | ||||||||||||||||||||||||
| 1378 | - | |||||||||||||||||||||||||
| 1379 | if (!CBB_finish(&cbb_params, ¶ms, ¶ms_len)
| 0-51 | ||||||||||||||||||||||||
| 1380 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1381 | - | |||||||||||||||||||||||||
| 1382 | if (!CBB_add_bytes(&server_kex, params, params_len)
| 0-51 | ||||||||||||||||||||||||
| 1383 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1384 | - | |||||||||||||||||||||||||
| 1385 | - | |||||||||||||||||||||||||
| 1386 | if (!((s->s3->internal)->hs.new_cipher->algorithm_auth & 0x00000004L)
| 10-41 | ||||||||||||||||||||||||
| 1387 | if ((
| 0-41 | ||||||||||||||||||||||||
| 1388 | &md)) ==
| 0-41 | ||||||||||||||||||||||||
| 1389 | ((void *)0)
| 0-41 | ||||||||||||||||||||||||
| 1390 | ) { | - | ||||||||||||||||||||||||
| 1391 | al = 50; | - | ||||||||||||||||||||||||
| 1392 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1393 | } | - | ||||||||||||||||||||||||
| 1394 | - | |||||||||||||||||||||||||
| 1395 | if (pkey->type == 6
| 0-41 | ||||||||||||||||||||||||
| 1396 | md = EVP_md5_sha1(); executed 13 times by 2 tests: md = EVP_md5_sha1();Executed by:
| 13 | ||||||||||||||||||||||||
| 1397 | - | |||||||||||||||||||||||||
| 1398 | if (md ==
| 0-41 | ||||||||||||||||||||||||
| 1399 | ((void *)0)
| 0-41 | ||||||||||||||||||||||||
| 1400 | ) { | - | ||||||||||||||||||||||||
| 1401 | - | |||||||||||||||||||||||||
| 1402 | al = 40; | - | ||||||||||||||||||||||||
| 1403 | SSL_error_internal(s, 251, __FILE__, 1561); | - | ||||||||||||||||||||||||
| 1404 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1405 | } | - | ||||||||||||||||||||||||
| 1406 | - | |||||||||||||||||||||||||
| 1407 | - | |||||||||||||||||||||||||
| 1408 | if ((
| 13-28 | ||||||||||||||||||||||||
| 1409 | if (!tls12_get_hashandsig(&server_kex, pkey, md)
| 0-28 | ||||||||||||||||||||||||
| 1410 | - | |||||||||||||||||||||||||
| 1411 | al = 80; | - | ||||||||||||||||||||||||
| 1412 | SSL_error_internal(s, (4|64), __FILE__, 1570); | - | ||||||||||||||||||||||||
| 1413 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1414 | } | - | ||||||||||||||||||||||||
| 1415 | } executed 28 times by 3 tests: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||
| 1416 | - | |||||||||||||||||||||||||
| 1417 | if ((
| 0-41 | ||||||||||||||||||||||||
| 1418 | ((void *)0)
| 0-41 | ||||||||||||||||||||||||
| 1419 | ) | - | ||||||||||||||||||||||||
| 1420 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1421 | - | |||||||||||||||||||||||||
| 1422 | if (!EVP_DigestInit_ex(&md_ctx,md,
| 0-41 | ||||||||||||||||||||||||
| 1423 | ((void *)0)
| 0-41 | ||||||||||||||||||||||||
| 1424 | )
| 0-41 | ||||||||||||||||||||||||
| 1425 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1426 | if (!EVP_DigestUpdate(&md_ctx,s->s3->client_random,32)
| 0-41 | ||||||||||||||||||||||||
| 1427 | ) | - | ||||||||||||||||||||||||
| 1428 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1429 | if (!EVP_DigestUpdate(&md_ctx,s->s3->server_random,32)
| 0-41 | ||||||||||||||||||||||||
| 1430 | ) | - | ||||||||||||||||||||||||
| 1431 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1432 | if (!EVP_DigestUpdate(&md_ctx,params,params_len)
| 0-41 | ||||||||||||||||||||||||
| 1433 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1434 | if (!EVP_SignFinal(&md_ctx, signature, &signature_len,
| 0-41 | ||||||||||||||||||||||||
| 1435 | pkey)
| 0-41 | ||||||||||||||||||||||||
| 1436 | SSL_error_internal(s, 6, __FILE__, 1590); | - | ||||||||||||||||||||||||
| 1437 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1438 | } | - | ||||||||||||||||||||||||
| 1439 | - | |||||||||||||||||||||||||
| 1440 | if (!CBB_add_u16_length_prefixed(&server_kex,
| 0-41 | ||||||||||||||||||||||||
| 1441 | &cbb_signature)
| 0-41 | ||||||||||||||||||||||||
| 1442 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1443 | if (!CBB_add_bytes(&cbb_signature, signature,
| 0-41 | ||||||||||||||||||||||||
| 1444 | signature_len)
| 0-41 | ||||||||||||||||||||||||
| 1445 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1446 | } executed 41 times by 3 tests: end of blockExecuted by:
| 41 | ||||||||||||||||||||||||
| 1447 | - | |||||||||||||||||||||||||
| 1448 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0-51 | ||||||||||||||||||||||||
| 1449 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1450 | - | |||||||||||||||||||||||||
| 1451 | (s->s3->internal)->hs.state = (0x151|0x2000); | - | ||||||||||||||||||||||||
| 1452 | } executed 51 times by 3 tests: end of blockExecuted by:
| 51 | ||||||||||||||||||||||||
| 1453 | - | |||||||||||||||||||||||||
| 1454 | EVP_MD_CTX_cleanup(&md_ctx); | - | ||||||||||||||||||||||||
| 1455 | free(params); | - | ||||||||||||||||||||||||
| 1456 | free(signature); | - | ||||||||||||||||||||||||
| 1457 | - | |||||||||||||||||||||||||
| 1458 | return executed 51 times by 3 tests: (ssl3_handshake_write(s));return (ssl3_handshake_write(s));Executed by:
executed 51 times by 3 tests: return (ssl3_handshake_write(s));Executed by:
| 51 | ||||||||||||||||||||||||
| 1459 | - | |||||||||||||||||||||||||
| 1460 | f_err: | - | ||||||||||||||||||||||||
| 1461 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
| 1462 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
| 1463 | CBB_cleanup(&cbb_params); | - | ||||||||||||||||||||||||
| 1464 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
| 1465 | EVP_MD_CTX_cleanup(&md_ctx); | - | ||||||||||||||||||||||||
| 1466 | free(params); | - | ||||||||||||||||||||||||
| 1467 | free(signature); | - | ||||||||||||||||||||||||
| 1468 | - | |||||||||||||||||||||||||
| 1469 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 1470 | } | - | ||||||||||||||||||||||||
| 1471 | - | |||||||||||||||||||||||||
| 1472 | int | - | ||||||||||||||||||||||||
| 1473 | ssl3_send_certificate_request(SSL *s) | - | ||||||||||||||||||||||||
| 1474 | { | - | ||||||||||||||||||||||||
| 1475 | CBB cbb, cert_request, cert_types, sigalgs, cert_auth, dn; | - | ||||||||||||||||||||||||
| 1476 | struct stack_st_X509_NAME *sk = | - | ||||||||||||||||||||||||
| 1477 | ((void *)0) | - | ||||||||||||||||||||||||
| 1478 | ; | - | ||||||||||||||||||||||||
| 1479 | X509_NAME *name; | - | ||||||||||||||||||||||||
| 1480 | int i; | - | ||||||||||||||||||||||||
| 1481 | - | |||||||||||||||||||||||||
| 1482 | - | |||||||||||||||||||||||||
| 1483 | - | |||||||||||||||||||||||||
| 1484 | - | |||||||||||||||||||||||||
| 1485 | - | |||||||||||||||||||||||||
| 1486 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
| 1487 | - | |||||||||||||||||||||||||
| 1488 | if ((
| 0-7 | ||||||||||||||||||||||||
| 1489 | if (!ssl3_handshake_msg_start(s, &cbb, &cert_request,
| 0-7 | ||||||||||||||||||||||||
| 1490 | 13)
| 0-7 | ||||||||||||||||||||||||
| 1491 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1492 | - | |||||||||||||||||||||||||
| 1493 | if (!CBB_add_u8_length_prefixed(&cert_request, &cert_types)
| 0-7 | ||||||||||||||||||||||||
| 1494 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1495 | if (!ssl3_get_req_cert_types(s, &cert_types)
| 0-7 | ||||||||||||||||||||||||
| 1496 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1497 | - | |||||||||||||||||||||||||
| 1498 | if ((
| 2-5 | ||||||||||||||||||||||||
| 1499 | unsigned char *sigalgs_data; | - | ||||||||||||||||||||||||
| 1500 | size_t sigalgs_len; | - | ||||||||||||||||||||||||
| 1501 | - | |||||||||||||||||||||||||
| 1502 | tls12_get_req_sig_algs(s, &sigalgs_data, &sigalgs_len); | - | ||||||||||||||||||||||||
| 1503 | - | |||||||||||||||||||||||||
| 1504 | if (!CBB_add_u16_length_prefixed(&cert_request, &sigalgs)
| 0-5 | ||||||||||||||||||||||||
| 1505 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1506 | if (!CBB_add_bytes(&sigalgs, sigalgs_data, sigalgs_len)
| 0-5 | ||||||||||||||||||||||||
| 1507 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1508 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||||||||
| 1509 | - | |||||||||||||||||||||||||
| 1510 | if (!CBB_add_u16_length_prefixed(&cert_request, &cert_auth)
| 0-7 | ||||||||||||||||||||||||
| 1511 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1512 | - | |||||||||||||||||||||||||
| 1513 | sk = SSL_get_client_CA_list(s); | - | ||||||||||||||||||||||||
| 1514 | for (i = 0; i < sk_num(((_STACK*) (1 ? (sk) : (struct stack_st_X509_NAME*)0)))
| 0-7 | ||||||||||||||||||||||||
| 1515 | unsigned char *name_data; | - | ||||||||||||||||||||||||
| 1516 | size_t name_len; | - | ||||||||||||||||||||||||
| 1517 | - | |||||||||||||||||||||||||
| 1518 | name = ((X509_NAME *)sk_value(((_STACK*) (1 ? (sk) : (struct stack_st_X509_NAME*)0)), (i))); | - | ||||||||||||||||||||||||
| 1519 | name_len = i2d_X509_NAME(name, | - | ||||||||||||||||||||||||
| 1520 | ((void *)0) | - | ||||||||||||||||||||||||
| 1521 | ); | - | ||||||||||||||||||||||||
| 1522 | - | |||||||||||||||||||||||||
| 1523 | if (!CBB_add_u16_length_prefixed(&cert_auth, &dn)
| 0 | ||||||||||||||||||||||||
| 1524 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1525 | if (!CBB_add_space(&dn, &name_data, name_len)
| 0 | ||||||||||||||||||||||||
| 1526 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1527 | if (i2d_X509_NAME(name, &name_data) != name_len
| 0 | ||||||||||||||||||||||||
| 1528 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1529 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1530 | - | |||||||||||||||||||||||||
| 1531 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0-7 | ||||||||||||||||||||||||
| 1532 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1533 | - | |||||||||||||||||||||||||
| 1534 | (s->s3->internal)->hs.state = (0x161|0x2000); | - | ||||||||||||||||||||||||
| 1535 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||
| 1536 | - | |||||||||||||||||||||||||
| 1537 | - | |||||||||||||||||||||||||
| 1538 | return executed 7 times by 1 test: (ssl3_handshake_write(s));return (ssl3_handshake_write(s));Executed by:
executed 7 times by 1 test: return (ssl3_handshake_write(s));Executed by:
| 7 | ||||||||||||||||||||||||
| 1539 | - | |||||||||||||||||||||||||
| 1540 | err: | - | ||||||||||||||||||||||||
| 1541 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
| 1542 | - | |||||||||||||||||||||||||
| 1543 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 1544 | } | - | ||||||||||||||||||||||||
| 1545 | - | |||||||||||||||||||||||||
| 1546 | static int | - | ||||||||||||||||||||||||
| 1547 | ssl3_get_client_kex_rsa(SSL *s, CBS *cbs) | - | ||||||||||||||||||||||||
| 1548 | { | - | ||||||||||||||||||||||||
| 1549 | unsigned char fakekey[48]; | - | ||||||||||||||||||||||||
| 1550 | unsigned char *pms = | - | ||||||||||||||||||||||||
| 1551 | ((void *)0) | - | ||||||||||||||||||||||||
| 1552 | ; | - | ||||||||||||||||||||||||
| 1553 | unsigned char *p; | - | ||||||||||||||||||||||||
| 1554 | size_t pms_len = 0; | - | ||||||||||||||||||||||||
| 1555 | EVP_PKEY *pkey = | - | ||||||||||||||||||||||||
| 1556 | ((void *)0) | - | ||||||||||||||||||||||||
| 1557 | ; | - | ||||||||||||||||||||||||
| 1558 | RSA *rsa = | - | ||||||||||||||||||||||||
| 1559 | ((void *)0) | - | ||||||||||||||||||||||||
| 1560 | ; | - | ||||||||||||||||||||||||
| 1561 | CBS enc_pms; | - | ||||||||||||||||||||||||
| 1562 | int decrypt_len; | - | ||||||||||||||||||||||||
| 1563 | int al = -1; | - | ||||||||||||||||||||||||
| 1564 | - | |||||||||||||||||||||||||
| 1565 | arc4random_buf(fakekey, sizeof(fakekey)); | - | ||||||||||||||||||||||||
| 1566 | fakekey[0] = s->client_version >> 8; | - | ||||||||||||||||||||||||
| 1567 | fakekey[1] = s->client_version & 0xff; | - | ||||||||||||||||||||||||
| 1568 | - | |||||||||||||||||||||||||
| 1569 | pkey = s->cert->pkeys[0].privatekey; | - | ||||||||||||||||||||||||
| 1570 | if ((
| 0-14 | ||||||||||||||||||||||||
| 1571 | ((void *)0)
| 0-14 | ||||||||||||||||||||||||
| 1572 | )
| 0-14 | ||||||||||||||||||||||||
| 1573 | (
| 0-14 | ||||||||||||||||||||||||
| 1574 | ((void *)0)
| 0-14 | ||||||||||||||||||||||||
| 1575 | )
| 0-14 | ||||||||||||||||||||||||
| 1576 | al = 40; | - | ||||||||||||||||||||||||
| 1577 | SSL_error_internal(s, 168, __FILE__, 1717); | - | ||||||||||||||||||||||||
| 1578 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1579 | } | - | ||||||||||||||||||||||||
| 1580 | rsa = pkey->pkey.rsa; | - | ||||||||||||||||||||||||
| 1581 | - | |||||||||||||||||||||||||
| 1582 | pms_len = RSA_size(rsa); | - | ||||||||||||||||||||||||
| 1583 | if (pms_len < 48
| 0-14 | ||||||||||||||||||||||||
| 1584 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1585 | if ((
| 0-14 | ||||||||||||||||||||||||
| 1586 | ((void *)0)
| 0-14 | ||||||||||||||||||||||||
| 1587 | ) | - | ||||||||||||||||||||||||
| 1588 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1589 | p = pms; | - | ||||||||||||||||||||||||
| 1590 | - | |||||||||||||||||||||||||
| 1591 | if (!CBS_get_u16_length_prefixed(cbs, &enc_pms)
| 0-14 | ||||||||||||||||||||||||
| 1592 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 1593 | if (CBS_len(cbs) != 0
| 0-14 | ||||||||||||||||||||||||
| 1594 | SSL_error_internal(s, 234, __FILE__, 1732); | - | ||||||||||||||||||||||||
| 1595 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1596 | } | - | ||||||||||||||||||||||||
| 1597 | - | |||||||||||||||||||||||||
| 1598 | decrypt_len = RSA_private_decrypt(CBS_len(&enc_pms), CBS_data(&enc_pms), | - | ||||||||||||||||||||||||
| 1599 | pms, rsa, 1); | - | ||||||||||||||||||||||||
| 1600 | - | |||||||||||||||||||||||||
| 1601 | ERR_clear_error(); | - | ||||||||||||||||||||||||
| 1602 | - | |||||||||||||||||||||||||
| 1603 | if (decrypt_len != 48
| 0-14 | ||||||||||||||||||||||||
| 1604 | al = 50; | - | ||||||||||||||||||||||||
| 1605 | - | |||||||||||||||||||||||||
| 1606 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1607 | - | |||||||||||||||||||||||||
| 1608 | if ((
| 0-14 | ||||||||||||||||||||||||
| 1609 | (
| 0-14 | ||||||||||||||||||||||||
| 1610 | al = 50; | - | ||||||||||||||||||||||||
| 1611 | - | |||||||||||||||||||||||||
| 1612 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1613 | - | |||||||||||||||||||||||||
| 1614 | if (al != -1
| 0-14 | ||||||||||||||||||||||||
| 1615 | - | |||||||||||||||||||||||||
| 1616 | - | |||||||||||||||||||||||||
| 1617 | - | |||||||||||||||||||||||||
| 1618 | - | |||||||||||||||||||||||||
| 1619 | - | |||||||||||||||||||||||||
| 1620 | - | |||||||||||||||||||||||||
| 1621 | p = fakekey; | - | ||||||||||||||||||||||||
| 1622 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1623 | - | |||||||||||||||||||||||||
| 1624 | s->session->master_key_length = | - | ||||||||||||||||||||||||
| 1625 | tls1_generate_master_secret(s, | - | ||||||||||||||||||||||||
| 1626 | s->session->master_key, p, 48); | - | ||||||||||||||||||||||||
| 1627 | - | |||||||||||||||||||||||||
| 1628 | freezero(pms, pms_len); | - | ||||||||||||||||||||||||
| 1629 | - | |||||||||||||||||||||||||
| 1630 | return executed 14 times by 1 test: (1);return (1);Executed by:
executed 14 times by 1 test: return (1);Executed by:
| 14 | ||||||||||||||||||||||||
| 1631 | - | |||||||||||||||||||||||||
| 1632 | truncated: | - | ||||||||||||||||||||||||
| 1633 | al = 50; | - | ||||||||||||||||||||||||
| 1634 | SSL_error_internal(s, 115, __FILE__, 1786); | - | ||||||||||||||||||||||||
| 1635 | f_err: code before this statement never executed: f_err: | 0 | ||||||||||||||||||||||||
| 1636 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
| 1637 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
| 1638 | freezero(pms, pms_len); | - | ||||||||||||||||||||||||
| 1639 | - | |||||||||||||||||||||||||
| 1640 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 1641 | } | - | ||||||||||||||||||||||||
| 1642 | - | |||||||||||||||||||||||||
| 1643 | static int | - | ||||||||||||||||||||||||
| 1644 | ssl3_get_client_kex_dhe(SSL *s, CBS *cbs) | - | ||||||||||||||||||||||||
| 1645 | { | - | ||||||||||||||||||||||||
| 1646 | int key_size = 0, key_len, al; | - | ||||||||||||||||||||||||
| 1647 | unsigned char *key = | - | ||||||||||||||||||||||||
| 1648 | ((void *)0) | - | ||||||||||||||||||||||||
| 1649 | ; | - | ||||||||||||||||||||||||
| 1650 | BIGNUM *bn = | - | ||||||||||||||||||||||||
| 1651 | ((void *)0) | - | ||||||||||||||||||||||||
| 1652 | ; | - | ||||||||||||||||||||||||
| 1653 | CBS dh_Yc; | - | ||||||||||||||||||||||||
| 1654 | DH *dh; | - | ||||||||||||||||||||||||
| 1655 | - | |||||||||||||||||||||||||
| 1656 | if (!CBS_get_u16_length_prefixed(cbs, &dh_Yc)
| 0-21 | ||||||||||||||||||||||||
| 1657 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 1658 | if (CBS_len(cbs) != 0
| 0-21 | ||||||||||||||||||||||||
| 1659 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 1660 | - | |||||||||||||||||||||||||
| 1661 | if ((
| 0-21 | ||||||||||||||||||||||||
| 1662 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
| 1663 | ) { | - | ||||||||||||||||||||||||
| 1664 | al = 40; | - | ||||||||||||||||||||||||
| 1665 | SSL_error_internal(s, 171, __FILE__, 1811); | - | ||||||||||||||||||||||||
| 1666 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1667 | } | - | ||||||||||||||||||||||||
| 1668 | dh = (s->s3->internal)->tmp.dh; | - | ||||||||||||||||||||||||
| 1669 | - | |||||||||||||||||||||||||
| 1670 | if ((
| 0-21 | ||||||||||||||||||||||||
| 1671 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
| 1672 | )) ==
| 0-21 | ||||||||||||||||||||||||
| 1673 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
| 1674 | ) { | - | ||||||||||||||||||||||||
| 1675 | SSL_error_internal(s, 130, __FILE__, 1817); | - | ||||||||||||||||||||||||
| 1676 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1677 | } | - | ||||||||||||||||||||||||
| 1678 | - | |||||||||||||||||||||||||
| 1679 | if ((
| 0-21 | ||||||||||||||||||||||||
| 1680 | SSL_error_internal(s, 5, __FILE__, 1822); | - | ||||||||||||||||||||||||
| 1681 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1682 | } | - | ||||||||||||||||||||||||
| 1683 | if ((
| 0-21 | ||||||||||||||||||||||||
| 1684 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
| 1685 | ) { | - | ||||||||||||||||||||||||
| 1686 | SSL_error_internal(s, (1|64), __FILE__, 1826); | - | ||||||||||||||||||||||||
| 1687 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1688 | } | - | ||||||||||||||||||||||||
| 1689 | if ((
| 0-21 | ||||||||||||||||||||||||
| 1690 | SSL_error_internal(s, 5, __FILE__, 1830); | - | ||||||||||||||||||||||||
| 1691 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1692 | } | - | ||||||||||||||||||||||||
| 1693 | - | |||||||||||||||||||||||||
| 1694 | s->session->master_key_length = tls1_generate_master_secret(s, | - | ||||||||||||||||||||||||
| 1695 | s->session->master_key, key, key_len); | - | ||||||||||||||||||||||||
| 1696 | - | |||||||||||||||||||||||||
| 1697 | DH_free((s->s3->internal)->tmp.dh); | - | ||||||||||||||||||||||||
| 1698 | (s->s3->internal)->tmp.dh = | - | ||||||||||||||||||||||||
| 1699 | ((void *)0) | - | ||||||||||||||||||||||||
| 1700 | ; | - | ||||||||||||||||||||||||
| 1701 | - | |||||||||||||||||||||||||
| 1702 | freezero(key, key_size); | - | ||||||||||||||||||||||||
| 1703 | BN_clear_free(bn); | - | ||||||||||||||||||||||||
| 1704 | - | |||||||||||||||||||||||||
| 1705 | return executed 21 times by 1 test: (1);return (1);Executed by:
executed 21 times by 1 test: return (1);Executed by:
| 21 | ||||||||||||||||||||||||
| 1706 | - | |||||||||||||||||||||||||
| 1707 | truncated: | - | ||||||||||||||||||||||||
| 1708 | al = 50; | - | ||||||||||||||||||||||||
| 1709 | SSL_error_internal(s, 115, __FILE__, 1847); | - | ||||||||||||||||||||||||
| 1710 | f_err: code before this statement never executed: f_err: | 0 | ||||||||||||||||||||||||
| 1711 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
| 1712 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
| 1713 | freezero(key, key_size); | - | ||||||||||||||||||||||||
| 1714 | BN_clear_free(bn); | - | ||||||||||||||||||||||||
| 1715 | - | |||||||||||||||||||||||||
| 1716 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 1717 | } | - | ||||||||||||||||||||||||
| 1718 | - | |||||||||||||||||||||||||
| 1719 | static int | - | ||||||||||||||||||||||||
| 1720 | ssl3_get_client_kex_ecdhe_ecp(SSL *s, CBS *cbs) | - | ||||||||||||||||||||||||
| 1721 | { | - | ||||||||||||||||||||||||
| 1722 | unsigned char *key = | - | ||||||||||||||||||||||||
| 1723 | ((void *)0) | - | ||||||||||||||||||||||||
| 1724 | ; | - | ||||||||||||||||||||||||
| 1725 | int key_size = 0, key_len; | - | ||||||||||||||||||||||||
| 1726 | EC_POINT *point = | - | ||||||||||||||||||||||||
| 1727 | ((void *)0) | - | ||||||||||||||||||||||||
| 1728 | ; | - | ||||||||||||||||||||||||
| 1729 | BN_CTX *bn_ctx = | - | ||||||||||||||||||||||||
| 1730 | ((void *)0) | - | ||||||||||||||||||||||||
| 1731 | ; | - | ||||||||||||||||||||||||
| 1732 | const EC_GROUP *group; | - | ||||||||||||||||||||||||
| 1733 | EC_KEY *ecdh; | - | ||||||||||||||||||||||||
| 1734 | CBS public; | - | ||||||||||||||||||||||||
| 1735 | int ret = -1; | - | ||||||||||||||||||||||||
| 1736 | - | |||||||||||||||||||||||||
| 1737 | if (!CBS_get_u8_length_prefixed(cbs, &public)
| 0-23 | ||||||||||||||||||||||||
| 1738 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1739 | if (CBS_len(cbs) != 0
| 0-23 | ||||||||||||||||||||||||
| 1740 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1741 | - | |||||||||||||||||||||||||
| 1742 | - | |||||||||||||||||||||||||
| 1743 | - | |||||||||||||||||||||||||
| 1744 | - | |||||||||||||||||||||||||
| 1745 | - | |||||||||||||||||||||||||
| 1746 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1747 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1748 | ) { | - | ||||||||||||||||||||||||
| 1749 | SSL_error_internal(s, (4|64), __FILE__, 1879); | - | ||||||||||||||||||||||||
| 1750 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1751 | } | - | ||||||||||||||||||||||||
| 1752 | group = EC_KEY_get0_group(ecdh); | - | ||||||||||||||||||||||||
| 1753 | - | |||||||||||||||||||||||||
| 1754 | - | |||||||||||||||||||||||||
| 1755 | - | |||||||||||||||||||||||||
| 1756 | - | |||||||||||||||||||||||||
| 1757 | - | |||||||||||||||||||||||||
| 1758 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1759 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1760 | ) { | - | ||||||||||||||||||||||||
| 1761 | SSL_error_internal(s, (1|64), __FILE__, 1889); | - | ||||||||||||||||||||||||
| 1762 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1763 | } | - | ||||||||||||||||||||||||
| 1764 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1765 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1766 | ) { | - | ||||||||||||||||||||||||
| 1767 | SSL_error_internal(s, (1|64), __FILE__, 1893); | - | ||||||||||||||||||||||||
| 1768 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1769 | } | - | ||||||||||||||||||||||||
| 1770 | if (EC_POINT_oct2point(group, point, CBS_data(&public),
| 0-23 | ||||||||||||||||||||||||
| 1771 | CBS_len(&public), bn_ctx) == 0
| 0-23 | ||||||||||||||||||||||||
| 1772 | SSL_error_internal(s, 16, __FILE__, 1898); | - | ||||||||||||||||||||||||
| 1773 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1774 | } | - | ||||||||||||||||||||||||
| 1775 | - | |||||||||||||||||||||||||
| 1776 | - | |||||||||||||||||||||||||
| 1777 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1778 | SSL_error_internal(s, 43, __FILE__, 1904); | - | ||||||||||||||||||||||||
| 1779 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1780 | } | - | ||||||||||||||||||||||||
| 1781 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1782 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1783 | ) { | - | ||||||||||||||||||||||||
| 1784 | SSL_error_internal(s, (1|64), __FILE__, 1908); | - | ||||||||||||||||||||||||
| 1785 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1786 | } | - | ||||||||||||||||||||||||
| 1787 | if ((
| 0-23 | ||||||||||||||||||||||||
| 1788 |
| 0-23 | ||||||||||||||||||||||||
| 1789 | ((void *)0)
| 0-23 | ||||||||||||||||||||||||
| 1790 | )) <= 0
| 0-23 | ||||||||||||||||||||||||
| 1791 | SSL_error_internal(s, 43, __FILE__, 1913); | - | ||||||||||||||||||||||||
| 1792 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1793 | } | - | ||||||||||||||||||||||||
| 1794 | - | |||||||||||||||||||||||||
| 1795 | - | |||||||||||||||||||||||||
| 1796 | s->session->master_key_length = tls1_generate_master_secret(s, | - | ||||||||||||||||||||||||
| 1797 | s->session->master_key, key, key_len); | - | ||||||||||||||||||||||||
| 1798 | - | |||||||||||||||||||||||||
| 1799 | EC_KEY_free((s->s3->internal)->tmp.ecdh); | - | ||||||||||||||||||||||||
| 1800 | (s->s3->internal)->tmp.ecdh = | - | ||||||||||||||||||||||||
| 1801 | ((void *)0) | - | ||||||||||||||||||||||||
| 1802 | ; | - | ||||||||||||||||||||||||
| 1803 | - | |||||||||||||||||||||||||
| 1804 | ret = 1; | - | ||||||||||||||||||||||||
| 1805 | - | |||||||||||||||||||||||||
| 1806 | err: code before this statement executed 23 times by 1 test: err:Executed by:
| 23 | ||||||||||||||||||||||||
| 1807 | freezero(key, key_size); | - | ||||||||||||||||||||||||
| 1808 | EC_POINT_free(point); | - | ||||||||||||||||||||||||
| 1809 | BN_CTX_free(bn_ctx); | - | ||||||||||||||||||||||||
| 1810 | - | |||||||||||||||||||||||||
| 1811 | return executed 23 times by 1 test: (ret);return (ret);Executed by:
executed 23 times by 1 test: return (ret);Executed by:
| 23 | ||||||||||||||||||||||||
| 1812 | } | - | ||||||||||||||||||||||||
| 1813 | - | |||||||||||||||||||||||||
| 1814 | static int | - | ||||||||||||||||||||||||
| 1815 | ssl3_get_client_kex_ecdhe_ecx(SSL *s, CBS *cbs) | - | ||||||||||||||||||||||||
| 1816 | { | - | ||||||||||||||||||||||||
| 1817 | uint8_t *shared_key = | - | ||||||||||||||||||||||||
| 1818 | ((void *)0) | - | ||||||||||||||||||||||||
| 1819 | ; | - | ||||||||||||||||||||||||
| 1820 | CBS ecpoint; | - | ||||||||||||||||||||||||
| 1821 | int ret = -1; | - | ||||||||||||||||||||||||
| 1822 | - | |||||||||||||||||||||||||
| 1823 | if (!CBS_get_u8_length_prefixed(cbs, &ecpoint)
| 0-5 | ||||||||||||||||||||||||
| 1824 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1825 | if (CBS_len(cbs) != 0
| 0-5 | ||||||||||||||||||||||||
| 1826 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1827 | if (CBS_len(&ecpoint) != 32
| 0-5 | ||||||||||||||||||||||||
| 1828 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1829 | - | |||||||||||||||||||||||||
| 1830 | if ((
| 0-5 | ||||||||||||||||||||||||
| 1831 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
| 1832 | ) | - | ||||||||||||||||||||||||
| 1833 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1834 | if (!X25519(shared_key, (s->s3->internal)->tmp.x25519, CBS_data(&ecpoint))
| 0-5 | ||||||||||||||||||||||||
| 1835 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1836 | - | |||||||||||||||||||||||||
| 1837 | freezero((s->s3->internal)->tmp.x25519, 32); | - | ||||||||||||||||||||||||
| 1838 | (s->s3->internal)->tmp.x25519 = | - | ||||||||||||||||||||||||
| 1839 | ((void *)0) | - | ||||||||||||||||||||||||
| 1840 | ; | - | ||||||||||||||||||||||||
| 1841 | - | |||||||||||||||||||||||||
| 1842 | s->session->master_key_length = | - | ||||||||||||||||||||||||
| 1843 | tls1_generate_master_secret( | - | ||||||||||||||||||||||||
| 1844 | s, s->session->master_key, shared_key, 32); | - | ||||||||||||||||||||||||
| 1845 | - | |||||||||||||||||||||||||
| 1846 | ret = 1; | - | ||||||||||||||||||||||||
| 1847 | - | |||||||||||||||||||||||||
| 1848 | err: code before this statement executed 5 times by 2 tests: err:Executed by:
| 5 | ||||||||||||||||||||||||
| 1849 | freezero(shared_key, 32); | - | ||||||||||||||||||||||||
| 1850 | - | |||||||||||||||||||||||||
| 1851 | return executed 5 times by 2 tests: (ret);return (ret);Executed by:
executed 5 times by 2 tests: return (ret);Executed by:
| 5 | ||||||||||||||||||||||||
| 1852 | } | - | ||||||||||||||||||||||||
| 1853 | - | |||||||||||||||||||||||||
| 1854 | static int | - | ||||||||||||||||||||||||
| 1855 | ssl3_get_client_kex_ecdhe(SSL *s, CBS *cbs) | - | ||||||||||||||||||||||||
| 1856 | { | - | ||||||||||||||||||||||||
| 1857 | if ((
| 5-23 | ||||||||||||||||||||||||
| 1858 | ((void *)0)
| 5-23 | ||||||||||||||||||||||||
| 1859 | ) | - | ||||||||||||||||||||||||
| 1860 | return executed 5 times by 2 tests: ssl3_get_client_kex_ecdhe_ecx(s, cbs);return ssl3_get_client_kex_ecdhe_ecx(s, cbs);Executed by:
executed 5 times by 2 tests: return ssl3_get_client_kex_ecdhe_ecx(s, cbs);Executed by:
| 5 | ||||||||||||||||||||||||
| 1861 | - | |||||||||||||||||||||||||
| 1862 | return executed 23 times by 1 test: ssl3_get_client_kex_ecdhe_ecp(s, cbs);return ssl3_get_client_kex_ecdhe_ecp(s, cbs);Executed by:
executed 23 times by 1 test: return ssl3_get_client_kex_ecdhe_ecp(s, cbs);Executed by:
| 23 | ||||||||||||||||||||||||
| 1863 | } | - | ||||||||||||||||||||||||
| 1864 | - | |||||||||||||||||||||||||
| 1865 | static int | - | ||||||||||||||||||||||||
| 1866 | ssl3_get_client_kex_gost(SSL *s, CBS *cbs) | - | ||||||||||||||||||||||||
| 1867 | { | - | ||||||||||||||||||||||||
| 1868 | EVP_PKEY_CTX *pkey_ctx; | - | ||||||||||||||||||||||||
| 1869 | EVP_PKEY *client_pub_pkey = | - | ||||||||||||||||||||||||
| 1870 | ((void *)0) | - | ||||||||||||||||||||||||
| 1871 | , *pk = | - | ||||||||||||||||||||||||
| 1872 | ((void *)0) | - | ||||||||||||||||||||||||
| 1873 | ; | - | ||||||||||||||||||||||||
| 1874 | unsigned char premaster_secret[32]; | - | ||||||||||||||||||||||||
| 1875 | unsigned long alg_a; | - | ||||||||||||||||||||||||
| 1876 | size_t outlen = 32; | - | ||||||||||||||||||||||||
| 1877 | CBS gostblob; | - | ||||||||||||||||||||||||
| 1878 | int al; | - | ||||||||||||||||||||||||
| 1879 | int ret = 0; | - | ||||||||||||||||||||||||
| 1880 | - | |||||||||||||||||||||||||
| 1881 | - | |||||||||||||||||||||||||
| 1882 | alg_a = (s->s3->internal)->hs.new_cipher->algorithm_auth; | - | ||||||||||||||||||||||||
| 1883 | if (alg_a & 0x00000200L
| 0 | ||||||||||||||||||||||||
| 1884 | pk = s->cert->pkeys[4].privatekey; never executed: pk = s->cert->pkeys[4].privatekey; | 0 | ||||||||||||||||||||||||
| 1885 | - | |||||||||||||||||||||||||
| 1886 | if ((
| 0 | ||||||||||||||||||||||||
| 1887 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 1888 | )) ==
| 0 | ||||||||||||||||||||||||
| 1889 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 1890 | ) | - | ||||||||||||||||||||||||
| 1891 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1892 | if (EVP_PKEY_decrypt_init(pkey_ctx) <= 0
| 0 | ||||||||||||||||||||||||
| 1893 | goto never executed: gerr;goto gerr;never executed: goto gerr; | 0 | ||||||||||||||||||||||||
| 1894 | if ((
| 0 | ||||||||||||||||||||||||
| 1895 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 1896 | ) { | - | ||||||||||||||||||||||||
| 1897 | if (EVP_PKEY_derive_set_peer(pkey_ctx,
| 0 | ||||||||||||||||||||||||
| 1898 | client_pub_pkey) <= 0
| 0 | ||||||||||||||||||||||||
| 1899 | ERR_clear_error(); never executed: ERR_clear_error(); | 0 | ||||||||||||||||||||||||
| 1900 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1901 | - | |||||||||||||||||||||||||
| 1902 | - | |||||||||||||||||||||||||
| 1903 | if (!CBS_get_asn1(cbs, &gostblob, (0x00 | 0x20 | 0x10))
| 0 | ||||||||||||||||||||||||
| 1904 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 1905 | if (CBS_len(cbs) != 0
| 0 | ||||||||||||||||||||||||
| 1906 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 1907 | if (EVP_PKEY_decrypt(pkey_ctx, premaster_secret, &outlen,
| 0 | ||||||||||||||||||||||||
| 1908 | CBS_data(&gostblob), CBS_len(&gostblob)) <= 0
| 0 | ||||||||||||||||||||||||
| 1909 | SSL_error_internal(s, 147, __FILE__, 2019); | - | ||||||||||||||||||||||||
| 1910 | goto never executed: gerr;goto gerr;never executed: goto gerr; | 0 | ||||||||||||||||||||||||
| 1911 | } | - | ||||||||||||||||||||||||
| 1912 | - | |||||||||||||||||||||||||
| 1913 | - | |||||||||||||||||||||||||
| 1914 | s->session->master_key_length = | - | ||||||||||||||||||||||||
| 1915 | tls1_generate_master_secret( | - | ||||||||||||||||||||||||
| 1916 | s, s->session->master_key, premaster_secret, 32); | - | ||||||||||||||||||||||||
| 1917 | - | |||||||||||||||||||||||||
| 1918 | - | |||||||||||||||||||||||||
| 1919 | if (EVP_PKEY_CTX_ctrl(pkey_ctx, -1, -1,
| 0 | ||||||||||||||||||||||||
| 1920 | 2, 2,
| 0 | ||||||||||||||||||||||||
| 1921 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 1922 | ) > 0
| 0 | ||||||||||||||||||||||||
| 1923 | ret = 2; never executed: ret = 2; | 0 | ||||||||||||||||||||||||
| 1924 | else | - | ||||||||||||||||||||||||
| 1925 | ret = 1; never executed: ret = 1; | 0 | ||||||||||||||||||||||||
| 1926 | gerr: code before this statement never executed: gerr: | 0 | ||||||||||||||||||||||||
| 1927 | EVP_PKEY_free(client_pub_pkey); | - | ||||||||||||||||||||||||
| 1928 | EVP_PKEY_CTX_free(pkey_ctx); | - | ||||||||||||||||||||||||
| 1929 | if (ret
| 0 | ||||||||||||||||||||||||
| 1930 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||||||||||||||
| 1931 | else | - | ||||||||||||||||||||||||
| 1932 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1933 | - | |||||||||||||||||||||||||
| 1934 | truncated: | - | ||||||||||||||||||||||||
| 1935 | al = 50; | - | ||||||||||||||||||||||||
| 1936 | SSL_error_internal(s, 115, __FILE__, 2044); | - | ||||||||||||||||||||||||
| 1937 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
| 1938 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
| 1939 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 1940 | } | - | ||||||||||||||||||||||||
| 1941 | - | |||||||||||||||||||||||||
| 1942 | int | - | ||||||||||||||||||||||||
| 1943 | ssl3_get_client_key_exchange(SSL *s) | - | ||||||||||||||||||||||||
| 1944 | { | - | ||||||||||||||||||||||||
| 1945 | unsigned long alg_k; | - | ||||||||||||||||||||||||
| 1946 | int al, ok; | - | ||||||||||||||||||||||||
| 1947 | CBS cbs; | - | ||||||||||||||||||||||||
| 1948 | long n; | - | ||||||||||||||||||||||||
| 1949 | - | |||||||||||||||||||||||||
| 1950 | - | |||||||||||||||||||||||||
| 1951 | n = s->method->internal->ssl_get_message(s, (0x190|0x2000), | - | ||||||||||||||||||||||||
| 1952 | (0x191|0x2000), 16, 2048, &ok); | - | ||||||||||||||||||||||||
| 1953 | if (!ok
| 63-271 | ||||||||||||||||||||||||
| 1954 | return executed 271 times by 3 tests: ((int)n);return ((int)n);Executed by:
executed 271 times by 3 tests: return ((int)n);Executed by:
| 271 | ||||||||||||||||||||||||
| 1955 | - | |||||||||||||||||||||||||
| 1956 | if (n < 0
| 0-63 | ||||||||||||||||||||||||
| 1957 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1958 | - | |||||||||||||||||||||||||
| 1959 | CBS_init(&cbs, s->internal->init_msg, n); | - | ||||||||||||||||||||||||
| 1960 | - | |||||||||||||||||||||||||
| 1961 | alg_k = (s->s3->internal)->hs.new_cipher->algorithm_mkey; | - | ||||||||||||||||||||||||
| 1962 | - | |||||||||||||||||||||||||
| 1963 | if (alg_k & 0x00000001L
| 14-49 | ||||||||||||||||||||||||
| 1964 | if (ssl3_get_client_kex_rsa(s, &cbs) != 1
| 0-14 | ||||||||||||||||||||||||
| 1965 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1966 | } executed 14 times by 1 test: else if (alg_k & 0x00000008Lend of blockExecuted by:
| 14-28 | ||||||||||||||||||||||||
| 1967 | if (ssl3_get_client_kex_dhe(s, &cbs) != 1
| 0-21 | ||||||||||||||||||||||||
| 1968 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1969 | } executed 21 times by 1 test: else if (alg_k & 0x00000080Lend of blockExecuted by:
| 0-28 | ||||||||||||||||||||||||
| 1970 | if (ssl3_get_client_kex_ecdhe(s, &cbs) != 1
| 0-28 | ||||||||||||||||||||||||
| 1971 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1972 | } executed 28 times by 2 tests: else if (alg_k & 0x00000200Lend of blockExecuted by:
| 0-28 | ||||||||||||||||||||||||
| 1973 | if (ssl3_get_client_kex_gost(s, &cbs) != 1
| 0 | ||||||||||||||||||||||||
| 1974 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1975 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1976 | al = 40; | - | ||||||||||||||||||||||||
| 1977 | SSL_error_internal(s, 249, __FILE__, 2085); | - | ||||||||||||||||||||||||
| 1978 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1979 | } | - | ||||||||||||||||||||||||
| 1980 | - | |||||||||||||||||||||||||
| 1981 | if (CBS_len(&cbs) != 0
| 0-63 | ||||||||||||||||||||||||
| 1982 | al = 50; | - | ||||||||||||||||||||||||
| 1983 | SSL_error_internal(s, 115, __FILE__, 2091); | - | ||||||||||||||||||||||||
| 1984 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 1985 | } | - | ||||||||||||||||||||||||
| 1986 | - | |||||||||||||||||||||||||
| 1987 | return executed 63 times by 2 tests: (1);return (1);Executed by:
executed 63 times by 2 tests: return (1);Executed by:
| 63 | ||||||||||||||||||||||||
| 1988 | - | |||||||||||||||||||||||||
| 1989 | f_err: | - | ||||||||||||||||||||||||
| 1990 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
| 1991 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||||||||
| 1992 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 1993 | } | - | ||||||||||||||||||||||||
| 1994 | - | |||||||||||||||||||||||||
| 1995 | int | - | ||||||||||||||||||||||||
| 1996 | ssl3_get_cert_verify(SSL *s) | - | ||||||||||||||||||||||||
| 1997 | { | - | ||||||||||||||||||||||||
| 1998 | CBS cbs, signature; | - | ||||||||||||||||||||||||
| 1999 | const EVP_MD *md = | - | ||||||||||||||||||||||||
| 2000 | ((void *)0) | - | ||||||||||||||||||||||||
| 2001 | ; | - | ||||||||||||||||||||||||
| 2002 | EVP_PKEY *pkey = | - | ||||||||||||||||||||||||
| 2003 | ((void *)0) | - | ||||||||||||||||||||||||
| 2004 | ; | - | ||||||||||||||||||||||||
| 2005 | X509 *peer = | - | ||||||||||||||||||||||||
| 2006 | ((void *)0) | - | ||||||||||||||||||||||||
| 2007 | ; | - | ||||||||||||||||||||||||
| 2008 | EVP_MD_CTX mctx; | - | ||||||||||||||||||||||||
| 2009 | uint8_t hash_id, sig_id; | - | ||||||||||||||||||||||||
| 2010 | int al, ok, sigalg, verify; | - | ||||||||||||||||||||||||
| 2011 | int type = 0; | - | ||||||||||||||||||||||||
| 2012 | int ret = 0; | - | ||||||||||||||||||||||||
| 2013 | long hdatalen; | - | ||||||||||||||||||||||||
| 2014 | void *hdata; | - | ||||||||||||||||||||||||
| 2015 | long n; | - | ||||||||||||||||||||||||
| 2016 | - | |||||||||||||||||||||||||
| 2017 | EVP_MD_CTX_init(&mctx); | - | ||||||||||||||||||||||||
| 2018 | - | |||||||||||||||||||||||||
| 2019 | n = s->method->internal->ssl_get_message(s, (0x1A0|0x2000), | - | ||||||||||||||||||||||||
| 2020 | (0x1A1|0x2000), -1, 16384, &ok); | - | ||||||||||||||||||||||||
| 2021 | if (!ok
| 63-324 | ||||||||||||||||||||||||
| 2022 | return executed 324 times by 1 test: ((int)n);return ((int)n);Executed by:
executed 324 times by 1 test: return ((int)n);Executed by:
| 324 | ||||||||||||||||||||||||
| 2023 | - | |||||||||||||||||||||||||
| 2024 | if (n < 0
| 0-63 | ||||||||||||||||||||||||
| 2025 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2026 | - | |||||||||||||||||||||||||
| 2027 | CBS_init(&cbs, s->internal->init_msg, n); | - | ||||||||||||||||||||||||
| 2028 | - | |||||||||||||||||||||||||
| 2029 | if (s->session->peer !=
| 7-56 | ||||||||||||||||||||||||
| 2030 | ((void *)0)
| 7-56 | ||||||||||||||||||||||||
| 2031 | ) { | - | ||||||||||||||||||||||||
| 2032 | peer = s->session->peer; | - | ||||||||||||||||||||||||
| 2033 | pkey = X509_get_pubkey(peer); | - | ||||||||||||||||||||||||
| 2034 | type = X509_certificate_type(peer, pkey); | - | ||||||||||||||||||||||||
| 2035 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||
| 2036 | - | |||||||||||||||||||||||||
| 2037 | if ((
| 7-56 | ||||||||||||||||||||||||
| 2038 | (s->s3->internal)->tmp.reuse_message = 1; | - | ||||||||||||||||||||||||
| 2039 | if (peer !=
| 0-56 | ||||||||||||||||||||||||
| 2040 | ((void *)0)
| 0-56 | ||||||||||||||||||||||||
| 2041 | ) { | - | ||||||||||||||||||||||||
| 2042 | al = 10; | - | ||||||||||||||||||||||||
| 2043 | SSL_error_internal(s, 174, __FILE__, 2141); | - | ||||||||||||||||||||||||
| 2044 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2045 | } | - | ||||||||||||||||||||||||
| 2046 | ret = 1; | - | ||||||||||||||||||||||||
| 2047 | goto executed 56 times by 2 tests: end;goto end;Executed by:
executed 56 times by 2 tests: goto end;Executed by:
| 56 | ||||||||||||||||||||||||
| 2048 | } | - | ||||||||||||||||||||||||
| 2049 | - | |||||||||||||||||||||||||
| 2050 | if (peer ==
| 0-7 | ||||||||||||||||||||||||
| 2051 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
| 2052 | ) { | - | ||||||||||||||||||||||||
| 2053 | SSL_error_internal(s, 186, __FILE__, 2149); | - | ||||||||||||||||||||||||
| 2054 | al = 10; | - | ||||||||||||||||||||||||
| 2055 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2056 | } | - | ||||||||||||||||||||||||
| 2057 | - | |||||||||||||||||||||||||
| 2058 | if (!(type & 0x0010)
| 0-7 | ||||||||||||||||||||||||
| 2059 | SSL_error_internal(s, 220, __FILE__, 2155); | - | ||||||||||||||||||||||||
| 2060 | al = 47; | - | ||||||||||||||||||||||||
| 2061 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2062 | } | - | ||||||||||||||||||||||||
| 2063 | - | |||||||||||||||||||||||||
| 2064 | if ((
| 0-7 | ||||||||||||||||||||||||
| 2065 | SSL_error_internal(s, 133, __FILE__, 2161); | - | ||||||||||||||||||||||||
| 2066 | al = 10; | - | ||||||||||||||||||||||||
| 2067 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2068 | } | - | ||||||||||||||||||||||||
| 2069 | - | |||||||||||||||||||||||||
| 2070 | - | |||||||||||||||||||||||||
| 2071 | - | |||||||||||||||||||||||||
| 2072 | - | |||||||||||||||||||||||||
| 2073 | - | |||||||||||||||||||||||||
| 2074 | - | |||||||||||||||||||||||||
| 2075 | - | |||||||||||||||||||||||||
| 2076 | if ((pkey->type == 812
| 0-7 | ||||||||||||||||||||||||
| 2077 | pkey->type == 811
| 0-7 | ||||||||||||||||||||||||
| 2078 | CBS_dup(&cbs, &signature); | - | ||||||||||||||||||||||||
| 2079 | if (!CBS_skip(&cbs, CBS_len(&cbs))
| 0 | ||||||||||||||||||||||||
| 2080 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2081 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2082 | if ((
| 2-5 | ||||||||||||||||||||||||
| 2083 | if (!CBS_get_u8(&cbs, &hash_id)
| 0-5 | ||||||||||||||||||||||||
| 2084 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 2085 | if (!CBS_get_u8(&cbs, &sig_id)
| 0-5 | ||||||||||||||||||||||||
| 2086 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 2087 | - | |||||||||||||||||||||||||
| 2088 | if ((
| 0-5 | ||||||||||||||||||||||||
| 2089 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
| 2090 | ) { | - | ||||||||||||||||||||||||
| 2091 | SSL_error_internal(s, 368, __FILE__, 2185); | - | ||||||||||||||||||||||||
| 2092 | al = 50; | - | ||||||||||||||||||||||||
| 2093 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2094 | } | - | ||||||||||||||||||||||||
| 2095 | - | |||||||||||||||||||||||||
| 2096 | - | |||||||||||||||||||||||||
| 2097 | if ((
| 0-5 | ||||||||||||||||||||||||
| 2098 | - | |||||||||||||||||||||||||
| 2099 | SSL_error_internal(s, (4|64), __FILE__, 2193); | - | ||||||||||||||||||||||||
| 2100 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2101 | } | - | ||||||||||||||||||||||||
| 2102 | if (sigalg != sig_id
| 0-5 | ||||||||||||||||||||||||
| 2103 | SSL_error_internal(s, 370, __FILE__, 2197); | - | ||||||||||||||||||||||||
| 2104 | al = 50; | - | ||||||||||||||||||||||||
| 2105 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2106 | } | - | ||||||||||||||||||||||||
| 2107 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||||||||
| 2108 | if (!CBS_get_u16_length_prefixed(&cbs, &signature)
| 0-7 | ||||||||||||||||||||||||
| 2109 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2110 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||
| 2111 | if (CBS_len(&signature) > EVP_PKEY_size(pkey)
| 0-7 | ||||||||||||||||||||||||
| 2112 | SSL_error_internal(s, 265, __FILE__, 2206); | - | ||||||||||||||||||||||||
| 2113 | al = 50; | - | ||||||||||||||||||||||||
| 2114 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2115 | } | - | ||||||||||||||||||||||||
| 2116 | if (CBS_len(&cbs) != 0
| 0-7 | ||||||||||||||||||||||||
| 2117 | al = 50; | - | ||||||||||||||||||||||||
| 2118 | SSL_error_internal(s, 153, __FILE__, 2212); | - | ||||||||||||||||||||||||
| 2119 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2120 | } | - | ||||||||||||||||||||||||
| 2121 | - | |||||||||||||||||||||||||
| 2122 | if ((
| 2-5 | ||||||||||||||||||||||||
| 2123 | hdatalen = BIO_ctrl((s->s3->internal)->handshake_buffer,3,0,(char *)&hdata); | - | ||||||||||||||||||||||||
| 2124 | if (hdatalen <= 0
| 0-5 | ||||||||||||||||||||||||
| 2125 | SSL_error_internal(s, (4|64), __FILE__, 2219); | - | ||||||||||||||||||||||||
| 2126 | al = 80; | - | ||||||||||||||||||||||||
| 2127 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2128 | } | - | ||||||||||||||||||||||||
| 2129 | if (!EVP_DigestInit_ex(&mctx,md,
| 0-5 | ||||||||||||||||||||||||
| 2130 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
| 2131 | )
| 0-5 | ||||||||||||||||||||||||
| 2132 | !EVP_DigestUpdate(&mctx,hdata,hdatalen)
| 0-5 | ||||||||||||||||||||||||
| 2133 | SSL_error_internal(s, 6, __FILE__, 2225); | - | ||||||||||||||||||||||||
| 2134 | al = 80; | - | ||||||||||||||||||||||||
| 2135 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2136 | } | - | ||||||||||||||||||||||||
| 2137 | if (EVP_VerifyFinal(&mctx, CBS_data(&signature),
| 0-5 | ||||||||||||||||||||||||
| 2138 | CBS_len(&signature), pkey) <= 0
| 0-5 | ||||||||||||||||||||||||
| 2139 | al = 51; | - | ||||||||||||||||||||||||
| 2140 | SSL_error_internal(s, 123, __FILE__, 2232); | - | ||||||||||||||||||||||||
| 2141 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2142 | } | - | ||||||||||||||||||||||||
| 2143 | } executed 5 times by 1 test: else if (pkey->type == 6end of blockExecuted by:
| 0-5 | ||||||||||||||||||||||||
| 2144 | verify = RSA_verify(114, (s->s3->internal)->tmp.cert_verify_md, | - | ||||||||||||||||||||||||
| 2145 | 16 + 20, CBS_data(&signature), | - | ||||||||||||||||||||||||
| 2146 | CBS_len(&signature), pkey->pkey.rsa); | - | ||||||||||||||||||||||||
| 2147 | if (verify < 0
| 0-2 | ||||||||||||||||||||||||
| 2148 | al = 51; | - | ||||||||||||||||||||||||
| 2149 | SSL_error_internal(s, 118, __FILE__, 2241); | - | ||||||||||||||||||||||||
| 2150 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2151 | } | - | ||||||||||||||||||||||||
| 2152 | if (verify == 0
| 0-2 | ||||||||||||||||||||||||
| 2153 | al = 51; | - | ||||||||||||||||||||||||
| 2154 | SSL_error_internal(s, 122, __FILE__, 2246); | - | ||||||||||||||||||||||||
| 2155 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2156 | } | - | ||||||||||||||||||||||||
| 2157 | } executed 2 times by 1 test: else if (pkey->type == 408end of blockExecuted by:
| 0-2 | ||||||||||||||||||||||||
| 2158 | verify = ECDSA_verify(pkey->save_type, | - | ||||||||||||||||||||||||
| 2159 | &((s->s3->internal)->tmp.cert_verify_md[16]), | - | ||||||||||||||||||||||||
| 2160 | 20, CBS_data(&signature), | - | ||||||||||||||||||||||||
| 2161 | CBS_len(&signature), pkey->pkey.ec); | - | ||||||||||||||||||||||||
| 2162 | if (verify <= 0
| 0 | ||||||||||||||||||||||||
| 2163 | al = 51; | - | ||||||||||||||||||||||||
| 2164 | SSL_error_internal(s, 305, __FILE__, 2256); | - | ||||||||||||||||||||||||
| 2165 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2166 | } | - | ||||||||||||||||||||||||
| 2167 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
| 2168 | - | |||||||||||||||||||||||||
| 2169 | if (pkey->type == 812
| 0 | ||||||||||||||||||||||||
| 2170 | pkey->type == 811
| 0 | ||||||||||||||||||||||||
| 2171 | unsigned char sigbuf[128]; | - | ||||||||||||||||||||||||
| 2172 | unsigned int siglen = sizeof(sigbuf); | - | ||||||||||||||||||||||||
| 2173 | EVP_PKEY_CTX *pctx; | - | ||||||||||||||||||||||||
| 2174 | int nid; | - | ||||||||||||||||||||||||
| 2175 | - | |||||||||||||||||||||||||
| 2176 | hdatalen = BIO_ctrl((s->s3->internal)->handshake_buffer,3,0,(char *)&hdata); | - | ||||||||||||||||||||||||
| 2177 | if (hdatalen <= 0
| 0 | ||||||||||||||||||||||||
| 2178 | SSL_error_internal(s, (4|64), __FILE__, 2270); | - | ||||||||||||||||||||||||
| 2179 | al = 80; | - | ||||||||||||||||||||||||
| 2180 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2181 | } | - | ||||||||||||||||||||||||
| 2182 | if (!EVP_PKEY_get_default_digest_nid(pkey, &nid)
| 0 | ||||||||||||||||||||||||
| 2183 | !(md = EVP_get_digestbyname(OBJ_nid2sn(nid)))
| 0 | ||||||||||||||||||||||||
| 2184 | SSL_error_internal(s, 6, __FILE__, 2276); | - | ||||||||||||||||||||||||
| 2185 | al = 80; | - | ||||||||||||||||||||||||
| 2186 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2187 | } | - | ||||||||||||||||||||||||
| 2188 | if ((
| 0 | ||||||||||||||||||||||||
| 2189 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 2190 | )) ==
| 0 | ||||||||||||||||||||||||
| 2191 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 2192 | ) { | - | ||||||||||||||||||||||||
| 2193 | SSL_error_internal(s, 6, __FILE__, 2281); | - | ||||||||||||||||||||||||
| 2194 | al = 80; | - | ||||||||||||||||||||||||
| 2195 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2196 | } | - | ||||||||||||||||||||||||
| 2197 | if (!EVP_DigestInit_ex(&mctx, md,
| 0 | ||||||||||||||||||||||||
| 2198 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 2199 | )
| 0 | ||||||||||||||||||||||||
| 2200 | !EVP_DigestUpdate(&mctx, hdata, hdatalen)
| 0 | ||||||||||||||||||||||||
| 2201 | !EVP_DigestFinal(&mctx, sigbuf, &siglen)
| 0 | ||||||||||||||||||||||||
| 2202 | (
| 0 | ||||||||||||||||||||||||
| 2203 | (
| 0 | ||||||||||||||||||||||||
| 2204 | (
| 0 | ||||||||||||||||||||||||
| 2205 | (0x1000 +2),
| 0 | ||||||||||||||||||||||||
| 2206 | 1,
| 0 | ||||||||||||||||||||||||
| 2207 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 2208 | ) <= 0)
| 0 | ||||||||||||||||||||||||
| 2209 | SSL_error_internal(s, 6, __FILE__, 2293); | - | ||||||||||||||||||||||||
| 2210 | al = 80; | - | ||||||||||||||||||||||||
| 2211 | EVP_PKEY_CTX_free(pctx); | - | ||||||||||||||||||||||||
| 2212 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2213 | } | - | ||||||||||||||||||||||||
| 2214 | if (EVP_PKEY_verify(pctx, CBS_data(&signature),
| 0 | ||||||||||||||||||||||||
| 2215 | CBS_len(&signature), sigbuf, siglen) <= 0
| 0 | ||||||||||||||||||||||||
| 2216 | al = 51; | - | ||||||||||||||||||||||||
| 2217 | SSL_error_internal(s, 123, __FILE__, 2301); | - | ||||||||||||||||||||||||
| 2218 | EVP_PKEY_CTX_free(pctx); | - | ||||||||||||||||||||||||
| 2219 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2220 | } | - | ||||||||||||||||||||||||
| 2221 | - | |||||||||||||||||||||||||
| 2222 | EVP_PKEY_CTX_free(pctx); | - | ||||||||||||||||||||||||
| 2223 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
| 2224 | - | |||||||||||||||||||||||||
| 2225 | { | - | ||||||||||||||||||||||||
| 2226 | SSL_error_internal(s, (4|64), __FILE__, 2310); | - | ||||||||||||||||||||||||
| 2227 | al = 43; | - | ||||||||||||||||||||||||
| 2228 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2229 | } | - | ||||||||||||||||||||||||
| 2230 | - | |||||||||||||||||||||||||
| 2231 | ret = 1; | - | ||||||||||||||||||||||||
| 2232 | if (0) { | - | ||||||||||||||||||||||||
| 2233 | truncated: | - | ||||||||||||||||||||||||
| 2234 | al = 50; | - | ||||||||||||||||||||||||
| 2235 | SSL_error_internal(s, 115, __FILE__, 2319); | - | ||||||||||||||||||||||||
| 2236 | f_err: code before this statement never executed: f_err: | 0 | ||||||||||||||||||||||||
| 2237 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
| 2238 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2239 | end: code before this statement executed 7 times by 1 test: end:Executed by:
| 7 | ||||||||||||||||||||||||
| 2240 | if ((
| 5-58 | ||||||||||||||||||||||||
| 2241 | BIO_free((s->s3->internal)->handshake_buffer); | - | ||||||||||||||||||||||||
| 2242 | (s->s3->internal)->handshake_buffer = | - | ||||||||||||||||||||||||
| 2243 | ((void *)0) | - | ||||||||||||||||||||||||
| 2244 | ; | - | ||||||||||||||||||||||||
| 2245 | s->s3->flags &= ~0x0020; | - | ||||||||||||||||||||||||
| 2246 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||||||||
| 2247 | err: code before this statement executed 63 times by 2 tests: err:Executed by:
| 63 | ||||||||||||||||||||||||
| 2248 | EVP_MD_CTX_cleanup(&mctx); | - | ||||||||||||||||||||||||
| 2249 | EVP_PKEY_free(pkey); | - | ||||||||||||||||||||||||
| 2250 | return executed 63 times by 2 tests: (ret);return (ret);Executed by:
executed 63 times by 2 tests: return (ret);Executed by:
| 63 | ||||||||||||||||||||||||
| 2251 | } | - | ||||||||||||||||||||||||
| 2252 | - | |||||||||||||||||||||||||
| 2253 | int | - | ||||||||||||||||||||||||
| 2254 | ssl3_get_client_certificate(SSL *s) | - | ||||||||||||||||||||||||
| 2255 | { | - | ||||||||||||||||||||||||
| 2256 | CBS cbs, client_certs; | - | ||||||||||||||||||||||||
| 2257 | int i, ok, al, ret = -1; | - | ||||||||||||||||||||||||
| 2258 | X509 *x = | - | ||||||||||||||||||||||||
| 2259 | ((void *)0) | - | ||||||||||||||||||||||||
| 2260 | ; | - | ||||||||||||||||||||||||
| 2261 | long n; | - | ||||||||||||||||||||||||
| 2262 | const unsigned char *q; | - | ||||||||||||||||||||||||
| 2263 | struct stack_st_X509 *sk = | - | ||||||||||||||||||||||||
| 2264 | ((void *)0) | - | ||||||||||||||||||||||||
| 2265 | ; | - | ||||||||||||||||||||||||
| 2266 | - | |||||||||||||||||||||||||
| 2267 | n = s->method->internal->ssl_get_message(s, (0x180|0x2000), (0x181|0x2000), | - | ||||||||||||||||||||||||
| 2268 | -1, s->internal->max_cert_list, &ok); | - | ||||||||||||||||||||||||
| 2269 | - | |||||||||||||||||||||||||
| 2270 | if (!ok
| 7-100 | ||||||||||||||||||||||||
| 2271 | return executed 100 times by 1 test: ((int)n);return ((int)n);Executed by:
executed 100 times by 1 test: return ((int)n);Executed by:
| 100 | ||||||||||||||||||||||||
| 2272 | - | |||||||||||||||||||||||||
| 2273 | if ((
| 0-7 | ||||||||||||||||||||||||
| 2274 | if ((
| 0 | ||||||||||||||||||||||||
| 2275 | (
| 0 | ||||||||||||||||||||||||
| 2276 | SSL_error_internal(s, 199, __FILE__, 2354); | - | ||||||||||||||||||||||||
| 2277 | al = 40; | - | ||||||||||||||||||||||||
| 2278 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2279 | } | - | ||||||||||||||||||||||||
| 2280 | - | |||||||||||||||||||||||||
| 2281 | - | |||||||||||||||||||||||||
| 2282 | - | |||||||||||||||||||||||||
| 2283 | - | |||||||||||||||||||||||||
| 2284 | if ((
| 0 | ||||||||||||||||||||||||
| 2285 | SSL_error_internal(s, 233, | - | ||||||||||||||||||||||||
| 2286 | __FILE__ | - | ||||||||||||||||||||||||
| 2287 | , | - | ||||||||||||||||||||||||
| 2288 | 2364 | - | ||||||||||||||||||||||||
| 2289 | ) | - | ||||||||||||||||||||||||
| 2290 | ; | - | ||||||||||||||||||||||||
| 2291 | al = 10; | - | ||||||||||||||||||||||||
| 2292 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2293 | } | - | ||||||||||||||||||||||||
| 2294 | (s->s3->internal)->tmp.reuse_message = 1; | - | ||||||||||||||||||||||||
| 2295 | return never executed: (1);return (1);never executed: return (1); | 0 | ||||||||||||||||||||||||
| 2296 | } | - | ||||||||||||||||||||||||
| 2297 | - | |||||||||||||||||||||||||
| 2298 | if ((
| 0-7 | ||||||||||||||||||||||||
| 2299 | al = 10; | - | ||||||||||||||||||||||||
| 2300 | SSL_error_internal(s, 262, __FILE__, 2374); | - | ||||||||||||||||||||||||
| 2301 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2302 | } | - | ||||||||||||||||||||||||
| 2303 | - | |||||||||||||||||||||||||
| 2304 | if (n < 0
| 0-7 | ||||||||||||||||||||||||
| 2305 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 2306 | - | |||||||||||||||||||||||||
| 2307 | CBS_init(&cbs, s->internal->init_msg, n); | - | ||||||||||||||||||||||||
| 2308 | - | |||||||||||||||||||||||||
| 2309 | if ((
| 0-7 | ||||||||||||||||||||||||
| 2310 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
| 2311 | ) { | - | ||||||||||||||||||||||||
| 2312 | SSL_error_internal(s, (1|64), __FILE__, 2384); | - | ||||||||||||||||||||||||
| 2313 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2314 | } | - | ||||||||||||||||||||||||
| 2315 | - | |||||||||||||||||||||||||
| 2316 | if (!CBS_get_u24_length_prefixed(&cbs, &client_certs)
| 0-7 | ||||||||||||||||||||||||
| 2317 | CBS_len(&cbs) != 0
| 0-7 | ||||||||||||||||||||||||
| 2318 | goto never executed: truncated;goto truncated;never executed: goto truncated; | 0 | ||||||||||||||||||||||||
| 2319 | - | |||||||||||||||||||||||||
| 2320 | while (CBS_len(&client_certs) > 0
| 7-21 | ||||||||||||||||||||||||
| 2321 | CBS cert; | - | ||||||||||||||||||||||||
| 2322 | - | |||||||||||||||||||||||||
| 2323 | if (!CBS_get_u24_length_prefixed(&client_certs, &cert)
| 0-21 | ||||||||||||||||||||||||
| 2324 | al = 50; | - | ||||||||||||||||||||||||
| 2325 | SSL_error_internal(s, 135, __FILE__, 2397); | - | ||||||||||||||||||||||||
| 2326 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2327 | } | - | ||||||||||||||||||||||||
| 2328 | - | |||||||||||||||||||||||||
| 2329 | q = CBS_data(&cert); | - | ||||||||||||||||||||||||
| 2330 | x = d2i_X509( | - | ||||||||||||||||||||||||
| 2331 | ((void *)0) | - | ||||||||||||||||||||||||
| 2332 | , &q, CBS_len(&cert)); | - | ||||||||||||||||||||||||
| 2333 | if (x ==
| 0-21 | ||||||||||||||||||||||||
| 2334 | ((void *)0)
| 0-21 | ||||||||||||||||||||||||
| 2335 | ) { | - | ||||||||||||||||||||||||
| 2336 | SSL_error_internal(s, 13, __FILE__, 2404); | - | ||||||||||||||||||||||||
| 2337 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2338 | } | - | ||||||||||||||||||||||||
| 2339 | if (q != CBS_data(&cert) + CBS_len(&cert)
| 0-21 | ||||||||||||||||||||||||
| 2340 | al = 50; | - | ||||||||||||||||||||||||
| 2341 | SSL_error_internal(s, 135, __FILE__, 2409); | - | ||||||||||||||||||||||||
| 2342 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2343 | } | - | ||||||||||||||||||||||||
| 2344 | if (!sk_push(((_STACK*) (1 ? (sk) : (struct stack_st_X509*)0)), ((void*) (1 ? (x) : (X509*)0)))
| 0-21 | ||||||||||||||||||||||||
| 2345 | SSL_error_internal(s, (1|64), __FILE__, 2413); | - | ||||||||||||||||||||||||
| 2346 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2347 | } | - | ||||||||||||||||||||||||
| 2348 | x = | - | ||||||||||||||||||||||||
| 2349 | ((void *)0) | - | ||||||||||||||||||||||||
| 2350 | ; | - | ||||||||||||||||||||||||
| 2351 | } executed 21 times by 1 test: end of blockExecuted by:
| 21 | ||||||||||||||||||||||||
| 2352 | - | |||||||||||||||||||||||||
| 2353 | if (sk_num(((_STACK*) (1 ? (sk) : (struct stack_st_X509*)0))) <= 0
| 0-7 | ||||||||||||||||||||||||
| 2354 | - | |||||||||||||||||||||||||
| 2355 | - | |||||||||||||||||||||||||
| 2356 | - | |||||||||||||||||||||||||
| 2357 | - | |||||||||||||||||||||||||
| 2358 | if ((
| 0 | ||||||||||||||||||||||||
| 2359 | (
| 0 | ||||||||||||||||||||||||
| 2360 | SSL_error_internal(s, 199, __FILE__, 2426); | - | ||||||||||||||||||||||||
| 2361 | al = 40; | - | ||||||||||||||||||||||||
| 2362 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2363 | } | - | ||||||||||||||||||||||||
| 2364 | - | |||||||||||||||||||||||||
| 2365 | if ((
| 0 | ||||||||||||||||||||||||
| 2366 | al = 80; | - | ||||||||||||||||||||||||
| 2367 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2368 | } | - | ||||||||||||||||||||||||
| 2369 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2370 | i = ssl_verify_cert_chain(s, sk); | - | ||||||||||||||||||||||||
| 2371 | if (i <= 0
| 0-7 | ||||||||||||||||||||||||
| 2372 | al = ssl_verify_alarm_type(s->verify_result); | - | ||||||||||||||||||||||||
| 2373 | SSL_error_internal(s, 178, __FILE__, 2439); | - | ||||||||||||||||||||||||
| 2374 | goto never executed: f_err;goto f_err;never executed: goto f_err; | 0 | ||||||||||||||||||||||||
| 2375 | } | - | ||||||||||||||||||||||||
| 2376 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||
| 2377 | - | |||||||||||||||||||||||||
| 2378 | X509_free(s->session->peer); | - | ||||||||||||||||||||||||
| 2379 | s->session->peer = (X509 *)sk_shift(((_STACK*) (1 ? (sk) : (struct stack_st_X509*)0))); | - | ||||||||||||||||||||||||
| 2380 | s->session->verify_result = s->verify_result; | - | ||||||||||||||||||||||||
| 2381 | - | |||||||||||||||||||||||||
| 2382 | - | |||||||||||||||||||||||||
| 2383 | - | |||||||||||||||||||||||||
| 2384 | - | |||||||||||||||||||||||||
| 2385 | - | |||||||||||||||||||||||||
| 2386 | if ((
| 0-7 | ||||||||||||||||||||||||
| 2387 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
| 2388 | ) { | - | ||||||||||||||||||||||||
| 2389 | (s->session->internal)->sess_cert = ssl_sess_cert_new(); | - | ||||||||||||||||||||||||
| 2390 | if ((
| 0-7 | ||||||||||||||||||||||||
| 2391 | ((void *)0)
| 0-7 | ||||||||||||||||||||||||
| 2392 | ) { | - | ||||||||||||||||||||||||
| 2393 | SSL_error_internal(s, (1|64), __FILE__, 2455); | - | ||||||||||||||||||||||||
| 2394 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2395 | } | - | ||||||||||||||||||||||||
| 2396 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||
| 2397 | sk_pop_free(((_STACK*) (1 ? ((s->session->internal)->sess_cert->cert_chain) : (struct stack_st_X509*)0)), ((void (*)(void *)) ((1 ? (X509_free) : (void (*)(X509 *))0)))); | - | ||||||||||||||||||||||||
| 2398 | (s->session->internal)->sess_cert->cert_chain = sk; | - | ||||||||||||||||||||||||
| 2399 | - | |||||||||||||||||||||||||
| 2400 | - | |||||||||||||||||||||||||
| 2401 | - | |||||||||||||||||||||||||
| 2402 | - | |||||||||||||||||||||||||
| 2403 | - | |||||||||||||||||||||||||
| 2404 | - | |||||||||||||||||||||||||
| 2405 | sk = | - | ||||||||||||||||||||||||
| 2406 | ((void *)0) | - | ||||||||||||||||||||||||
| 2407 | ; | - | ||||||||||||||||||||||||
| 2408 | - | |||||||||||||||||||||||||
| 2409 | ret = 1; | - | ||||||||||||||||||||||||
| 2410 | if (0) { | - | ||||||||||||||||||||||||
| 2411 | truncated: | - | ||||||||||||||||||||||||
| 2412 | al = 50; | - | ||||||||||||||||||||||||
| 2413 | SSL_error_internal(s, 115, __FILE__, 2473); | - | ||||||||||||||||||||||||
| 2414 | f_err: code before this statement never executed: f_err: | 0 | ||||||||||||||||||||||||
| 2415 | ssl3_send_alert(s, 2, al); | - | ||||||||||||||||||||||||
| 2416 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2417 | err: code before this statement executed 7 times by 1 test: err:Executed by:
| 7 | ||||||||||||||||||||||||
| 2418 | X509_free(x); | - | ||||||||||||||||||||||||
| 2419 | sk_pop_free(((_STACK*) (1 ? (sk) : (struct stack_st_X509*)0)), ((void (*)(void *)) ((1 ? (X509_free) : (void (*)(X509 *))0)))); | - | ||||||||||||||||||||||||
| 2420 | - | |||||||||||||||||||||||||
| 2421 | return executed 7 times by 1 test: (ret);return (ret);Executed by:
executed 7 times by 1 test: return (ret);Executed by:
| 7 | ||||||||||||||||||||||||
| 2422 | } | - | ||||||||||||||||||||||||
| 2423 | - | |||||||||||||||||||||||||
| 2424 | int | - | ||||||||||||||||||||||||
| 2425 | ssl3_send_server_certificate(SSL *s) | - | ||||||||||||||||||||||||
| 2426 | { | - | ||||||||||||||||||||||||
| 2427 | CBB cbb, server_cert; | - | ||||||||||||||||||||||||
| 2428 | X509 *x; | - | ||||||||||||||||||||||||
| 2429 | - | |||||||||||||||||||||||||
| 2430 | - | |||||||||||||||||||||||||
| 2431 | - | |||||||||||||||||||||||||
| 2432 | - | |||||||||||||||||||||||||
| 2433 | - | |||||||||||||||||||||||||
| 2434 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
| 2435 | - | |||||||||||||||||||||||||
| 2436 | if ((
| 0-55 | ||||||||||||||||||||||||
| 2437 | if ((
| 0-55 | ||||||||||||||||||||||||
| 2438 | ((void *)0)
| 0-55 | ||||||||||||||||||||||||
| 2439 | ) { | - | ||||||||||||||||||||||||
| 2440 | SSL_error_internal(s, (4|64), __FILE__, 2498); | - | ||||||||||||||||||||||||
| 2441 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||||||||||||||
| 2442 | } | - | ||||||||||||||||||||||||
| 2443 | - | |||||||||||||||||||||||||
| 2444 | if (!ssl3_handshake_msg_start(s, &cbb, &server_cert,
| 0-55 | ||||||||||||||||||||||||
| 2445 | 11)
| 0-55 | ||||||||||||||||||||||||
| 2446 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2447 | if (!ssl3_output_cert_chain(s, &server_cert, x)
| 0-55 | ||||||||||||||||||||||||
| 2448 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2449 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0-55 | ||||||||||||||||||||||||
| 2450 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2451 | - | |||||||||||||||||||||||||
| 2452 | (s->s3->internal)->hs.state = (0x141|0x2000); | - | ||||||||||||||||||||||||
| 2453 | } executed 55 times by 3 tests: end of blockExecuted by:
| 55 | ||||||||||||||||||||||||
| 2454 | - | |||||||||||||||||||||||||
| 2455 | - | |||||||||||||||||||||||||
| 2456 | return executed 55 times by 3 tests: (ssl3_handshake_write(s));return (ssl3_handshake_write(s));Executed by:
executed 55 times by 3 tests: return (ssl3_handshake_write(s));Executed by:
| 55 | ||||||||||||||||||||||||
| 2457 | - | |||||||||||||||||||||||||
| 2458 | err: | - | ||||||||||||||||||||||||
| 2459 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
| 2460 | - | |||||||||||||||||||||||||
| 2461 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||||||||||||||
| 2462 | } | - | ||||||||||||||||||||||||
| 2463 | - | |||||||||||||||||||||||||
| 2464 | - | |||||||||||||||||||||||||
| 2465 | int | - | ||||||||||||||||||||||||
| 2466 | ssl3_send_newsession_ticket(SSL *s) | - | ||||||||||||||||||||||||
| 2467 | { | - | ||||||||||||||||||||||||
| 2468 | CBB cbb, session_ticket, ticket; | - | ||||||||||||||||||||||||
| 2469 | SSL_CTX *tctx = s->initial_ctx; | - | ||||||||||||||||||||||||
| 2470 | size_t enc_session_len, enc_session_max_len, hmac_len; | - | ||||||||||||||||||||||||
| 2471 | size_t session_len = 0; | - | ||||||||||||||||||||||||
| 2472 | unsigned char *enc_session = | - | ||||||||||||||||||||||||
| 2473 | ((void *)0) | - | ||||||||||||||||||||||||
| 2474 | , *session = | - | ||||||||||||||||||||||||
| 2475 | ((void *)0) | - | ||||||||||||||||||||||||
| 2476 | ; | - | ||||||||||||||||||||||||
| 2477 | unsigned char iv[16]; | - | ||||||||||||||||||||||||
| 2478 | unsigned char key_name[16]; | - | ||||||||||||||||||||||||
| 2479 | unsigned char *hmac; | - | ||||||||||||||||||||||||
| 2480 | unsigned int hlen; | - | ||||||||||||||||||||||||
| 2481 | EVP_CIPHER_CTX ctx; | - | ||||||||||||||||||||||||
| 2482 | HMAC_CTX hctx; | - | ||||||||||||||||||||||||
| 2483 | int len; | - | ||||||||||||||||||||||||
| 2484 | - | |||||||||||||||||||||||||
| 2485 | - | |||||||||||||||||||||||||
| 2486 | - | |||||||||||||||||||||||||
| 2487 | - | |||||||||||||||||||||||||
| 2488 | - | |||||||||||||||||||||||||
| 2489 | EVP_CIPHER_CTX_init(&ctx); | - | ||||||||||||||||||||||||
| 2490 | HMAC_CTX_init(&hctx); | - | ||||||||||||||||||||||||
| 2491 | - | |||||||||||||||||||||||||
| 2492 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
| 2493 | - | |||||||||||||||||||||||||
| 2494 | if ((
| 0-59 | ||||||||||||||||||||||||
| 2495 | if (!ssl3_handshake_msg_start(s, &cbb, &session_ticket,
| 0-59 | ||||||||||||||||||||||||
| 2496 | 4)
| 0-59 | ||||||||||||||||||||||||
| 2497 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2498 | - | |||||||||||||||||||||||||
| 2499 | if (!SSL_SESSION_ticket(s->session, &session, &session_len)
| 0-59 | ||||||||||||||||||||||||
| 2500 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2501 | if (session_len > 0xffff
| 0-59 | ||||||||||||||||||||||||
| 2502 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2503 | - | |||||||||||||||||||||||||
| 2504 | - | |||||||||||||||||||||||||
| 2505 | - | |||||||||||||||||||||||||
| 2506 | - | |||||||||||||||||||||||||
| 2507 | - | |||||||||||||||||||||||||
| 2508 | - | |||||||||||||||||||||||||
| 2509 | if (tctx->internal->tlsext_ticket_key_cb !=
| 0-59 | ||||||||||||||||||||||||
| 2510 | ((void *)0)
| 0-59 | ||||||||||||||||||||||||
| 2511 | ) { | - | ||||||||||||||||||||||||
| 2512 | if (tctx->internal->tlsext_ticket_key_cb(s,
| 0 | ||||||||||||||||||||||||
| 2513 | key_name, iv, &ctx, &hctx, 1) < 0
| 0 | ||||||||||||||||||||||||
| 2514 | EVP_CIPHER_CTX_cleanup(&ctx); | - | ||||||||||||||||||||||||
| 2515 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2516 | } | - | ||||||||||||||||||||||||
| 2517 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2518 | arc4random_buf(iv, 16); | - | ||||||||||||||||||||||||
| 2519 | EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), | - | ||||||||||||||||||||||||
| 2520 | ((void *)0) | - | ||||||||||||||||||||||||
| 2521 | , | - | ||||||||||||||||||||||||
| 2522 | tctx->internal->tlsext_tick_aes_key, iv); | - | ||||||||||||||||||||||||
| 2523 | HMAC_Init_ex(&hctx, tctx->internal->tlsext_tick_hmac_key, | - | ||||||||||||||||||||||||
| 2524 | 16, EVP_sha256(), | - | ||||||||||||||||||||||||
| 2525 | ((void *)0) | - | ||||||||||||||||||||||||
| 2526 | ); | - | ||||||||||||||||||||||||
| 2527 | memcpy(key_name, tctx->internal->tlsext_tick_key_name, 16); | - | ||||||||||||||||||||||||
| 2528 | } executed 59 times by 1 test: end of blockExecuted by:
| 59 | ||||||||||||||||||||||||
| 2529 | - | |||||||||||||||||||||||||
| 2530 | - | |||||||||||||||||||||||||
| 2531 | enc_session_max_len = session_len + 32; | - | ||||||||||||||||||||||||
| 2532 | if ((
| 0-59 | ||||||||||||||||||||||||
| 2533 | ((void *)0)
| 0-59 | ||||||||||||||||||||||||
| 2534 | ) | - | ||||||||||||||||||||||||
| 2535 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2536 | enc_session_len = 0; | - | ||||||||||||||||||||||||
| 2537 | if (!EVP_EncryptUpdate(&ctx, enc_session, &len, session,
| 0-59 | ||||||||||||||||||||||||
| 2538 | session_len)
| 0-59 | ||||||||||||||||||||||||
| 2539 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2540 | enc_session_len += len; | - | ||||||||||||||||||||||||
| 2541 | if (!EVP_EncryptFinal_ex(&ctx, enc_session + enc_session_len,
| 0-59 | ||||||||||||||||||||||||
| 2542 | &len)
| 0-59 | ||||||||||||||||||||||||
| 2543 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2544 | enc_session_len += len; | - | ||||||||||||||||||||||||
| 2545 | - | |||||||||||||||||||||||||
| 2546 | if (enc_session_len > enc_session_max_len
| 0-59 | ||||||||||||||||||||||||
| 2547 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2548 | - | |||||||||||||||||||||||||
| 2549 | - | |||||||||||||||||||||||||
| 2550 | if (!HMAC_Update(&hctx, key_name, sizeof(key_name))
| 0-59 | ||||||||||||||||||||||||
| 2551 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2552 | if (!HMAC_Update(&hctx, iv, EVP_CIPHER_CTX_iv_length(&ctx))
| 0-59 | ||||||||||||||||||||||||
| 2553 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2554 | if (!HMAC_Update(&hctx, enc_session, enc_session_len)
| 0-59 | ||||||||||||||||||||||||
| 2555 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2556 | - | |||||||||||||||||||||||||
| 2557 | if ((
| 0-59 | ||||||||||||||||||||||||
| 2558 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2559 | - | |||||||||||||||||||||||||
| 2560 | - | |||||||||||||||||||||||||
| 2561 | - | |||||||||||||||||||||||||
| 2562 | - | |||||||||||||||||||||||||
| 2563 | - | |||||||||||||||||||||||||
| 2564 | - | |||||||||||||||||||||||||
| 2565 | - | |||||||||||||||||||||||||
| 2566 | if (!CBB_add_u32(&session_ticket,
| 0-59 | ||||||||||||||||||||||||
| 2567 | s->internal->hit ? 0 : s->session->timeout)
| 0-59 | ||||||||||||||||||||||||
| 2568 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2569 | - | |||||||||||||||||||||||||
| 2570 | if (!CBB_add_u16_length_prefixed(&session_ticket, &ticket)
| 0-59 | ||||||||||||||||||||||||
| 2571 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2572 | if (!CBB_add_bytes(&ticket, key_name, sizeof(key_name))
| 0-59 | ||||||||||||||||||||||||
| 2573 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2574 | if (!CBB_add_bytes(&ticket, iv, EVP_CIPHER_CTX_iv_length(&ctx))
| 0-59 | ||||||||||||||||||||||||
| 2575 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2576 | if (!CBB_add_bytes(&ticket, enc_session, enc_session_len)
| 0-59 | ||||||||||||||||||||||||
| 2577 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2578 | if (!CBB_add_space(&ticket, &hmac, hmac_len)
| 0-59 | ||||||||||||||||||||||||
| 2579 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2580 | - | |||||||||||||||||||||||||
| 2581 | if (!HMAC_Final(&hctx, hmac, &hlen)
| 0-59 | ||||||||||||||||||||||||
| 2582 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2583 | if (hlen != hmac_len
| 0-59 | ||||||||||||||||||||||||
| 2584 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2585 | - | |||||||||||||||||||||||||
| 2586 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0-59 | ||||||||||||||||||||||||
| 2587 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2588 | - | |||||||||||||||||||||||||
| 2589 | (s->s3->internal)->hs.state = (0x1F1|0x2000); | - | ||||||||||||||||||||||||
| 2590 | } executed 59 times by 1 test: end of blockExecuted by:
| 59 | ||||||||||||||||||||||||
| 2591 | - | |||||||||||||||||||||||||
| 2592 | EVP_CIPHER_CTX_cleanup(&ctx); | - | ||||||||||||||||||||||||
| 2593 | HMAC_CTX_cleanup(&hctx); | - | ||||||||||||||||||||||||
| 2594 | freezero(session, session_len); | - | ||||||||||||||||||||||||
| 2595 | free(enc_session); | - | ||||||||||||||||||||||||
| 2596 | - | |||||||||||||||||||||||||
| 2597 | - | |||||||||||||||||||||||||
| 2598 | return executed 59 times by 1 test: (ssl3_handshake_write(s));return (ssl3_handshake_write(s));Executed by:
executed 59 times by 1 test: return (ssl3_handshake_write(s));Executed by:
| 59 | ||||||||||||||||||||||||
| 2599 | - | |||||||||||||||||||||||||
| 2600 | err: | - | ||||||||||||||||||||||||
| 2601 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
| 2602 | EVP_CIPHER_CTX_cleanup(&ctx); | - | ||||||||||||||||||||||||
| 2603 | HMAC_CTX_cleanup(&hctx); | - | ||||||||||||||||||||||||
| 2604 | freezero(session, session_len); | - | ||||||||||||||||||||||||
| 2605 | free(enc_session); | - | ||||||||||||||||||||||||
| 2606 | - | |||||||||||||||||||||||||
| 2607 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 2608 | } | - | ||||||||||||||||||||||||
| 2609 | - | |||||||||||||||||||||||||
| 2610 | int | - | ||||||||||||||||||||||||
| 2611 | ssl3_send_cert_status(SSL *s) | - | ||||||||||||||||||||||||
| 2612 | { | - | ||||||||||||||||||||||||
| 2613 | CBB cbb, certstatus, ocspresp; | - | ||||||||||||||||||||||||
| 2614 | - | |||||||||||||||||||||||||
| 2615 | memset(&cbb, 0, sizeof(cbb)); | - | ||||||||||||||||||||||||
| 2616 | - | |||||||||||||||||||||||||
| 2617 | if ((
| 0 | ||||||||||||||||||||||||
| 2618 | if (!ssl3_handshake_msg_start(s, &cbb, &certstatus,
| 0 | ||||||||||||||||||||||||
| 2619 | 22)
| 0 | ||||||||||||||||||||||||
| 2620 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2621 | if (!CBB_add_u8(&certstatus, s->tlsext_status_type)
| 0 | ||||||||||||||||||||||||
| 2622 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2623 | if (!CBB_add_u24_length_prefixed(&certstatus, &ocspresp)
| 0 | ||||||||||||||||||||||||
| 2624 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2625 | if (!CBB_add_bytes(&ocspresp, s->internal->tlsext_ocsp_resp,
| 0 | ||||||||||||||||||||||||
| 2626 | s->internal->tlsext_ocsp_resplen)
| 0 | ||||||||||||||||||||||||
| 2627 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2628 | if (!ssl3_handshake_msg_finish(s, &cbb)
| 0 | ||||||||||||||||||||||||
| 2629 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 2630 | - | |||||||||||||||||||||||||
| 2631 | (s->s3->internal)->hs.state = (0x201|0x2000); | - | ||||||||||||||||||||||||
| 2632 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2633 | - | |||||||||||||||||||||||||
| 2634 | - | |||||||||||||||||||||||||
| 2635 | return never executed: (ssl3_handshake_write(s));return (ssl3_handshake_write(s));never executed: return (ssl3_handshake_write(s)); | 0 | ||||||||||||||||||||||||
| 2636 | - | |||||||||||||||||||||||||
| 2637 | err: | - | ||||||||||||||||||||||||
| 2638 | CBB_cleanup(&cbb); | - | ||||||||||||||||||||||||
| 2639 | - | |||||||||||||||||||||||||
| 2640 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||
| 2641 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |