Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/statem/statem_lib.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | typedef struct x509err2alert_st { | - | ||||||||||||||||||||||||||||||||||||
2 | int x509err; | - | ||||||||||||||||||||||||||||||||||||
3 | int alert; | - | ||||||||||||||||||||||||||||||||||||
4 | } X509ERR2ALERT; | - | ||||||||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||||||||||||||
7 | const unsigned char hrrrandom[] = { | - | ||||||||||||||||||||||||||||||||||||
8 | 0xcf, 0x21, 0xad, 0x74, 0xe5, 0x9a, 0x61, 0x11, 0xbe, 0x1d, 0x8c, 0x02, | - | ||||||||||||||||||||||||||||||||||||
9 | 0x1e, 0x65, 0xb8, 0x91, 0xc2, 0xa2, 0x11, 0x16, 0x7a, 0xbb, 0x8c, 0x5e, | - | ||||||||||||||||||||||||||||||||||||
10 | 0x07, 0x9e, 0x09, 0xe2, 0xc8, 0xa8, 0x33, 0x9c | - | ||||||||||||||||||||||||||||||||||||
11 | }; | - | ||||||||||||||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||||||||||||||
17 | int ssl3_do_write(SSL *s, int type) | - | ||||||||||||||||||||||||||||||||||||
18 | { | - | ||||||||||||||||||||||||||||||||||||
19 | int ret; | - | ||||||||||||||||||||||||||||||||||||
20 | size_t written = 0; | - | ||||||||||||||||||||||||||||||||||||
21 | - | |||||||||||||||||||||||||||||||||||||
22 | ret = ssl3_write_bytes(s, type, &s->init_buf->data[s->init_off], | - | ||||||||||||||||||||||||||||||||||||
23 | s->init_num, &written); | - | ||||||||||||||||||||||||||||||||||||
24 | if (ret < 0
| 0-24034 | ||||||||||||||||||||||||||||||||||||
25 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
26 | if (type == 22
| 4316-19718 | ||||||||||||||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||||||||||||||
28 | - | |||||||||||||||||||||||||||||||||||||
29 | - | |||||||||||||||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||||||||||||||
32 | if (!(!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-19718 | ||||||||||||||||||||||||||||||||||||
33 | && s->statem.hand_state != TLS_ST_CW_KEY_UPDATE
| 4-4882 | ||||||||||||||||||||||||||||||||||||
34 | && s->statem.hand_state != TLS_ST_SW_KEY_UPDATE
| 4-4878 | ||||||||||||||||||||||||||||||||||||
35 | if (!ssl3_finish_mac(s,
| 0-18677 | ||||||||||||||||||||||||||||||||||||
36 | (unsigned char *)&s->init_buf->data[s->init_off],
| 0-18677 | ||||||||||||||||||||||||||||||||||||
37 | written)
| 0-18677 | ||||||||||||||||||||||||||||||||||||
38 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
39 | if (written == s->init_num
| 0-24034 | ||||||||||||||||||||||||||||||||||||
40 | if (s->msg_callback
| 0-24034 | ||||||||||||||||||||||||||||||||||||
41 | s->msg_callback(1, s->version, type, s->init_buf->data, never executed: s->msg_callback(1, s->version, type, s->init_buf->data, (size_t)(s->init_off + s->init_num), s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
42 | (size_t)(s->init_off + s->init_num), s, never executed: s->msg_callback(1, s->version, type, s->init_buf->data, (size_t)(s->init_off + s->init_num), s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
43 | s->msg_callback_arg); never executed: s->msg_callback(1, s->version, type, s->init_buf->data, (size_t)(s->init_off + s->init_num), s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
44 | return executed 24034 times by 1 test: 1;return 1; Executed by:
executed 24034 times by 1 test: return 1; Executed by:
| 24034 | ||||||||||||||||||||||||||||||||||||
45 | } | - | ||||||||||||||||||||||||||||||||||||
46 | s->init_off += written; | - | ||||||||||||||||||||||||||||||||||||
47 | s->init_num -= written; | - | ||||||||||||||||||||||||||||||||||||
48 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
49 | } | - | ||||||||||||||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||||||||||||||
51 | int tls_close_construct_packet(SSL *s, WPACKET *pkt, int htype) | - | ||||||||||||||||||||||||||||||||||||
52 | { | - | ||||||||||||||||||||||||||||||||||||
53 | size_t msglen; | - | ||||||||||||||||||||||||||||||||||||
54 | - | |||||||||||||||||||||||||||||||||||||
55 | if ((htype != 0x0101
| 0-19718 | ||||||||||||||||||||||||||||||||||||
56 | || !WPACKET_get_length(pkt, &msglen)
| 0-24034 | ||||||||||||||||||||||||||||||||||||
57 | || msglen > 0x7fffffff
| 0-24034 | ||||||||||||||||||||||||||||||||||||
58 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
59 | s->init_num = (int)msglen; | - | ||||||||||||||||||||||||||||||||||||
60 | s->init_off = 0; | - | ||||||||||||||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||||||||||||||
62 | return executed 24034 times by 1 test: 1;return 1; Executed by:
executed 24034 times by 1 test: return 1; Executed by:
| 24034 | ||||||||||||||||||||||||||||||||||||
63 | } | - | ||||||||||||||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||||||||||||||
65 | int tls_setup_handshake(SSL *s) | - | ||||||||||||||||||||||||||||||||||||
66 | { | - | ||||||||||||||||||||||||||||||||||||
67 | if (!ssl3_init_finished_mac(s)
| 0-8064 | ||||||||||||||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||||||||||||||
69 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
70 | } | - | ||||||||||||||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||||||||||||||
73 | memset(s->ext.extflags, 0, sizeof(s->ext.extflags)); | - | ||||||||||||||||||||||||||||||||||||
74 | - | |||||||||||||||||||||||||||||||||||||
75 | if (s->server
| 3751-4313 | ||||||||||||||||||||||||||||||||||||
76 | struct stack_st_SSL_CIPHER *ciphers = SSL_get_ciphers(s); | - | ||||||||||||||||||||||||||||||||||||
77 | int i, ver_min, ver_max, ok = 0; | - | ||||||||||||||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||||||||||||||
84 | if (ssl_get_min_max_version(s, &ver_min, &ver_max,
| 48-3703 | ||||||||||||||||||||||||||||||||||||
85 | ((void *)0)
| 48-3703 | ||||||||||||||||||||||||||||||||||||
86 | ) != 0
| 48-3703 | ||||||||||||||||||||||||||||||||||||
87 | ossl_statem_fatal((s), (80), (508), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
88 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
89 | , | - | ||||||||||||||||||||||||||||||||||||
90 | 110 | - | ||||||||||||||||||||||||||||||||||||
91 | ) | - | ||||||||||||||||||||||||||||||||||||
92 | ; | - | ||||||||||||||||||||||||||||||||||||
93 | return executed 48 times by 1 test: 0;return 0; Executed by:
executed 48 times by 1 test: return 0; Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||
94 | } | - | ||||||||||||||||||||||||||||||||||||
95 | for (i = 0; i < sk_SSL_CIPHER_num(ciphers)
| 1-10179 | ||||||||||||||||||||||||||||||||||||
96 | const SSL_CIPHER *c = sk_SSL_CIPHER_value(ciphers, i); | - | ||||||||||||||||||||||||||||||||||||
97 | - | |||||||||||||||||||||||||||||||||||||
98 | if ((
| 1234-8945 | ||||||||||||||||||||||||||||||||||||
99 | if (((((
| 0-1234 | ||||||||||||||||||||||||||||||||||||
100 | ((((
| 0-196 | ||||||||||||||||||||||||||||||||||||
101 | ok = 1; executed 196 times by 1 test: ok = 1; Executed by:
| 196 | ||||||||||||||||||||||||||||||||||||
102 | } executed 1234 times by 1 test: else if (ver_max >= c->min_tlsend of block Executed by:
| 1-5438 | ||||||||||||||||||||||||||||||||||||
103 | ok = 1; | - | ||||||||||||||||||||||||||||||||||||
104 | } executed 3506 times by 1 test: end of block Executed by:
| 3506 | ||||||||||||||||||||||||||||||||||||
105 | if (ok
| 3702-6477 | ||||||||||||||||||||||||||||||||||||
106 | break; executed 3702 times by 1 test: break; Executed by:
| 3702 | ||||||||||||||||||||||||||||||||||||
107 | } executed 6477 times by 1 test: end of block Executed by:
| 6477 | ||||||||||||||||||||||||||||||||||||
108 | if (!ok
| 1-3702 | ||||||||||||||||||||||||||||||||||||
109 | ossl_statem_fatal((s), (40), (508), (181), | - | ||||||||||||||||||||||||||||||||||||
110 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
111 | , | - | ||||||||||||||||||||||||||||||||||||
112 | 128 | - | ||||||||||||||||||||||||||||||||||||
113 | ) | - | ||||||||||||||||||||||||||||||||||||
114 | ; | - | ||||||||||||||||||||||||||||||||||||
115 | ERR_add_error_data(1, "No ciphers enabled for max supported " | - | ||||||||||||||||||||||||||||||||||||
116 | "SSL/TLS version"); | - | ||||||||||||||||||||||||||||||||||||
117 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
118 | } | - | ||||||||||||||||||||||||||||||||||||
119 | if (((
| 0-3663 | ||||||||||||||||||||||||||||||||||||
120 | - | |||||||||||||||||||||||||||||||||||||
121 | - | |||||||||||||||||||||||||||||||||||||
122 | __atomic_fetch_add (( | - | ||||||||||||||||||||||||||||||||||||
123 | (&s->session_ctx->stats.sess_accept) | - | ||||||||||||||||||||||||||||||||||||
124 | ), ( | - | ||||||||||||||||||||||||||||||||||||
125 | 1 | - | ||||||||||||||||||||||||||||||||||||
126 | ), ( | - | ||||||||||||||||||||||||||||||||||||
127 | memory_order_relaxed | - | ||||||||||||||||||||||||||||||||||||
128 | )) | - | ||||||||||||||||||||||||||||||||||||
129 | ; | - | ||||||||||||||||||||||||||||||||||||
130 | } executed 3663 times by 1 test: else {end of block Executed by:
| 3663 | ||||||||||||||||||||||||||||||||||||
131 | - | |||||||||||||||||||||||||||||||||||||
132 | - | |||||||||||||||||||||||||||||||||||||
133 | __atomic_fetch_add (( | - | ||||||||||||||||||||||||||||||||||||
134 | (&s->ctx->stats.sess_accept_renegotiate) | - | ||||||||||||||||||||||||||||||||||||
135 | ), ( | - | ||||||||||||||||||||||||||||||||||||
136 | 1 | - | ||||||||||||||||||||||||||||||||||||
137 | ), ( | - | ||||||||||||||||||||||||||||||||||||
138 | memory_order_relaxed | - | ||||||||||||||||||||||||||||||||||||
139 | )) | - | ||||||||||||||||||||||||||||||||||||
140 | ; | - | ||||||||||||||||||||||||||||||||||||
141 | - | |||||||||||||||||||||||||||||||||||||
142 | s->s3->tmp.cert_request = 0; | - | ||||||||||||||||||||||||||||||||||||
143 | } executed 39 times by 1 test: end of block Executed by:
| 39 | ||||||||||||||||||||||||||||||||||||
144 | } else { | - | ||||||||||||||||||||||||||||||||||||
145 | if (((
| 0-4289 | ||||||||||||||||||||||||||||||||||||
146 | - | |||||||||||||||||||||||||||||||||||||
147 | __atomic_fetch_add (( executed 4289 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 4289 | ||||||||||||||||||||||||||||||||||||
148 | (&s->session_ctx->stats.sess_connect) executed 4289 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 4289 | ||||||||||||||||||||||||||||||||||||
149 | ), ( executed 4289 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 4289 | ||||||||||||||||||||||||||||||||||||
150 | 1 executed 4289 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 4289 | ||||||||||||||||||||||||||||||||||||
151 | ), ( executed 4289 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 4289 | ||||||||||||||||||||||||||||||||||||
152 | memory_order_relaxed executed 4289 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 4289 | ||||||||||||||||||||||||||||||||||||
153 | )) executed 4289 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 4289 | ||||||||||||||||||||||||||||||||||||
154 | ; executed 4289 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 4289 | ||||||||||||||||||||||||||||||||||||
155 | else | - | ||||||||||||||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||||||||||||||
157 | __atomic_fetch_add (( executed 24 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect_renegotiate) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||
158 | (&s->session_ctx->stats.sess_connect_renegotiate) executed 24 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect_renegotiate) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||
159 | ), ( executed 24 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect_renegotiate) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||
160 | 1 executed 24 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect_renegotiate) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||
161 | ), ( executed 24 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect_renegotiate) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||
162 | memory_order_relaxed executed 24 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect_renegotiate) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||
163 | )) executed 24 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect_renegotiate) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||
164 | ; executed 24 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_connect_renegotiate) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||
165 | - | |||||||||||||||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||||||||||||||
167 | memset(s->s3->client_random, 0, sizeof(s->s3->client_random)); | - | ||||||||||||||||||||||||||||||||||||
168 | s->hit = 0; | - | ||||||||||||||||||||||||||||||||||||
169 | - | |||||||||||||||||||||||||||||||||||||
170 | s->s3->tmp.cert_req = 0; | - | ||||||||||||||||||||||||||||||||||||
171 | - | |||||||||||||||||||||||||||||||||||||
172 | if ((
| 191-4122 | ||||||||||||||||||||||||||||||||||||
173 | s->statem.use_timer = 1; executed 191 times by 1 test: s->statem.use_timer = 1; Executed by:
| 191 | ||||||||||||||||||||||||||||||||||||
174 | } executed 4313 times by 1 test: end of block Executed by:
| 4313 | ||||||||||||||||||||||||||||||||||||
175 | - | |||||||||||||||||||||||||||||||||||||
176 | return executed 8015 times by 1 test: 1;return 1; Executed by:
executed 8015 times by 1 test: return 1; Executed by:
| 8015 | ||||||||||||||||||||||||||||||||||||
177 | } | - | ||||||||||||||||||||||||||||||||||||
178 | static int get_cert_verify_tbs_data(SSL *s, unsigned char *tls13tbs, | - | ||||||||||||||||||||||||||||||||||||
179 | void **hdata, size_t *hdatalen) | - | ||||||||||||||||||||||||||||||||||||
180 | { | - | ||||||||||||||||||||||||||||||||||||
181 | static const char *servercontext = "TLS 1.3, server CertificateVerify"; | - | ||||||||||||||||||||||||||||||||||||
182 | static const char *clientcontext = "TLS 1.3, client CertificateVerify"; | - | ||||||||||||||||||||||||||||||||||||
183 | - | |||||||||||||||||||||||||||||||||||||
184 | if ((!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-1275 | ||||||||||||||||||||||||||||||||||||
185 | size_t hashlen; | - | ||||||||||||||||||||||||||||||||||||
186 | - | |||||||||||||||||||||||||||||||||||||
187 | - | |||||||||||||||||||||||||||||||||||||
188 | memset(tls13tbs, 32, 64); | - | ||||||||||||||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||||||||||||||
190 | if (s->statem.hand_state == TLS_ST_CR_CERT_VRFY
| 473-773 | ||||||||||||||||||||||||||||||||||||
191 | || s->statem.hand_state == TLS_ST_SW_CERT_VRFY
| 33-740 | ||||||||||||||||||||||||||||||||||||
192 | strcpy((char *)tls13tbs + 64, servercontext); executed 1213 times by 1 test: strcpy((char *)tls13tbs + 64, servercontext); Executed by:
| 1213 | ||||||||||||||||||||||||||||||||||||
193 | else | - | ||||||||||||||||||||||||||||||||||||
194 | strcpy((char *)tls13tbs + 64, clientcontext); executed 33 times by 1 test: strcpy((char *)tls13tbs + 64, clientcontext); Executed by:
| 33 | ||||||||||||||||||||||||||||||||||||
195 | - | |||||||||||||||||||||||||||||||||||||
196 | - | |||||||||||||||||||||||||||||||||||||
197 | - | |||||||||||||||||||||||||||||||||||||
198 | - | |||||||||||||||||||||||||||||||||||||
199 | - | |||||||||||||||||||||||||||||||||||||
200 | - | |||||||||||||||||||||||||||||||||||||
201 | if (s->statem.hand_state == TLS_ST_CR_CERT_VRFY
| 473-773 | ||||||||||||||||||||||||||||||||||||
202 | || s->statem.hand_state == TLS_ST_SR_CERT_VRFY
| 15-758 | ||||||||||||||||||||||||||||||||||||
203 | memcpy(tls13tbs + (64 + 33 + 1), s->cert_verify_hash, | - | ||||||||||||||||||||||||||||||||||||
204 | s->cert_verify_hash_len); | - | ||||||||||||||||||||||||||||||||||||
205 | hashlen = s->cert_verify_hash_len; | - | ||||||||||||||||||||||||||||||||||||
206 | } executed 488 times by 1 test: else if (!ssl_handshake_hash(s, tls13tbs + (64 + 33 + 1),end of block Executed by:
| 0-758 | ||||||||||||||||||||||||||||||||||||
207 | 64, &hashlen)
| 0-758 | ||||||||||||||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||||||||||||||
209 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
210 | } | - | ||||||||||||||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||||||||||||||
212 | *hdata = tls13tbs; | - | ||||||||||||||||||||||||||||||||||||
213 | *hdatalen = (64 + 33 + 1) + hashlen; | - | ||||||||||||||||||||||||||||||||||||
214 | } executed 1246 times by 1 test: else {end of block Executed by:
| 1246 | ||||||||||||||||||||||||||||||||||||
215 | size_t retlen; | - | ||||||||||||||||||||||||||||||||||||
216 | - | |||||||||||||||||||||||||||||||||||||
217 | retlen = BIO_ctrl(s->s3->handshake_buffer,3,0,(char *)(hdata)); | - | ||||||||||||||||||||||||||||||||||||
218 | if (retlen <= 0
| 0-45 | ||||||||||||||||||||||||||||||||||||
219 | ossl_statem_fatal((s), (80), (588), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
220 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
221 | , | - | ||||||||||||||||||||||||||||||||||||
222 | 210 | - | ||||||||||||||||||||||||||||||||||||
223 | ) | - | ||||||||||||||||||||||||||||||||||||
224 | ; | - | ||||||||||||||||||||||||||||||||||||
225 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
226 | } | - | ||||||||||||||||||||||||||||||||||||
227 | *hdatalen = retlen; | - | ||||||||||||||||||||||||||||||||||||
228 | } executed 45 times by 1 test: end of block Executed by:
| 45 | ||||||||||||||||||||||||||||||||||||
229 | - | |||||||||||||||||||||||||||||||||||||
230 | return executed 1291 times by 1 test: 1;return 1; Executed by:
executed 1291 times by 1 test: return 1; Executed by:
| 1291 | ||||||||||||||||||||||||||||||||||||
231 | } | - | ||||||||||||||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||||||||||||||
233 | int tls_construct_cert_verify(SSL *s, WPACKET *pkt) | - | ||||||||||||||||||||||||||||||||||||
234 | { | - | ||||||||||||||||||||||||||||||||||||
235 | EVP_PKEY *pkey = | - | ||||||||||||||||||||||||||||||||||||
236 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
237 | ; | - | ||||||||||||||||||||||||||||||||||||
238 | const EVP_MD *md = | - | ||||||||||||||||||||||||||||||||||||
239 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
240 | ; | - | ||||||||||||||||||||||||||||||||||||
241 | EVP_MD_CTX *mctx = | - | ||||||||||||||||||||||||||||||||||||
242 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
243 | ; | - | ||||||||||||||||||||||||||||||||||||
244 | EVP_PKEY_CTX *pctx = | - | ||||||||||||||||||||||||||||||||||||
245 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
246 | ; | - | ||||||||||||||||||||||||||||||||||||
247 | size_t hdatalen = 0, siglen = 0; | - | ||||||||||||||||||||||||||||||||||||
248 | void *hdata; | - | ||||||||||||||||||||||||||||||||||||
249 | unsigned char *sig = | - | ||||||||||||||||||||||||||||||||||||
250 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
251 | ; | - | ||||||||||||||||||||||||||||||||||||
252 | unsigned char tls13tbs[(64 + 33 + 1) + 64]; | - | ||||||||||||||||||||||||||||||||||||
253 | const SIGALG_LOOKUP *lu = s->s3->tmp.sigalg; | - | ||||||||||||||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||||||||||||||
255 | if (lu ==
| 0-783 | ||||||||||||||||||||||||||||||||||||
256 | ((void *)0)
| 0-783 | ||||||||||||||||||||||||||||||||||||
257 | || s->s3->tmp.cert ==
| 0-783 | ||||||||||||||||||||||||||||||||||||
258 | ((void *)0)
| 0-783 | ||||||||||||||||||||||||||||||||||||
259 | ) { | - | ||||||||||||||||||||||||||||||||||||
260 | ossl_statem_fatal((s), (80), (496), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
261 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
262 | , | - | ||||||||||||||||||||||||||||||||||||
263 | 233 | - | ||||||||||||||||||||||||||||||||||||
264 | ) | - | ||||||||||||||||||||||||||||||||||||
265 | ; | - | ||||||||||||||||||||||||||||||||||||
266 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
267 | } | - | ||||||||||||||||||||||||||||||||||||
268 | pkey = s->s3->tmp.cert->privatekey; | - | ||||||||||||||||||||||||||||||||||||
269 | - | |||||||||||||||||||||||||||||||||||||
270 | if (pkey ==
| 0-783 | ||||||||||||||||||||||||||||||||||||
271 | ((void *)0)
| 0-783 | ||||||||||||||||||||||||||||||||||||
272 | || !tls1_lookup_md(lu, &md)
| 0-783 | ||||||||||||||||||||||||||||||||||||
273 | ossl_statem_fatal((s), (80), (496), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
274 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
275 | , | - | ||||||||||||||||||||||||||||||||||||
276 | 240 | - | ||||||||||||||||||||||||||||||||||||
277 | ) | - | ||||||||||||||||||||||||||||||||||||
278 | ; | - | ||||||||||||||||||||||||||||||||||||
279 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
280 | } | - | ||||||||||||||||||||||||||||||||||||
281 | - | |||||||||||||||||||||||||||||||||||||
282 | mctx = EVP_MD_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||
283 | if (mctx ==
| 0-783 | ||||||||||||||||||||||||||||||||||||
284 | ((void *)0)
| 0-783 | ||||||||||||||||||||||||||||||||||||
285 | ) { | - | ||||||||||||||||||||||||||||||||||||
286 | ossl_statem_fatal((s), (80), (496), ((1|64)), | - | ||||||||||||||||||||||||||||||||||||
287 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
288 | , | - | ||||||||||||||||||||||||||||||||||||
289 | 247 | - | ||||||||||||||||||||||||||||||||||||
290 | ) | - | ||||||||||||||||||||||||||||||||||||
291 | ; | - | ||||||||||||||||||||||||||||||||||||
292 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
293 | } | - | ||||||||||||||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||||||||||||||
295 | - | |||||||||||||||||||||||||||||||||||||
296 | if (!get_cert_verify_tbs_data(s, tls13tbs, &hdata, &hdatalen)
| 0-783 | ||||||||||||||||||||||||||||||||||||
297 | - | |||||||||||||||||||||||||||||||||||||
298 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
299 | } | - | ||||||||||||||||||||||||||||||||||||
300 | - | |||||||||||||||||||||||||||||||||||||
301 | if ((
| 0-774 | ||||||||||||||||||||||||||||||||||||
302 | ossl_statem_fatal((s), (80), (496), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
303 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
304 | , | - | ||||||||||||||||||||||||||||||||||||
305 | 259 | - | ||||||||||||||||||||||||||||||||||||
306 | ) | - | ||||||||||||||||||||||||||||||||||||
307 | ; | - | ||||||||||||||||||||||||||||||||||||
308 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
309 | } | - | ||||||||||||||||||||||||||||||||||||
310 | siglen = EVP_PKEY_size(pkey); | - | ||||||||||||||||||||||||||||||||||||
311 | sig = CRYPTO_malloc(siglen, __FILE__, 263); | - | ||||||||||||||||||||||||||||||||||||
312 | if (sig ==
| 0-783 | ||||||||||||||||||||||||||||||||||||
313 | ((void *)0)
| 0-783 | ||||||||||||||||||||||||||||||||||||
314 | ) { | - | ||||||||||||||||||||||||||||||||||||
315 | ossl_statem_fatal((s), (80), (496), ((1|64)), | - | ||||||||||||||||||||||||||||||||||||
316 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
317 | , | - | ||||||||||||||||||||||||||||||||||||
318 | 266 | - | ||||||||||||||||||||||||||||||||||||
319 | ) | - | ||||||||||||||||||||||||||||||||||||
320 | ; | - | ||||||||||||||||||||||||||||||||||||
321 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
322 | } | - | ||||||||||||||||||||||||||||||||||||
323 | - | |||||||||||||||||||||||||||||||||||||
324 | if (EVP_DigestSignInit(mctx, &pctx, md,
| 0-783 | ||||||||||||||||||||||||||||||||||||
325 | ((void *)0)
| 0-783 | ||||||||||||||||||||||||||||||||||||
326 | , pkey) <= 0
| 0-783 | ||||||||||||||||||||||||||||||||||||
327 | ossl_statem_fatal((s), (80), (496), (6), | - | ||||||||||||||||||||||||||||||||||||
328 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
329 | , | - | ||||||||||||||||||||||||||||||||||||
330 | 272 | - | ||||||||||||||||||||||||||||||||||||
331 | ) | - | ||||||||||||||||||||||||||||||||||||
332 | ; | - | ||||||||||||||||||||||||||||||||||||
333 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
334 | } | - | ||||||||||||||||||||||||||||||||||||
335 | - | |||||||||||||||||||||||||||||||||||||
336 | if (lu->sig == 912
| 190-593 | ||||||||||||||||||||||||||||||||||||
337 | if (RSA_pkey_ctx_ctrl(pctx, -1, (0x1000 + 1), 6,
| 0-593 | ||||||||||||||||||||||||||||||||||||
338 | ((void *)0)
| 0-593 | ||||||||||||||||||||||||||||||||||||
339 | ) <= 0
| 0-593 | ||||||||||||||||||||||||||||||||||||
340 | || RSA_pkey_ctx_ctrl(pctx, ((1<<3)|(1<<4)), (0x1000 + 2), -1,
| 0-593 | ||||||||||||||||||||||||||||||||||||
341 | ((void *)0)
| 0-593 | ||||||||||||||||||||||||||||||||||||
342 | )
| 0-593 | ||||||||||||||||||||||||||||||||||||
343 | <= 0
| 0-593 | ||||||||||||||||||||||||||||||||||||
344 | ossl_statem_fatal((s), (80), (496), (6), | - | ||||||||||||||||||||||||||||||||||||
345 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
346 | , | - | ||||||||||||||||||||||||||||||||||||
347 | 281 | - | ||||||||||||||||||||||||||||||||||||
348 | ) | - | ||||||||||||||||||||||||||||||||||||
349 | ; | - | ||||||||||||||||||||||||||||||||||||
350 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
351 | } | - | ||||||||||||||||||||||||||||||||||||
352 | } executed 593 times by 1 test: end of block Executed by:
| 593 | ||||||||||||||||||||||||||||||||||||
353 | if (s->version == 0x0300
| 0-783 | ||||||||||||||||||||||||||||||||||||
354 | if (EVP_DigestUpdate(mctx,hdata,hdatalen) <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
355 | || !EVP_MD_CTX_ctrl(mctx, 0x1d,
| 0 | ||||||||||||||||||||||||||||||||||||
356 | (int)s->session->master_key_length,
| 0 | ||||||||||||||||||||||||||||||||||||
357 | s->session->master_key)
| 0 | ||||||||||||||||||||||||||||||||||||
358 | || EVP_DigestSignFinal(mctx, sig, &siglen) <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
359 | - | |||||||||||||||||||||||||||||||||||||
360 | ossl_statem_fatal((s), (80), (496), (6), | - | ||||||||||||||||||||||||||||||||||||
361 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
362 | , | - | ||||||||||||||||||||||||||||||||||||
363 | 293 | - | ||||||||||||||||||||||||||||||||||||
364 | ) | - | ||||||||||||||||||||||||||||||||||||
365 | ; | - | ||||||||||||||||||||||||||||||||||||
366 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
367 | } | - | ||||||||||||||||||||||||||||||||||||
368 | } never executed: else if (EVP_DigestSign(mctx, sig, &siglen, hdata, hdatalen) <= 0end of block
| 0-783 | ||||||||||||||||||||||||||||||||||||
369 | ossl_statem_fatal((s), (80), (496), (6), | - | ||||||||||||||||||||||||||||||||||||
370 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
371 | , | - | ||||||||||||||||||||||||||||||||||||
372 | 298 | - | ||||||||||||||||||||||||||||||||||||
373 | ) | - | ||||||||||||||||||||||||||||||||||||
374 | ; | - | ||||||||||||||||||||||||||||||||||||
375 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
376 | } | - | ||||||||||||||||||||||||||||||||||||
377 | - | |||||||||||||||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||||||||||||||
379 | { | - | ||||||||||||||||||||||||||||||||||||
380 | int pktype = lu->sig; | - | ||||||||||||||||||||||||||||||||||||
381 | - | |||||||||||||||||||||||||||||||||||||
382 | if (pktype == 811
| 0-783 | ||||||||||||||||||||||||||||||||||||
383 | || pktype == 979
| 0-783 | ||||||||||||||||||||||||||||||||||||
384 | || pktype == 980
| 0-783 | ||||||||||||||||||||||||||||||||||||
385 | BUF_reverse(sig, never executed: BUF_reverse(sig, ((void *)0) , siglen); | 0 | ||||||||||||||||||||||||||||||||||||
386 | ((void *)0) never executed: BUF_reverse(sig, ((void *)0) , siglen); | 0 | ||||||||||||||||||||||||||||||||||||
387 | , siglen); never executed: BUF_reverse(sig, ((void *)0) , siglen); | 0 | ||||||||||||||||||||||||||||||||||||
388 | } | - | ||||||||||||||||||||||||||||||||||||
389 | - | |||||||||||||||||||||||||||||||||||||
390 | - | |||||||||||||||||||||||||||||||||||||
391 | if (!WPACKET_sub_memcpy__((pkt), (sig), (siglen), 2)
| 0-783 | ||||||||||||||||||||||||||||||||||||
392 | ossl_statem_fatal((s), (80), (496), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
393 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
394 | , | - | ||||||||||||||||||||||||||||||||||||
395 | 315 | - | ||||||||||||||||||||||||||||||||||||
396 | ) | - | ||||||||||||||||||||||||||||||||||||
397 | ; | - | ||||||||||||||||||||||||||||||||||||
398 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
399 | } | - | ||||||||||||||||||||||||||||||||||||
400 | - | |||||||||||||||||||||||||||||||||||||
401 | - | |||||||||||||||||||||||||||||||||||||
402 | if (!ssl3_digest_cached_records(s, 0)
| 0-783 | ||||||||||||||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||||||||||||||
404 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
405 | } | - | ||||||||||||||||||||||||||||||||||||
406 | - | |||||||||||||||||||||||||||||||||||||
407 | CRYPTO_free(sig, __FILE__, 325); | - | ||||||||||||||||||||||||||||||||||||
408 | EVP_MD_CTX_free(mctx); | - | ||||||||||||||||||||||||||||||||||||
409 | return executed 783 times by 1 test: 1;return 1; Executed by:
executed 783 times by 1 test: return 1; Executed by:
| 783 | ||||||||||||||||||||||||||||||||||||
410 | err: | - | ||||||||||||||||||||||||||||||||||||
411 | CRYPTO_free(sig, __FILE__, 329); | - | ||||||||||||||||||||||||||||||||||||
412 | EVP_MD_CTX_free(mctx); | - | ||||||||||||||||||||||||||||||||||||
413 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
414 | } | - | ||||||||||||||||||||||||||||||||||||
415 | - | |||||||||||||||||||||||||||||||||||||
416 | MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) | - | ||||||||||||||||||||||||||||||||||||
417 | { | - | ||||||||||||||||||||||||||||||||||||
418 | EVP_PKEY *pkey = | - | ||||||||||||||||||||||||||||||||||||
419 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
420 | ; | - | ||||||||||||||||||||||||||||||||||||
421 | const unsigned char *data; | - | ||||||||||||||||||||||||||||||||||||
422 | - | |||||||||||||||||||||||||||||||||||||
423 | unsigned char *gost_data = | - | ||||||||||||||||||||||||||||||||||||
424 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
425 | ; | - | ||||||||||||||||||||||||||||||||||||
426 | - | |||||||||||||||||||||||||||||||||||||
427 | MSG_PROCESS_RETURN ret = MSG_PROCESS_ERROR; | - | ||||||||||||||||||||||||||||||||||||
428 | int j; | - | ||||||||||||||||||||||||||||||||||||
429 | unsigned int len; | - | ||||||||||||||||||||||||||||||||||||
430 | X509 *peer; | - | ||||||||||||||||||||||||||||||||||||
431 | const EVP_MD *md = | - | ||||||||||||||||||||||||||||||||||||
432 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
433 | ; | - | ||||||||||||||||||||||||||||||||||||
434 | size_t hdatalen = 0; | - | ||||||||||||||||||||||||||||||||||||
435 | void *hdata; | - | ||||||||||||||||||||||||||||||||||||
436 | unsigned char tls13tbs[(64 + 33 + 1) + 64]; | - | ||||||||||||||||||||||||||||||||||||
437 | EVP_MD_CTX *mctx = EVP_MD_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||
438 | EVP_PKEY_CTX *pctx = | - | ||||||||||||||||||||||||||||||||||||
439 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
440 | ; | - | ||||||||||||||||||||||||||||||||||||
441 | - | |||||||||||||||||||||||||||||||||||||
442 | if (mctx ==
| 0-509 | ||||||||||||||||||||||||||||||||||||
443 | ((void *)0)
| 0-509 | ||||||||||||||||||||||||||||||||||||
444 | ) { | - | ||||||||||||||||||||||||||||||||||||
445 | ossl_statem_fatal((s), (80), (379), ((1|64)), | - | ||||||||||||||||||||||||||||||||||||
446 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
447 | , | - | ||||||||||||||||||||||||||||||||||||
448 | 354 | - | ||||||||||||||||||||||||||||||||||||
449 | ) | - | ||||||||||||||||||||||||||||||||||||
450 | ; | - | ||||||||||||||||||||||||||||||||||||
451 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
452 | } | - | ||||||||||||||||||||||||||||||||||||
453 | - | |||||||||||||||||||||||||||||||||||||
454 | peer = s->session->peer; | - | ||||||||||||||||||||||||||||||||||||
455 | pkey = X509_get0_pubkey(peer); | - | ||||||||||||||||||||||||||||||||||||
456 | if (pkey ==
| 0-509 | ||||||||||||||||||||||||||||||||||||
457 | ((void *)0)
| 0-509 | ||||||||||||||||||||||||||||||||||||
458 | ) { | - | ||||||||||||||||||||||||||||||||||||
459 | ossl_statem_fatal((s), (80), (379), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
460 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
461 | , | - | ||||||||||||||||||||||||||||||||||||
462 | 362 | - | ||||||||||||||||||||||||||||||||||||
463 | ) | - | ||||||||||||||||||||||||||||||||||||
464 | ; | - | ||||||||||||||||||||||||||||||||||||
465 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
466 | } | - | ||||||||||||||||||||||||||||||||||||
467 | - | |||||||||||||||||||||||||||||||||||||
468 | if (ssl_cert_lookup_by_pkey(pkey,
| 0-509 | ||||||||||||||||||||||||||||||||||||
469 | ((void *)0)
| 0-509 | ||||||||||||||||||||||||||||||||||||
470 | ) ==
| 0-509 | ||||||||||||||||||||||||||||||||||||
471 | ((void *)0)
| 0-509 | ||||||||||||||||||||||||||||||||||||
472 | ) { | - | ||||||||||||||||||||||||||||||||||||
473 | ossl_statem_fatal((s), (47), (379), (220), | - | ||||||||||||||||||||||||||||||||||||
474 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
475 | , | - | ||||||||||||||||||||||||||||||||||||
476 | 368 | - | ||||||||||||||||||||||||||||||||||||
477 | ) | - | ||||||||||||||||||||||||||||||||||||
478 | ; | - | ||||||||||||||||||||||||||||||||||||
479 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
480 | } | - | ||||||||||||||||||||||||||||||||||||
481 | - | |||||||||||||||||||||||||||||||||||||
482 | if ((
| 6-503 | ||||||||||||||||||||||||||||||||||||
483 | unsigned int sigalg; | - | ||||||||||||||||||||||||||||||||||||
484 | - | |||||||||||||||||||||||||||||||||||||
485 | if (!PACKET_get_net_2(pkt, &sigalg)
| 0-503 | ||||||||||||||||||||||||||||||||||||
486 | ossl_statem_fatal((s), (50), (379), (240), | - | ||||||||||||||||||||||||||||||||||||
487 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
488 | , | - | ||||||||||||||||||||||||||||||||||||
489 | 377 | - | ||||||||||||||||||||||||||||||||||||
490 | ) | - | ||||||||||||||||||||||||||||||||||||
491 | ; | - | ||||||||||||||||||||||||||||||||||||
492 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
493 | } | - | ||||||||||||||||||||||||||||||||||||
494 | if (tls12_check_peer_sigalg(s, sigalg, pkey) <= 0
| 1-502 | ||||||||||||||||||||||||||||||||||||
495 | - | |||||||||||||||||||||||||||||||||||||
496 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
497 | } | - | ||||||||||||||||||||||||||||||||||||
498 | } executed 502 times by 1 test: else if (!tls1_set_peer_legacy_sigalg(s, pkey)end of block Executed by:
| 0-502 | ||||||||||||||||||||||||||||||||||||
499 | ossl_statem_fatal((s), (80), (379), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
500 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
501 | , | - | ||||||||||||||||||||||||||||||||||||
502 | 386 | - | ||||||||||||||||||||||||||||||||||||
503 | ) | - | ||||||||||||||||||||||||||||||||||||
504 | ; | - | ||||||||||||||||||||||||||||||||||||
505 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
506 | } | - | ||||||||||||||||||||||||||||||||||||
507 | - | |||||||||||||||||||||||||||||||||||||
508 | if (!tls1_lookup_md(s->s3->tmp.peer_sigalg, &md)
| 0-508 | ||||||||||||||||||||||||||||||||||||
509 | ossl_statem_fatal((s), (80), (379), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
510 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
511 | , | - | ||||||||||||||||||||||||||||||||||||
512 | 392 | - | ||||||||||||||||||||||||||||||||||||
513 | ) | - | ||||||||||||||||||||||||||||||||||||
514 | ; | - | ||||||||||||||||||||||||||||||||||||
515 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
516 | } | - | ||||||||||||||||||||||||||||||||||||
517 | if (!(s->method->ssl3_enc->enc_flags & 0x2)
| 6-502 | ||||||||||||||||||||||||||||||||||||
518 | && ((PACKET_remaining(pkt) == 64
| 0-6 | ||||||||||||||||||||||||||||||||||||
519 | && (EVP_PKEY_id(pkey) == 811
| 0 | ||||||||||||||||||||||||||||||||||||
520 | || EVP_PKEY_id(pkey) == 979
| 0 | ||||||||||||||||||||||||||||||||||||
521 | || (PACKET_remaining(pkt) == 128
| 0-6 | ||||||||||||||||||||||||||||||||||||
522 | && EVP_PKEY_id(pkey) == 980
| 0 | ||||||||||||||||||||||||||||||||||||
523 | len = PACKET_remaining(pkt); | - | ||||||||||||||||||||||||||||||||||||
524 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||||||||||||||
525 | - | |||||||||||||||||||||||||||||||||||||
526 | if (!PACKET_get_net_2(pkt, &len)
| 0-508 | ||||||||||||||||||||||||||||||||||||
527 | ossl_statem_fatal((s), (50), (379), (159), | - | ||||||||||||||||||||||||||||||||||||
528 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
529 | , | - | ||||||||||||||||||||||||||||||||||||
530 | 418 | - | ||||||||||||||||||||||||||||||||||||
531 | ) | - | ||||||||||||||||||||||||||||||||||||
532 | ; | - | ||||||||||||||||||||||||||||||||||||
533 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
534 | } | - | ||||||||||||||||||||||||||||||||||||
535 | - | |||||||||||||||||||||||||||||||||||||
536 | j = EVP_PKEY_size(pkey); | - | ||||||||||||||||||||||||||||||||||||
537 | if (((
| 0-508 | ||||||||||||||||||||||||||||||||||||
538 | || (
| 0-508 | ||||||||||||||||||||||||||||||||||||
539 | ossl_statem_fatal((s), (50), (379), (265), | - | ||||||||||||||||||||||||||||||||||||
540 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
541 | , | - | ||||||||||||||||||||||||||||||||||||
542 | 426 | - | ||||||||||||||||||||||||||||||||||||
543 | ) | - | ||||||||||||||||||||||||||||||||||||
544 | ; | - | ||||||||||||||||||||||||||||||||||||
545 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
546 | } | - | ||||||||||||||||||||||||||||||||||||
547 | if (!PACKET_get_bytes(pkt, &data, len)
| 0-508 | ||||||||||||||||||||||||||||||||||||
548 | ossl_statem_fatal((s), (50), (379), (159), | - | ||||||||||||||||||||||||||||||||||||
549 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
550 | , | - | ||||||||||||||||||||||||||||||||||||
551 | 431 | - | ||||||||||||||||||||||||||||||||||||
552 | ) | - | ||||||||||||||||||||||||||||||||||||
553 | ; | - | ||||||||||||||||||||||||||||||||||||
554 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
555 | } | - | ||||||||||||||||||||||||||||||||||||
556 | - | |||||||||||||||||||||||||||||||||||||
557 | if (!get_cert_verify_tbs_data(s, tls13tbs, &hdata, &hdatalen)
| 0-508 | ||||||||||||||||||||||||||||||||||||
558 | - | |||||||||||||||||||||||||||||||||||||
559 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
560 | } | - | ||||||||||||||||||||||||||||||||||||
561 | - | |||||||||||||||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||||||||||||||
564 | - | |||||||||||||||||||||||||||||||||||||
565 | if (EVP_DigestVerifyInit(mctx, &pctx, md,
| 0-508 | ||||||||||||||||||||||||||||||||||||
566 | ((void *)0)
| 0-508 | ||||||||||||||||||||||||||||||||||||
567 | , pkey) <= 0
| 0-508 | ||||||||||||||||||||||||||||||||||||
568 | ossl_statem_fatal((s), (80), (379), (6), | - | ||||||||||||||||||||||||||||||||||||
569 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
570 | , | - | ||||||||||||||||||||||||||||||||||||
571 | 445 | - | ||||||||||||||||||||||||||||||||||||
572 | ) | - | ||||||||||||||||||||||||||||||||||||
573 | ; | - | ||||||||||||||||||||||||||||||||||||
574 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
575 | } | - | ||||||||||||||||||||||||||||||||||||
576 | - | |||||||||||||||||||||||||||||||||||||
577 | { | - | ||||||||||||||||||||||||||||||||||||
578 | int pktype = EVP_PKEY_id(pkey); | - | ||||||||||||||||||||||||||||||||||||
579 | if (pktype == 811
| 0-508 | ||||||||||||||||||||||||||||||||||||
580 | || pktype == 979
| 0-508 | ||||||||||||||||||||||||||||||||||||
581 | || pktype == 980
| 0-508 | ||||||||||||||||||||||||||||||||||||
582 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||
583 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
584 | ) { | - | ||||||||||||||||||||||||||||||||||||
585 | ossl_statem_fatal((s), (80), (379), ((1|64)), | - | ||||||||||||||||||||||||||||||||||||
586 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
587 | , | - | ||||||||||||||||||||||||||||||||||||
588 | 456 | - | ||||||||||||||||||||||||||||||||||||
589 | ) | - | ||||||||||||||||||||||||||||||||||||
590 | ; | - | ||||||||||||||||||||||||||||||||||||
591 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
592 | } | - | ||||||||||||||||||||||||||||||||||||
593 | BUF_reverse(gost_data, data, len); | - | ||||||||||||||||||||||||||||||||||||
594 | data = gost_data; | - | ||||||||||||||||||||||||||||||||||||
595 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
596 | } | - | ||||||||||||||||||||||||||||||||||||
597 | - | |||||||||||||||||||||||||||||||||||||
598 | - | |||||||||||||||||||||||||||||||||||||
599 | if ((s->s3->tmp.peer_sigalg !=
| 0-508 | ||||||||||||||||||||||||||||||||||||
600 | ((void *)0)
| 0-508 | ||||||||||||||||||||||||||||||||||||
601 | && s->s3->tmp.peer_sigalg->sig == 912
| 23-485 | ||||||||||||||||||||||||||||||||||||
602 | if (RSA_pkey_ctx_ctrl(pctx, -1, (0x1000 + 1), 6,
| 0-485 | ||||||||||||||||||||||||||||||||||||
603 | ((void *)0)
| 0-485 | ||||||||||||||||||||||||||||||||||||
604 | ) <= 0
| 0-485 | ||||||||||||||||||||||||||||||||||||
605 | || RSA_pkey_ctx_ctrl(pctx, ((1<<3)|(1<<4)), (0x1000 + 2), -1,
| 0-485 | ||||||||||||||||||||||||||||||||||||
606 | ((void *)0)
| 0-485 | ||||||||||||||||||||||||||||||||||||
607 | )
| 0-485 | ||||||||||||||||||||||||||||||||||||
608 | <= 0
| 0-485 | ||||||||||||||||||||||||||||||||||||
609 | ossl_statem_fatal((s), (80), (379), (6), | - | ||||||||||||||||||||||||||||||||||||
610 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
611 | , | - | ||||||||||||||||||||||||||||||||||||
612 | 470 | - | ||||||||||||||||||||||||||||||||||||
613 | ) | - | ||||||||||||||||||||||||||||||||||||
614 | ; | - | ||||||||||||||||||||||||||||||||||||
615 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
616 | } | - | ||||||||||||||||||||||||||||||||||||
617 | } executed 485 times by 1 test: end of block Executed by:
| 485 | ||||||||||||||||||||||||||||||||||||
618 | if (s->version == 0x0300
| 0-508 | ||||||||||||||||||||||||||||||||||||
619 | if (EVP_DigestUpdate(mctx,hdata,hdatalen) <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
620 | || !EVP_MD_CTX_ctrl(mctx, 0x1d,
| 0 | ||||||||||||||||||||||||||||||||||||
621 | (int)s->session->master_key_length,
| 0 | ||||||||||||||||||||||||||||||||||||
622 | s->session->master_key)
| 0 | ||||||||||||||||||||||||||||||||||||
623 | ossl_statem_fatal((s), (80), (379), (6), | - | ||||||||||||||||||||||||||||||||||||
624 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
625 | , | - | ||||||||||||||||||||||||||||||||||||
626 | 480 | - | ||||||||||||||||||||||||||||||||||||
627 | ) | - | ||||||||||||||||||||||||||||||||||||
628 | ; | - | ||||||||||||||||||||||||||||||||||||
629 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
630 | } | - | ||||||||||||||||||||||||||||||||||||
631 | if (EVP_DigestVerifyFinal(mctx, data, len) <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
632 | ossl_statem_fatal((s), (51), (379), (123), | - | ||||||||||||||||||||||||||||||||||||
633 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
634 | , | - | ||||||||||||||||||||||||||||||||||||
635 | 485 | - | ||||||||||||||||||||||||||||||||||||
636 | ) | - | ||||||||||||||||||||||||||||||||||||
637 | ; | - | ||||||||||||||||||||||||||||||||||||
638 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
639 | } | - | ||||||||||||||||||||||||||||||||||||
640 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
641 | j = EVP_DigestVerify(mctx, data, len, hdata, hdatalen); | - | ||||||||||||||||||||||||||||||||||||
642 | if (j <= 0
| 2-506 | ||||||||||||||||||||||||||||||||||||
643 | ossl_statem_fatal((s), (51), (379), (123), | - | ||||||||||||||||||||||||||||||||||||
644 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
645 | , | - | ||||||||||||||||||||||||||||||||||||
646 | 492 | - | ||||||||||||||||||||||||||||||||||||
647 | ) | - | ||||||||||||||||||||||||||||||||||||
648 | ; | - | ||||||||||||||||||||||||||||||||||||
649 | goto executed 2 times by 1 test: err;goto err; Executed by:
executed 2 times by 1 test: goto err; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
650 | } | - | ||||||||||||||||||||||||||||||||||||
651 | } executed 506 times by 1 test: end of block Executed by:
| 506 | ||||||||||||||||||||||||||||||||||||
652 | - | |||||||||||||||||||||||||||||||||||||
653 | ret = MSG_PROCESS_CONTINUE_READING; | - | ||||||||||||||||||||||||||||||||||||
654 | err: code before this statement executed 506 times by 1 test: err: Executed by:
| 506 | ||||||||||||||||||||||||||||||||||||
655 | BIO_free(s->s3->handshake_buffer); | - | ||||||||||||||||||||||||||||||||||||
656 | s->s3->handshake_buffer = | - | ||||||||||||||||||||||||||||||||||||
657 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
658 | ; | - | ||||||||||||||||||||||||||||||||||||
659 | EVP_MD_CTX_free(mctx); | - | ||||||||||||||||||||||||||||||||||||
660 | - | |||||||||||||||||||||||||||||||||||||
661 | CRYPTO_free(gost_data, __FILE__, 503); | - | ||||||||||||||||||||||||||||||||||||
662 | - | |||||||||||||||||||||||||||||||||||||
663 | return executed 509 times by 1 test: ret;return ret; Executed by:
executed 509 times by 1 test: return ret; Executed by:
| 509 | ||||||||||||||||||||||||||||||||||||
664 | } | - | ||||||||||||||||||||||||||||||||||||
665 | - | |||||||||||||||||||||||||||||||||||||
666 | int tls_construct_finished(SSL *s, WPACKET *pkt) | - | ||||||||||||||||||||||||||||||||||||
667 | { | - | ||||||||||||||||||||||||||||||||||||
668 | size_t finish_md_len; | - | ||||||||||||||||||||||||||||||||||||
669 | const char *sender; | - | ||||||||||||||||||||||||||||||||||||
670 | size_t slen; | - | ||||||||||||||||||||||||||||||||||||
671 | - | |||||||||||||||||||||||||||||||||||||
672 | - | |||||||||||||||||||||||||||||||||||||
673 | if (!s->server
| 25-2054 | ||||||||||||||||||||||||||||||||||||
674 | s->statem.cleanuphand = 1; executed 2029 times by 1 test: s->statem.cleanuphand = 1; Executed by:
| 2029 | ||||||||||||||||||||||||||||||||||||
675 | - | |||||||||||||||||||||||||||||||||||||
676 | - | |||||||||||||||||||||||||||||||||||||
677 | - | |||||||||||||||||||||||||||||||||||||
678 | - | |||||||||||||||||||||||||||||||||||||
679 | - | |||||||||||||||||||||||||||||||||||||
680 | if ((!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-3614 | ||||||||||||||||||||||||||||||||||||
681 | && !s->server
| 598-853 | ||||||||||||||||||||||||||||||||||||
682 | && s->s3->tmp.cert_req == 0
| 43-555 | ||||||||||||||||||||||||||||||||||||
683 | && (
| 0-555 | ||||||||||||||||||||||||||||||||||||
684 | 0x080 | (0x010|0x002)))
| 0-555 | ||||||||||||||||||||||||||||||||||||
685 | - | |||||||||||||||||||||||||||||||||||||
686 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
687 | } | - | ||||||||||||||||||||||||||||||||||||
688 | - | |||||||||||||||||||||||||||||||||||||
689 | if (s->server
| 1919-2054 | ||||||||||||||||||||||||||||||||||||
690 | sender = s->method->ssl3_enc->server_finished_label; | - | ||||||||||||||||||||||||||||||||||||
691 | slen = s->method->ssl3_enc->server_finished_label_len; | - | ||||||||||||||||||||||||||||||||||||
692 | } executed 1919 times by 1 test: else {end of block Executed by:
| 1919 | ||||||||||||||||||||||||||||||||||||
693 | sender = s->method->ssl3_enc->client_finished_label; | - | ||||||||||||||||||||||||||||||||||||
694 | slen = s->method->ssl3_enc->client_finished_label_len; | - | ||||||||||||||||||||||||||||||||||||
695 | } executed 2054 times by 1 test: end of block Executed by:
| 2054 | ||||||||||||||||||||||||||||||||||||
696 | - | |||||||||||||||||||||||||||||||||||||
697 | finish_md_len = s->method->ssl3_enc->final_finish_mac(s, | - | ||||||||||||||||||||||||||||||||||||
698 | sender, slen, | - | ||||||||||||||||||||||||||||||||||||
699 | s->s3->tmp.finish_md); | - | ||||||||||||||||||||||||||||||||||||
700 | if (finish_md_len == 0
| 0-3973 | ||||||||||||||||||||||||||||||||||||
701 | - | |||||||||||||||||||||||||||||||||||||
702 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
703 | } | - | ||||||||||||||||||||||||||||||||||||
704 | - | |||||||||||||||||||||||||||||||||||||
705 | s->s3->tmp.finish_md_len = finish_md_len; | - | ||||||||||||||||||||||||||||||||||||
706 | - | |||||||||||||||||||||||||||||||||||||
707 | if (!WPACKET_memcpy(pkt, s->s3->tmp.finish_md, finish_md_len)
| 0-3973 | ||||||||||||||||||||||||||||||||||||
708 | ossl_statem_fatal((s), (80), (359), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
709 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
710 | , | - | ||||||||||||||||||||||||||||||||||||
711 | 551 | - | ||||||||||||||||||||||||||||||||||||
712 | ) | - | ||||||||||||||||||||||||||||||||||||
713 | ; | - | ||||||||||||||||||||||||||||||||||||
714 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
715 | } | - | ||||||||||||||||||||||||||||||||||||
716 | - | |||||||||||||||||||||||||||||||||||||
717 | - | |||||||||||||||||||||||||||||||||||||
718 | - | |||||||||||||||||||||||||||||||||||||
719 | - | |||||||||||||||||||||||||||||||||||||
720 | - | |||||||||||||||||||||||||||||||||||||
721 | if (!(!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-3614 | ||||||||||||||||||||||||||||||||||||
722 | s->session->master_key,
| 0-2522 | ||||||||||||||||||||||||||||||||||||
723 | s->session->master_key_length)
| 0-2522 | ||||||||||||||||||||||||||||||||||||
724 | - | |||||||||||||||||||||||||||||||||||||
725 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
726 | } | - | ||||||||||||||||||||||||||||||||||||
727 | - | |||||||||||||||||||||||||||||||||||||
728 | - | |||||||||||||||||||||||||||||||||||||
729 | - | |||||||||||||||||||||||||||||||||||||
730 | - | |||||||||||||||||||||||||||||||||||||
731 | if (!((finish_md_len <= 64) != 0)
| 0-3973 | ||||||||||||||||||||||||||||||||||||
732 | ossl_statem_fatal((s), (80), (359), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
733 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
734 | , | - | ||||||||||||||||||||||||||||||||||||
735 | 571 | - | ||||||||||||||||||||||||||||||||||||
736 | ) | - | ||||||||||||||||||||||||||||||||||||
737 | ; | - | ||||||||||||||||||||||||||||||||||||
738 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
739 | } | - | ||||||||||||||||||||||||||||||||||||
740 | if (!s->server
| 1919-2054 | ||||||||||||||||||||||||||||||||||||
741 | memcpy(s->s3->previous_client_finished, s->s3->tmp.finish_md, | - | ||||||||||||||||||||||||||||||||||||
742 | finish_md_len); | - | ||||||||||||||||||||||||||||||||||||
743 | s->s3->previous_client_finished_len = finish_md_len; | - | ||||||||||||||||||||||||||||||||||||
744 | } executed 2054 times by 1 test: else {end of block Executed by:
| 2054 | ||||||||||||||||||||||||||||||||||||
745 | memcpy(s->s3->previous_server_finished, s->s3->tmp.finish_md, | - | ||||||||||||||||||||||||||||||||||||
746 | finish_md_len); | - | ||||||||||||||||||||||||||||||||||||
747 | s->s3->previous_server_finished_len = finish_md_len; | - | ||||||||||||||||||||||||||||||||||||
748 | } executed 1919 times by 1 test: end of block Executed by:
| 1919 | ||||||||||||||||||||||||||||||||||||
749 | - | |||||||||||||||||||||||||||||||||||||
750 | return executed 3973 times by 1 test: 1;return 1; Executed by:
executed 3973 times by 1 test: return 1; Executed by:
| 3973 | ||||||||||||||||||||||||||||||||||||
751 | } | - | ||||||||||||||||||||||||||||||||||||
752 | - | |||||||||||||||||||||||||||||||||||||
753 | int tls_construct_key_update(SSL *s, WPACKET *pkt) | - | ||||||||||||||||||||||||||||||||||||
754 | { | - | ||||||||||||||||||||||||||||||||||||
755 | if (!WPACKET_put_bytes__((pkt), (s->key_update), 1)
| 0-8 | ||||||||||||||||||||||||||||||||||||
756 | ossl_statem_fatal((s), (80), (517), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
757 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
758 | , | - | ||||||||||||||||||||||||||||||||||||
759 | 591 | - | ||||||||||||||||||||||||||||||||||||
760 | ) | - | ||||||||||||||||||||||||||||||||||||
761 | ; | - | ||||||||||||||||||||||||||||||||||||
762 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
763 | } | - | ||||||||||||||||||||||||||||||||||||
764 | - | |||||||||||||||||||||||||||||||||||||
765 | s->key_update = -1; | - | ||||||||||||||||||||||||||||||||||||
766 | return executed 8 times by 1 test: 1;return 1; Executed by:
executed 8 times by 1 test: return 1; Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||
767 | } | - | ||||||||||||||||||||||||||||||||||||
768 | - | |||||||||||||||||||||||||||||||||||||
769 | MSG_PROCESS_RETURN tls_process_key_update(SSL *s, PACKET *pkt) | - | ||||||||||||||||||||||||||||||||||||
770 | { | - | ||||||||||||||||||||||||||||||||||||
771 | unsigned int updatetype; | - | ||||||||||||||||||||||||||||||||||||
772 | - | |||||||||||||||||||||||||||||||||||||
773 | s->key_update_count++; | - | ||||||||||||||||||||||||||||||||||||
774 | if (s->key_update_count > 32
| 0-8 | ||||||||||||||||||||||||||||||||||||
775 | ossl_statem_fatal((s), (47), (518), (132), | - | ||||||||||||||||||||||||||||||||||||
776 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
777 | , | - | ||||||||||||||||||||||||||||||||||||
778 | 606 | - | ||||||||||||||||||||||||||||||||||||
779 | ) | - | ||||||||||||||||||||||||||||||||||||
780 | ; | - | ||||||||||||||||||||||||||||||||||||
781 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
782 | } | - | ||||||||||||||||||||||||||||||||||||
783 | - | |||||||||||||||||||||||||||||||||||||
784 | - | |||||||||||||||||||||||||||||||||||||
785 | - | |||||||||||||||||||||||||||||||||||||
786 | - | |||||||||||||||||||||||||||||||||||||
787 | - | |||||||||||||||||||||||||||||||||||||
788 | if (RECORD_LAYER_processed_read_pending(&s->rlayer)
| 1-7 | ||||||||||||||||||||||||||||||||||||
789 | ossl_statem_fatal((s), (10), (518), (182), | - | ||||||||||||||||||||||||||||||||||||
790 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
791 | , | - | ||||||||||||||||||||||||||||||||||||
792 | 616 | - | ||||||||||||||||||||||||||||||||||||
793 | ) | - | ||||||||||||||||||||||||||||||||||||
794 | ; | - | ||||||||||||||||||||||||||||||||||||
795 | return executed 1 time by 1 test: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; Executed by:
executed 1 time by 1 test: return MSG_PROCESS_ERROR; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
796 | } | - | ||||||||||||||||||||||||||||||||||||
797 | - | |||||||||||||||||||||||||||||||||||||
798 | if (!PACKET_get_1(pkt, &updatetype)
| 0-7 | ||||||||||||||||||||||||||||||||||||
799 | || PACKET_remaining(pkt) != 0
| 0-7 | ||||||||||||||||||||||||||||||||||||
800 | ossl_statem_fatal((s), (50), (518), (122), | - | ||||||||||||||||||||||||||||||||||||
801 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
802 | , | - | ||||||||||||||||||||||||||||||||||||
803 | 623 | - | ||||||||||||||||||||||||||||||||||||
804 | ) | - | ||||||||||||||||||||||||||||||||||||
805 | ; | - | ||||||||||||||||||||||||||||||||||||
806 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
807 | } | - | ||||||||||||||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||||||||||||||
809 | - | |||||||||||||||||||||||||||||||||||||
810 | - | |||||||||||||||||||||||||||||||||||||
811 | - | |||||||||||||||||||||||||||||||||||||
812 | - | |||||||||||||||||||||||||||||||||||||
813 | if (updatetype != 0
| 3-4 | ||||||||||||||||||||||||||||||||||||
814 | && updatetype != 1
| 0-3 | ||||||||||||||||||||||||||||||||||||
815 | ossl_statem_fatal((s), (47), (518), (122), | - | ||||||||||||||||||||||||||||||||||||
816 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
817 | , | - | ||||||||||||||||||||||||||||||||||||
818 | 634 | - | ||||||||||||||||||||||||||||||||||||
819 | ) | - | ||||||||||||||||||||||||||||||||||||
820 | ; | - | ||||||||||||||||||||||||||||||||||||
821 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
822 | } | - | ||||||||||||||||||||||||||||||||||||
823 | if (updatetype == 1
| 3-4 | ||||||||||||||||||||||||||||||||||||
824 | && (
| 1-2 | ||||||||||||||||||||||||||||||||||||
825 | s->key_update = 0; executed 2 times by 1 test: s->key_update = 0; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
826 | - | |||||||||||||||||||||||||||||||||||||
827 | if (!tls13_update_key(s, 0)
| 0-7 | ||||||||||||||||||||||||||||||||||||
828 | - | |||||||||||||||||||||||||||||||||||||
829 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
830 | } | - | ||||||||||||||||||||||||||||||||||||
831 | - | |||||||||||||||||||||||||||||||||||||
832 | return executed 7 times by 1 test: MSG_PROCESS_FINISHED_READING;return MSG_PROCESS_FINISHED_READING; Executed by:
executed 7 times by 1 test: return MSG_PROCESS_FINISHED_READING; Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||
833 | } | - | ||||||||||||||||||||||||||||||||||||
834 | - | |||||||||||||||||||||||||||||||||||||
835 | - | |||||||||||||||||||||||||||||||||||||
836 | - | |||||||||||||||||||||||||||||||||||||
837 | - | |||||||||||||||||||||||||||||||||||||
838 | - | |||||||||||||||||||||||||||||||||||||
839 | int ssl3_take_mac(SSL *s) | - | ||||||||||||||||||||||||||||||||||||
840 | { | - | ||||||||||||||||||||||||||||||||||||
841 | const char *sender; | - | ||||||||||||||||||||||||||||||||||||
842 | size_t slen; | - | ||||||||||||||||||||||||||||||||||||
843 | - | |||||||||||||||||||||||||||||||||||||
844 | if (!s->server
| 1626-1633 | ||||||||||||||||||||||||||||||||||||
845 | sender = s->method->ssl3_enc->server_finished_label; | - | ||||||||||||||||||||||||||||||||||||
846 | slen = s->method->ssl3_enc->server_finished_label_len; | - | ||||||||||||||||||||||||||||||||||||
847 | } executed 1626 times by 1 test: else {end of block Executed by:
| 1626 | ||||||||||||||||||||||||||||||||||||
848 | sender = s->method->ssl3_enc->client_finished_label; | - | ||||||||||||||||||||||||||||||||||||
849 | slen = s->method->ssl3_enc->client_finished_label_len; | - | ||||||||||||||||||||||||||||||||||||
850 | } executed 1633 times by 1 test: end of block Executed by:
| 1633 | ||||||||||||||||||||||||||||||||||||
851 | - | |||||||||||||||||||||||||||||||||||||
852 | s->s3->tmp.peer_finish_md_len = | - | ||||||||||||||||||||||||||||||||||||
853 | s->method->ssl3_enc->final_finish_mac(s, sender, slen, | - | ||||||||||||||||||||||||||||||||||||
854 | s->s3->tmp.peer_finish_md); | - | ||||||||||||||||||||||||||||||||||||
855 | - | |||||||||||||||||||||||||||||||||||||
856 | if (s->s3->tmp.peer_finish_md_len == 0
| 0-3259 | ||||||||||||||||||||||||||||||||||||
857 | - | |||||||||||||||||||||||||||||||||||||
858 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
859 | } | - | ||||||||||||||||||||||||||||||||||||
860 | - | |||||||||||||||||||||||||||||||||||||
861 | return executed 3259 times by 1 test: 1;return 1; Executed by:
executed 3259 times by 1 test: return 1; Executed by:
| 3259 | ||||||||||||||||||||||||||||||||||||
862 | } | - | ||||||||||||||||||||||||||||||||||||
863 | - | |||||||||||||||||||||||||||||||||||||
864 | MSG_PROCESS_RETURN tls_process_change_cipher_spec(SSL *s, PACKET *pkt) | - | ||||||||||||||||||||||||||||||||||||
865 | { | - | ||||||||||||||||||||||||||||||||||||
866 | size_t remain; | - | ||||||||||||||||||||||||||||||||||||
867 | - | |||||||||||||||||||||||||||||||||||||
868 | remain = PACKET_remaining(pkt); | - | ||||||||||||||||||||||||||||||||||||
869 | - | |||||||||||||||||||||||||||||||||||||
870 | - | |||||||||||||||||||||||||||||||||||||
871 | - | |||||||||||||||||||||||||||||||||||||
872 | - | |||||||||||||||||||||||||||||||||||||
873 | - | |||||||||||||||||||||||||||||||||||||
874 | if ((
| 355-2114 | ||||||||||||||||||||||||||||||||||||
875 | if ((s->version == 0x0100
| 1-354 | ||||||||||||||||||||||||||||||||||||
876 | && remain != 1 + 1
| 0-1 | ||||||||||||||||||||||||||||||||||||
877 | || (s->version != 0x0100
| 1-354 | ||||||||||||||||||||||||||||||||||||
878 | && remain != 1 - 1
| 0-354 | ||||||||||||||||||||||||||||||||||||
879 | ossl_statem_fatal((s), (50), (363), (103), | - | ||||||||||||||||||||||||||||||||||||
880 | - | |||||||||||||||||||||||||||||||||||||
881 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
882 | , | - | ||||||||||||||||||||||||||||||||||||
883 | - | |||||||||||||||||||||||||||||||||||||
884 | 703 | - | ||||||||||||||||||||||||||||||||||||
885 | ) | - | ||||||||||||||||||||||||||||||||||||
886 | - | |||||||||||||||||||||||||||||||||||||
887 | ; | - | ||||||||||||||||||||||||||||||||||||
888 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
889 | } | - | ||||||||||||||||||||||||||||||||||||
890 | } executed 355 times by 1 test: else {end of block Executed by:
| 355 | ||||||||||||||||||||||||||||||||||||
891 | if (remain != 0
| 0-2114 | ||||||||||||||||||||||||||||||||||||
892 | ossl_statem_fatal((s), (50), (363), (103), | - | ||||||||||||||||||||||||||||||||||||
893 | - | |||||||||||||||||||||||||||||||||||||
894 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
895 | , | - | ||||||||||||||||||||||||||||||||||||
896 | - | |||||||||||||||||||||||||||||||||||||
897 | 710 | - | ||||||||||||||||||||||||||||||||||||
898 | ) | - | ||||||||||||||||||||||||||||||||||||
899 | - | |||||||||||||||||||||||||||||||||||||
900 | ; | - | ||||||||||||||||||||||||||||||||||||
901 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
902 | } | - | ||||||||||||||||||||||||||||||||||||
903 | } executed 2114 times by 1 test: end of block Executed by:
| 2114 | ||||||||||||||||||||||||||||||||||||
904 | - | |||||||||||||||||||||||||||||||||||||
905 | - | |||||||||||||||||||||||||||||||||||||
906 | if (s->s3->tmp.new_cipher ==
| 0-2469 | ||||||||||||||||||||||||||||||||||||
907 | ((void *)0)
| 0-2469 | ||||||||||||||||||||||||||||||||||||
908 | ) { | - | ||||||||||||||||||||||||||||||||||||
909 | ossl_statem_fatal((s), (10), (363), (133), | - | ||||||||||||||||||||||||||||||||||||
910 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
911 | , | - | ||||||||||||||||||||||||||||||||||||
912 | 718 | - | ||||||||||||||||||||||||||||||||||||
913 | ) | - | ||||||||||||||||||||||||||||||||||||
914 | ; | - | ||||||||||||||||||||||||||||||||||||
915 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
916 | } | - | ||||||||||||||||||||||||||||||||||||
917 | - | |||||||||||||||||||||||||||||||||||||
918 | s->s3->change_cipher_spec = 1; | - | ||||||||||||||||||||||||||||||||||||
919 | if (!ssl3_do_change_cipher_spec(s)
| 0-2469 | ||||||||||||||||||||||||||||||||||||
920 | ossl_statem_fatal((s), (80), (363), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
921 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
922 | , | - | ||||||||||||||||||||||||||||||||||||
923 | 725 | - | ||||||||||||||||||||||||||||||||||||
924 | ) | - | ||||||||||||||||||||||||||||||||||||
925 | ; | - | ||||||||||||||||||||||||||||||||||||
926 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
927 | } | - | ||||||||||||||||||||||||||||||||||||
928 | - | |||||||||||||||||||||||||||||||||||||
929 | if ((
| 355-2114 | ||||||||||||||||||||||||||||||||||||
930 | dtls1_reset_seq_numbers(s, 0x001); | - | ||||||||||||||||||||||||||||||||||||
931 | - | |||||||||||||||||||||||||||||||||||||
932 | if (s->version == 0x0100
| 1-354 | ||||||||||||||||||||||||||||||||||||
933 | s->d1->handshake_read_seq++; executed 1 time by 1 test: s->d1->handshake_read_seq++; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
934 | } executed 355 times by 1 test: end of block Executed by:
| 355 | ||||||||||||||||||||||||||||||||||||
935 | - | |||||||||||||||||||||||||||||||||||||
936 | return executed 2469 times by 1 test: MSG_PROCESS_CONTINUE_READING;return MSG_PROCESS_CONTINUE_READING; Executed by:
executed 2469 times by 1 test: return MSG_PROCESS_CONTINUE_READING; Executed by:
| 2469 | ||||||||||||||||||||||||||||||||||||
937 | } | - | ||||||||||||||||||||||||||||||||||||
938 | - | |||||||||||||||||||||||||||||||||||||
939 | MSG_PROCESS_RETURN tls_process_finished(SSL *s, PACKET *pkt) | - | ||||||||||||||||||||||||||||||||||||
940 | { | - | ||||||||||||||||||||||||||||||||||||
941 | size_t md_len; | - | ||||||||||||||||||||||||||||||||||||
942 | - | |||||||||||||||||||||||||||||||||||||
943 | - | |||||||||||||||||||||||||||||||||||||
944 | - | |||||||||||||||||||||||||||||||||||||
945 | if (s->server
| 1626-1633 | ||||||||||||||||||||||||||||||||||||
946 | - | |||||||||||||||||||||||||||||||||||||
947 | - | |||||||||||||||||||||||||||||||||||||
948 | - | |||||||||||||||||||||||||||||||||||||
949 | - | |||||||||||||||||||||||||||||||||||||
950 | - | |||||||||||||||||||||||||||||||||||||
951 | s->statem.enc_read_state = ENC_READ_STATE_VALID; | - | ||||||||||||||||||||||||||||||||||||
952 | if (s->post_handshake_auth != SSL_PHA_REQUESTED
| 22-1611 | ||||||||||||||||||||||||||||||||||||
953 | s->statem.cleanuphand = 1; executed 1611 times by 1 test: s->statem.cleanuphand = 1; Executed by:
| 1611 | ||||||||||||||||||||||||||||||||||||
954 | if ((!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-1456 | ||||||||||||||||||||||||||||||||||||
955 | - | |||||||||||||||||||||||||||||||||||||
956 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
957 | } | - | ||||||||||||||||||||||||||||||||||||
958 | } executed 1633 times by 1 test: end of block Executed by:
| 1633 | ||||||||||||||||||||||||||||||||||||
959 | - | |||||||||||||||||||||||||||||||||||||
960 | - | |||||||||||||||||||||||||||||||||||||
961 | - | |||||||||||||||||||||||||||||||||||||
962 | - | |||||||||||||||||||||||||||||||||||||
963 | - | |||||||||||||||||||||||||||||||||||||
964 | if ((!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-2904 | ||||||||||||||||||||||||||||||||||||
965 | ossl_statem_fatal((s), (10), (364), (182), | - | ||||||||||||||||||||||||||||||||||||
966 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
967 | , | - | ||||||||||||||||||||||||||||||||||||
968 | 775 | - | ||||||||||||||||||||||||||||||||||||
969 | ) | - | ||||||||||||||||||||||||||||||||||||
970 | ; | - | ||||||||||||||||||||||||||||||||||||
971 | return executed 1 time by 1 test: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; Executed by:
executed 1 time by 1 test: return MSG_PROCESS_ERROR; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
972 | } | - | ||||||||||||||||||||||||||||||||||||
973 | - | |||||||||||||||||||||||||||||||||||||
974 | - | |||||||||||||||||||||||||||||||||||||
975 | if (!(!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-2903 | ||||||||||||||||||||||||||||||||||||
976 | ossl_statem_fatal((s), (10), (364), (154), | - | ||||||||||||||||||||||||||||||||||||
977 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
978 | , | - | ||||||||||||||||||||||||||||||||||||
979 | 782 | - | ||||||||||||||||||||||||||||||||||||
980 | ) | - | ||||||||||||||||||||||||||||||||||||
981 | ; | - | ||||||||||||||||||||||||||||||||||||
982 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
983 | } | - | ||||||||||||||||||||||||||||||||||||
984 | s->s3->change_cipher_spec = 0; | - | ||||||||||||||||||||||||||||||||||||
985 | - | |||||||||||||||||||||||||||||||||||||
986 | md_len = s->s3->tmp.peer_finish_md_len; | - | ||||||||||||||||||||||||||||||||||||
987 | - | |||||||||||||||||||||||||||||||||||||
988 | if (md_len != PACKET_remaining(pkt)
| 1-3257 | ||||||||||||||||||||||||||||||||||||
989 | ossl_statem_fatal((s), (50), (364), (111), | - | ||||||||||||||||||||||||||||||||||||
990 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
991 | , | - | ||||||||||||||||||||||||||||||||||||
992 | 791 | - | ||||||||||||||||||||||||||||||||||||
993 | ) | - | ||||||||||||||||||||||||||||||||||||
994 | ; | - | ||||||||||||||||||||||||||||||||||||
995 | return executed 1 time by 1 test: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; Executed by:
executed 1 time by 1 test: return MSG_PROCESS_ERROR; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
996 | } | - | ||||||||||||||||||||||||||||||||||||
997 | - | |||||||||||||||||||||||||||||||||||||
998 | if (CRYPTO_memcmp(PACKET_data(pkt), s->s3->tmp.peer_finish_md,
| 3-3254 | ||||||||||||||||||||||||||||||||||||
999 | md_len) != 0
| 3-3254 | ||||||||||||||||||||||||||||||||||||
1000 | ossl_statem_fatal((s), (51), (364), (149), | - | ||||||||||||||||||||||||||||||||||||
1001 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1002 | , | - | ||||||||||||||||||||||||||||||||||||
1003 | 798 | - | ||||||||||||||||||||||||||||||||||||
1004 | ) | - | ||||||||||||||||||||||||||||||||||||
1005 | ; | - | ||||||||||||||||||||||||||||||||||||
1006 | return executed 3 times by 1 test: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; Executed by:
executed 3 times by 1 test: return MSG_PROCESS_ERROR; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
1007 | } | - | ||||||||||||||||||||||||||||||||||||
1008 | - | |||||||||||||||||||||||||||||||||||||
1009 | - | |||||||||||||||||||||||||||||||||||||
1010 | - | |||||||||||||||||||||||||||||||||||||
1011 | - | |||||||||||||||||||||||||||||||||||||
1012 | if (!((md_len <= 64) != 0)
| 0-3254 | ||||||||||||||||||||||||||||||||||||
1013 | ossl_statem_fatal((s), (80), (364), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
1014 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1015 | , | - | ||||||||||||||||||||||||||||||||||||
1016 | 807 | - | ||||||||||||||||||||||||||||||||||||
1017 | ) | - | ||||||||||||||||||||||||||||||||||||
1018 | ; | - | ||||||||||||||||||||||||||||||||||||
1019 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
1020 | } | - | ||||||||||||||||||||||||||||||||||||
1021 | if (s->server
| 1621-1633 | ||||||||||||||||||||||||||||||||||||
1022 | memcpy(s->s3->previous_client_finished, s->s3->tmp.peer_finish_md, | - | ||||||||||||||||||||||||||||||||||||
1023 | md_len); | - | ||||||||||||||||||||||||||||||||||||
1024 | s->s3->previous_client_finished_len = md_len; | - | ||||||||||||||||||||||||||||||||||||
1025 | } executed 1633 times by 1 test: else {end of block Executed by:
| 1633 | ||||||||||||||||||||||||||||||||||||
1026 | memcpy(s->s3->previous_server_finished, s->s3->tmp.peer_finish_md, | - | ||||||||||||||||||||||||||||||||||||
1027 | md_len); | - | ||||||||||||||||||||||||||||||||||||
1028 | s->s3->previous_server_finished_len = md_len; | - | ||||||||||||||||||||||||||||||||||||
1029 | } executed 1621 times by 1 test: end of block Executed by:
| 1621 | ||||||||||||||||||||||||||||||||||||
1030 | - | |||||||||||||||||||||||||||||||||||||
1031 | - | |||||||||||||||||||||||||||||||||||||
1032 | - | |||||||||||||||||||||||||||||||||||||
1033 | - | |||||||||||||||||||||||||||||||||||||
1034 | - | |||||||||||||||||||||||||||||||||||||
1035 | if ((!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-2899 | ||||||||||||||||||||||||||||||||||||
1036 | if (s->server
| 575-587 | ||||||||||||||||||||||||||||||||||||
1037 | if (s->post_handshake_auth != SSL_PHA_REQUESTED
| 22-565 | ||||||||||||||||||||||||||||||||||||
1038 | !s->method->ssl3_enc->change_cipher_state(s,
| 0-565 | ||||||||||||||||||||||||||||||||||||
1039 | 0x100 | (0x020|0x001))
| 0-565 | ||||||||||||||||||||||||||||||||||||
1040 | - | |||||||||||||||||||||||||||||||||||||
1041 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
1042 | } | - | ||||||||||||||||||||||||||||||||||||
1043 | } executed 587 times by 1 test: else {end of block Executed by:
| 587 | ||||||||||||||||||||||||||||||||||||
1044 | if (!s->method->ssl3_enc->generate_master_secret(s,
| 0-575 | ||||||||||||||||||||||||||||||||||||
1045 | s->master_secret, s->handshake_secret, 0,
| 0-575 | ||||||||||||||||||||||||||||||||||||
1046 | &s->session->master_key_length)
| 0-575 | ||||||||||||||||||||||||||||||||||||
1047 | - | |||||||||||||||||||||||||||||||||||||
1048 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
1049 | } | - | ||||||||||||||||||||||||||||||||||||
1050 | if (!s->method->ssl3_enc->change_cipher_state(s,
| 0-575 | ||||||||||||||||||||||||||||||||||||
1051 | 0x100 | (0x010|0x001))
| 0-575 | ||||||||||||||||||||||||||||||||||||
1052 | - | |||||||||||||||||||||||||||||||||||||
1053 | return never executed: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; never executed: return MSG_PROCESS_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
1054 | } | - | ||||||||||||||||||||||||||||||||||||
1055 | if (!tls_process_initial_server_flight(s)
| 2-573 | ||||||||||||||||||||||||||||||||||||
1056 | - | |||||||||||||||||||||||||||||||||||||
1057 | return executed 2 times by 1 test: MSG_PROCESS_ERROR;return MSG_PROCESS_ERROR; Executed by:
executed 2 times by 1 test: return MSG_PROCESS_ERROR; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
1058 | } | - | ||||||||||||||||||||||||||||||||||||
1059 | } executed 573 times by 1 test: end of block Executed by:
| 573 | ||||||||||||||||||||||||||||||||||||
1060 | } | - | ||||||||||||||||||||||||||||||||||||
1061 | - | |||||||||||||||||||||||||||||||||||||
1062 | return executed 3252 times by 1 test: MSG_PROCESS_FINISHED_READING;return MSG_PROCESS_FINISHED_READING; Executed by:
executed 3252 times by 1 test: return MSG_PROCESS_FINISHED_READING; Executed by:
| 3252 | ||||||||||||||||||||||||||||||||||||
1063 | } | - | ||||||||||||||||||||||||||||||||||||
1064 | - | |||||||||||||||||||||||||||||||||||||
1065 | int tls_construct_change_cipher_spec(SSL *s, WPACKET *pkt) | - | ||||||||||||||||||||||||||||||||||||
1066 | { | - | ||||||||||||||||||||||||||||||||||||
1067 | if (!WPACKET_put_bytes__((pkt), (1), 1)
| 0-4316 | ||||||||||||||||||||||||||||||||||||
1068 | ossl_statem_fatal((s), (80), (427), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
1069 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1070 | , | - | ||||||||||||||||||||||||||||||||||||
1071 | 858 | - | ||||||||||||||||||||||||||||||||||||
1072 | ) | - | ||||||||||||||||||||||||||||||||||||
1073 | ; | - | ||||||||||||||||||||||||||||||||||||
1074 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1075 | } | - | ||||||||||||||||||||||||||||||||||||
1076 | - | |||||||||||||||||||||||||||||||||||||
1077 | return executed 4316 times by 1 test: 1;return 1; Executed by:
executed 4316 times by 1 test: return 1; Executed by:
| 4316 | ||||||||||||||||||||||||||||||||||||
1078 | } | - | ||||||||||||||||||||||||||||||||||||
1079 | - | |||||||||||||||||||||||||||||||||||||
1080 | - | |||||||||||||||||||||||||||||||||||||
1081 | static int ssl_add_cert_to_wpacket(SSL *s, WPACKET *pkt, X509 *x, int chain) | - | ||||||||||||||||||||||||||||||||||||
1082 | { | - | ||||||||||||||||||||||||||||||||||||
1083 | int len; | - | ||||||||||||||||||||||||||||||||||||
1084 | unsigned char *outbytes; | - | ||||||||||||||||||||||||||||||||||||
1085 | - | |||||||||||||||||||||||||||||||||||||
1086 | len = i2d_X509(x, | - | ||||||||||||||||||||||||||||||||||||
1087 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1088 | ); | - | ||||||||||||||||||||||||||||||||||||
1089 | if (len < 0
| 0-2304 | ||||||||||||||||||||||||||||||||||||
1090 | ossl_statem_fatal((s), (80), (493), (7), | - | ||||||||||||||||||||||||||||||||||||
1091 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1092 | , | - | ||||||||||||||||||||||||||||||||||||
1093 | 874 | - | ||||||||||||||||||||||||||||||||||||
1094 | ) | - | ||||||||||||||||||||||||||||||||||||
1095 | ; | - | ||||||||||||||||||||||||||||||||||||
1096 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1097 | } | - | ||||||||||||||||||||||||||||||||||||
1098 | if (!WPACKET_sub_allocate_bytes__((pkt), (len), (&outbytes), 3)
| 0-2304 | ||||||||||||||||||||||||||||||||||||
1099 | || i2d_X509(x, &outbytes) != len
| 0-2304 | ||||||||||||||||||||||||||||||||||||
1100 | ossl_statem_fatal((s), (80), (493), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
1101 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1102 | , | - | ||||||||||||||||||||||||||||||||||||
1103 | 880 | - | ||||||||||||||||||||||||||||||||||||
1104 | ) | - | ||||||||||||||||||||||||||||||||||||
1105 | ; | - | ||||||||||||||||||||||||||||||||||||
1106 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1107 | } | - | ||||||||||||||||||||||||||||||||||||
1108 | - | |||||||||||||||||||||||||||||||||||||
1109 | if ((!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-2103 | ||||||||||||||||||||||||||||||||||||
1110 | && !tls_construct_extensions(s, pkt, 0x1000, x,
| 0-858 | ||||||||||||||||||||||||||||||||||||
1111 | chain)
| 0-858 | ||||||||||||||||||||||||||||||||||||
1112 | - | |||||||||||||||||||||||||||||||||||||
1113 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1114 | } | - | ||||||||||||||||||||||||||||||||||||
1115 | - | |||||||||||||||||||||||||||||||||||||
1116 | return executed 2304 times by 1 test: 1;return 1; Executed by:
executed 2304 times by 1 test: return 1; Executed by:
| 2304 | ||||||||||||||||||||||||||||||||||||
1117 | } | - | ||||||||||||||||||||||||||||||||||||
1118 | - | |||||||||||||||||||||||||||||||||||||
1119 | - | |||||||||||||||||||||||||||||||||||||
1120 | static int ssl_add_cert_chain(SSL *s, WPACKET *pkt, CERT_PKEY *cpk) | - | ||||||||||||||||||||||||||||||||||||
1121 | { | - | ||||||||||||||||||||||||||||||||||||
1122 | int i, chain_count; | - | ||||||||||||||||||||||||||||||||||||
1123 | X509 *x; | - | ||||||||||||||||||||||||||||||||||||
1124 | struct stack_st_X509 *extra_certs; | - | ||||||||||||||||||||||||||||||||||||
1125 | struct stack_st_X509 *chain = | - | ||||||||||||||||||||||||||||||||||||
1126 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1127 | ; | - | ||||||||||||||||||||||||||||||||||||
1128 | X509_STORE *chain_store; | - | ||||||||||||||||||||||||||||||||||||
1129 | - | |||||||||||||||||||||||||||||||||||||
1130 | if (cpk ==
| 39-2143 | ||||||||||||||||||||||||||||||||||||
1131 | ((void *)0)
| 39-2143 | ||||||||||||||||||||||||||||||||||||
1132 | || cpk->x509 ==
| 1-2142 | ||||||||||||||||||||||||||||||||||||
1133 | ((void *)0)
| 1-2142 | ||||||||||||||||||||||||||||||||||||
1134 | ) | - | ||||||||||||||||||||||||||||||||||||
1135 | return executed 40 times by 1 test: 1;return 1; Executed by:
executed 40 times by 1 test: return 1; Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||
1136 | - | |||||||||||||||||||||||||||||||||||||
1137 | x = cpk->x509; | - | ||||||||||||||||||||||||||||||||||||
1138 | - | |||||||||||||||||||||||||||||||||||||
1139 | - | |||||||||||||||||||||||||||||||||||||
1140 | - | |||||||||||||||||||||||||||||||||||||
1141 | - | |||||||||||||||||||||||||||||||||||||
1142 | if (cpk->chain !=
| 35-2107 | ||||||||||||||||||||||||||||||||||||
1143 | ((void *)0)
| 35-2107 | ||||||||||||||||||||||||||||||||||||
1144 | ) | - | ||||||||||||||||||||||||||||||||||||
1145 | extra_certs = cpk->chain; executed 35 times by 1 test: extra_certs = cpk->chain; Executed by:
| 35 | ||||||||||||||||||||||||||||||||||||
1146 | else | - | ||||||||||||||||||||||||||||||||||||
1147 | extra_certs = s->ctx->extra_certs; executed 2107 times by 1 test: extra_certs = s->ctx->extra_certs; Executed by:
| 2107 | ||||||||||||||||||||||||||||||||||||
1148 | - | |||||||||||||||||||||||||||||||||||||
1149 | if ((
| 0-2142 | ||||||||||||||||||||||||||||||||||||
1150 | chain_store = executed 38 times by 1 test: chain_store = ((void *)0) ; Executed by:
| 38 | ||||||||||||||||||||||||||||||||||||
1151 | ((void *)0) executed 38 times by 1 test: chain_store = ((void *)0) ; Executed by:
| 38 | ||||||||||||||||||||||||||||||||||||
1152 | ; executed 38 times by 1 test: chain_store = ((void *)0) ; Executed by:
| 38 | ||||||||||||||||||||||||||||||||||||
1153 | else if (s->cert->chain_store
| 0-2104 | ||||||||||||||||||||||||||||||||||||
1154 | chain_store = s->cert->chain_store; never executed: chain_store = s->cert->chain_store; | 0 | ||||||||||||||||||||||||||||||||||||
1155 | else | - | ||||||||||||||||||||||||||||||||||||
1156 | chain_store = s->ctx->cert_store; executed 2104 times by 1 test: chain_store = s->ctx->cert_store; Executed by:
| 2104 | ||||||||||||||||||||||||||||||||||||
1157 | - | |||||||||||||||||||||||||||||||||||||
1158 | if (chain_store !=
| 38-2104 | ||||||||||||||||||||||||||||||||||||
1159 | ((void *)0)
| 38-2104 | ||||||||||||||||||||||||||||||||||||
1160 | ) { | - | ||||||||||||||||||||||||||||||||||||
1161 | X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||
1162 | - | |||||||||||||||||||||||||||||||||||||
1163 | if (xs_ctx ==
| 0-2104 | ||||||||||||||||||||||||||||||||||||
1164 | ((void *)0)
| 0-2104 | ||||||||||||||||||||||||||||||||||||
1165 | ) { | - | ||||||||||||||||||||||||||||||||||||
1166 | ossl_statem_fatal((s), (80), (316), ((1|64)), | - | ||||||||||||||||||||||||||||||||||||
1167 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1168 | , | - | ||||||||||||||||||||||||||||||||||||
1169 | 928 | - | ||||||||||||||||||||||||||||||||||||
1170 | ) | - | ||||||||||||||||||||||||||||||||||||
1171 | ; | - | ||||||||||||||||||||||||||||||||||||
1172 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1173 | } | - | ||||||||||||||||||||||||||||||||||||
1174 | if (!X509_STORE_CTX_init(xs_ctx, chain_store, x,
| 0-2104 | ||||||||||||||||||||||||||||||||||||
1175 | ((void *)0)
| 0-2104 | ||||||||||||||||||||||||||||||||||||
1176 | )
| 0-2104 | ||||||||||||||||||||||||||||||||||||
1177 | X509_STORE_CTX_free(xs_ctx); | - | ||||||||||||||||||||||||||||||||||||
1178 | ossl_statem_fatal((s), (80), (316), (11), | - | ||||||||||||||||||||||||||||||||||||
1179 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1180 | , | - | ||||||||||||||||||||||||||||||||||||
1181 | 934 | - | ||||||||||||||||||||||||||||||||||||
1182 | ) | - | ||||||||||||||||||||||||||||||||||||
1183 | ; | - | ||||||||||||||||||||||||||||||||||||
1184 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1185 | } | - | ||||||||||||||||||||||||||||||||||||
1186 | - | |||||||||||||||||||||||||||||||||||||
1187 | - | |||||||||||||||||||||||||||||||||||||
1188 | - | |||||||||||||||||||||||||||||||||||||
1189 | - | |||||||||||||||||||||||||||||||||||||
1190 | - | |||||||||||||||||||||||||||||||||||||
1191 | - | |||||||||||||||||||||||||||||||||||||
1192 | (void)X509_verify_cert(xs_ctx); | - | ||||||||||||||||||||||||||||||||||||
1193 | - | |||||||||||||||||||||||||||||||||||||
1194 | ERR_clear_error(); | - | ||||||||||||||||||||||||||||||||||||
1195 | chain = X509_STORE_CTX_get0_chain(xs_ctx); | - | ||||||||||||||||||||||||||||||||||||
1196 | i = ssl_security_cert_chain(s, chain, | - | ||||||||||||||||||||||||||||||||||||
1197 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1198 | , 0); | - | ||||||||||||||||||||||||||||||||||||
1199 | if (i != 1
| 0-2104 | ||||||||||||||||||||||||||||||||||||
1200 | - | |||||||||||||||||||||||||||||||||||||
1201 | - | |||||||||||||||||||||||||||||||||||||
1202 | - | |||||||||||||||||||||||||||||||||||||
1203 | - | |||||||||||||||||||||||||||||||||||||
1204 | - | |||||||||||||||||||||||||||||||||||||
1205 | - | |||||||||||||||||||||||||||||||||||||
1206 | X509_STORE_CTX_free(xs_ctx); | - | ||||||||||||||||||||||||||||||||||||
1207 | ossl_statem_fatal((s), (80), (316), (i), __FILE__, 956); | - | ||||||||||||||||||||||||||||||||||||
1208 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1209 | } | - | ||||||||||||||||||||||||||||||||||||
1210 | chain_count = sk_X509_num(chain); | - | ||||||||||||||||||||||||||||||||||||
1211 | for (i = 0; i < chain_count
| 2104-2111 | ||||||||||||||||||||||||||||||||||||
1212 | x = sk_X509_value(chain, i); | - | ||||||||||||||||||||||||||||||||||||
1213 | - | |||||||||||||||||||||||||||||||||||||
1214 | if (!ssl_add_cert_to_wpacket(s, pkt, x, i)
| 0-2111 | ||||||||||||||||||||||||||||||||||||
1215 | - | |||||||||||||||||||||||||||||||||||||
1216 | X509_STORE_CTX_free(xs_ctx); | - | ||||||||||||||||||||||||||||||||||||
1217 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1218 | } | - | ||||||||||||||||||||||||||||||||||||
1219 | } executed 2111 times by 1 test: end of block Executed by:
| 2111 | ||||||||||||||||||||||||||||||||||||
1220 | X509_STORE_CTX_free(xs_ctx); | - | ||||||||||||||||||||||||||||||||||||
1221 | } executed 2104 times by 1 test: else {end of block Executed by:
| 2104 | ||||||||||||||||||||||||||||||||||||
1222 | i = ssl_security_cert_chain(s, extra_certs, x, 0); | - | ||||||||||||||||||||||||||||||||||||
1223 | if (i != 1
| 0-38 | ||||||||||||||||||||||||||||||||||||
1224 | ossl_statem_fatal((s), (80), (316), (i), __FILE__, 973); | - | ||||||||||||||||||||||||||||||||||||
1225 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1226 | } | - | ||||||||||||||||||||||||||||||||||||
1227 | if (!ssl_add_cert_to_wpacket(s, pkt, x, 0)
| 0-38 | ||||||||||||||||||||||||||||||||||||
1228 | - | |||||||||||||||||||||||||||||||||||||
1229 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1230 | } | - | ||||||||||||||||||||||||||||||||||||
1231 | for (i = 0; i < sk_X509_num(extra_certs)
| 38-155 | ||||||||||||||||||||||||||||||||||||
1232 | x = sk_X509_value(extra_certs, i); | - | ||||||||||||||||||||||||||||||||||||
1233 | if (!ssl_add_cert_to_wpacket(s, pkt, x, i + 1)
| 0-155 | ||||||||||||||||||||||||||||||||||||
1234 | - | |||||||||||||||||||||||||||||||||||||
1235 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1236 | } | - | ||||||||||||||||||||||||||||||||||||
1237 | } executed 155 times by 1 test: end of block Executed by:
| 155 | ||||||||||||||||||||||||||||||||||||
1238 | } executed 38 times by 1 test: end of block Executed by:
| 38 | ||||||||||||||||||||||||||||||||||||
1239 | return executed 2142 times by 1 test: 1;return 1; Executed by:
executed 2142 times by 1 test: return 1; Executed by:
| 2142 | ||||||||||||||||||||||||||||||||||||
1240 | } | - | ||||||||||||||||||||||||||||||||||||
1241 | - | |||||||||||||||||||||||||||||||||||||
1242 | unsigned long ssl3_output_cert_chain(SSL *s, WPACKET *pkt, CERT_PKEY *cpk) | - | ||||||||||||||||||||||||||||||||||||
1243 | { | - | ||||||||||||||||||||||||||||||||||||
1244 | if (!WPACKET_start_sub_packet_len__((pkt), 3)
| 0-2182 | ||||||||||||||||||||||||||||||||||||
1245 | ossl_statem_fatal((s), (80), (147), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
1246 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1247 | , | - | ||||||||||||||||||||||||||||||||||||
1248 | 995 | - | ||||||||||||||||||||||||||||||||||||
1249 | ) | - | ||||||||||||||||||||||||||||||||||||
1250 | ; | - | ||||||||||||||||||||||||||||||||||||
1251 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1252 | } | - | ||||||||||||||||||||||||||||||||||||
1253 | - | |||||||||||||||||||||||||||||||||||||
1254 | if (!ssl_add_cert_chain(s, pkt, cpk)
| 0-2182 | ||||||||||||||||||||||||||||||||||||
1255 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1256 | - | |||||||||||||||||||||||||||||||||||||
1257 | if (!WPACKET_close(pkt)
| 0-2182 | ||||||||||||||||||||||||||||||||||||
1258 | ossl_statem_fatal((s), (80), (147), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
1259 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1260 | , | - | ||||||||||||||||||||||||||||||||||||
1261 | 1004 | - | ||||||||||||||||||||||||||||||||||||
1262 | ) | - | ||||||||||||||||||||||||||||||||||||
1263 | ; | - | ||||||||||||||||||||||||||||||||||||
1264 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1265 | } | - | ||||||||||||||||||||||||||||||||||||
1266 | - | |||||||||||||||||||||||||||||||||||||
1267 | return executed 2182 times by 1 test: 1;return 1; Executed by:
executed 2182 times by 1 test: return 1; Executed by:
| 2182 | ||||||||||||||||||||||||||||||||||||
1268 | } | - | ||||||||||||||||||||||||||||||||||||
1269 | - | |||||||||||||||||||||||||||||||||||||
1270 | - | |||||||||||||||||||||||||||||||||||||
1271 | - | |||||||||||||||||||||||||||||||||||||
1272 | - | |||||||||||||||||||||||||||||||||||||
1273 | - | |||||||||||||||||||||||||||||||||||||
1274 | - | |||||||||||||||||||||||||||||||||||||
1275 | WORK_STATE tls_finish_handshake(SSL *s, WORK_STATE wst, int clearbufs, int stop) | - | ||||||||||||||||||||||||||||||||||||
1276 | { | - | ||||||||||||||||||||||||||||||||||||
1277 | void (*cb) (const SSL *ssl, int type, int val) = | - | ||||||||||||||||||||||||||||||||||||
1278 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1279 | ; | - | ||||||||||||||||||||||||||||||||||||
1280 | - | |||||||||||||||||||||||||||||||||||||
1281 | if (clearbufs
| 630-4433 | ||||||||||||||||||||||||||||||||||||
1282 | if (!(s->method->ssl3_enc->enc_flags & 0x8)
| 358-4075 | ||||||||||||||||||||||||||||||||||||
1283 | - | |||||||||||||||||||||||||||||||||||||
1284 | - | |||||||||||||||||||||||||||||||||||||
1285 | - | |||||||||||||||||||||||||||||||||||||
1286 | - | |||||||||||||||||||||||||||||||||||||
1287 | BUF_MEM_free(s->init_buf); | - | ||||||||||||||||||||||||||||||||||||
1288 | s->init_buf = | - | ||||||||||||||||||||||||||||||||||||
1289 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1290 | ; | - | ||||||||||||||||||||||||||||||||||||
1291 | } executed 4075 times by 1 test: end of block Executed by:
| 4075 | ||||||||||||||||||||||||||||||||||||
1292 | if (!ssl_free_wbio_buffer(s)
| 0-4433 | ||||||||||||||||||||||||||||||||||||
1293 | ossl_statem_fatal((s), (80), (597), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
1294 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1295 | , | - | ||||||||||||||||||||||||||||||||||||
1296 | 1031 | - | ||||||||||||||||||||||||||||||||||||
1297 | ) | - | ||||||||||||||||||||||||||||||||||||
1298 | ; | - | ||||||||||||||||||||||||||||||||||||
1299 | return never executed: WORK_ERROR;return WORK_ERROR; never executed: return WORK_ERROR; | 0 | ||||||||||||||||||||||||||||||||||||
1300 | } | - | ||||||||||||||||||||||||||||||||||||
1301 | s->init_num = 0; | - | ||||||||||||||||||||||||||||||||||||
1302 | } executed 4433 times by 1 test: end of block Executed by:
| 4433 | ||||||||||||||||||||||||||||||||||||
1303 | - | |||||||||||||||||||||||||||||||||||||
1304 | if ((!(s->method->ssl3_enc->enc_flags & 0x8)
| 50-4705 | ||||||||||||||||||||||||||||||||||||
1305 | && s->post_handshake_auth == SSL_PHA_REQUESTED
| 25-1530 | ||||||||||||||||||||||||||||||||||||
1306 | s->post_handshake_auth = SSL_PHA_EXT_SENT; executed 25 times by 1 test: s->post_handshake_auth = SSL_PHA_EXT_SENT; Executed by:
| 25 | ||||||||||||||||||||||||||||||||||||
1307 | - | |||||||||||||||||||||||||||||||||||||
1308 | - | |||||||||||||||||||||||||||||||||||||
1309 | - | |||||||||||||||||||||||||||||||||||||
1310 | - | |||||||||||||||||||||||||||||||||||||
1311 | - | |||||||||||||||||||||||||||||||||||||
1312 | if (s->statem.cleanuphand
| 1833-3230 | ||||||||||||||||||||||||||||||||||||
1313 | - | |||||||||||||||||||||||||||||||||||||
1314 | s->renegotiate = 0; | - | ||||||||||||||||||||||||||||||||||||
1315 | s->new_session = 0; | - | ||||||||||||||||||||||||||||||||||||
1316 | s->statem.cleanuphand = 0; | - | ||||||||||||||||||||||||||||||||||||
1317 | s->ext.ticket_expected = 0; | - | ||||||||||||||||||||||||||||||||||||
1318 | - | |||||||||||||||||||||||||||||||||||||
1319 | ssl3_cleanup_key_block(s); | - | ||||||||||||||||||||||||||||||||||||
1320 | - | |||||||||||||||||||||||||||||||||||||
1321 | if (s->server
| 1611-1619 | ||||||||||||||||||||||||||||||||||||
1322 | - | |||||||||||||||||||||||||||||||||||||
1323 | - | |||||||||||||||||||||||||||||||||||||
1324 | - | |||||||||||||||||||||||||||||||||||||
1325 | - | |||||||||||||||||||||||||||||||||||||
1326 | if (!(!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-1434 | ||||||||||||||||||||||||||||||||||||
1327 | ssl_update_cache(s, 0x0002); executed 1046 times by 1 test: ssl_update_cache(s, 0x0002); Executed by:
| 1046 | ||||||||||||||||||||||||||||||||||||
1328 | - | |||||||||||||||||||||||||||||||||||||
1329 | - | |||||||||||||||||||||||||||||||||||||
1330 | - | |||||||||||||||||||||||||||||||||||||
1331 | __atomic_fetch_add (( | - | ||||||||||||||||||||||||||||||||||||
1332 | (&s->ctx->stats.sess_accept_good) | - | ||||||||||||||||||||||||||||||||||||
1333 | ), ( | - | ||||||||||||||||||||||||||||||||||||
1334 | 1 | - | ||||||||||||||||||||||||||||||||||||
1335 | ), ( | - | ||||||||||||||||||||||||||||||||||||
1336 | memory_order_relaxed | - | ||||||||||||||||||||||||||||||||||||
1337 | )) | - | ||||||||||||||||||||||||||||||||||||
1338 | ; | - | ||||||||||||||||||||||||||||||||||||
1339 | s->handshake_func = ossl_statem_accept; | - | ||||||||||||||||||||||||||||||||||||
1340 | - | |||||||||||||||||||||||||||||||||||||
1341 | if ((
| 16-1434 | ||||||||||||||||||||||||||||||||||||
1342 | - | |||||||||||||||||||||||||||||||||||||
1343 | - | |||||||||||||||||||||||||||||||||||||
1344 | - | |||||||||||||||||||||||||||||||||||||
1345 | - | |||||||||||||||||||||||||||||||||||||
1346 | - | |||||||||||||||||||||||||||||||||||||
1347 | dtls1_start_timer(s); | - | ||||||||||||||||||||||||||||||||||||
1348 | } executed 161 times by 1 test: end of block Executed by:
| 161 | ||||||||||||||||||||||||||||||||||||
1349 | } executed 1611 times by 1 test: else {end of block Executed by:
| 1611 | ||||||||||||||||||||||||||||||||||||
1350 | if ((!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-1441 | ||||||||||||||||||||||||||||||||||||
1351 | - | |||||||||||||||||||||||||||||||||||||
1352 | - | |||||||||||||||||||||||||||||||||||||
1353 | - | |||||||||||||||||||||||||||||||||||||
1354 | - | |||||||||||||||||||||||||||||||||||||
1355 | if ((
| 95-478 | ||||||||||||||||||||||||||||||||||||
1356 | & 0x0001) != 0
| 95-478 | ||||||||||||||||||||||||||||||||||||
1357 | SSL_CTX_remove_session(s->session_ctx, s->session); executed 95 times by 1 test: SSL_CTX_remove_session(s->session_ctx, s->session); Executed by:
| 95 | ||||||||||||||||||||||||||||||||||||
1358 | } executed 573 times by 1 test: else {end of block Executed by:
| 573 | ||||||||||||||||||||||||||||||||||||
1359 | - | |||||||||||||||||||||||||||||||||||||
1360 | - | |||||||||||||||||||||||||||||||||||||
1361 | - | |||||||||||||||||||||||||||||||||||||
1362 | - | |||||||||||||||||||||||||||||||||||||
1363 | ssl_update_cache(s, 0x0001); | - | ||||||||||||||||||||||||||||||||||||
1364 | } executed 1046 times by 1 test: end of block Executed by:
| 1046 | ||||||||||||||||||||||||||||||||||||
1365 | if (s->hit
| 168-1451 | ||||||||||||||||||||||||||||||||||||
1366 | - | |||||||||||||||||||||||||||||||||||||
1367 | __atomic_fetch_add (( executed 168 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_hit) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 168 | ||||||||||||||||||||||||||||||||||||
1368 | (&s->session_ctx->stats.sess_hit) executed 168 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_hit) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 168 | ||||||||||||||||||||||||||||||||||||
1369 | ), ( executed 168 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_hit) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 168 | ||||||||||||||||||||||||||||||||||||
1370 | 1 executed 168 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_hit) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 168 | ||||||||||||||||||||||||||||||||||||
1371 | ), ( executed 168 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_hit) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 168 | ||||||||||||||||||||||||||||||||||||
1372 | memory_order_relaxed executed 168 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_hit) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 168 | ||||||||||||||||||||||||||||||||||||
1373 | )) executed 168 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_hit) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 168 | ||||||||||||||||||||||||||||||||||||
1374 | ; executed 168 times by 1 test: __atomic_fetch_add (( (&s->session_ctx->stats.sess_hit) ), ( 1 ), ( memory_order_relaxed )) ; Executed by:
| 168 | ||||||||||||||||||||||||||||||||||||
1375 | - | |||||||||||||||||||||||||||||||||||||
1376 | s->handshake_func = ossl_statem_connect; | - | ||||||||||||||||||||||||||||||||||||
1377 | - | |||||||||||||||||||||||||||||||||||||
1378 | __atomic_fetch_add (( | - | ||||||||||||||||||||||||||||||||||||
1379 | (&s->session_ctx->stats.sess_connect_good) | - | ||||||||||||||||||||||||||||||||||||
1380 | ), ( | - | ||||||||||||||||||||||||||||||||||||
1381 | 1 | - | ||||||||||||||||||||||||||||||||||||
1382 | ), ( | - | ||||||||||||||||||||||||||||||||||||
1383 | memory_order_relaxed | - | ||||||||||||||||||||||||||||||||||||
1384 | )) | - | ||||||||||||||||||||||||||||||||||||
1385 | ; | - | ||||||||||||||||||||||||||||||||||||
1386 | - | |||||||||||||||||||||||||||||||||||||
1387 | if ((
| 17-1441 | ||||||||||||||||||||||||||||||||||||
1388 | - | |||||||||||||||||||||||||||||||||||||
1389 | - | |||||||||||||||||||||||||||||||||||||
1390 | - | |||||||||||||||||||||||||||||||||||||
1391 | - | |||||||||||||||||||||||||||||||||||||
1392 | - | |||||||||||||||||||||||||||||||||||||
1393 | dtls1_start_timer(s); | - | ||||||||||||||||||||||||||||||||||||
1394 | } executed 17 times by 1 test: end of block Executed by:
| 17 | ||||||||||||||||||||||||||||||||||||
1395 | } executed 1619 times by 1 test: end of block Executed by:
| 1619 | ||||||||||||||||||||||||||||||||||||
1396 | - | |||||||||||||||||||||||||||||||||||||
1397 | if ((
| 355-2875 | ||||||||||||||||||||||||||||||||||||
1398 | - | |||||||||||||||||||||||||||||||||||||
1399 | s->d1->handshake_read_seq = 0; | - | ||||||||||||||||||||||||||||||||||||
1400 | s->d1->handshake_write_seq = 0; | - | ||||||||||||||||||||||||||||||||||||
1401 | s->d1->next_handshake_write_seq = 0; | - | ||||||||||||||||||||||||||||||||||||
1402 | dtls1_clear_received_buffer(s); | - | ||||||||||||||||||||||||||||||||||||
1403 | } executed 355 times by 1 test: end of block Executed by:
| 355 | ||||||||||||||||||||||||||||||||||||
1404 | } executed 3230 times by 1 test: end of block Executed by:
| 3230 | ||||||||||||||||||||||||||||||||||||
1405 | - | |||||||||||||||||||||||||||||||||||||
1406 | if (s->info_callback !=
| 2258-2805 | ||||||||||||||||||||||||||||||||||||
1407 | ((void *)0)
| 2258-2805 | ||||||||||||||||||||||||||||||||||||
1408 | ) | - | ||||||||||||||||||||||||||||||||||||
1409 | cb = s->info_callback; executed 2805 times by 1 test: cb = s->info_callback; Executed by:
| 2805 | ||||||||||||||||||||||||||||||||||||
1410 | else if (s->ctx->info_callback !=
| 13-2245 | ||||||||||||||||||||||||||||||||||||
1411 | ((void *)0)
| 13-2245 | ||||||||||||||||||||||||||||||||||||
1412 | ) | - | ||||||||||||||||||||||||||||||||||||
1413 | cb = s->ctx->info_callback; executed 13 times by 1 test: cb = s->ctx->info_callback; Executed by:
| 13 | ||||||||||||||||||||||||||||||||||||
1414 | - | |||||||||||||||||||||||||||||||||||||
1415 | - | |||||||||||||||||||||||||||||||||||||
1416 | ossl_statem_set_in_init(s, 0); | - | ||||||||||||||||||||||||||||||||||||
1417 | - | |||||||||||||||||||||||||||||||||||||
1418 | if (cb !=
| 2245-2818 | ||||||||||||||||||||||||||||||||||||
1419 | ((void *)0)
| 2245-2818 | ||||||||||||||||||||||||||||||||||||
1420 | ) | - | ||||||||||||||||||||||||||||||||||||
1421 | cb(s, 0x20, 1); executed 2818 times by 1 test: cb(s, 0x20, 1); Executed by:
| 2818 | ||||||||||||||||||||||||||||||||||||
1422 | - | |||||||||||||||||||||||||||||||||||||
1423 | if (!stop
| 577-4486 | ||||||||||||||||||||||||||||||||||||
1424 | - | |||||||||||||||||||||||||||||||||||||
1425 | ossl_statem_set_in_init(s, 1); | - | ||||||||||||||||||||||||||||||||||||
1426 | return executed 577 times by 1 test: WORK_FINISHED_CONTINUE;return WORK_FINISHED_CONTINUE; Executed by:
executed 577 times by 1 test: return WORK_FINISHED_CONTINUE; Executed by:
| 577 | ||||||||||||||||||||||||||||||||||||
1427 | } | - | ||||||||||||||||||||||||||||||||||||
1428 | - | |||||||||||||||||||||||||||||||||||||
1429 | return executed 4486 times by 1 test: WORK_FINISHED_STOP;return WORK_FINISHED_STOP; Executed by:
executed 4486 times by 1 test: return WORK_FINISHED_STOP; Executed by:
| 4486 | ||||||||||||||||||||||||||||||||||||
1430 | } | - | ||||||||||||||||||||||||||||||||||||
1431 | - | |||||||||||||||||||||||||||||||||||||
1432 | int tls_get_message_header(SSL *s, int *mt) | - | ||||||||||||||||||||||||||||||||||||
1433 | { | - | ||||||||||||||||||||||||||||||||||||
1434 | - | |||||||||||||||||||||||||||||||||||||
1435 | int skip_message, i, recvd_type; | - | ||||||||||||||||||||||||||||||||||||
1436 | unsigned char *p; | - | ||||||||||||||||||||||||||||||||||||
1437 | size_t l, readbytes; | - | ||||||||||||||||||||||||||||||||||||
1438 | - | |||||||||||||||||||||||||||||||||||||
1439 | p = (unsigned char *)s->init_buf->data; | - | ||||||||||||||||||||||||||||||||||||
1440 | - | |||||||||||||||||||||||||||||||||||||
1441 | do { | - | ||||||||||||||||||||||||||||||||||||
1442 | while (s->init_num < 4
| 21641-41601 | ||||||||||||||||||||||||||||||||||||
1443 | i = s->method->ssl_read_bytes(s, 22, &recvd_type, | - | ||||||||||||||||||||||||||||||||||||
1444 | &p[s->init_num], | - | ||||||||||||||||||||||||||||||||||||
1445 | 4 - s->init_num, | - | ||||||||||||||||||||||||||||||||||||
1446 | 0, &readbytes); | - | ||||||||||||||||||||||||||||||||||||
1447 | if (i <= 0
| 17479-24122 | ||||||||||||||||||||||||||||||||||||
1448 | s->rwstate = 3; | - | ||||||||||||||||||||||||||||||||||||
1449 | return executed 17479 times by 1 test: 0;return 0; Executed by:
executed 17479 times by 1 test: return 0; Executed by:
| 17479 | ||||||||||||||||||||||||||||||||||||
1450 | } | - | ||||||||||||||||||||||||||||||||||||
1451 | if (recvd_type == 20
| 2125-21997 | ||||||||||||||||||||||||||||||||||||
1452 | - | |||||||||||||||||||||||||||||||||||||
1453 | - | |||||||||||||||||||||||||||||||||||||
1454 | - | |||||||||||||||||||||||||||||||||||||
1455 | - | |||||||||||||||||||||||||||||||||||||
1456 | if (s->init_num != 0
| 2-2123 | ||||||||||||||||||||||||||||||||||||
1457 | ossl_statem_fatal((s), (10), (387), (103), | - | ||||||||||||||||||||||||||||||||||||
1458 | - | |||||||||||||||||||||||||||||||||||||
1459 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1460 | , | - | ||||||||||||||||||||||||||||||||||||
1461 | - | |||||||||||||||||||||||||||||||||||||
1462 | 1162 | - | ||||||||||||||||||||||||||||||||||||
1463 | ) | - | ||||||||||||||||||||||||||||||||||||
1464 | - | |||||||||||||||||||||||||||||||||||||
1465 | ; | - | ||||||||||||||||||||||||||||||||||||
1466 | return executed 9 times by 1 test: 0;return 0; Executed by:
executed 9 times by 1 test: return 0; Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||
1467 | } | - | ||||||||||||||||||||||||||||||||||||
1468 | if (s->statem.hand_state == TLS_ST_BEFORE
| 1-2115 | ||||||||||||||||||||||||||||||||||||
1469 | && (
| 0-1 | ||||||||||||||||||||||||||||||||||||
1470 | - | |||||||||||||||||||||||||||||||||||||
1471 | - | |||||||||||||||||||||||||||||||||||||
1472 | - | |||||||||||||||||||||||||||||||||||||
1473 | - | |||||||||||||||||||||||||||||||||||||
1474 | - | |||||||||||||||||||||||||||||||||||||
1475 | - | |||||||||||||||||||||||||||||||||||||
1476 | - | |||||||||||||||||||||||||||||||||||||
1477 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1478 | } | - | ||||||||||||||||||||||||||||||||||||
1479 | s->s3->tmp.message_type = *mt = 0x0101; | - | ||||||||||||||||||||||||||||||||||||
1480 | s->init_num = readbytes - 1; | - | ||||||||||||||||||||||||||||||||||||
1481 | s->init_msg = s->init_buf->data; | - | ||||||||||||||||||||||||||||||||||||
1482 | s->s3->tmp.message_size = readbytes; | - | ||||||||||||||||||||||||||||||||||||
1483 | return executed 2116 times by 1 test: 1;return 1; Executed by:
executed 2116 times by 1 test: return 1; Executed by:
| 2116 | ||||||||||||||||||||||||||||||||||||
1484 | } else if (recvd_type != 22
| 0-21997 | ||||||||||||||||||||||||||||||||||||
1485 | ossl_statem_fatal((s), (10), (387), (133), | - | ||||||||||||||||||||||||||||||||||||
1486 | - | |||||||||||||||||||||||||||||||||||||
1487 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1488 | , | - | ||||||||||||||||||||||||||||||||||||
1489 | - | |||||||||||||||||||||||||||||||||||||
1490 | 1184 | - | ||||||||||||||||||||||||||||||||||||
1491 | ) | - | ||||||||||||||||||||||||||||||||||||
1492 | - | |||||||||||||||||||||||||||||||||||||
1493 | ; | - | ||||||||||||||||||||||||||||||||||||
1494 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1495 | } | - | ||||||||||||||||||||||||||||||||||||
1496 | s->init_num += readbytes; | - | ||||||||||||||||||||||||||||||||||||
1497 | } executed 21997 times by 1 test: end of block Executed by:
| 21997 | ||||||||||||||||||||||||||||||||||||
1498 | - | |||||||||||||||||||||||||||||||||||||
1499 | skip_message = 0; | - | ||||||||||||||||||||||||||||||||||||
1500 | if (!s->server
| 6246-15395 | ||||||||||||||||||||||||||||||||||||
1501 | if (s->statem.hand_state != TLS_ST_OK
| 983-14412 | ||||||||||||||||||||||||||||||||||||
1502 | && p[0] == 0
| 1130-13282 | ||||||||||||||||||||||||||||||||||||
1503 | - | |||||||||||||||||||||||||||||||||||||
1504 | - | |||||||||||||||||||||||||||||||||||||
1505 | - | |||||||||||||||||||||||||||||||||||||
1506 | - | |||||||||||||||||||||||||||||||||||||
1507 | - | |||||||||||||||||||||||||||||||||||||
1508 | - | |||||||||||||||||||||||||||||||||||||
1509 | if (p[1] == 0
| 1-1114 | ||||||||||||||||||||||||||||||||||||
1510 | s->init_num = 0; | - | ||||||||||||||||||||||||||||||||||||
1511 | skip_message = 1; | - | ||||||||||||||||||||||||||||||||||||
1512 | - | |||||||||||||||||||||||||||||||||||||
1513 | if (s->msg_callback
| 0-1105 | ||||||||||||||||||||||||||||||||||||
1514 | s->msg_callback(0, s->version, 22, never executed: s->msg_callback(0, s->version, 22, p, 4, s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
1515 | p, 4, s, never executed: s->msg_callback(0, s->version, 22, p, 4, s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
1516 | s->msg_callback_arg); never executed: s->msg_callback(0, s->version, 22, p, 4, s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
1517 | } executed 1105 times by 1 test: end of block Executed by:
| 1105 | ||||||||||||||||||||||||||||||||||||
1518 | } executed 21641 times by 1 test: while (skip_messageend of block Executed by:
| 1105-21641 | ||||||||||||||||||||||||||||||||||||
1519 | - | |||||||||||||||||||||||||||||||||||||
1520 | - | |||||||||||||||||||||||||||||||||||||
1521 | *mt = *p; | - | ||||||||||||||||||||||||||||||||||||
1522 | s->s3->tmp.message_type = *(p++); | - | ||||||||||||||||||||||||||||||||||||
1523 | - | |||||||||||||||||||||||||||||||||||||
1524 | if (RECORD_LAYER_is_sslv2_record(&s->rlayer)
| 185-20351 | ||||||||||||||||||||||||||||||||||||
1525 | - | |||||||||||||||||||||||||||||||||||||
1526 | - | |||||||||||||||||||||||||||||||||||||
1527 | - | |||||||||||||||||||||||||||||||||||||
1528 | - | |||||||||||||||||||||||||||||||||||||
1529 | - | |||||||||||||||||||||||||||||||||||||
1530 | - | |||||||||||||||||||||||||||||||||||||
1531 | - | |||||||||||||||||||||||||||||||||||||
1532 | l = RECORD_LAYER_get_rrec_length(&s->rlayer) | - | ||||||||||||||||||||||||||||||||||||
1533 | + 4; | - | ||||||||||||||||||||||||||||||||||||
1534 | s->s3->tmp.message_size = l; | - | ||||||||||||||||||||||||||||||||||||
1535 | - | |||||||||||||||||||||||||||||||||||||
1536 | s->init_msg = s->init_buf->data; | - | ||||||||||||||||||||||||||||||||||||
1537 | s->init_num = 4; | - | ||||||||||||||||||||||||||||||||||||
1538 | } executed 185 times by 1 test: else {end of block Executed by:
| 185 | ||||||||||||||||||||||||||||||||||||
1539 | ((l =(((unsigned long)((p)[0]))<<16)| (((unsigned long)((p)[1]))<< 8)| (((unsigned long)((p)[2])) )),(p)+=3); | - | ||||||||||||||||||||||||||||||||||||
1540 | - | |||||||||||||||||||||||||||||||||||||
1541 | if (l > (0x7fffffff - 4)
| 0-20351 | ||||||||||||||||||||||||||||||||||||
1542 | ossl_statem_fatal((s), (47), (387), (152), | - | ||||||||||||||||||||||||||||||||||||
1543 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
1544 | , | - | ||||||||||||||||||||||||||||||||||||
1545 | 1234 | - | ||||||||||||||||||||||||||||||||||||
1546 | ) | - | ||||||||||||||||||||||||||||||||||||
1547 | ; | - | ||||||||||||||||||||||||||||||||||||
1548 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1549 | } | - | ||||||||||||||||||||||||||||||||||||
1550 | s->s3->tmp.message_size = l; | - | ||||||||||||||||||||||||||||||||||||
1551 | - | |||||||||||||||||||||||||||||||||||||
1552 | s->init_msg = s->init_buf->data + 4; | - | ||||||||||||||||||||||||||||||||||||
1553 | s->init_num = 0; | - | ||||||||||||||||||||||||||||||||||||
1554 | } executed 20351 times by 1 test: end of block Executed by:
| 20351 | ||||||||||||||||||||||||||||||||||||
1555 | - | |||||||||||||||||||||||||||||||||||||
1556 | return executed 20536 times by 1 test: 1;return 1; Executed by:
executed 20536 times by 1 test: return 1; Executed by:
| 20536 | ||||||||||||||||||||||||||||||||||||
1557 | } | - | ||||||||||||||||||||||||||||||||||||
1558 | - | |||||||||||||||||||||||||||||||||||||
1559 | int tls_get_message_body(SSL *s, size_t *len) | - | ||||||||||||||||||||||||||||||||||||
1560 | { | - | ||||||||||||||||||||||||||||||||||||
1561 | size_t n, readbytes; | - | ||||||||||||||||||||||||||||||||||||
1562 | unsigned char *p; | - | ||||||||||||||||||||||||||||||||||||
1563 | int i; | - | ||||||||||||||||||||||||||||||||||||
1564 | - | |||||||||||||||||||||||||||||||||||||
1565 | if (s->s3->tmp.message_type == 0x0101
| 2114-22875 | ||||||||||||||||||||||||||||||||||||
1566 | - | |||||||||||||||||||||||||||||||||||||
1567 | *len = (unsigned long)s->init_num; | - | ||||||||||||||||||||||||||||||||||||
1568 | return executed 2114 times by 1 test: 1;return 1; Executed by:
executed 2114 times by 1 test: return 1; Executed by:
| 2114 | ||||||||||||||||||||||||||||||||||||
1569 | } | - | ||||||||||||||||||||||||||||||||||||
1570 | - | |||||||||||||||||||||||||||||||||||||
1571 | p = s->init_msg; | - | ||||||||||||||||||||||||||||||||||||
1572 | n = s->s3->tmp.message_size - s->init_num; | - | ||||||||||||||||||||||||||||||||||||
1573 | while (n > 0
| 20397-26088 | ||||||||||||||||||||||||||||||||||||
1574 | i = s->method->ssl_read_bytes(s, 22, | - | ||||||||||||||||||||||||||||||||||||
1575 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1576 | , | - | ||||||||||||||||||||||||||||||||||||
1577 | &p[s->init_num], n, 0, &readbytes); | - | ||||||||||||||||||||||||||||||||||||
1578 | if (i <= 0
| 2478-23610 | ||||||||||||||||||||||||||||||||||||
1579 | s->rwstate = 3; | - | ||||||||||||||||||||||||||||||||||||
1580 | *len = 0; | - | ||||||||||||||||||||||||||||||||||||
1581 | return executed 2478 times by 1 test: 0;return 0; Executed by:
executed 2478 times by 1 test: return 0; Executed by:
| 2478 | ||||||||||||||||||||||||||||||||||||
1582 | } | - | ||||||||||||||||||||||||||||||||||||
1583 | s->init_num += readbytes; | - | ||||||||||||||||||||||||||||||||||||
1584 | n -= readbytes; | - | ||||||||||||||||||||||||||||||||||||
1585 | } executed 23610 times by 1 test: end of block Executed by:
| 23610 | ||||||||||||||||||||||||||||||||||||
1586 | - | |||||||||||||||||||||||||||||||||||||
1587 | - | |||||||||||||||||||||||||||||||||||||
1588 | - | |||||||||||||||||||||||||||||||||||||
1589 | - | |||||||||||||||||||||||||||||||||||||
1590 | - | |||||||||||||||||||||||||||||||||||||
1591 | if (*(
| 0-17493 | ||||||||||||||||||||||||||||||||||||
1592 | - | |||||||||||||||||||||||||||||||||||||
1593 | *len = 0; | - | ||||||||||||||||||||||||||||||||||||
1594 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1595 | } | - | ||||||||||||||||||||||||||||||||||||
1596 | - | |||||||||||||||||||||||||||||||||||||
1597 | - | |||||||||||||||||||||||||||||||||||||
1598 | if (RECORD_LAYER_is_sslv2_record(&s->rlayer)
| 185-20212 | ||||||||||||||||||||||||||||||||||||
1599 | if (!ssl3_finish_mac(s, (unsigned char *)s->init_buf->data,
| 0-185 | ||||||||||||||||||||||||||||||||||||
1600 | s->init_num)
| 0-185 | ||||||||||||||||||||||||||||||||||||
1601 | - | |||||||||||||||||||||||||||||||||||||
1602 | *len = 0; | - | ||||||||||||||||||||||||||||||||||||
1603 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1604 | } | - | ||||||||||||||||||||||||||||||||||||
1605 | if (s->msg_callback
| 0-185 | ||||||||||||||||||||||||||||||||||||
1606 | s->msg_callback(0, 0x0002, 0, s->init_buf->data, never executed: s->msg_callback(0, 0x0002, 0, s->init_buf->data, (size_t)s->init_num, s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
1607 | (size_t)s->init_num, s, s->msg_callback_arg); never executed: s->msg_callback(0, 0x0002, 0, s->init_buf->data, (size_t)s->init_num, s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
1608 | } executed 185 times by 1 test: else {end of block Executed by:
| 185 | ||||||||||||||||||||||||||||||||||||
1609 | if (!(!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-20212 | ||||||||||||||||||||||||||||||||||||
1610 | && s->s3->tmp.message_type != 24
| 8-2900 | ||||||||||||||||||||||||||||||||||||
1611 | if (s->s3->tmp.message_type != 2
| 4413-14844 | ||||||||||||||||||||||||||||||||||||
1612 | || s->init_num < (4 + 2) + 32
| 10-4403 | ||||||||||||||||||||||||||||||||||||
1613 | || memcmp(hrrrandom,
| 736-3667 | ||||||||||||||||||||||||||||||||||||
1614 | s->init_buf->data + (4 + 2),
| 736-3667 | ||||||||||||||||||||||||||||||||||||
1615 | 32) != 0
| 736-3667 | ||||||||||||||||||||||||||||||||||||
1616 | if (!ssl3_finish_mac(s, (unsigned char *)s->init_buf->data,
| 0-18521 | ||||||||||||||||||||||||||||||||||||
1617 | s->init_num + 4)
| 0-18521 | ||||||||||||||||||||||||||||||||||||
1618 | - | |||||||||||||||||||||||||||||||||||||
1619 | *len = 0; | - | ||||||||||||||||||||||||||||||||||||
1620 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1621 | } | - | ||||||||||||||||||||||||||||||||||||
1622 | } executed 18521 times by 1 test: end of block Executed by:
| 18521 | ||||||||||||||||||||||||||||||||||||
1623 | } executed 19257 times by 1 test: end of block Executed by:
| 19257 | ||||||||||||||||||||||||||||||||||||
1624 | if (s->msg_callback
| 0-20212 | ||||||||||||||||||||||||||||||||||||
1625 | s->msg_callback(0, s->version, 22, s->init_buf->data, never executed: s->msg_callback(0, s->version, 22, s->init_buf->data, (size_t)s->init_num + 4, s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
1626 | (size_t)s->init_num + 4, s, never executed: s->msg_callback(0, s->version, 22, s->init_buf->data, (size_t)s->init_num + 4, s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
1627 | s->msg_callback_arg); never executed: s->msg_callback(0, s->version, 22, s->init_buf->data, (size_t)s->init_num + 4, s, s->msg_callback_arg); | 0 | ||||||||||||||||||||||||||||||||||||
1628 | } executed 20212 times by 1 test: end of block Executed by:
| 20212 | ||||||||||||||||||||||||||||||||||||
1629 | - | |||||||||||||||||||||||||||||||||||||
1630 | *len = s->init_num; | - | ||||||||||||||||||||||||||||||||||||
1631 | return executed 20397 times by 1 test: 1;return 1; Executed by:
executed 20397 times by 1 test: return 1; Executed by:
| 20397 | ||||||||||||||||||||||||||||||||||||
1632 | } | - | ||||||||||||||||||||||||||||||||||||
1633 | - | |||||||||||||||||||||||||||||||||||||
1634 | static const X509ERR2ALERT x509table[] = { | - | ||||||||||||||||||||||||||||||||||||
1635 | {50, 40}, | - | ||||||||||||||||||||||||||||||||||||
1636 | {67, 42}, | - | ||||||||||||||||||||||||||||||||||||
1637 | {68, 42}, | - | ||||||||||||||||||||||||||||||||||||
1638 | {22, 48}, | - | ||||||||||||||||||||||||||||||||||||
1639 | {10, 45}, | - | ||||||||||||||||||||||||||||||||||||
1640 | {9, 42}, | - | ||||||||||||||||||||||||||||||||||||
1641 | {28, 42}, | - | ||||||||||||||||||||||||||||||||||||
1642 | {23, 44}, | - | ||||||||||||||||||||||||||||||||||||
1643 | {7, 51}, | - | ||||||||||||||||||||||||||||||||||||
1644 | {27, 42}, | - | ||||||||||||||||||||||||||||||||||||
1645 | {12, 45}, | - | ||||||||||||||||||||||||||||||||||||
1646 | {11, 42}, | - | ||||||||||||||||||||||||||||||||||||
1647 | {8, 51}, | - | ||||||||||||||||||||||||||||||||||||
1648 | {65, 42}, | - | ||||||||||||||||||||||||||||||||||||
1649 | {18, 48}, | - | ||||||||||||||||||||||||||||||||||||
1650 | {66, 42}, | - | ||||||||||||||||||||||||||||||||||||
1651 | {63, 42}, | - | ||||||||||||||||||||||||||||||||||||
1652 | {14, 42}, | - | ||||||||||||||||||||||||||||||||||||
1653 | {13, 42}, | - | ||||||||||||||||||||||||||||||||||||
1654 | {15, 42}, | - | ||||||||||||||||||||||||||||||||||||
1655 | {16, 42}, | - | ||||||||||||||||||||||||||||||||||||
1656 | {62, 42}, | - | ||||||||||||||||||||||||||||||||||||
1657 | {24, 48}, | - | ||||||||||||||||||||||||||||||||||||
1658 | {69, 80}, | - | ||||||||||||||||||||||||||||||||||||
1659 | {26, 43}, | - | ||||||||||||||||||||||||||||||||||||
1660 | {64, 42}, | - | ||||||||||||||||||||||||||||||||||||
1661 | {17, 80}, | - | ||||||||||||||||||||||||||||||||||||
1662 | {25, 48}, | - | ||||||||||||||||||||||||||||||||||||
1663 | {19, 48}, | - | ||||||||||||||||||||||||||||||||||||
1664 | {70, 80}, | - | ||||||||||||||||||||||||||||||||||||
1665 | {6, 42}, | - | ||||||||||||||||||||||||||||||||||||
1666 | {4, 42}, | - | ||||||||||||||||||||||||||||||||||||
1667 | {5, 42}, | - | ||||||||||||||||||||||||||||||||||||
1668 | {3, 48}, | - | ||||||||||||||||||||||||||||||||||||
1669 | {33, 48}, | - | ||||||||||||||||||||||||||||||||||||
1670 | {2, 48}, | - | ||||||||||||||||||||||||||||||||||||
1671 | {20, 48}, | - | ||||||||||||||||||||||||||||||||||||
1672 | {21, 48}, | - | ||||||||||||||||||||||||||||||||||||
1673 | {1, 80}, | - | ||||||||||||||||||||||||||||||||||||
1674 | - | |||||||||||||||||||||||||||||||||||||
1675 | - | |||||||||||||||||||||||||||||||||||||
1676 | {0, 46} | - | ||||||||||||||||||||||||||||||||||||
1677 | }; | - | ||||||||||||||||||||||||||||||||||||
1678 | - | |||||||||||||||||||||||||||||||||||||
1679 | int ssl_x509err2alert(int x509err) | - | ||||||||||||||||||||||||||||||||||||
1680 | { | - | ||||||||||||||||||||||||||||||||||||
1681 | const X509ERR2ALERT *tp; | - | ||||||||||||||||||||||||||||||||||||
1682 | - | |||||||||||||||||||||||||||||||||||||
1683 | for (tp = x509table; tp->x509err != 0
| 0-372 | ||||||||||||||||||||||||||||||||||||
1684 | if (tp->x509err == x509err
| 12-360 | ||||||||||||||||||||||||||||||||||||
1685 | break; executed 12 times by 1 test: break; Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||
1686 | return executed 12 times by 1 test: tp->alert;return tp->alert; Executed by:
executed 12 times by 1 test: return tp->alert; Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||
1687 | } | - | ||||||||||||||||||||||||||||||||||||
1688 | - | |||||||||||||||||||||||||||||||||||||
1689 | int ssl_allow_compression(SSL *s) | - | ||||||||||||||||||||||||||||||||||||
1690 | { | - | ||||||||||||||||||||||||||||||||||||
1691 | if (s->options & 0x00020000U
| 0-23912 | ||||||||||||||||||||||||||||||||||||
1692 | return executed 23912 times by 1 test: 0;return 0; Executed by:
executed 23912 times by 1 test: return 0; Executed by:
| 23912 | ||||||||||||||||||||||||||||||||||||
1693 | return never executed: ssl_security(s, (15 | 0), 0, 0, return ssl_security(s, (15 | 0), 0, 0, ((void *)0) ); never executed: return ssl_security(s, (15 | 0), 0, 0, ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
1694 | ((void *)0) never executed: return ssl_security(s, (15 | 0), 0, 0, ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
1695 | ); never executed: return ssl_security(s, (15 | 0), 0, 0, ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
1696 | } | - | ||||||||||||||||||||||||||||||||||||
1697 | - | |||||||||||||||||||||||||||||||||||||
1698 | static int version_cmp(const SSL *s, int a, int b) | - | ||||||||||||||||||||||||||||||||||||
1699 | { | - | ||||||||||||||||||||||||||||||||||||
1700 | int dtls = (s->method->ssl3_enc->enc_flags & 0x8); | - | ||||||||||||||||||||||||||||||||||||
1701 | - | |||||||||||||||||||||||||||||||||||||
1702 | if (a == b
| 31290-70559 | ||||||||||||||||||||||||||||||||||||
1703 | return executed 31290 times by 1 test: 0;return 0; Executed by:
executed 31290 times by 1 test: return 0; Executed by:
| 31290 | ||||||||||||||||||||||||||||||||||||
1704 | if (!dtls
| 2272-68287 | ||||||||||||||||||||||||||||||||||||
1705 | return executed 68287 times by 1 test: a < breturn a < b ? -1 : 1; Executed by:
executed 68287 times by 1 test: return a < b ? -1 : 1; Executed by:
| 31471-68287 | ||||||||||||||||||||||||||||||||||||
1706 | return executed 2272 times by 1 test: ((((return ((((a) == 0x0100) ? 0xff00 : (a)) > (((b) == 0x0100) ? 0xff00 : (b))) ? -1 : 1; Executed by:
executed 2272 times by 1 test: return ((((a) == 0x0100) ? 0xff00 : (a)) > (((b) == 0x0100) ? 0xff00 : (b))) ? -1 : 1; Executed by:
| 625-2272 | ||||||||||||||||||||||||||||||||||||
1707 | } | - | ||||||||||||||||||||||||||||||||||||
1708 | - | |||||||||||||||||||||||||||||||||||||
1709 | typedef struct { | - | ||||||||||||||||||||||||||||||||||||
1710 | int version; | - | ||||||||||||||||||||||||||||||||||||
1711 | const SSL_METHOD *(*cmeth) (void); | - | ||||||||||||||||||||||||||||||||||||
1712 | const SSL_METHOD *(*smeth) (void); | - | ||||||||||||||||||||||||||||||||||||
1713 | } version_info; | - | ||||||||||||||||||||||||||||||||||||
1714 | - | |||||||||||||||||||||||||||||||||||||
1715 | - | |||||||||||||||||||||||||||||||||||||
1716 | - | |||||||||||||||||||||||||||||||||||||
1717 | - | |||||||||||||||||||||||||||||||||||||
1718 | - | |||||||||||||||||||||||||||||||||||||
1719 | - | |||||||||||||||||||||||||||||||||||||
1720 | static const version_info tls_version_table[] = { | - | ||||||||||||||||||||||||||||||||||||
1721 | - | |||||||||||||||||||||||||||||||||||||
1722 | {0x0304, tlsv1_3_client_method, tlsv1_3_server_method}, | - | ||||||||||||||||||||||||||||||||||||
1723 | - | |||||||||||||||||||||||||||||||||||||
1724 | - | |||||||||||||||||||||||||||||||||||||
1725 | - | |||||||||||||||||||||||||||||||||||||
1726 | - | |||||||||||||||||||||||||||||||||||||
1727 | {0x0303, tlsv1_2_client_method, tlsv1_2_server_method}, | - | ||||||||||||||||||||||||||||||||||||
1728 | - | |||||||||||||||||||||||||||||||||||||
1729 | - | |||||||||||||||||||||||||||||||||||||
1730 | - | |||||||||||||||||||||||||||||||||||||
1731 | - | |||||||||||||||||||||||||||||||||||||
1732 | {0x0302, tlsv1_1_client_method, tlsv1_1_server_method}, | - | ||||||||||||||||||||||||||||||||||||
1733 | - | |||||||||||||||||||||||||||||||||||||
1734 | - | |||||||||||||||||||||||||||||||||||||
1735 | - | |||||||||||||||||||||||||||||||||||||
1736 | - | |||||||||||||||||||||||||||||||||||||
1737 | {0x0301, tlsv1_client_method, tlsv1_server_method}, | - | ||||||||||||||||||||||||||||||||||||
1738 | - | |||||||||||||||||||||||||||||||||||||
1739 | - | |||||||||||||||||||||||||||||||||||||
1740 | - | |||||||||||||||||||||||||||||||||||||
1741 | - | |||||||||||||||||||||||||||||||||||||
1742 | - | |||||||||||||||||||||||||||||||||||||
1743 | - | |||||||||||||||||||||||||||||||||||||
1744 | {0x0300, | - | ||||||||||||||||||||||||||||||||||||
1745 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1746 | , | - | ||||||||||||||||||||||||||||||||||||
1747 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1748 | }, | - | ||||||||||||||||||||||||||||||||||||
1749 | - | |||||||||||||||||||||||||||||||||||||
1750 | {0, | - | ||||||||||||||||||||||||||||||||||||
1751 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1752 | , | - | ||||||||||||||||||||||||||||||||||||
1753 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1754 | }, | - | ||||||||||||||||||||||||||||||||||||
1755 | }; | - | ||||||||||||||||||||||||||||||||||||
1756 | - | |||||||||||||||||||||||||||||||||||||
1757 | - | |||||||||||||||||||||||||||||||||||||
1758 | - | |||||||||||||||||||||||||||||||||||||
1759 | - | |||||||||||||||||||||||||||||||||||||
1760 | - | |||||||||||||||||||||||||||||||||||||
1761 | - | |||||||||||||||||||||||||||||||||||||
1762 | static const version_info dtls_version_table[] = { | - | ||||||||||||||||||||||||||||||||||||
1763 | - | |||||||||||||||||||||||||||||||||||||
1764 | {0xFEFD, dtlsv1_2_client_method, dtlsv1_2_server_method}, | - | ||||||||||||||||||||||||||||||||||||
1765 | - | |||||||||||||||||||||||||||||||||||||
1766 | - | |||||||||||||||||||||||||||||||||||||
1767 | - | |||||||||||||||||||||||||||||||||||||
1768 | - | |||||||||||||||||||||||||||||||||||||
1769 | {0xFEFF, dtlsv1_client_method, dtlsv1_server_method}, | - | ||||||||||||||||||||||||||||||||||||
1770 | {0x0100, dtls_bad_ver_client_method, | - | ||||||||||||||||||||||||||||||||||||
1771 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1772 | }, | - | ||||||||||||||||||||||||||||||||||||
1773 | - | |||||||||||||||||||||||||||||||||||||
1774 | - | |||||||||||||||||||||||||||||||||||||
1775 | - | |||||||||||||||||||||||||||||||||||||
1776 | - | |||||||||||||||||||||||||||||||||||||
1777 | {0, | - | ||||||||||||||||||||||||||||||||||||
1778 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1779 | , | - | ||||||||||||||||||||||||||||||||||||
1780 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
1781 | }, | - | ||||||||||||||||||||||||||||||||||||
1782 | }; | - | ||||||||||||||||||||||||||||||||||||
1783 | static int ssl_method_error(const SSL *s, const SSL_METHOD *method) | - | ||||||||||||||||||||||||||||||||||||
1784 | { | - | ||||||||||||||||||||||||||||||||||||
1785 | int version = method->version; | - | ||||||||||||||||||||||||||||||||||||
1786 | - | |||||||||||||||||||||||||||||||||||||
1787 | if ((s->min_proto_version != 0
| 29064-84877 | ||||||||||||||||||||||||||||||||||||
1788 | version_cmp(s, version, s->min_proto_version) < 0
| 5423-23641 | ||||||||||||||||||||||||||||||||||||
1789 | ssl_security(s, (9 | 0), 0, version,
| 0-108518 | ||||||||||||||||||||||||||||||||||||
1790 | ((void *)0)
| 0-108518 | ||||||||||||||||||||||||||||||||||||
1791 | ) == 0
| 0-108518 | ||||||||||||||||||||||||||||||||||||
1792 | return executed 5423 times by 1 test: 396;return 396; Executed by:
executed 5423 times by 1 test: return 396; Executed by:
| 5423 | ||||||||||||||||||||||||||||||||||||
1793 | - | |||||||||||||||||||||||||||||||||||||
1794 | if (s->max_proto_version != 0
| 41761-66757 | ||||||||||||||||||||||||||||||||||||
1795 | version_cmp(s, version, s->max_proto_version) > 0
| 8340-33421 | ||||||||||||||||||||||||||||||||||||
1796 | return executed 8340 times by 1 test: 166;return 166; Executed by:
executed 8340 times by 1 test: return 166; Executed by:
| 8340 | ||||||||||||||||||||||||||||||||||||
1797 | - | |||||||||||||||||||||||||||||||||||||
1798 | if ((
| 429-99749 | ||||||||||||||||||||||||||||||||||||
1799 | return executed 429 times by 1 test: 258;return 258; Executed by:
executed 429 times by 1 test: return 258; Executed by:
| 429 | ||||||||||||||||||||||||||||||||||||
1800 | if ((
| 4-50823 | ||||||||||||||||||||||||||||||||||||
1801 | return executed 4 times by 1 test: 158;return 158; Executed by:
executed 4 times by 1 test: return 158; Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||
1802 | - | |||||||||||||||||||||||||||||||||||||
1803 | return executed 99745 times by 1 test: 0;return 0; Executed by:
executed 99745 times by 1 test: return 0; Executed by:
| 99745 | ||||||||||||||||||||||||||||||||||||
1804 | } | - | ||||||||||||||||||||||||||||||||||||
1805 | - | |||||||||||||||||||||||||||||||||||||
1806 | - | |||||||||||||||||||||||||||||||||||||
1807 | - | |||||||||||||||||||||||||||||||||||||
1808 | - | |||||||||||||||||||||||||||||||||||||
1809 | - | |||||||||||||||||||||||||||||||||||||
1810 | - | |||||||||||||||||||||||||||||||||||||
1811 | static int is_tls13_capable(const SSL *s) | - | ||||||||||||||||||||||||||||||||||||
1812 | { | - | ||||||||||||||||||||||||||||||||||||
1813 | int i; | - | ||||||||||||||||||||||||||||||||||||
1814 | - | |||||||||||||||||||||||||||||||||||||
1815 | - | |||||||||||||||||||||||||||||||||||||
1816 | if (s->psk_server_callback !=
| 10-1980 | ||||||||||||||||||||||||||||||||||||
1817 | ((void *)0)
| 10-1980 | ||||||||||||||||||||||||||||||||||||
1818 | ) | - | ||||||||||||||||||||||||||||||||||||
1819 | return executed 10 times by 1 test: 1;return 1; Executed by:
executed 10 times by 1 test: return 1; Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
1820 | - | |||||||||||||||||||||||||||||||||||||
1821 | - | |||||||||||||||||||||||||||||||||||||
1822 | if (s->psk_find_session_cb !=
| 20-1960 | ||||||||||||||||||||||||||||||||||||
1823 | ((void *)0)
| 20-1960 | ||||||||||||||||||||||||||||||||||||
1824 | || s->cert->cert_cb !=
| 0-1960 | ||||||||||||||||||||||||||||||||||||
1825 | ((void *)0)
| 0-1960 | ||||||||||||||||||||||||||||||||||||
1826 | ) | - | ||||||||||||||||||||||||||||||||||||
1827 | return executed 20 times by 1 test: 1;return 1; Executed by:
executed 20 times by 1 test: return 1; Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||
1828 | - | |||||||||||||||||||||||||||||||||||||
1829 | for (i = 0; i < 9
| 0-1966 | ||||||||||||||||||||||||||||||||||||
1830 | - | |||||||||||||||||||||||||||||||||||||
1831 | switch (i) { | - | ||||||||||||||||||||||||||||||||||||
1832 | case executed 1 time by 1 test: 2:case 2: Executed by:
executed 1 time by 1 test: case 2: Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
1833 | case never executed: 4:case 4: never executed: case 4: | 0 | ||||||||||||||||||||||||||||||||||||
1834 | case never executed: 5:case 5: never executed: case 5: | 0 | ||||||||||||||||||||||||||||||||||||
1835 | case never executed: 6:case 6: never executed: case 6: | 0 | ||||||||||||||||||||||||||||||||||||
1836 | continue; executed 1 time by 1 test: continue; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
1837 | default executed 1965 times by 1 test: :default: Executed by:
executed 1965 times by 1 test: default: Executed by:
| 1965 | ||||||||||||||||||||||||||||||||||||
1838 | break; executed 1965 times by 1 test: break; Executed by:
| 1965 | ||||||||||||||||||||||||||||||||||||
1839 | } | - | ||||||||||||||||||||||||||||||||||||
1840 | if (ssl_has_cert(s, i)
| 5-1960 | ||||||||||||||||||||||||||||||||||||
1841 | return executed 1960 times by 1 test: 1;return 1; Executed by:
executed 1960 times by 1 test: return 1; Executed by:
| 1960 | ||||||||||||||||||||||||||||||||||||
1842 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||
1843 | - | |||||||||||||||||||||||||||||||||||||
1844 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1845 | } | - | ||||||||||||||||||||||||||||||||||||
1846 | int ssl_version_supported(const SSL *s, int version, const SSL_METHOD **meth) | - | ||||||||||||||||||||||||||||||||||||
1847 | { | - | ||||||||||||||||||||||||||||||||||||
1848 | const version_info *vent; | - | ||||||||||||||||||||||||||||||||||||
1849 | const version_info *table; | - | ||||||||||||||||||||||||||||||||||||
1850 | - | |||||||||||||||||||||||||||||||||||||
1851 | switch (s->method->version) { | - | ||||||||||||||||||||||||||||||||||||
1852 | default executed 519 times by 1 test: :default: Executed by:
executed 519 times by 1 test: default: Executed by:
| 519 | ||||||||||||||||||||||||||||||||||||
1853 | - | |||||||||||||||||||||||||||||||||||||
1854 | return executed 519 times by 1 test: version_cmp(s, version, s->version) == 0;return version_cmp(s, version, s->version) == 0; Executed by:
executed 519 times by 1 test: return version_cmp(s, version, s->version) == 0; Executed by:
| 519 | ||||||||||||||||||||||||||||||||||||
1855 | case executed 5831 times by 1 test: 0x10000:case 0x10000: Executed by:
executed 5831 times by 1 test: case 0x10000: Executed by:
| 5831 | ||||||||||||||||||||||||||||||||||||
1856 | table = tls_version_table; | - | ||||||||||||||||||||||||||||||||||||
1857 | break; executed 5831 times by 1 test: break; Executed by:
| 5831 | ||||||||||||||||||||||||||||||||||||
1858 | case executed 25 times by 1 test: 0x1FFFF:case 0x1FFFF: Executed by:
executed 25 times by 1 test: case 0x1FFFF: Executed by:
| 25 | ||||||||||||||||||||||||||||||||||||
1859 | table = dtls_version_table; | - | ||||||||||||||||||||||||||||||||||||
1860 | break; executed 25 times by 1 test: break; Executed by:
| 25 | ||||||||||||||||||||||||||||||||||||
1861 | } | - | ||||||||||||||||||||||||||||||||||||
1862 | - | |||||||||||||||||||||||||||||||||||||
1863 | for (vent = table; | - | ||||||||||||||||||||||||||||||||||||
1864 | vent->version != 0
| 105-8778 | ||||||||||||||||||||||||||||||||||||
1865 | ++vent) { | - | ||||||||||||||||||||||||||||||||||||
1866 | if (vent->cmeth !=
| 105-6653 | ||||||||||||||||||||||||||||||||||||
1867 | ((void *)0)
| 105-6653 | ||||||||||||||||||||||||||||||||||||
1868 | - | |||||||||||||||||||||||||||||||||||||
1869 | && version_cmp(s, version, vent->version) == 0
| 1984-4669 | ||||||||||||||||||||||||||||||||||||
1870 | && ssl_method_error(s, vent->cmeth()) == 0
| 938-3731 | ||||||||||||||||||||||||||||||||||||
1871 | && (!s->server
| 914-2817 | ||||||||||||||||||||||||||||||||||||
1872 | || version != 0x0304
| 827-1990 | ||||||||||||||||||||||||||||||||||||
1873 | || is_tls13_capable(s)
| 0-1990 | ||||||||||||||||||||||||||||||||||||
1874 | if (meth !=
| 1574-2157 | ||||||||||||||||||||||||||||||||||||
1875 | ((void *)0)
| 1574-2157 | ||||||||||||||||||||||||||||||||||||
1876 | ) | - | ||||||||||||||||||||||||||||||||||||
1877 | * executed 1574 times by 1 test: meth = vent->cmeth();*meth = vent->cmeth(); Executed by:
executed 1574 times by 1 test: *meth = vent->cmeth(); Executed by:
| 1574 | ||||||||||||||||||||||||||||||||||||
1878 | return executed 3731 times by 1 test: 1;return 1; Executed by:
executed 3731 times by 1 test: return 1; Executed by:
| 3731 | ||||||||||||||||||||||||||||||||||||
1879 | } | - | ||||||||||||||||||||||||||||||||||||
1880 | } executed 3027 times by 1 test: end of block Executed by:
| 3027 | ||||||||||||||||||||||||||||||||||||
1881 | return executed 2125 times by 1 test: 0;return 0; Executed by:
executed 2125 times by 1 test: return 0; Executed by:
| 2125 | ||||||||||||||||||||||||||||||||||||
1882 | } | - | ||||||||||||||||||||||||||||||||||||
1883 | int ssl_check_version_downgrade(SSL *s) | - | ||||||||||||||||||||||||||||||||||||
1884 | { | - | ||||||||||||||||||||||||||||||||||||
1885 | const version_info *vent; | - | ||||||||||||||||||||||||||||||||||||
1886 | const version_info *table; | - | ||||||||||||||||||||||||||||||||||||
1887 | - | |||||||||||||||||||||||||||||||||||||
1888 | - | |||||||||||||||||||||||||||||||||||||
1889 | - | |||||||||||||||||||||||||||||||||||||
1890 | - | |||||||||||||||||||||||||||||||||||||
1891 | - | |||||||||||||||||||||||||||||||||||||
1892 | - | |||||||||||||||||||||||||||||||||||||
1893 | if (s->version == s->ctx->method->version
| 0-57 | ||||||||||||||||||||||||||||||||||||
1894 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
1895 | - | |||||||||||||||||||||||||||||||||||||
1896 | - | |||||||||||||||||||||||||||||||||||||
1897 | - | |||||||||||||||||||||||||||||||||||||
1898 | - | |||||||||||||||||||||||||||||||||||||
1899 | - | |||||||||||||||||||||||||||||||||||||
1900 | if (s->ctx->method->version == TLS_method()->version
| 0-57 | ||||||||||||||||||||||||||||||||||||
1901 | table = tls_version_table; executed 57 times by 1 test: table = tls_version_table; Executed by:
| 57 | ||||||||||||||||||||||||||||||||||||
1902 | else if (s->ctx->method->version == DTLS_method()->version
| 0 | ||||||||||||||||||||||||||||||||||||
1903 | table = dtls_version_table; never executed: table = dtls_version_table; | 0 | ||||||||||||||||||||||||||||||||||||
1904 | else { | - | ||||||||||||||||||||||||||||||||||||
1905 | - | |||||||||||||||||||||||||||||||||||||
1906 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1907 | } | - | ||||||||||||||||||||||||||||||||||||
1908 | - | |||||||||||||||||||||||||||||||||||||
1909 | for (vent = table; vent->version != 0
| 0-57 | ||||||||||||||||||||||||||||||||||||
1910 | if (vent->smeth !=
| 0-57 | ||||||||||||||||||||||||||||||||||||
1911 | ((void *)0)
| 0-57 | ||||||||||||||||||||||||||||||||||||
1912 | && ssl_method_error(s, vent->smeth()) == 0
| 0-57 | ||||||||||||||||||||||||||||||||||||
1913 | return executed 57 times by 1 test: s->version == vent->version;return s->version == vent->version; Executed by:
executed 57 times by 1 test: return s->version == vent->version; Executed by:
| 57 | ||||||||||||||||||||||||||||||||||||
1914 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1915 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1916 | } | - | ||||||||||||||||||||||||||||||||||||
1917 | int ssl_set_version_bound(int method_version, int version, int *bound) | - | ||||||||||||||||||||||||||||||||||||
1918 | { | - | ||||||||||||||||||||||||||||||||||||
1919 | if (version == 0
| 4115-7703 | ||||||||||||||||||||||||||||||||||||
1920 | *bound = version; | - | ||||||||||||||||||||||||||||||||||||
1921 | return executed 4115 times by 1 test: 1;return 1; Executed by:
executed 4115 times by 1 test: return 1; Executed by:
| 4115 | ||||||||||||||||||||||||||||||||||||
1922 | } | - | ||||||||||||||||||||||||||||||||||||
1923 | switch (method_version) { | - | ||||||||||||||||||||||||||||||||||||
1924 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
1925 | - | |||||||||||||||||||||||||||||||||||||
1926 | - | |||||||||||||||||||||||||||||||||||||
1927 | - | |||||||||||||||||||||||||||||||||||||
1928 | - | |||||||||||||||||||||||||||||||||||||
1929 | - | |||||||||||||||||||||||||||||||||||||
1930 | - | |||||||||||||||||||||||||||||||||||||
1931 | - | |||||||||||||||||||||||||||||||||||||
1932 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1933 | - | |||||||||||||||||||||||||||||||||||||
1934 | case executed 7095 times by 1 test: 0x10000:case 0x10000: Executed by:
executed 7095 times by 1 test: case 0x10000: Executed by:
| 7095 | ||||||||||||||||||||||||||||||||||||
1935 | if (version < 0x0300
| 0-7095 | ||||||||||||||||||||||||||||||||||||
1936 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1937 | break; executed 7095 times by 1 test: break; Executed by:
| 7095 | ||||||||||||||||||||||||||||||||||||
1938 | - | |||||||||||||||||||||||||||||||||||||
1939 | case executed 608 times by 1 test: 0x1FFFF:case 0x1FFFF: Executed by:
executed 608 times by 1 test: case 0x1FFFF: Executed by:
| 608 | ||||||||||||||||||||||||||||||||||||
1940 | if (((((
| 0-608 | ||||||||||||||||||||||||||||||||||||
1941 | ((((
| 0-608 | ||||||||||||||||||||||||||||||||||||
1942 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
1943 | break; executed 608 times by 1 test: break; Executed by:
| 608 | ||||||||||||||||||||||||||||||||||||
1944 | } | - | ||||||||||||||||||||||||||||||||||||
1945 | - | |||||||||||||||||||||||||||||||||||||
1946 | *bound = version; | - | ||||||||||||||||||||||||||||||||||||
1947 | return executed 7703 times by 1 test: 1;return 1; Executed by:
executed 7703 times by 1 test: return 1; Executed by:
| 7703 | ||||||||||||||||||||||||||||||||||||
1948 | } | - | ||||||||||||||||||||||||||||||||||||
1949 | - | |||||||||||||||||||||||||||||||||||||
1950 | static void check_for_downgrade(SSL *s, int vers, DOWNGRADE *dgrd) | - | ||||||||||||||||||||||||||||||||||||
1951 | { | - | ||||||||||||||||||||||||||||||||||||
1952 | if (vers == 0x0303
| 1213-1841 | ||||||||||||||||||||||||||||||||||||
1953 | && ssl_version_supported(s, 0x0304,
| 309-904 | ||||||||||||||||||||||||||||||||||||
1954 | ((void *)0)
| 309-904 | ||||||||||||||||||||||||||||||||||||
1955 | )
| 309-904 | ||||||||||||||||||||||||||||||||||||
1956 | *dgrd = DOWNGRADE_TO_1_2; | - | ||||||||||||||||||||||||||||||||||||
1957 | } executed 904 times by 1 test: else if (!(s->method->ssl3_enc->enc_flags & 0x8)end of block Executed by:
| 177-1973 | ||||||||||||||||||||||||||||||||||||
1958 | && vers < 0x0303
| 578-1395 | ||||||||||||||||||||||||||||||||||||
1959 | - | |||||||||||||||||||||||||||||||||||||
1960 | - | |||||||||||||||||||||||||||||||||||||
1961 | - | |||||||||||||||||||||||||||||||||||||
1962 | - | |||||||||||||||||||||||||||||||||||||
1963 | - | |||||||||||||||||||||||||||||||||||||
1964 | - | |||||||||||||||||||||||||||||||||||||
1965 | - | |||||||||||||||||||||||||||||||||||||
1966 | && ssl_version_supported(s, 0x0303,
| 239-339 | ||||||||||||||||||||||||||||||||||||
1967 | ((void *)0)
| 239-339 | ||||||||||||||||||||||||||||||||||||
1968 | )
| 239-339 | ||||||||||||||||||||||||||||||||||||
1969 | *dgrd = DOWNGRADE_TO_1_1; | - | ||||||||||||||||||||||||||||||||||||
1970 | } executed 339 times by 1 test: else {end of block Executed by:
| 339 | ||||||||||||||||||||||||||||||||||||
1971 | *dgrd = DOWNGRADE_NONE; | - | ||||||||||||||||||||||||||||||||||||
1972 | } executed 1811 times by 1 test: end of block Executed by:
| 1811 | ||||||||||||||||||||||||||||||||||||
1973 | } | - | ||||||||||||||||||||||||||||||||||||
1974 | int ssl_choose_server_version(SSL *s, CLIENTHELLO_MSG *hello, DOWNGRADE *dgrd) | - | ||||||||||||||||||||||||||||||||||||
1975 | { | - | ||||||||||||||||||||||||||||||||||||
1976 | int server_version = s->method->version; | - | ||||||||||||||||||||||||||||||||||||
1977 | int client_version = hello->legacy_version; | - | ||||||||||||||||||||||||||||||||||||
1978 | const version_info *vent; | - | ||||||||||||||||||||||||||||||||||||
1979 | const version_info *table; | - | ||||||||||||||||||||||||||||||||||||
1980 | int disabled = 0; | - | ||||||||||||||||||||||||||||||||||||
1981 | RAW_EXTENSION *suppversions; | - | ||||||||||||||||||||||||||||||||||||
1982 | - | |||||||||||||||||||||||||||||||||||||
1983 | s->client_version = client_version; | - | ||||||||||||||||||||||||||||||||||||
1984 | - | |||||||||||||||||||||||||||||||||||||
1985 | switch (server_version) { | - | ||||||||||||||||||||||||||||||||||||
1986 | default executed 78 times by 1 test: :default: Executed by:
executed 78 times by 1 test: default: Executed by:
| 78 | ||||||||||||||||||||||||||||||||||||
1987 | if (!(!(s->method->ssl3_enc->enc_flags & 0x8)
| 0-78 | ||||||||||||||||||||||||||||||||||||
1988 | if (version_cmp(s, client_version, s->version) < 0
| 0-13 | ||||||||||||||||||||||||||||||||||||
1989 | return never executed: 266;return 266; never executed: return 266; | 0 | ||||||||||||||||||||||||||||||||||||
1990 | *dgrd = DOWNGRADE_NONE; | - | ||||||||||||||||||||||||||||||||||||
1991 | - | |||||||||||||||||||||||||||||||||||||
1992 | - | |||||||||||||||||||||||||||||||||||||
1993 | - | |||||||||||||||||||||||||||||||||||||
1994 | - | |||||||||||||||||||||||||||||||||||||
1995 | - | |||||||||||||||||||||||||||||||||||||
1996 | - | |||||||||||||||||||||||||||||||||||||
1997 | - | |||||||||||||||||||||||||||||||||||||
1998 | return executed 13 times by 1 test: 0;return 0; Executed by:
executed 13 times by 1 test: return 0; Executed by:
| 13 | ||||||||||||||||||||||||||||||||||||
1999 | } | - | ||||||||||||||||||||||||||||||||||||
2000 | - | |||||||||||||||||||||||||||||||||||||
2001 | - | |||||||||||||||||||||||||||||||||||||
2002 | - | |||||||||||||||||||||||||||||||||||||
2003 | - | |||||||||||||||||||||||||||||||||||||
2004 | - | |||||||||||||||||||||||||||||||||||||
2005 | case executed 3385 times by 1 test: 0x10000:case 0x10000: Executed by:
executed 3385 times by 1 test: case 0x10000: Executed by:
code before this statement executed 65 times by 1 test: case 0x10000: Executed by:
| 65-3385 | ||||||||||||||||||||||||||||||||||||
2006 | table = tls_version_table; | - | ||||||||||||||||||||||||||||||||||||
2007 | break; executed 3450 times by 1 test: break; Executed by:
| 3450 | ||||||||||||||||||||||||||||||||||||
2008 | case executed 181 times by 1 test: 0x1FFFF:case 0x1FFFF: Executed by:
executed 181 times by 1 test: case 0x1FFFF: Executed by:
| 181 | ||||||||||||||||||||||||||||||||||||
2009 | table = dtls_version_table; | - | ||||||||||||||||||||||||||||||||||||
2010 | break; executed 181 times by 1 test: break; Executed by:
| 181 | ||||||||||||||||||||||||||||||||||||
2011 | } | - | ||||||||||||||||||||||||||||||||||||
2012 | - | |||||||||||||||||||||||||||||||||||||
2013 | suppversions = &hello->pre_proc_exts[TLSEXT_IDX_supported_versions]; | - | ||||||||||||||||||||||||||||||||||||
2014 | - | |||||||||||||||||||||||||||||||||||||
2015 | - | |||||||||||||||||||||||||||||||||||||
2016 | if (!suppversions->present
| 1-2210 | ||||||||||||||||||||||||||||||||||||
2017 | return executed 1 time by 1 test: 258;return 258; Executed by:
executed 1 time by 1 test: return 258; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
2018 | - | |||||||||||||||||||||||||||||||||||||
2019 | if (suppversions->present
| 0-2209 | ||||||||||||||||||||||||||||||||||||
2020 | unsigned int candidate_vers = 0; | - | ||||||||||||||||||||||||||||||||||||
2021 | unsigned int best_vers = 0; | - | ||||||||||||||||||||||||||||||||||||
2022 | const SSL_METHOD *best_method = | - | ||||||||||||||||||||||||||||||||||||
2023 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
2024 | ; | - | ||||||||||||||||||||||||||||||||||||
2025 | PACKET versionslist; | - | ||||||||||||||||||||||||||||||||||||
2026 | - | |||||||||||||||||||||||||||||||||||||
2027 | suppversions->parsed = 1; | - | ||||||||||||||||||||||||||||||||||||
2028 | - | |||||||||||||||||||||||||||||||||||||
2029 | if (!PACKET_as_length_prefixed_1(&suppversions->data, &versionslist)
| 4-1417 | ||||||||||||||||||||||||||||||||||||
2030 | - | |||||||||||||||||||||||||||||||||||||
2031 | return executed 4 times by 1 test: 159;return 159; Executed by:
executed 4 times by 1 test: return 159; Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||
2032 | } | - | ||||||||||||||||||||||||||||||||||||
2033 | if (client_version <= 0x0300
| 2-1415 | ||||||||||||||||||||||||||||||||||||
2034 | return executed 2 times by 1 test: 292;return 292; Executed by:
executed 2 times by 1 test: return 292; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
2035 | - | |||||||||||||||||||||||||||||||||||||
2036 | while (PACKET_get_net_2(&versionslist, &candidate_vers)
| 1415-6950 | ||||||||||||||||||||||||||||||||||||
2037 | if (version_cmp(s, candidate_vers, best_vers) <= 0
| 3318-3632 | ||||||||||||||||||||||||||||||||||||
2038 | continue; executed 3318 times by 1 test: continue; Executed by:
| 3318 | ||||||||||||||||||||||||||||||||||||
2039 | if (ssl_version_supported(s, candidate_vers, &best_method)
| 1632-2000 | ||||||||||||||||||||||||||||||||||||
2040 | best_vers = candidate_vers; executed 1632 times by 1 test: best_vers = candidate_vers; Executed by:
| 1632 | ||||||||||||||||||||||||||||||||||||
2041 | } executed 3632 times by 1 test: end of block Executed by:
| 3632 | ||||||||||||||||||||||||||||||||||||
2042 | if (PACKET_remaining(&versionslist) != 0
| 22-1393 | ||||||||||||||||||||||||||||||||||||
2043 | - | |||||||||||||||||||||||||||||||||||||
2044 | return executed 22 times by 1 test: 159;return 159; Executed by:
executed 22 times by 1 test: return 159; Executed by:
| 22 | ||||||||||||||||||||||||||||||||||||
2045 | } | - | ||||||||||||||||||||||||||||||||||||
2046 | - | |||||||||||||||||||||||||||||||||||||
2047 | if (best_vers > 0
| 53-1340 | ||||||||||||||||||||||||||||||||||||
2048 | if (s->hello_retry_request != SSL_HRR_NONE
| 55-1285 | ||||||||||||||||||||||||||||||||||||
2049 | - | |||||||||||||||||||||||||||||||||||||
2050 | - | |||||||||||||||||||||||||||||||||||||
2051 | - | |||||||||||||||||||||||||||||||||||||
2052 | - | |||||||||||||||||||||||||||||||||||||
2053 | if (best_vers != 0x0304
| 0-55 | ||||||||||||||||||||||||||||||||||||
2054 | return never executed: 258;return 258; never executed: return 258; | 0 | ||||||||||||||||||||||||||||||||||||
2055 | return executed 55 times by 1 test: 0;return 0; Executed by:
executed 55 times by 1 test: return 0; Executed by:
| 55 | ||||||||||||||||||||||||||||||||||||
2056 | } | - | ||||||||||||||||||||||||||||||||||||
2057 | check_for_downgrade(s, best_vers, dgrd); | - | ||||||||||||||||||||||||||||||||||||
2058 | s->version = best_vers; | - | ||||||||||||||||||||||||||||||||||||
2059 | s->method = best_method; | - | ||||||||||||||||||||||||||||||||||||
2060 | return executed 1285 times by 1 test: 0;return 0; Executed by:
executed 1285 times by 1 test: return 0; Executed by:
| 1285 | ||||||||||||||||||||||||||||||||||||
2061 | } | - | ||||||||||||||||||||||||||||||||||||
2062 | return executed 53 times by 1 test: 258;return 258; Executed by:
executed 53 times by 1 test: return 258; Executed by:
| 53 | ||||||||||||||||||||||||||||||||||||
2063 | } | - | ||||||||||||||||||||||||||||||||||||
2064 | - | |||||||||||||||||||||||||||||||||||||
2065 | - | |||||||||||||||||||||||||||||||||||||
2066 | - | |||||||||||||||||||||||||||||||||||||
2067 | - | |||||||||||||||||||||||||||||||||||||
2068 | - | |||||||||||||||||||||||||||||||||||||
2069 | if (version_cmp(s, client_version, 0x0304) >= 0
| 367-1842 | ||||||||||||||||||||||||||||||||||||
2070 | client_version = 0x0303; executed 367 times by 1 test: client_version = 0x0303; Executed by:
| 367 | ||||||||||||||||||||||||||||||||||||
2071 | - | |||||||||||||||||||||||||||||||||||||
2072 | - | |||||||||||||||||||||||||||||||||||||
2073 | - | |||||||||||||||||||||||||||||||||||||
2074 | - | |||||||||||||||||||||||||||||||||||||
2075 | - | |||||||||||||||||||||||||||||||||||||
2076 | for (vent = table; vent->version != 0
| 440-6342 | ||||||||||||||||||||||||||||||||||||
2077 | const SSL_METHOD *method; | - | ||||||||||||||||||||||||||||||||||||
2078 | - | |||||||||||||||||||||||||||||||||||||
2079 | if (vent->smeth ==
| 440-5902 | ||||||||||||||||||||||||||||||||||||
2080 | ((void *)0)
| 440-5902 | ||||||||||||||||||||||||||||||||||||
2081 | || | - | ||||||||||||||||||||||||||||||||||||
2082 | version_cmp(s, client_version, vent->version) < 0
| 1971-3931 | ||||||||||||||||||||||||||||||||||||
2083 | continue; executed 4371 times by 1 test: continue; Executed by:
| 4371 | ||||||||||||||||||||||||||||||||||||
2084 | method = vent->smeth(); | - | ||||||||||||||||||||||||||||||||||||
2085 | if (ssl_method_error(s, method) == 0
| 202-1769 | ||||||||||||||||||||||||||||||||||||
2086 | check_for_downgrade(s, vent->version, dgrd); | - | ||||||||||||||||||||||||||||||||||||
2087 | s->version = vent->version; | - | ||||||||||||||||||||||||||||||||||||
2088 | s->method = method; | - | ||||||||||||||||||||||||||||||||||||
2089 | return executed 1769 times by 1 test: 0;return 0; Executed by:
executed 1769 times by 1 test: return 0; Executed by:
| 1769 | ||||||||||||||||||||||||||||||||||||
2090 | } | - | ||||||||||||||||||||||||||||||||||||
2091 | disabled = 1; | - | ||||||||||||||||||||||||||||||||||||
2092 | } executed 202 times by 1 test: end of block Executed by:
| 202 | ||||||||||||||||||||||||||||||||||||
2093 | return executed 440 times by 1 test: disabledreturn disabled ? 258 : 396; Executed by:
executed 440 times by 1 test: return disabled ? 258 : 396; Executed by:
| 66-440 | ||||||||||||||||||||||||||||||||||||
2094 | } | - | ||||||||||||||||||||||||||||||||||||
2095 | int ssl_choose_client_version(SSL *s, int version, RAW_EXTENSION *extensions) | - | ||||||||||||||||||||||||||||||||||||
2096 | { | - | ||||||||||||||||||||||||||||||||||||
2097 | const version_info *vent; | - | ||||||||||||||||||||||||||||||||||||
2098 | const version_info *table; | - | ||||||||||||||||||||||||||||||||||||
2099 | int ret, ver_min, ver_max, real_max, origv; | - | ||||||||||||||||||||||||||||||||||||
2100 | - | |||||||||||||||||||||||||||||||||||||
2101 | origv = s->version; | - | ||||||||||||||||||||||||||||||||||||
2102 | s->version = version; | - | ||||||||||||||||||||||||||||||||||||
2103 | - | |||||||||||||||||||||||||||||||||||||
2104 | - | |||||||||||||||||||||||||||||||||||||
2105 | if (!tls_parse_extension(s, TLSEXT_IDX_supported_versions,
| 3-3813 | ||||||||||||||||||||||||||||||||||||
2106 | 0x0100
| 3-3813 | ||||||||||||||||||||||||||||||||||||
2107 | | 0x0200, extensions,
| 3-3813 | ||||||||||||||||||||||||||||||||||||
2108 |
| 3-3813 | ||||||||||||||||||||||||||||||||||||
2109 | ((void *)0)
| 3-3813 | ||||||||||||||||||||||||||||||||||||
2110 | , 0)
| 3-3813 | ||||||||||||||||||||||||||||||||||||
2111 | s->version = origv; | - | ||||||||||||||||||||||||||||||||||||
2112 | return executed 3 times by 1 test: 0;return 0; Executed by:
executed 3 times by 1 test: return 0; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
2113 | } | - | ||||||||||||||||||||||||||||||||||||
2114 | - | |||||||||||||||||||||||||||||||||||||
2115 | if (s->hello_retry_request != SSL_HRR_NONE
| 33-3780 | ||||||||||||||||||||||||||||||||||||
2116 | && s->version != 0x0304
| 4-29 | ||||||||||||||||||||||||||||||||||||
2117 | s->version = origv; | - | ||||||||||||||||||||||||||||||||||||
2118 | ossl_statem_fatal((s), (70), (607), (266), | - | ||||||||||||||||||||||||||||||||||||
2119 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2120 | , | - | ||||||||||||||||||||||||||||||||||||
2121 | 1867 | - | ||||||||||||||||||||||||||||||||||||
2122 | ) | - | ||||||||||||||||||||||||||||||||||||
2123 | ; | - | ||||||||||||||||||||||||||||||||||||
2124 | return executed 4 times by 1 test: 0;return 0; Executed by:
executed 4 times by 1 test: return 0; Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||
2125 | } | - | ||||||||||||||||||||||||||||||||||||
2126 | - | |||||||||||||||||||||||||||||||||||||
2127 | switch (s->method->version) { | - | ||||||||||||||||||||||||||||||||||||
2128 | default executed 22 times by 1 test: :default: Executed by:
executed 22 times by 1 test: default: Executed by:
| 22 | ||||||||||||||||||||||||||||||||||||
2129 | if (s->version != s->method->version
| 0-22 | ||||||||||||||||||||||||||||||||||||
2130 | s->version = origv; | - | ||||||||||||||||||||||||||||||||||||
2131 | ossl_statem_fatal((s), (70), (607), (266), | - | ||||||||||||||||||||||||||||||||||||
2132 | - | |||||||||||||||||||||||||||||||||||||
2133 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2134 | , | - | ||||||||||||||||||||||||||||||||||||
2135 | - | |||||||||||||||||||||||||||||||||||||
2136 | 1877 | - | ||||||||||||||||||||||||||||||||||||
2137 | ) | - | ||||||||||||||||||||||||||||||||||||
2138 | - | |||||||||||||||||||||||||||||||||||||
2139 | ; | - | ||||||||||||||||||||||||||||||||||||
2140 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2141 | } | - | ||||||||||||||||||||||||||||||||||||
2142 | - | |||||||||||||||||||||||||||||||||||||
2143 | - | |||||||||||||||||||||||||||||||||||||
2144 | - | |||||||||||||||||||||||||||||||||||||
2145 | - | |||||||||||||||||||||||||||||||||||||
2146 | - | |||||||||||||||||||||||||||||||||||||
2147 | - | |||||||||||||||||||||||||||||||||||||
2148 | - | |||||||||||||||||||||||||||||||||||||
2149 | return executed 22 times by 1 test: 1;return 1; Executed by:
executed 22 times by 1 test: return 1; Executed by:
| 22 | ||||||||||||||||||||||||||||||||||||
2150 | case executed 3609 times by 1 test: 0x10000:case 0x10000: Executed by:
executed 3609 times by 1 test: case 0x10000: Executed by:
| 3609 | ||||||||||||||||||||||||||||||||||||
2151 | table = tls_version_table; | - | ||||||||||||||||||||||||||||||||||||
2152 | break; executed 3609 times by 1 test: break; Executed by:
| 3609 | ||||||||||||||||||||||||||||||||||||
2153 | case executed 178 times by 1 test: 0x1FFFF:case 0x1FFFF: Executed by:
executed 178 times by 1 test: case 0x1FFFF: Executed by:
| 178 | ||||||||||||||||||||||||||||||||||||
2154 | table = dtls_version_table; | - | ||||||||||||||||||||||||||||||||||||
2155 | break; executed 178 times by 1 test: break; Executed by:
| 178 | ||||||||||||||||||||||||||||||||||||
2156 | } | - | ||||||||||||||||||||||||||||||||||||
2157 | - | |||||||||||||||||||||||||||||||||||||
2158 | ret = ssl_get_min_max_version(s, &ver_min, &ver_max, &real_max); | - | ||||||||||||||||||||||||||||||||||||
2159 | if (ret != 0
| 0-3787 | ||||||||||||||||||||||||||||||||||||
2160 | s->version = origv; | - | ||||||||||||||||||||||||||||||||||||
2161 | ossl_statem_fatal((s), (70), (607), (ret), | - | ||||||||||||||||||||||||||||||||||||
2162 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2163 | , | - | ||||||||||||||||||||||||||||||||||||
2164 | 1900 | - | ||||||||||||||||||||||||||||||||||||
2165 | ) | - | ||||||||||||||||||||||||||||||||||||
2166 | ; | - | ||||||||||||||||||||||||||||||||||||
2167 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2168 | } | - | ||||||||||||||||||||||||||||||||||||
2169 | if ((
| 1-3609 | ||||||||||||||||||||||||||||||||||||
2170 | : s->version < ver_min
| 307-3480 | ||||||||||||||||||||||||||||||||||||
2171 | s->version = origv; | - | ||||||||||||||||||||||||||||||||||||
2172 | ossl_statem_fatal((s), (70), (607), (258), | - | ||||||||||||||||||||||||||||||||||||
2173 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2174 | , | - | ||||||||||||||||||||||||||||||||||||
2175 | 1907 | - | ||||||||||||||||||||||||||||||||||||
2176 | ) | - | ||||||||||||||||||||||||||||||||||||
2177 | ; | - | ||||||||||||||||||||||||||||||||||||
2178 | return executed 307 times by 1 test: 0;return 0; Executed by:
executed 307 times by 1 test: return 0; Executed by:
| 307 | ||||||||||||||||||||||||||||||||||||
2179 | } else if ((
| 1-3479 | ||||||||||||||||||||||||||||||||||||
2180 | : s->version > ver_max
| 1-3479 | ||||||||||||||||||||||||||||||||||||
2181 | s->version = origv; | - | ||||||||||||||||||||||||||||||||||||
2182 | ossl_statem_fatal((s), (70), (607), (258), | - | ||||||||||||||||||||||||||||||||||||
2183 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2184 | , | - | ||||||||||||||||||||||||||||||||||||
2185 | 1913 | - | ||||||||||||||||||||||||||||||||||||
2186 | ) | - | ||||||||||||||||||||||||||||||||||||
2187 | ; | - | ||||||||||||||||||||||||||||||||||||
2188 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
2189 | } | - | ||||||||||||||||||||||||||||||||||||
2190 | - | |||||||||||||||||||||||||||||||||||||
2191 | if ((
| 1-3478 | ||||||||||||||||||||||||||||||||||||
2192 | real_max = ver_max; executed 3478 times by 1 test: real_max = ver_max; Executed by:
| 3478 | ||||||||||||||||||||||||||||||||||||
2193 | - | |||||||||||||||||||||||||||||||||||||
2194 | - | |||||||||||||||||||||||||||||||||||||
2195 | if (s->version == 0x0303
| 441-1994 | ||||||||||||||||||||||||||||||||||||
2196 | if (memcmp(tls12downgrade,
| 3-1550 | ||||||||||||||||||||||||||||||||||||
2197 | s->s3->server_random + 32
| 3-1550 | ||||||||||||||||||||||||||||||||||||
2198 | - sizeof(tls12downgrade),
| 3-1550 | ||||||||||||||||||||||||||||||||||||
2199 | sizeof(tls12downgrade)) == 0
| 3-1550 | ||||||||||||||||||||||||||||||||||||
2200 | s->version = origv; | - | ||||||||||||||||||||||||||||||||||||
2201 | ossl_statem_fatal((s), (47), (607), (373), | - | ||||||||||||||||||||||||||||||||||||
2202 | - | |||||||||||||||||||||||||||||||||||||
2203 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2204 | , | - | ||||||||||||||||||||||||||||||||||||
2205 | - | |||||||||||||||||||||||||||||||||||||
2206 | 1929 | - | ||||||||||||||||||||||||||||||||||||
2207 | ) | - | ||||||||||||||||||||||||||||||||||||
2208 | - | |||||||||||||||||||||||||||||||||||||
2209 | ; | - | ||||||||||||||||||||||||||||||||||||
2210 | return executed 3 times by 1 test: 0;return 0; Executed by:
executed 3 times by 1 test: return 0; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
2211 | } | - | ||||||||||||||||||||||||||||||||||||
2212 | } executed 1550 times by 1 test: else if (!(s->method->ssl3_enc->enc_flags & 0x8)end of block Executed by:
| 174-1752 | ||||||||||||||||||||||||||||||||||||
2213 | && s->version < 0x0303
| 672-1080 | ||||||||||||||||||||||||||||||||||||
2214 | && real_max > s->version
| 215-457 | ||||||||||||||||||||||||||||||||||||
2215 | if (memcmp(tls11downgrade,
| 3-454 | ||||||||||||||||||||||||||||||||||||
2216 | s->s3->server_random + 32
| 3-454 | ||||||||||||||||||||||||||||||||||||
2217 | - sizeof(tls11downgrade),
| 3-454 | ||||||||||||||||||||||||||||||||||||
2218 | sizeof(tls11downgrade)) == 0
| 3-454 | ||||||||||||||||||||||||||||||||||||
2219 | s->version = origv; | - | ||||||||||||||||||||||||||||||||||||
2220 | ossl_statem_fatal((s), (47), (607), (373), | - | ||||||||||||||||||||||||||||||||||||
2221 | - | |||||||||||||||||||||||||||||||||||||
2222 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2223 | , | - | ||||||||||||||||||||||||||||||||||||
2224 | - | |||||||||||||||||||||||||||||||||||||
2225 | 1942 | - | ||||||||||||||||||||||||||||||||||||
2226 | ) | - | ||||||||||||||||||||||||||||||||||||
2227 | - | |||||||||||||||||||||||||||||||||||||
2228 | ; | - | ||||||||||||||||||||||||||||||||||||
2229 | return executed 3 times by 1 test: 0;return 0; Executed by:
executed 3 times by 1 test: return 0; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
2230 | } | - | ||||||||||||||||||||||||||||||||||||
2231 | } executed 454 times by 1 test: end of block Executed by:
| 454 | ||||||||||||||||||||||||||||||||||||
2232 | - | |||||||||||||||||||||||||||||||||||||
2233 | for (vent = table; vent->version != 0
| 0-7188 | ||||||||||||||||||||||||||||||||||||
2234 | if (vent->cmeth ==
| 0-7188 | ||||||||||||||||||||||||||||||||||||
2235 | ((void *)0)
| 0-7188 | ||||||||||||||||||||||||||||||||||||
2236 | || s->version != vent->version
| 3473-3715 | ||||||||||||||||||||||||||||||||||||
2237 | continue; executed 3715 times by 1 test: continue; Executed by:
| 3715 | ||||||||||||||||||||||||||||||||||||
2238 | - | |||||||||||||||||||||||||||||||||||||
2239 | s->method = vent->cmeth(); | - | ||||||||||||||||||||||||||||||||||||
2240 | return executed 3473 times by 1 test: 1;return 1; Executed by:
executed 3473 times by 1 test: return 1; Executed by:
| 3473 | ||||||||||||||||||||||||||||||||||||
2241 | } | - | ||||||||||||||||||||||||||||||||||||
2242 | - | |||||||||||||||||||||||||||||||||||||
2243 | s->version = origv; | - | ||||||||||||||||||||||||||||||||||||
2244 | ossl_statem_fatal((s), (70), (607), (258), | - | ||||||||||||||||||||||||||||||||||||
2245 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2246 | , | - | ||||||||||||||||||||||||||||||||||||
2247 | 1957 | - | ||||||||||||||||||||||||||||||||||||
2248 | ) | - | ||||||||||||||||||||||||||||||||||||
2249 | ; | - | ||||||||||||||||||||||||||||||||||||
2250 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2251 | } | - | ||||||||||||||||||||||||||||||||||||
2252 | int ssl_get_min_max_version(const SSL *s, int *min_version, int *max_version, | - | ||||||||||||||||||||||||||||||||||||
2253 | int *real_max) | - | ||||||||||||||||||||||||||||||||||||
2254 | { | - | ||||||||||||||||||||||||||||||||||||
2255 | int version, tmp_real_max; | - | ||||||||||||||||||||||||||||||||||||
2256 | int hole; | - | ||||||||||||||||||||||||||||||||||||
2257 | const SSL_METHOD *single = | - | ||||||||||||||||||||||||||||||||||||
2258 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
2259 | ; | - | ||||||||||||||||||||||||||||||||||||
2260 | const SSL_METHOD *method; | - | ||||||||||||||||||||||||||||||||||||
2261 | const version_info *table; | - | ||||||||||||||||||||||||||||||||||||
2262 | const version_info *vent; | - | ||||||||||||||||||||||||||||||||||||
2263 | - | |||||||||||||||||||||||||||||||||||||
2264 | switch (s->method->version) { | - | ||||||||||||||||||||||||||||||||||||
2265 | default executed 102 times by 1 test: :default: Executed by:
executed 102 times by 1 test: default: Executed by:
| 102 | ||||||||||||||||||||||||||||||||||||
2266 | - | |||||||||||||||||||||||||||||||||||||
2267 | - | |||||||||||||||||||||||||||||||||||||
2268 | - | |||||||||||||||||||||||||||||||||||||
2269 | - | |||||||||||||||||||||||||||||||||||||
2270 | - | |||||||||||||||||||||||||||||||||||||
2271 | - | |||||||||||||||||||||||||||||||||||||
2272 | - | |||||||||||||||||||||||||||||||||||||
2273 | *min_version = *max_version = s->version; | - | ||||||||||||||||||||||||||||||||||||
2274 | - | |||||||||||||||||||||||||||||||||||||
2275 | - | |||||||||||||||||||||||||||||||||||||
2276 | - | |||||||||||||||||||||||||||||||||||||
2277 | - | |||||||||||||||||||||||||||||||||||||
2278 | if (!((real_max ==
| 0-102 | ||||||||||||||||||||||||||||||||||||
2279 | ((void *)0)
| 0-102 | ||||||||||||||||||||||||||||||||||||
2280 | ) != 0)
| 0-102 | ||||||||||||||||||||||||||||||||||||
2281 | return never executed: (4|64);return (4|64); never executed: return (4|64); | 0 | ||||||||||||||||||||||||||||||||||||
2282 | return executed 102 times by 1 test: 0;return 0; Executed by:
executed 102 times by 1 test: return 0; Executed by:
| 102 | ||||||||||||||||||||||||||||||||||||
2283 | case executed 26130 times by 1 test: 0x10000:case 0x10000: Executed by:
executed 26130 times by 1 test: case 0x10000: Executed by:
| 26130 | ||||||||||||||||||||||||||||||||||||
2284 | table = tls_version_table; | - | ||||||||||||||||||||||||||||||||||||
2285 | break; executed 26130 times by 1 test: break; Executed by:
| 26130 | ||||||||||||||||||||||||||||||||||||
2286 | case executed 908 times by 1 test: 0x1FFFF:case 0x1FFFF: Executed by:
executed 908 times by 1 test: case 0x1FFFF: Executed by:
| 908 | ||||||||||||||||||||||||||||||||||||
2287 | table = dtls_version_table; | - | ||||||||||||||||||||||||||||||||||||
2288 | break; executed 908 times by 1 test: break; Executed by:
| 908 | ||||||||||||||||||||||||||||||||||||
2289 | } | - | ||||||||||||||||||||||||||||||||||||
2290 | *min_version = version = 0; | - | ||||||||||||||||||||||||||||||||||||
2291 | hole = 1; | - | ||||||||||||||||||||||||||||||||||||
2292 | if (real_max !=
| 3787-23251 | ||||||||||||||||||||||||||||||||||||
2293 | ((void *)0)
| 3787-23251 | ||||||||||||||||||||||||||||||||||||
2294 | ) | - | ||||||||||||||||||||||||||||||||||||
2295 | * executed 3787 times by 1 test: real_max = 0;*real_max = 0; Executed by:
executed 3787 times by 1 test: *real_max = 0; Executed by:
| 3787 | ||||||||||||||||||||||||||||||||||||
2296 | tmp_real_max = 0; | - | ||||||||||||||||||||||||||||||||||||
2297 | for (vent = table; vent->version != 0
| 27038-133374 | ||||||||||||||||||||||||||||||||||||
2298 | - | |||||||||||||||||||||||||||||||||||||
2299 | - | |||||||||||||||||||||||||||||||||||||
2300 | - | |||||||||||||||||||||||||||||||||||||
2301 | - | |||||||||||||||||||||||||||||||||||||
2302 | if (vent->cmeth ==
| 26130-107244 | ||||||||||||||||||||||||||||||||||||
2303 | ((void *)0)
| 26130-107244 | ||||||||||||||||||||||||||||||||||||
2304 | ) { | - | ||||||||||||||||||||||||||||||||||||
2305 | hole = 1; | - | ||||||||||||||||||||||||||||||||||||
2306 | tmp_real_max = 0; | - | ||||||||||||||||||||||||||||||||||||
2307 | continue; executed 26130 times by 1 test: continue; Executed by:
| 26130 | ||||||||||||||||||||||||||||||||||||
2308 | } | - | ||||||||||||||||||||||||||||||||||||
2309 | method = vent->cmeth(); | - | ||||||||||||||||||||||||||||||||||||
2310 | - | |||||||||||||||||||||||||||||||||||||
2311 | if (hole == 1
| 10079-70127 | ||||||||||||||||||||||||||||||||||||
2312 | tmp_real_max = vent->version; executed 27038 times by 1 test: tmp_real_max = vent->version; Executed by:
| 27038 | ||||||||||||||||||||||||||||||||||||
2313 | - | |||||||||||||||||||||||||||||||||||||
2314 | if (ssl_method_error(s, method) != 0
| 13056-94188 | ||||||||||||||||||||||||||||||||||||
2315 | hole = 1; | - | ||||||||||||||||||||||||||||||||||||
2316 | } executed 13056 times by 1 test: else if (!holeend of block Executed by:
| 13056-67244 | ||||||||||||||||||||||||||||||||||||
2317 | single = | - | ||||||||||||||||||||||||||||||||||||
2318 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
2319 | ; | - | ||||||||||||||||||||||||||||||||||||
2320 | *min_version = method->version; | - | ||||||||||||||||||||||||||||||||||||
2321 | } executed 67244 times by 1 test: else {end of block Executed by:
| 67244 | ||||||||||||||||||||||||||||||||||||
2322 | if (real_max !=
| 3788-23156 | ||||||||||||||||||||||||||||||||||||
2323 | ((void *)0)
| 3788-23156 | ||||||||||||||||||||||||||||||||||||
2324 | && tmp_real_max != 0
| 0-3788 | ||||||||||||||||||||||||||||||||||||
2325 | * executed 3788 times by 1 test: real_max = tmp_real_max;*real_max = tmp_real_max; Executed by:
executed 3788 times by 1 test: *real_max = tmp_real_max; Executed by:
| 3788 | ||||||||||||||||||||||||||||||||||||
2326 | version = (single = method)->version; | - | ||||||||||||||||||||||||||||||||||||
2327 | *min_version = version; | - | ||||||||||||||||||||||||||||||||||||
2328 | hole = 0; | - | ||||||||||||||||||||||||||||||||||||
2329 | } executed 26944 times by 1 test: end of block Executed by:
| 26944 | ||||||||||||||||||||||||||||||||||||
2330 | } | - | ||||||||||||||||||||||||||||||||||||
2331 | - | |||||||||||||||||||||||||||||||||||||
2332 | *max_version = version; | - | ||||||||||||||||||||||||||||||||||||
2333 | - | |||||||||||||||||||||||||||||||||||||
2334 | - | |||||||||||||||||||||||||||||||||||||
2335 | if (version == 0
| 100-26938 | ||||||||||||||||||||||||||||||||||||
2336 | return executed 100 times by 1 test: 191;return 191; Executed by:
executed 100 times by 1 test: return 191; Executed by:
| 100 | ||||||||||||||||||||||||||||||||||||
2337 | - | |||||||||||||||||||||||||||||||||||||
2338 | return executed 26938 times by 1 test: 0;return 0; Executed by:
executed 26938 times by 1 test: return 0; Executed by:
| 26938 | ||||||||||||||||||||||||||||||||||||
2339 | } | - | ||||||||||||||||||||||||||||||||||||
2340 | int ssl_set_client_hello_version(SSL *s) | - | ||||||||||||||||||||||||||||||||||||
2341 | { | - | ||||||||||||||||||||||||||||||||||||
2342 | int ver_min, ver_max, ret; | - | ||||||||||||||||||||||||||||||||||||
2343 | - | |||||||||||||||||||||||||||||||||||||
2344 | - | |||||||||||||||||||||||||||||||||||||
2345 | - | |||||||||||||||||||||||||||||||||||||
2346 | - | |||||||||||||||||||||||||||||||||||||
2347 | - | |||||||||||||||||||||||||||||||||||||
2348 | if (!((
| 0-4968 | ||||||||||||||||||||||||||||||||||||
2349 | return executed 24 times by 1 test: 0;return 0; Executed by:
executed 24 times by 1 test: return 0; Executed by:
| 24 | ||||||||||||||||||||||||||||||||||||
2350 | - | |||||||||||||||||||||||||||||||||||||
2351 | ret = ssl_get_min_max_version(s, &ver_min, &ver_max, | - | ||||||||||||||||||||||||||||||||||||
2352 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
2353 | ); | - | ||||||||||||||||||||||||||||||||||||
2354 | - | |||||||||||||||||||||||||||||||||||||
2355 | if (ret != 0
| 52-4916 | ||||||||||||||||||||||||||||||||||||
2356 | return executed 52 times by 1 test: ret;return ret; Executed by:
executed 52 times by 1 test: return ret; Executed by:
| 52 | ||||||||||||||||||||||||||||||||||||
2357 | - | |||||||||||||||||||||||||||||||||||||
2358 | s->version = ver_max; | - | ||||||||||||||||||||||||||||||||||||
2359 | - | |||||||||||||||||||||||||||||||||||||
2360 | - | |||||||||||||||||||||||||||||||||||||
2361 | if (!(s->method->ssl3_enc->enc_flags & 0x8)
| 183-4733 | ||||||||||||||||||||||||||||||||||||
2362 | ver_max = 0x0303; executed 3919 times by 1 test: ver_max = 0x0303; Executed by:
| 3919 | ||||||||||||||||||||||||||||||||||||
2363 | - | |||||||||||||||||||||||||||||||||||||
2364 | s->client_version = ver_max; | - | ||||||||||||||||||||||||||||||||||||
2365 | return executed 4916 times by 1 test: 0;return 0; Executed by:
executed 4916 times by 1 test: return 0; Executed by:
| 4916 | ||||||||||||||||||||||||||||||||||||
2366 | } | - | ||||||||||||||||||||||||||||||||||||
2367 | int check_in_list(SSL *s, uint16_t group_id, const uint16_t *groups, | - | ||||||||||||||||||||||||||||||||||||
2368 | size_t num_groups, int checkallow) | - | ||||||||||||||||||||||||||||||||||||
2369 | { | - | ||||||||||||||||||||||||||||||||||||
2370 | size_t i; | - | ||||||||||||||||||||||||||||||||||||
2371 | - | |||||||||||||||||||||||||||||||||||||
2372 | if (groups ==
| 0-2424 | ||||||||||||||||||||||||||||||||||||
2373 | ((void *)0)
| 0-2424 | ||||||||||||||||||||||||||||||||||||
2374 | || num_groups == 0
| 0-2424 | ||||||||||||||||||||||||||||||||||||
2375 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2376 | - | |||||||||||||||||||||||||||||||||||||
2377 | for (i = 0; i < num_groups
| 280-4840 | ||||||||||||||||||||||||||||||||||||
2378 | uint16_t group = groups[i]; | - | ||||||||||||||||||||||||||||||||||||
2379 | - | |||||||||||||||||||||||||||||||||||||
2380 | if (group_id == group
| 2144-2696 | ||||||||||||||||||||||||||||||||||||
2381 | && (!checkallow
| 1044-1100 | ||||||||||||||||||||||||||||||||||||
2382 | || tls_curve_allowed(s, group, (6 | (2 << 16)))
| 0-1044 | ||||||||||||||||||||||||||||||||||||
2383 | return executed 2144 times by 1 test: 1;return 1; Executed by:
executed 2144 times by 1 test: return 1; Executed by:
| 2144 | ||||||||||||||||||||||||||||||||||||
2384 | } | - | ||||||||||||||||||||||||||||||||||||
2385 | } executed 2696 times by 1 test: end of block Executed by:
| 2696 | ||||||||||||||||||||||||||||||||||||
2386 | - | |||||||||||||||||||||||||||||||||||||
2387 | return executed 280 times by 1 test: 0;return 0; Executed by:
executed 280 times by 1 test: return 0; Executed by:
| 280 | ||||||||||||||||||||||||||||||||||||
2388 | } | - | ||||||||||||||||||||||||||||||||||||
2389 | - | |||||||||||||||||||||||||||||||||||||
2390 | - | |||||||||||||||||||||||||||||||||||||
2391 | - | |||||||||||||||||||||||||||||||||||||
2392 | int create_synthetic_message_hash(SSL *s, const unsigned char *hashval, | - | ||||||||||||||||||||||||||||||||||||
2393 | size_t hashlen, const unsigned char *hrr, | - | ||||||||||||||||||||||||||||||||||||
2394 | size_t hrrlen) | - | ||||||||||||||||||||||||||||||||||||
2395 | { | - | ||||||||||||||||||||||||||||||||||||
2396 | unsigned char hashvaltmp[64]; | - | ||||||||||||||||||||||||||||||||||||
2397 | unsigned char msghdr[4]; | - | ||||||||||||||||||||||||||||||||||||
2398 | - | |||||||||||||||||||||||||||||||||||||
2399 | memset(msghdr, 0, sizeof(msghdr)); | - | ||||||||||||||||||||||||||||||||||||
2400 | - | |||||||||||||||||||||||||||||||||||||
2401 | if (hashval ==
| 1-792 | ||||||||||||||||||||||||||||||||||||
2402 | ((void *)0)
| 1-792 | ||||||||||||||||||||||||||||||||||||
2403 | ) { | - | ||||||||||||||||||||||||||||||||||||
2404 | hashval = hashvaltmp; | - | ||||||||||||||||||||||||||||||||||||
2405 | hashlen = 0; | - | ||||||||||||||||||||||||||||||||||||
2406 | - | |||||||||||||||||||||||||||||||||||||
2407 | if (!ssl3_digest_cached_records(s, 0)
| 0-792 | ||||||||||||||||||||||||||||||||||||
2408 | || !ssl_handshake_hash(s, hashvaltmp, sizeof(hashvaltmp),
| 0-792 | ||||||||||||||||||||||||||||||||||||
2409 | &hashlen)
| 0-792 | ||||||||||||||||||||||||||||||||||||
2410 | - | |||||||||||||||||||||||||||||||||||||
2411 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2412 | } | - | ||||||||||||||||||||||||||||||||||||
2413 | } executed 792 times by 1 test: end of block Executed by:
| 792 | ||||||||||||||||||||||||||||||||||||
2414 | - | |||||||||||||||||||||||||||||||||||||
2415 | - | |||||||||||||||||||||||||||||||||||||
2416 | if (!ssl3_init_finished_mac(s)
| 0-793 | ||||||||||||||||||||||||||||||||||||
2417 | - | |||||||||||||||||||||||||||||||||||||
2418 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2419 | } | - | ||||||||||||||||||||||||||||||||||||
2420 | - | |||||||||||||||||||||||||||||||||||||
2421 | - | |||||||||||||||||||||||||||||||||||||
2422 | msghdr[0] = 254; | - | ||||||||||||||||||||||||||||||||||||
2423 | msghdr[4 - 1] = (unsigned char)hashlen; | - | ||||||||||||||||||||||||||||||||||||
2424 | if (!ssl3_finish_mac(s, msghdr, 4)
| 0-793 | ||||||||||||||||||||||||||||||||||||
2425 | || !ssl3_finish_mac(s, hashval, hashlen)
| 0-793 | ||||||||||||||||||||||||||||||||||||
2426 | - | |||||||||||||||||||||||||||||||||||||
2427 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2428 | } | - | ||||||||||||||||||||||||||||||||||||
2429 | - | |||||||||||||||||||||||||||||||||||||
2430 | - | |||||||||||||||||||||||||||||||||||||
2431 | - | |||||||||||||||||||||||||||||||||||||
2432 | - | |||||||||||||||||||||||||||||||||||||
2433 | - | |||||||||||||||||||||||||||||||||||||
2434 | - | |||||||||||||||||||||||||||||||||||||
2435 | if (hrr !=
| 1-792 | ||||||||||||||||||||||||||||||||||||
2436 | ((void *)0)
| 1-792 | ||||||||||||||||||||||||||||||||||||
2437 | - | |||||||||||||||||||||||||||||||||||||
2438 | && (!ssl3_finish_mac(s, hrr, hrrlen)
| 0-1 | ||||||||||||||||||||||||||||||||||||
2439 | || !ssl3_finish_mac(s, (unsigned char *)s->init_buf->data,
| 0-1 | ||||||||||||||||||||||||||||||||||||
2440 | s->s3->tmp.message_size
| 0-1 | ||||||||||||||||||||||||||||||||||||
2441 | + 4)
| 0-1 | ||||||||||||||||||||||||||||||||||||
2442 | - | |||||||||||||||||||||||||||||||||||||
2443 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2444 | } | - | ||||||||||||||||||||||||||||||||||||
2445 | - | |||||||||||||||||||||||||||||||||||||
2446 | return executed 793 times by 1 test: 1;return 1; Executed by:
executed 793 times by 1 test: return 1; Executed by:
| 793 | ||||||||||||||||||||||||||||||||||||
2447 | } | - | ||||||||||||||||||||||||||||||||||||
2448 | - | |||||||||||||||||||||||||||||||||||||
2449 | static int ca_dn_cmp(const X509_NAME *const *a, const X509_NAME *const *b) | - | ||||||||||||||||||||||||||||||||||||
2450 | { | - | ||||||||||||||||||||||||||||||||||||
2451 | return never executed: X509_NAME_cmp(*a, *b);return X509_NAME_cmp(*a, *b); never executed: return X509_NAME_cmp(*a, *b); | 0 | ||||||||||||||||||||||||||||||||||||
2452 | } | - | ||||||||||||||||||||||||||||||||||||
2453 | - | |||||||||||||||||||||||||||||||||||||
2454 | int parse_ca_names(SSL *s, PACKET *pkt) | - | ||||||||||||||||||||||||||||||||||||
2455 | { | - | ||||||||||||||||||||||||||||||||||||
2456 | struct stack_st_X509_NAME *ca_sk = sk_X509_NAME_new(ca_dn_cmp); | - | ||||||||||||||||||||||||||||||||||||
2457 | X509_NAME *xn = | - | ||||||||||||||||||||||||||||||||||||
2458 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
2459 | ; | - | ||||||||||||||||||||||||||||||||||||
2460 | PACKET cadns; | - | ||||||||||||||||||||||||||||||||||||
2461 | - | |||||||||||||||||||||||||||||||||||||
2462 | if (ca_sk ==
| 0-115 | ||||||||||||||||||||||||||||||||||||
2463 | ((void *)0)
| 0-115 | ||||||||||||||||||||||||||||||||||||
2464 | ) { | - | ||||||||||||||||||||||||||||||||||||
2465 | ossl_statem_fatal((s), (80), (541), ((1|64)), | - | ||||||||||||||||||||||||||||||||||||
2466 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2467 | , | - | ||||||||||||||||||||||||||||||||||||
2468 | 2212 | - | ||||||||||||||||||||||||||||||||||||
2469 | ) | - | ||||||||||||||||||||||||||||||||||||
2470 | ; | - | ||||||||||||||||||||||||||||||||||||
2471 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
2472 | } | - | ||||||||||||||||||||||||||||||||||||
2473 | - | |||||||||||||||||||||||||||||||||||||
2474 | if (!PACKET_get_length_prefixed_2(pkt, &cadns)
| 48-67 | ||||||||||||||||||||||||||||||||||||
2475 | ossl_statem_fatal((s), (50), (541), (159), | - | ||||||||||||||||||||||||||||||||||||
2476 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2477 | , | - | ||||||||||||||||||||||||||||||||||||
2478 | 2218 | - | ||||||||||||||||||||||||||||||||||||
2479 | ) | - | ||||||||||||||||||||||||||||||||||||
2480 | ; | - | ||||||||||||||||||||||||||||||||||||
2481 | goto executed 48 times by 1 test: err;goto err; Executed by:
executed 48 times by 1 test: goto err; Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||
2482 | } | - | ||||||||||||||||||||||||||||||||||||
2483 | - | |||||||||||||||||||||||||||||||||||||
2484 | while (PACKET_remaining(&cadns)
| 51-59 | ||||||||||||||||||||||||||||||||||||
2485 | const unsigned char *namestart, *namebytes; | - | ||||||||||||||||||||||||||||||||||||
2486 | unsigned int name_len; | - | ||||||||||||||||||||||||||||||||||||
2487 | - | |||||||||||||||||||||||||||||||||||||
2488 | if (!PACKET_get_net_2(&cadns, &name_len)
| 3-56 | ||||||||||||||||||||||||||||||||||||
2489 | || !PACKET_get_bytes(&cadns, &namebytes, name_len)
| 6-50 | ||||||||||||||||||||||||||||||||||||
2490 | ossl_statem_fatal((s), (50), (541), (159), | - | ||||||||||||||||||||||||||||||||||||
2491 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2492 | , | - | ||||||||||||||||||||||||||||||||||||
2493 | 2229 | - | ||||||||||||||||||||||||||||||||||||
2494 | ) | - | ||||||||||||||||||||||||||||||||||||
2495 | ; | - | ||||||||||||||||||||||||||||||||||||
2496 | goto executed 9 times by 1 test: err;goto err; Executed by:
executed 9 times by 1 test: goto err; Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||
2497 | } | - | ||||||||||||||||||||||||||||||||||||
2498 | - | |||||||||||||||||||||||||||||||||||||
2499 | namestart = namebytes; | - | ||||||||||||||||||||||||||||||||||||
2500 | if ((
| 6-44 | ||||||||||||||||||||||||||||||||||||
2501 | ((void *)0)
| 6-44 | ||||||||||||||||||||||||||||||||||||
2502 | , &namebytes, name_len)) ==
| 6-44 | ||||||||||||||||||||||||||||||||||||
2503 | ((void *)0)
| 6-44 | ||||||||||||||||||||||||||||||||||||
2504 | ) { | - | ||||||||||||||||||||||||||||||||||||
2505 | ossl_statem_fatal((s), (50), (541), (13), | - | ||||||||||||||||||||||||||||||||||||
2506 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2507 | , | - | ||||||||||||||||||||||||||||||||||||
2508 | 2236 | - | ||||||||||||||||||||||||||||||||||||
2509 | ) | - | ||||||||||||||||||||||||||||||||||||
2510 | ; | - | ||||||||||||||||||||||||||||||||||||
2511 | goto executed 6 times by 1 test: err;goto err; Executed by:
executed 6 times by 1 test: goto err; Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||
2512 | } | - | ||||||||||||||||||||||||||||||||||||
2513 | if (namebytes != (namestart + name_len)
| 1-43 | ||||||||||||||||||||||||||||||||||||
2514 | ossl_statem_fatal((s), (50), (541), (131), | - | ||||||||||||||||||||||||||||||||||||
2515 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2516 | , | - | ||||||||||||||||||||||||||||||||||||
2517 | 2241 | - | ||||||||||||||||||||||||||||||||||||
2518 | ) | - | ||||||||||||||||||||||||||||||||||||
2519 | ; | - | ||||||||||||||||||||||||||||||||||||
2520 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
2521 | } | - | ||||||||||||||||||||||||||||||||||||
2522 | - | |||||||||||||||||||||||||||||||||||||
2523 | if (!sk_X509_NAME_push(ca_sk, xn)
| 0-43 | ||||||||||||||||||||||||||||||||||||
2524 | ossl_statem_fatal((s), (80), (541), ((1|64)), | - | ||||||||||||||||||||||||||||||||||||
2525 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2526 | , | - | ||||||||||||||||||||||||||||||||||||
2527 | 2247 | - | ||||||||||||||||||||||||||||||||||||
2528 | ) | - | ||||||||||||||||||||||||||||||||||||
2529 | ; | - | ||||||||||||||||||||||||||||||||||||
2530 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
2531 | } | - | ||||||||||||||||||||||||||||||||||||
2532 | xn = | - | ||||||||||||||||||||||||||||||||||||
2533 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
2534 | ; | - | ||||||||||||||||||||||||||||||||||||
2535 | } executed 43 times by 1 test: end of block Executed by:
| 43 | ||||||||||||||||||||||||||||||||||||
2536 | - | |||||||||||||||||||||||||||||||||||||
2537 | sk_X509_NAME_pop_free(s->s3->tmp.peer_ca_names, X509_NAME_free); | - | ||||||||||||||||||||||||||||||||||||
2538 | s->s3->tmp.peer_ca_names = ca_sk; | - | ||||||||||||||||||||||||||||||||||||
2539 | - | |||||||||||||||||||||||||||||||||||||
2540 | return executed 51 times by 1 test: 1;return 1; Executed by:
executed 51 times by 1 test: return 1; Executed by:
| 51 | ||||||||||||||||||||||||||||||||||||
2541 | - | |||||||||||||||||||||||||||||||||||||
2542 | err: | - | ||||||||||||||||||||||||||||||||||||
2543 | sk_X509_NAME_pop_free(ca_sk, X509_NAME_free); | - | ||||||||||||||||||||||||||||||||||||
2544 | X509_NAME_free(xn); | - | ||||||||||||||||||||||||||||||||||||
2545 | return executed 64 times by 1 test: 0;return 0; Executed by:
executed 64 times by 1 test: return 0; Executed by:
| 64 | ||||||||||||||||||||||||||||||||||||
2546 | } | - | ||||||||||||||||||||||||||||||||||||
2547 | - | |||||||||||||||||||||||||||||||||||||
2548 | int construct_ca_names(SSL *s, WPACKET *pkt) | - | ||||||||||||||||||||||||||||||||||||
2549 | { | - | ||||||||||||||||||||||||||||||||||||
2550 | const struct stack_st_X509_NAME *ca_sk = SSL_get0_CA_list(s); | - | ||||||||||||||||||||||||||||||||||||
2551 | - | |||||||||||||||||||||||||||||||||||||
2552 | - | |||||||||||||||||||||||||||||||||||||
2553 | if (!WPACKET_start_sub_packet_len__((pkt), 2)
| 0-40 | ||||||||||||||||||||||||||||||||||||
2554 | ossl_statem_fatal((s), (80), (552), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
2555 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2556 | , | - | ||||||||||||||||||||||||||||||||||||
2557 | 2271 | - | ||||||||||||||||||||||||||||||||||||
2558 | ) | - | ||||||||||||||||||||||||||||||||||||
2559 | ; | - | ||||||||||||||||||||||||||||||||||||
2560 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2561 | } | - | ||||||||||||||||||||||||||||||||||||
2562 | - | |||||||||||||||||||||||||||||||||||||
2563 | if (ca_sk !=
| 0-40 | ||||||||||||||||||||||||||||||||||||
2564 | ((void *)0)
| 0-40 | ||||||||||||||||||||||||||||||||||||
2565 | ) { | - | ||||||||||||||||||||||||||||||||||||
2566 | int i; | - | ||||||||||||||||||||||||||||||||||||
2567 | - | |||||||||||||||||||||||||||||||||||||
2568 | for (i = 0; i < sk_X509_NAME_num(ca_sk)
| 10-40 | ||||||||||||||||||||||||||||||||||||
2569 | unsigned char *namebytes; | - | ||||||||||||||||||||||||||||||||||||
2570 | X509_NAME *name = sk_X509_NAME_value(ca_sk, i); | - | ||||||||||||||||||||||||||||||||||||
2571 | int namelen; | - | ||||||||||||||||||||||||||||||||||||
2572 | - | |||||||||||||||||||||||||||||||||||||
2573 | if (name ==
| 0-10 | ||||||||||||||||||||||||||||||||||||
2574 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||||||||||||||
2575 | - | |||||||||||||||||||||||||||||||||||||
2576 | || (
| 0-10 | ||||||||||||||||||||||||||||||||||||
2577 | ((void *)0)
| 0-10 | ||||||||||||||||||||||||||||||||||||
2578 | )) < 0
| 0-10 | ||||||||||||||||||||||||||||||||||||
2579 | || !WPACKET_sub_allocate_bytes__((pkt), (namelen), (&namebytes), 2)
| 0-10 | ||||||||||||||||||||||||||||||||||||
2580 | - | |||||||||||||||||||||||||||||||||||||
2581 | || i2d_X509_NAME(name, &namebytes) != namelen
| 0-10 | ||||||||||||||||||||||||||||||||||||
2582 | ossl_statem_fatal((s), (80), (552), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
2583 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2584 | , | - | ||||||||||||||||||||||||||||||||||||
2585 | 2289 | - | ||||||||||||||||||||||||||||||||||||
2586 | ) | - | ||||||||||||||||||||||||||||||||||||
2587 | ; | - | ||||||||||||||||||||||||||||||||||||
2588 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2589 | } | - | ||||||||||||||||||||||||||||||||||||
2590 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
2591 | } executed 40 times by 1 test: end of block Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||
2592 | - | |||||||||||||||||||||||||||||||||||||
2593 | if (!WPACKET_close(pkt)
| 0-40 | ||||||||||||||||||||||||||||||||||||
2594 | ossl_statem_fatal((s), (80), (552), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
2595 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2596 | , | - | ||||||||||||||||||||||||||||||||||||
2597 | 2297 | - | ||||||||||||||||||||||||||||||||||||
2598 | ) | - | ||||||||||||||||||||||||||||||||||||
2599 | ; | - | ||||||||||||||||||||||||||||||||||||
2600 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2601 | } | - | ||||||||||||||||||||||||||||||||||||
2602 | - | |||||||||||||||||||||||||||||||||||||
2603 | return executed 40 times by 1 test: 1;return 1; Executed by:
executed 40 times by 1 test: return 1; Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||
2604 | } | - | ||||||||||||||||||||||||||||||||||||
2605 | - | |||||||||||||||||||||||||||||||||||||
2606 | - | |||||||||||||||||||||||||||||||||||||
2607 | size_t construct_key_exchange_tbs(SSL *s, unsigned char **ptbs, | - | ||||||||||||||||||||||||||||||||||||
2608 | const void *param, size_t paramlen) | - | ||||||||||||||||||||||||||||||||||||
2609 | { | - | ||||||||||||||||||||||||||||||||||||
2610 | size_t tbslen = 2 * 32 + paramlen; | - | ||||||||||||||||||||||||||||||||||||
2611 | unsigned char *tbs = CRYPTO_malloc(tbslen, __FILE__, 2309); | - | ||||||||||||||||||||||||||||||||||||
2612 | - | |||||||||||||||||||||||||||||||||||||
2613 | if (tbs ==
| 0-2344 | ||||||||||||||||||||||||||||||||||||
2614 | ((void *)0)
| 0-2344 | ||||||||||||||||||||||||||||||||||||
2615 | ) { | - | ||||||||||||||||||||||||||||||||||||
2616 | ossl_statem_fatal((s), (80), (553), ((1|64)), | - | ||||||||||||||||||||||||||||||||||||
2617 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2618 | , | - | ||||||||||||||||||||||||||||||||||||
2619 | 2313 | - | ||||||||||||||||||||||||||||||||||||
2620 | ) | - | ||||||||||||||||||||||||||||||||||||
2621 | ; | - | ||||||||||||||||||||||||||||||||||||
2622 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2623 | } | - | ||||||||||||||||||||||||||||||||||||
2624 | memcpy(tbs, s->s3->client_random, 32); | - | ||||||||||||||||||||||||||||||||||||
2625 | memcpy(tbs + 32, s->s3->server_random, 32); | - | ||||||||||||||||||||||||||||||||||||
2626 | - | |||||||||||||||||||||||||||||||||||||
2627 | memcpy(tbs + 32 * 2, param, paramlen); | - | ||||||||||||||||||||||||||||||||||||
2628 | - | |||||||||||||||||||||||||||||||||||||
2629 | *ptbs = tbs; | - | ||||||||||||||||||||||||||||||||||||
2630 | return executed 2344 times by 1 test: tbslen;return tbslen; Executed by:
executed 2344 times by 1 test: return tbslen; Executed by:
| 2344 | ||||||||||||||||||||||||||||||||||||
2631 | } | - | ||||||||||||||||||||||||||||||||||||
2632 | - | |||||||||||||||||||||||||||||||||||||
2633 | - | |||||||||||||||||||||||||||||||||||||
2634 | - | |||||||||||||||||||||||||||||||||||||
2635 | - | |||||||||||||||||||||||||||||||||||||
2636 | - | |||||||||||||||||||||||||||||||||||||
2637 | int tls13_save_handshake_digest_for_pha(SSL *s) | - | ||||||||||||||||||||||||||||||||||||
2638 | { | - | ||||||||||||||||||||||||||||||||||||
2639 | if (s->pha_dgst ==
| 47-1138 | ||||||||||||||||||||||||||||||||||||
2640 | ((void *)0)
| 47-1138 | ||||||||||||||||||||||||||||||||||||
2641 | ) { | - | ||||||||||||||||||||||||||||||||||||
2642 | if (!ssl3_digest_cached_records(s, 1)
| 0-1138 | ||||||||||||||||||||||||||||||||||||
2643 | - | |||||||||||||||||||||||||||||||||||||
2644 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2645 | - | |||||||||||||||||||||||||||||||||||||
2646 | s->pha_dgst = EVP_MD_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||
2647 | if (s->pha_dgst ==
| 0-1138 | ||||||||||||||||||||||||||||||||||||
2648 | ((void *)0)
| 0-1138 | ||||||||||||||||||||||||||||||||||||
2649 | ) { | - | ||||||||||||||||||||||||||||||||||||
2650 | ossl_statem_fatal((s), (80), (618), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
2651 | - | |||||||||||||||||||||||||||||||||||||
2652 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2653 | , | - | ||||||||||||||||||||||||||||||||||||
2654 | - | |||||||||||||||||||||||||||||||||||||
2655 | 2340 | - | ||||||||||||||||||||||||||||||||||||
2656 | ) | - | ||||||||||||||||||||||||||||||||||||
2657 | - | |||||||||||||||||||||||||||||||||||||
2658 | ; | - | ||||||||||||||||||||||||||||||||||||
2659 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2660 | } | - | ||||||||||||||||||||||||||||||||||||
2661 | if (!EVP_MD_CTX_copy_ex(s->pha_dgst,
| 0-1138 | ||||||||||||||||||||||||||||||||||||
2662 | s->s3->handshake_dgst)
| 0-1138 | ||||||||||||||||||||||||||||||||||||
2663 | ossl_statem_fatal((s), (80), (618), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
2664 | - | |||||||||||||||||||||||||||||||||||||
2665 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2666 | , | - | ||||||||||||||||||||||||||||||||||||
2667 | - | |||||||||||||||||||||||||||||||||||||
2668 | 2347 | - | ||||||||||||||||||||||||||||||||||||
2669 | ) | - | ||||||||||||||||||||||||||||||||||||
2670 | - | |||||||||||||||||||||||||||||||||||||
2671 | ; | - | ||||||||||||||||||||||||||||||||||||
2672 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2673 | } | - | ||||||||||||||||||||||||||||||||||||
2674 | } executed 1138 times by 1 test: end of block Executed by:
| 1138 | ||||||||||||||||||||||||||||||||||||
2675 | return executed 1185 times by 1 test: 1;return 1; Executed by:
executed 1185 times by 1 test: return 1; Executed by:
| 1185 | ||||||||||||||||||||||||||||||||||||
2676 | } | - | ||||||||||||||||||||||||||||||||||||
2677 | - | |||||||||||||||||||||||||||||||||||||
2678 | - | |||||||||||||||||||||||||||||||||||||
2679 | - | |||||||||||||||||||||||||||||||||||||
2680 | - | |||||||||||||||||||||||||||||||||||||
2681 | - | |||||||||||||||||||||||||||||||||||||
2682 | int tls13_restore_handshake_digest_for_pha(SSL *s) | - | ||||||||||||||||||||||||||||||||||||
2683 | { | - | ||||||||||||||||||||||||||||||||||||
2684 | if (s->pha_dgst ==
| 0-51 | ||||||||||||||||||||||||||||||||||||
2685 | ((void *)0)
| 0-51 | ||||||||||||||||||||||||||||||||||||
2686 | ) { | - | ||||||||||||||||||||||||||||||||||||
2687 | ossl_statem_fatal((s), (80), (617), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
2688 | - | |||||||||||||||||||||||||||||||||||||
2689 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2690 | , | - | ||||||||||||||||||||||||||||||||||||
2691 | - | |||||||||||||||||||||||||||||||||||||
2692 | 2363 | - | ||||||||||||||||||||||||||||||||||||
2693 | ) | - | ||||||||||||||||||||||||||||||||||||
2694 | - | |||||||||||||||||||||||||||||||||||||
2695 | ; | - | ||||||||||||||||||||||||||||||||||||
2696 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2697 | } | - | ||||||||||||||||||||||||||||||||||||
2698 | if (!EVP_MD_CTX_copy_ex(s->s3->handshake_dgst,
| 0-51 | ||||||||||||||||||||||||||||||||||||
2699 | s->pha_dgst)
| 0-51 | ||||||||||||||||||||||||||||||||||||
2700 | ossl_statem_fatal((s), (80), (617), ((4|64)), | - | ||||||||||||||||||||||||||||||||||||
2701 | - | |||||||||||||||||||||||||||||||||||||
2702 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
2703 | , | - | ||||||||||||||||||||||||||||||||||||
2704 | - | |||||||||||||||||||||||||||||||||||||
2705 | 2370 | - | ||||||||||||||||||||||||||||||||||||
2706 | ) | - | ||||||||||||||||||||||||||||||||||||
2707 | - | |||||||||||||||||||||||||||||||||||||
2708 | ; | - | ||||||||||||||||||||||||||||||||||||
2709 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
2710 | } | - | ||||||||||||||||||||||||||||||||||||
2711 | return executed 51 times by 1 test: 1;return 1; Executed by:
executed 51 times by 1 test: return 1; Executed by:
| 51 | ||||||||||||||||||||||||||||||||||||
2712 | } | - | ||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |