OpenCoverage

statem_dtls.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/statem/statem_dtls.c
Switch to Source codePreprocessed file
LineSourceCount
1static unsigned char bitmask_start_values[] =-
2 { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80 };-
3static unsigned char bitmask_end_values[] =-
4 { 0xff, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f };-
5-
6static void dtls1_fix_message_header(SSL *s, size_t frag_off,-
7 size_t frag_len);-
8static unsigned char *dtls1_write_message_header(SSL *s, unsigned char *p);-
9static void dtls1_set_message_header_int(SSL *s, unsigned char mt,-
10 size_t len,-
11 unsigned short seq_num,-
12 size_t frag_off,-
13 size_t frag_len);-
14static int dtls_get_reassembled_message(SSL *s, int *errtype, size_t *len);-
15-
16static hm_fragment *dtls1_hm_fragment_new(size_t frag_len, int reassembly)-
17{-
18 hm_fragment *frag = -
19 ((void *)0)-
20 ;-
21 unsigned char *buf = -
22 ((void *)0)-
23 ;-
24 unsigned char *bitmask = -
25 ((void *)0)-
26 ;-
27-
28 if ((
(frag = CRYPTO...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2234 times by 1 test
Evaluated by:
  • libssl.so.1.1
frag = CRYPTO_malloc(sizeof(*frag), __FILE__, 62)) ==
(frag = CRYPTO...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2234 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2234
29 ((void *)0)
(frag = CRYPTO...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2234 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2234
30 ) {-
31 ERR_put_error(20,(623),((1|64)),__FILE__,63);-
32 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
33 ((void *)0)
never executed: return ((void *)0) ;
0
34 ;
never executed: return ((void *)0) ;
0
35 }-
36-
37 if (frag_len
frag_lenDescription
TRUEevaluated 2225 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
9-2225
38 if ((
(buf = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2225 times by 1 test
Evaluated by:
  • libssl.so.1.1
buf = CRYPTO_malloc(frag_len, __FILE__, 68)) ==
(buf = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2225 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2225
39 ((void *)0)
(buf = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2225 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2225
40 ) {-
41 ERR_put_error(20,(623),((1|64)),__FILE__,69);-
42 CRYPTO_free(frag, __FILE__, 70);-
43 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
44 ((void *)0)
never executed: return ((void *)0) ;
0
45 ;
never executed: return ((void *)0) ;
0
46 }-
47 }
executed 2225 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2225
48-
49-
50 frag->fragment = buf;-
51-
52-
53 if (reassembly
reassemblyDescription
TRUEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1900 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
334-1900
54 bitmask = CRYPTO_zalloc((((frag_len) + 7) / 8), __FILE__, 80);-
55 if (bitmask ==
bitmask == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-334
56 ((void *)0)
bitmask == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-334
57 ) {-
58 ERR_put_error(20,(623),((1|64)),__FILE__,82);-
59 CRYPTO_free(buf, __FILE__, 83);-
60 CRYPTO_free(frag, __FILE__, 84);-
61 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
62 ((void *)0)
never executed: return ((void *)0) ;
0
63 ;
never executed: return ((void *)0) ;
0
64 }-
65 }
executed 334 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
334
66-
67 frag->reassembly = bitmask;-
68-
69 return
executed 2234 times by 1 test: return frag;
Executed by:
  • libssl.so.1.1
frag;
executed 2234 times by 1 test: return frag;
Executed by:
  • libssl.so.1.1
2234
70}-
71-
72void dtls1_hm_fragment_free(hm_fragment *frag)-
73{-
74 if (!frag
!fragDescription
TRUEnever evaluated
FALSEevaluated 2234 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-2234
75 return;
never executed: return;
0
76 if (frag->msg_header.is_ccs
frag->msg_header.is_ccsDescription
TRUEevaluated 359 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1875 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
359-1875
77 EVP_CIPHER_CTX_free(frag->msg_header.-
78 saved_retransmit_state.enc_write_ctx);-
79 EVP_MD_CTX_free(frag->msg_header.saved_retransmit_state.write_hash);-
80 }
executed 359 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
359
81 CRYPTO_free(frag->fragment, __FILE__, 103);-
82 CRYPTO_free(frag->reassembly, __FILE__, 104);-
83 CRYPTO_free(frag, __FILE__, 105);-
84}
executed 2234 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2234
85-
86-
87-
88-
89-
90int dtls1_do_write(SSL *s, int type)-
91{-
92 int ret;-
93 size_t written;-
94 size_t curr_mtu;-
95 int retry = 1;-
96 size_t len, frag_off, mac_size, blocksize, used_len;-
97-
98 if (!dtls1_query_mtu(s)
!dtls1_query_mtu(s)Description
TRUEnever evaluated
FALSEevaluated 2013 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-2013
99 return
never executed: return -1;
-1;
never executed: return -1;
0
100-
101 if (s->d1->mtu < dtls1_min_mtu(s)
s->d1->mtu < dtls1_min_mtu(s)Description
TRUEnever evaluated
FALSEevaluated 2013 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-2013
102-
103 return
never executed: return -1;
-1;
never executed: return -1;
0
104-
105 if (s->init_off == 0
s->init_off == 0Description
TRUEevaluated 2013 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
&& type == 22
type == 22Description
TRUEevaluated 1634 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 379 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-2013
106 if (!((s->init_num == s->d1->w_msg_hdr.msg_len + 12) != 0)
!((s->init_num...en + 12) != 0)Description
TRUEnever evaluated
FALSEevaluated 1634 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1634
107 )-
108 return
never executed: return -1;
-1;
never executed: return -1;
0
109 }
executed 1634 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1634
110-
111 if (s->write_hash
s->write_hashDescription
TRUEevaluated 452 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1561 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
452-1561
112 if (s->enc_write_ctx
s->enc_write_ctxDescription
TRUEevaluated 452 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-452
113 && (
(EVP_CIPHER_fl...0x200000) != 0Description
TRUEevaluated 307 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 145 times by 1 test
Evaluated by:
  • libssl.so.1.1
EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(s->enc_write_ctx)) &
(EVP_CIPHER_fl...0x200000) != 0Description
TRUEevaluated 307 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 145 times by 1 test
Evaluated by:
  • libssl.so.1.1
145-307
114 0x200000) != 0
(EVP_CIPHER_fl...0x200000) != 0Description
TRUEevaluated 307 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 145 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
145-307
115 mac_size = 0;
executed 307 times by 1 test: mac_size = 0;
Executed by:
  • libssl.so.1.1
307
116 else-
117 mac_size = EVP_MD_size(EVP_MD_CTX_md(s->write_hash));
executed 145 times by 1 test: mac_size = EVP_MD_size(EVP_MD_CTX_md(s->write_hash));
Executed by:
  • libssl.so.1.1
145
118 } else-
119 mac_size = 0;
executed 1561 times by 1 test: mac_size = 0;
Executed by:
  • libssl.so.1.1
1561
120-
121 if (s->enc_write_ctx
s->enc_write_ctxDescription
TRUEevaluated 452 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1561 times by 1 test
Evaluated by:
  • libssl.so.1.1
&&
452-1561
122 ((
((EVP_CIPHER_f...F0007) == 0x2)Description
TRUEevaluated 133 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 319 times by 1 test
Evaluated by:
  • libssl.so.1.1
EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(s->enc_write_ctx)) & 0xF0007) == 0x2)
((EVP_CIPHER_f...F0007) == 0x2)Description
TRUEevaluated 133 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 319 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
133-319
123 blocksize = 2 * EVP_CIPHER_CTX_block_size(s->enc_write_ctx);
executed 133 times by 1 test: blocksize = 2 * EVP_CIPHER_CTX_block_size(s->enc_write_ctx);
Executed by:
  • libssl.so.1.1
133
124 else-
125 blocksize = 0;
executed 1880 times by 1 test: blocksize = 0;
Executed by:
  • libssl.so.1.1
1880
126-
127 frag_off = 0;-
128 s->rwstate = 1;-
129-
130-
131 while (s->init_num > 0
s->init_num > 0Description
TRUEevaluated 3030 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
) {
0-3030
132 if (type == 22
type == 22Description
TRUEevaluated 2651 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 379 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& s->init_off != 0
s->init_off != 0Description
TRUEevaluated 1017 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1634 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
379-2651
133-
134-
135 if (frag_off > 0
frag_off > 0Description
TRUEevaluated 1017 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
) {
0-1017
136-
137-
138 if (s->init_off <= 12
s->init_off <= 12Description
TRUEnever evaluated
FALSEevaluated 1017 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1017
139-
140-
141-
142-
143-
144-
145-
146 return
never executed: return -1;
-1;
never executed: return -1;
0
147 }-
148-
149-
150-
151-
152-
153 s->init_off -= 12;-
154 s->init_num += 12;-
155 }
executed 1017 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
1017
156-
157-
158-
159-
160-
161-
162 frag_off = s->d1->w_msg_hdr.frag_off;-
163 }
never executed: end of block
0
164 }-
165-
166 used_len = (int)BIO_ctrl(s->wbio,13,0,-
167 ((void *)0)-
168 ) + 13-
169 + mac_size + blocksize;-
170 if (s->d1->mtu > used_len
s->d1->mtu > used_lenDescription
TRUEevaluated 1962 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1068 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
1068-1962
171 curr_mtu = s->d1->mtu - used_len;
executed 1962 times by 1 test: curr_mtu = s->d1->mtu - used_len;
Executed by:
  • libssl.so.1.1
1962
172 else-
173 curr_mtu = 0;
executed 1068 times by 1 test: curr_mtu = 0;
Executed by:
  • libssl.so.1.1
1068
174-
175 if (curr_mtu <= 12
curr_mtu <= 12Description
TRUEevaluated 1162 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1868 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
1162-1868
176-
177-
178-
179 ret = (int)BIO_ctrl(s->wbio,11,0,-
180 ((void *)0)-
181 );-
182 if (ret <= 0
ret <= 0Description
TRUEnever evaluated
FALSEevaluated 1162 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1162
183 s->rwstate = 2;-
184 return
never executed: return ret;
ret;
never executed: return ret;
0
185 }-
186 used_len = 13 + mac_size + blocksize;-
187 if (s->d1->mtu > used_len + 12
s->d1->mtu > used_len + 12Description
TRUEevaluated 1162 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
) {
0-1162
188 curr_mtu = s->d1->mtu - used_len;-
189 }
executed 1162 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
1162
190-
191 return
never executed: return -1;
-1;
never executed: return -1;
0
192 }-
193 }-
194-
195-
196-
197-
198 if (((
((unsigned int...um) > curr_mtuDescription
TRUEevaluated 1017 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2013 times by 1 test
Evaluated by:
  • libssl.so.1.1
unsigned int)s->init_num) > curr_mtu
((unsigned int...um) > curr_mtuDescription
TRUEevaluated 1017 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2013 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
1017-2013
199 len = curr_mtu;
executed 1017 times by 1 test: len = curr_mtu;
Executed by:
  • libssl.so.1.1
1017
200 else-
201 len = s->init_num;
executed 2013 times by 1 test: len = s->init_num;
Executed by:
  • libssl.so.1.1
2013
202-
203 if (len > s->max_send_fragment
len > s->max_send_fragmentDescription
TRUEnever evaluated
FALSEevaluated 3030 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-3030
204 len = s->max_send_fragment;
never executed: len = s->max_send_fragment;
0
205-
206-
207-
208-
209 if (type == 22
type == 22Description
TRUEevaluated 2651 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 379 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
379-2651
210 if (len < 12
len < 12Description
TRUEnever evaluated
FALSEevaluated 2651 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-2651
211-
212-
213-
214-
215 return
never executed: return -1;
-1;
never executed: return -1;
0
216 }-
217 dtls1_fix_message_header(s, frag_off, len - 12);-
218-
219 dtls1_write_message_header(s,-
220 (unsigned char *)&s->init_buf->-
221 data[s->init_off]);-
222 }
executed 2651 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2651
223-
224 ret = dtls1_write_bytes(s, type, &s->init_buf->data[s->init_off], len,-
225 &written);-
226 if (ret < 0
ret < 0Description
TRUEnever evaluated
FALSEevaluated 3030 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-3030
227-
228-
229-
230-
231-
232-
233 if (retry
retryDescription
TRUEnever evaluated
FALSEnever evaluated
&& BIO_ctrl(SSL_get_wbio(s),
BIO_ctrl(SSL_g...oid *)0) ) > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
234 43, 0,
BIO_ctrl(SSL_g...oid *)0) ) > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
235 ((void *)0)
BIO_ctrl(SSL_g...oid *)0) ) > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
236 ) > 0
BIO_ctrl(SSL_g...oid *)0) ) > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
237 if (!(SSL_get_options(s) & 0x00001000U)
!(SSL_get_opti...& 0x00001000U)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
238 if (!dtls1_query_mtu(s)
!dtls1_query_mtu(s)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
239 return
never executed: return -1;
-1;
never executed: return -1;
0
240-
241 retry = 0;-
242 }
never executed: end of block
else
0
243 return
never executed: return -1;
-1;
never executed: return -1;
0
244 } else {-
245 return
never executed: return -1;
-1;
never executed: return -1;
0
246 }-
247 } else {-
248-
249-
250-
251-
252-
253 if (!((len == written) != 0)
!((len == written) != 0)Description
TRUEnever evaluated
FALSEevaluated 3030 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-3030
254 return
never executed: return -1;
-1;
never executed: return -1;
0
255-
256 if (type == 22
type == 22Description
TRUEevaluated 2651 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 379 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& !s->d1->retransmitting
!s->d1->retransmittingDescription
TRUEevaluated 2479 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 172 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
172-2651
257-
258-
259-
260-
261 unsigned char *p =-
262 (unsigned char *)&s->init_buf->data[s->init_off];-
263 const struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr;-
264 size_t xlen;-
265-
266 if (frag_off == 0
frag_off == 0Description
TRUEevaluated 1532 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 947 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& s->version != 0x0100
s->version != 0x0100Description
TRUEevaluated 1529 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
3-1532
267-
268-
269-
270-
271 *p++ = msg_hdr->type;-
272 (((p)[0]=(unsigned char)(((msg_hdr->msg_len)>>16)&0xff), (p)[1]=(unsigned char)(((msg_hdr->msg_len)>> 8)&0xff), (p)[2]=(unsigned char)(((msg_hdr->msg_len) )&0xff)),(p)+=3);-
273 (((p)[0]=(unsigned char)(((msg_hdr->seq)>> 8)&0xff), (p)[1]=(unsigned char)(((msg_hdr->seq) )&0xff)),(p)+=2);-
274 (((p)[0]=(unsigned char)(((0)>>16)&0xff), (p)[1]=(unsigned char)(((0)>> 8)&0xff), (p)[2]=(unsigned char)(((0) )&0xff)),(p)+=3);-
275 (((p)[0]=(unsigned char)(((msg_hdr->msg_len)>>16)&0xff), (p)[1]=(unsigned char)(((msg_hdr->msg_len)>> 8)&0xff), (p)[2]=(unsigned char)(((msg_hdr->msg_len) )&0xff)),(p)+=3);-
276 p -= 12;-
277 xlen = written;-
278 }
executed 1529 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
1529
279 p += 12;-
280 xlen = written - 12;-
281 }
executed 950 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
950
282-
283 if (!ssl3_finish_mac(s, p, xlen)
!ssl3_finish_mac(s, p, xlen)Description
TRUEnever evaluated
FALSEevaluated 2479 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-2479
284 return
never executed: return -1;
-1;
never executed: return -1;
0
285 }
executed 2479 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2479
286-
287 if (written == s->init_num
written == s->init_numDescription
TRUEevaluated 2013 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1017 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
1017-2013
288 if (s->msg_callback
s->msg_callbackDescription
TRUEnever evaluated
FALSEevaluated 2013 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-2013
289 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
290 (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
291 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
292-
293 s->init_off = 0;-
294 s->init_num = 0;-
295-
296 return
executed 2013 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 2013 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
2013
297 }-
298 s->init_off += written;-
299 s->init_num -= written;-
300 written -= 12;-
301 frag_off += written;-
302-
303-
304-
305-
306-
307-
308-
309 dtls1_fix_message_header(s, frag_off, 0);-
310 }
executed 1017 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1017
311 }-
312 return
never executed: return 0;
0;
never executed: return 0;
0
313}-
314-
315int dtls_get_message(SSL *s, int *mt, size_t *len)-
316{-
317 struct hm_header_st *msg_hdr;-
318 unsigned char *p;-
319 size_t msg_len;-
320 size_t tmplen;-
321 int errtype;-
322-
323 msg_hdr = &s->d1->r_msg_hdr;-
324 memset(msg_hdr, 0, sizeof(*msg_hdr));-
325-
326 again:
code before this statement executed 2843 times by 1 test: again:
Executed by:
  • libssl.so.1.1
2843
327 if (!dtls_get_reassembled_message(s, &errtype, &tmplen)
!dtls_get_reas...type, &tmplen)Description
TRUEevaluated 2369 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1868 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
1868-2369
328 if (errtype == -2
errtype == -2Description
TRUEnever evaluated
FALSEevaluated 2369 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2369
329 || errtype == -3
errtype == -3Description
TRUEevaluated 1394 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 975 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
975-1394
330-
331 goto
executed 1394 times by 1 test: goto again;
Executed by:
  • libssl.so.1.1
again;
executed 1394 times by 1 test: goto again;
Executed by:
  • libssl.so.1.1
1394
332 }-
333 return
executed 975 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
0;
executed 975 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
975
334 }-
335-
336 *mt = s->s3->tmp.message_type;-
337-
338 p = (unsigned char *)s->init_buf->data;-
339 *len = s->init_num;-
340-
341 if (*
*mt == 0x0101Description
TRUEevaluated 358 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1510 times by 1 test
Evaluated by:
  • libssl.so.1.1
mt == 0x0101
*mt == 0x0101Description
TRUEevaluated 358 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1510 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
358-1510
342 if (s->msg_callback
s->msg_callbackDescription
TRUEnever evaluated
FALSEevaluated 358 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-358
343 s->msg_callback(0, s->version, 20,-
344 p, 1, s, s->msg_callback_arg);-
345 }
never executed: end of block
0
346-
347-
348-
349 return
executed 358 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 358 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
358
350 }-
351-
352 msg_len = msg_hdr->msg_len;-
353-
354-
355 *(p++) = msg_hdr->type;-
356 (((p)[0]=(unsigned char)(((msg_len)>>16)&0xff), (p)[1]=(unsigned char)(((msg_len)>> 8)&0xff), (p)[2]=(unsigned char)(((msg_len) )&0xff)),(p)+=3);-
357 (((p)[0]=(unsigned char)(((msg_hdr->seq)>> 8)&0xff), (p)[1]=(unsigned char)(((msg_hdr->seq) )&0xff)),(p)+=2);-
358 (((p)[0]=(unsigned char)(((0)>>16)&0xff), (p)[1]=(unsigned char)(((0)>> 8)&0xff), (p)[2]=(unsigned char)(((0) )&0xff)),(p)+=3);-
359 (((p)[0]=(unsigned char)(((msg_len)>>16)&0xff), (p)[1]=(unsigned char)(((msg_len)>> 8)&0xff), (p)[2]=(unsigned char)(((msg_len) )&0xff)),(p)+=3);-
360 if (s->version != 0x0100
s->version != 0x0100Description
TRUEevaluated 1507 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
3-1507
361 p -= 12;-
362 msg_len += 12;-
363 }
executed 1507 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1507
364-
365-
366-
367-
368-
369 if (*
*mt == 20Description
TRUEevaluated 355 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1155 times by 1 test
Evaluated by:
  • libssl.so.1.1
mt == 20
*mt == 20Description
TRUEevaluated 355 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1155 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& !ssl3_take_mac(s)
!ssl3_take_mac(s)Description
TRUEnever evaluated
FALSEevaluated 355 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1155
370-
371 return
never executed: return 0;
0;
never executed: return 0;
0
372 }-
373-
374 if (!ssl3_finish_mac(s, p, msg_len)
!ssl3_finish_m...s, p, msg_len)Description
TRUEnever evaluated
FALSEevaluated 1510 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1510
375 return
never executed: return 0;
0;
never executed: return 0;
0
376 if (s->msg_callback
s->msg_callbackDescription
TRUEnever evaluated
FALSEevaluated 1510 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1510
377 s->msg_callback(0, s->version, 22,
never executed: s->msg_callback(0, s->version, 22, p, msg_len, s, s->msg_callback_arg);
0
378 p, msg_len, s, s->msg_callback_arg);
never executed: s->msg_callback(0, s->version, 22, p, msg_len, s, s->msg_callback_arg);
0
379-
380 memset(msg_hdr, 0, sizeof(*msg_hdr));-
381-
382 s->d1->handshake_read_seq++;-
383-
384 s->init_msg = s->init_buf->data + 12;-
385-
386 return
executed 1510 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 1510 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1510
387}-
388-
389-
390-
391-
392-
393-
394static size_t dtls1_max_handshake_message_len(const SSL *s)-
395{-
396 size_t max_len = 12 + ((256 + 64)+(16384 +1024));-
397 if (max_len < s->max_cert_list
max_len < s->max_cert_listDescription
TRUEevaluated 2793 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
)
0-2793
398 return
executed 2793 times by 1 test: return s->max_cert_list;
Executed by:
  • libssl.so.1.1
s->max_cert_list;
executed 2793 times by 1 test: return s->max_cert_list;
Executed by:
  • libssl.so.1.1
2793
399 return
never executed: return max_len;
max_len;
never executed: return max_len;
0
400}-
401-
402static int dtls1_preprocess_fragment(SSL *s, struct hm_header_st *msg_hdr)-
403{-
404 size_t frag_off, frag_len, msg_len;-
405-
406 msg_len = msg_hdr->msg_len;-
407 frag_off = msg_hdr->frag_off;-
408 frag_len = msg_hdr->frag_len;-
409-
410-
411 if ((
(frag_off + fr...len) > msg_lenDescription
TRUEnever evaluated
FALSEevaluated 1510 times by 1 test
Evaluated by:
  • libssl.so.1.1
frag_off + frag_len) > msg_len
(frag_off + fr...len) > msg_lenDescription
TRUEnever evaluated
FALSEevaluated 1510 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1510
412 || msg_len > dtls1_max_handshake_message_len(s)
msg_len > dtls...message_len(s)Description
TRUEnever evaluated
FALSEevaluated 1510 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1510
413 ossl_statem_fatal((s), (47), (288), (152),-
414 __FILE__-
415 ,-
416 430-
417 )-
418 ;-
419 return
never executed: return 0;
0;
never executed: return 0;
0
420 }-
421-
422 if (s->d1->r_msg_hdr.frag_off == 0
s->d1->r_msg_hdr.frag_off == 0Description
TRUEevaluated 1510 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
) {
0-1510
423-
424-
425-
426-
427 if (!BUF_MEM_grow_clean(s->init_buf, msg_len + 12)
!BUF_MEM_grow_... msg_len + 12)Description
TRUEnever evaluated
FALSEevaluated 1510 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1510
428 ossl_statem_fatal((s), (80), (288), (7),-
429 __FILE__-
430 ,-
431 441-
432 )-
433 ;-
434 return
never executed: return 0;
0;
never executed: return 0;
0
435 }-
436-
437 s->s3->tmp.message_size = msg_len;-
438 s->d1->r_msg_hdr.msg_len = msg_len;-
439 s->s3->tmp.message_type = msg_hdr->type;-
440 s->d1->r_msg_hdr.type = msg_hdr->type;-
441 s->d1->r_msg_hdr.seq = msg_hdr->seq;-
442 }
executed 1510 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else if (msg_len != s->d1->r_msg_hdr.msg_len
msg_len != s->...sg_hdr.msg_lenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-1510
443-
444-
445-
446-
447 ossl_statem_fatal((s), (47), (288), (152),-
448 __FILE__-
449 ,-
450 456-
451 )-
452 ;-
453 return
never executed: return 0;
0;
never executed: return 0;
0
454 }-
455-
456 return
executed 1510 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 1510 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1510
457}-
458-
459-
460-
461-
462-
463static int dtls1_retrieve_buffered_fragment(SSL *s, size_t *len)-
464{-
465-
466-
467-
468-
469-
470-
471 pitem *item;-
472 hm_fragment *frag;-
473 int ret;-
474-
475 do {-
476 item = pqueue_peek(s->d1->buffered_messages);-
477 if (item ==
item == ((void *)0)Description
TRUEevaluated 2806 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1431 times by 1 test
Evaluated by:
  • libssl.so.1.1
1431-2806
478 ((void *)0)
item == ((void *)0)Description
TRUEevaluated 2806 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1431 times by 1 test
Evaluated by:
  • libssl.so.1.1
1431-2806
479 )-
480 return
executed 2806 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
0;
executed 2806 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
2806
481-
482 frag = (hm_fragment *)item->data;-
483-
484 if (frag->msg_header.seq < s->d1->handshake_read_seq
frag->msg_head...shake_read_seqDescription
TRUEnever evaluated
FALSEevaluated 1431 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1431
485-
486 pqueue_pop(s->d1->buffered_messages);-
487 dtls1_hm_fragment_free(frag);-
488 pitem_free(item);-
489 item = -
490 ((void *)0)-
491 ;-
492 frag = -
493 ((void *)0)-
494 ;-
495 }
never executed: end of block
0
496 }
executed 1431 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
while (item ==
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1431 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1431
497 ((void *)0)
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1431 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1431
498 );-
499-
500-
501 if (frag->reassembly !=
frag->reassemb...!= ((void *)0)Description
TRUEevaluated 1073 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 358 times by 1 test
Evaluated by:
  • libssl.so.1.1
358-1073
502 ((void *)0)
frag->reassemb...!= ((void *)0)Description
TRUEevaluated 1073 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 358 times by 1 test
Evaluated by:
  • libssl.so.1.1
358-1073
503 )-
504 return
executed 1073 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
0;
executed 1073 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1073
505-
506 if (s->d1->handshake_read_seq == frag->msg_header.seq
s->d1->handsha...msg_header.seqDescription
TRUEevaluated 343 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
15-343
507 size_t frag_len = frag->msg_header.frag_len;-
508 pqueue_pop(s->d1->buffered_messages);-
509-
510-
511 ret = dtls1_preprocess_fragment(s, &frag->msg_header);-
512-
513 if (ret
retDescription
TRUEevaluated 343 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
&& frag->msg_header.frag_len > 0
frag->msg_header.frag_len > 0Description
TRUEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-343
514 unsigned char *p =-
515 (unsigned char *)s->init_buf->data + 12;-
516 memcpy(&p[frag->msg_header.frag_off], frag->fragment,-
517 frag->msg_header.frag_len);-
518 }
executed 334 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
334
519-
520 dtls1_hm_fragment_free(frag);-
521 pitem_free(item);-
522-
523 if (ret
retDescription
TRUEevaluated 343 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
) {
0-343
524 *len = frag_len;-
525 return
executed 343 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 343 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
343
526 }-
527-
528-
529 s->init_num = 0;-
530 return
never executed: return -1;
-1;
never executed: return -1;
0
531 } else {-
532 return
executed 15 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
0;
executed 15 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
15
533 }-
534}-
535-
536static int-
537dtls1_reassemble_fragment(SSL *s, const struct hm_header_st *msg_hdr)-
538{-
539 hm_fragment *frag = -
540 ((void *)0)-
541 ;-
542 pitem *item = -
543 ((void *)0)-
544 ;-
545 int i = -1, is_complete;-
546 unsigned char seq64be[8];-
547 size_t frag_len = msg_hdr->frag_len;-
548 size_t readbytes;-
549-
550 if ((
(msg_hdr->frag...g_hdr->msg_lenDescription
TRUEnever evaluated
FALSEevaluated 1274 times by 1 test
Evaluated by:
  • libssl.so.1.1
msg_hdr->frag_off + frag_len) > msg_hdr->msg_len
(msg_hdr->frag...g_hdr->msg_lenDescription
TRUEnever evaluated
FALSEevaluated 1274 times by 1 test
Evaluated by:
  • libssl.so.1.1
||
0-1274
551 msg_hdr->msg_len > dtls1_max_handshake_message_len(s)
msg_hdr->msg_l...message_len(s)Description
TRUEnever evaluated
FALSEevaluated 1274 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1274
552 goto
never executed: goto err;
err;
never executed: goto err;
0
553-
554 if (frag_len == 0
frag_len == 0Description
TRUEnever evaluated
FALSEevaluated 1274 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1274
555 return
never executed: return -3;
-3;
never executed: return -3;
0
556 }-
557-
558-
559 memset(seq64be, 0, sizeof(seq64be));-
560 seq64be[6] = (unsigned char)(msg_hdr->seq >> 8);-
561 seq64be[7] = (unsigned char)msg_hdr->seq;-
562 item = pqueue_find(s->d1->buffered_messages, seq64be);-
563-
564 if (item ==
item == ((void *)0)Description
TRUEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 940 times by 1 test
Evaluated by:
  • libssl.so.1.1
334-940
565 ((void *)0)
item == ((void *)0)Description
TRUEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 940 times by 1 test
Evaluated by:
  • libssl.so.1.1
334-940
566 ) {-
567 frag = dtls1_hm_fragment_new(msg_hdr->msg_len, 1);-
568 if (frag ==
frag == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-334
569 ((void *)0)
frag == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-334
570 )-
571 goto
never executed: goto err;
err;
never executed: goto err;
0
572 memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr));-
573 frag->msg_header.frag_len = frag->msg_header.msg_len;-
574 frag->msg_header.frag_off = 0;-
575 }
executed 334 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
334
576 frag = (hm_fragment *)item->data;-
577 if (frag->msg_header.msg_len != msg_hdr->msg_len
frag->msg_head...g_hdr->msg_lenDescription
TRUEnever evaluated
FALSEevaluated 940 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-940
578 item = -
579 ((void *)0)-
580 ;-
581 frag = -
582 ((void *)0)-
583 ;-
584 goto
never executed: goto err;
err;
never executed: goto err;
0
585 }-
586 }
executed 940 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
940
587-
588-
589-
590-
591-
592-
593 if (frag->reassembly ==
frag->reassemb...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1274 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1274
594 ((void *)0)
frag->reassemb...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1274 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1274
595 ) {-
596 unsigned char devnull[256];-
597-
598 while (frag_len
frag_lenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
599 i = s->method->ssl_read_bytes(s, 22, -
600 ((void *)0)-
601 ,-
602 devnull,-
603 frag_len >-
604 sizeof(devnull) ? sizeof(devnull) :-
605 frag_len, 0, &readbytes);-
606 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
607 goto
never executed: goto err;
err;
never executed: goto err;
0
608 frag_len -= readbytes;-
609 }
never executed: end of block
0
610 return
never executed: return -3;
-3;
never executed: return -3;
0
611 }-
612-
613-
614 i = s->method->ssl_read_bytes(s, 22, -
615 ((void *)0)-
616 ,-
617 frag->fragment + msg_hdr->frag_off,-
618 frag_len, 0, &readbytes);-
619 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEevaluated 1274 times by 1 test
Evaluated by:
  • libssl.so.1.1
|| readbytes != frag_len
readbytes != frag_lenDescription
TRUEnever evaluated
FALSEevaluated 1274 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1274
620 i = -1;
never executed: i = -1;
0
621 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEevaluated 1274 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1274
622 goto
never executed: goto err;
err;
never executed: goto err;
0
623-
624 { if (((
((long)(msg_hd...frag_off) <= 8Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1250 times by 1 test
Evaluated by:
  • libssl.so.1.1
long)(msg_hdr->frag_off + frag_len)) - ((long)msg_hdr->frag_off) <= 8
((long)(msg_hd...frag_off) <= 8Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1250 times by 1 test
Evaluated by:
  • libssl.so.1.1
) { long ii; for (ii = ((long)msg_hdr->frag_off); ii < ((long)(msg_hdr->frag_off + frag_len))
ii < ((long)(m...f + frag_len))Description
TRUEevaluated 91 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
; ii++) frag->reassembly[((ii) >> 3)] |= (1 << ((ii) & 7));
executed 91 times by 1 test: frag->reassembly[((ii) >> 3)] |= (1 << ((ii) & 7));
Executed by:
  • libssl.so.1.1
}
executed 24 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else { long ii; frag->reassembly[(((long)msg_hdr->frag_off) >> 3)] |= bitmask_start_values[(((long)msg_hdr->frag_off) & 7)]; for (ii = ((((long)msg_hdr->frag_off) >> 3) + 1); ii < (((((long)(msg_hdr->frag_off + frag_len)) - 1)) >> 3)
ii < (((((long...)) - 1)) >> 3)Description
TRUEevaluated 27354 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1250 times by 1 test
Evaluated by:
  • libssl.so.1.1
; ii++) frag->reassembly[ii] = 0xff;
executed 27354 times by 1 test: frag->reassembly[ii] = 0xff;
Executed by:
  • libssl.so.1.1
frag->reassembly[((((long)(msg_hdr->frag_off + frag_len)) - 1) >> 3)] |= bitmask_end_values[(((long)(msg_hdr->frag_off + frag_len)) & 7)]; }
executed 1250 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
}
24-27354
625 ;-
626-
627 if (!((msg_hdr->msg_len > 0) != 0)
!((msg_hdr->msg_len > 0) != 0)Description
TRUEnever evaluated
FALSEevaluated 1274 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1274
628 goto
never executed: goto err;
err;
never executed: goto err;
0
629 { long ii; is_complete = 1; if (frag->reassembly[((((long)msg_hdr->msg_len) - 1) >> 3)] != bitmask_end_values[(((long)msg_hdr->msg_len) & 7)]
frag->reassemb...msg_len) & 7)]Description
TRUEevaluated 926 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 348 times by 1 test
Evaluated by:
  • libssl.so.1.1
) is_complete = 0;
executed 926 times by 1 test: is_complete = 0;
Executed by:
  • libssl.so.1.1
if (is_complete
is_completeDescription
TRUEevaluated 348 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 926 times by 1 test
Evaluated by:
  • libssl.so.1.1
) for (ii = ((((long)msg_hdr->msg_len) - 1) >> 3) - 1; ii >= 0
ii >= 0Description
TRUEevaluated 28919 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
; ii--) if (frag->reassembly[ii] != 0xff
frag->reassembly[ii] != 0xffDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 28905 times by 1 test
Evaluated by:
  • libssl.so.1.1
) { is_complete = 0; break;
executed 14 times by 1 test: break;
Executed by:
  • libssl.so.1.1
} }
14-28919
630 ;-
631-
632 if (is_complete
is_completeDescription
TRUEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 940 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
334-940
633 CRYPTO_free(frag->reassembly, __FILE__, 609);-
634 frag->reassembly = -
635 ((void *)0)-
636 ;-
637 }
executed 334 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
334
638-
639 if (item ==
item == ((void *)0)Description
TRUEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 940 times by 1 test
Evaluated by:
  • libssl.so.1.1
334-940
640 ((void *)0)
item == ((void *)0)Description
TRUEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 940 times by 1 test
Evaluated by:
  • libssl.so.1.1
334-940
641 ) {-
642 item = pitem_new(seq64be, frag);-
643 if (item ==
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-334
644 ((void *)0)
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-334
645 ) {-
646 i = -1;-
647 goto
never executed: goto err;
err;
never executed: goto err;
0
648 }-
649-
650 item = pqueue_insert(s->d1->buffered_messages, item);-
651-
652-
653-
654-
655-
656-
657 if (!((item !=
!((item != ((void *)0) ) != 0)Description
TRUEnever evaluated
FALSEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-334
658 ((void *)0)
!((item != ((void *)0) ) != 0)Description
TRUEnever evaluated
FALSEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-334
659 ) != 0)
!((item != ((void *)0) ) != 0)Description
TRUEnever evaluated
FALSEevaluated 334 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-334
660 goto
never executed: goto err;
err;
never executed: goto err;
0
661 }
executed 334 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
334
662-
663 return
executed 1274 times by 1 test: return -3;
Executed by:
  • libssl.so.1.1
-3;
executed 1274 times by 1 test: return -3;
Executed by:
  • libssl.so.1.1
1274
664-
665 err:-
666 if (item ==
item == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
667 ((void *)0)
item == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
668 )-
669 dtls1_hm_fragment_free(frag);
never executed: dtls1_hm_fragment_free(frag);
0
670 return
never executed: return -1;
-1;
never executed: return -1;
0
671}-
672-
673static int-
674dtls1_process_out_of_seq_message(SSL *s, const struct hm_header_st *msg_hdr)-
675{-
676 int i = -1;-
677 hm_fragment *frag = -
678 ((void *)0)-
679 ;-
680 pitem *item = -
681 ((void *)0)-
682 ;-
683 unsigned char seq64be[8];-
684 size_t frag_len = msg_hdr->frag_len;-
685 size_t readbytes;-
686-
687 if ((
(msg_hdr->frag...g_hdr->msg_lenDescription
TRUEnever evaluated
FALSEevaluated 143 times by 1 test
Evaluated by:
  • libssl.so.1.1
msg_hdr->frag_off + frag_len) > msg_hdr->msg_len
(msg_hdr->frag...g_hdr->msg_lenDescription
TRUEnever evaluated
FALSEevaluated 143 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-143
688 goto
never executed: goto err;
err;
never executed: goto err;
0
689-
690-
691 memset(seq64be, 0, sizeof(seq64be));-
692 seq64be[6] = (unsigned char)(msg_hdr->seq >> 8);-
693 seq64be[7] = (unsigned char)msg_hdr->seq;-
694 item = pqueue_find(s->d1->buffered_messages, seq64be);-
695-
696-
697-
698-
699-
700 if (item !=
item != ((void *)0)Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 127 times by 1 test
Evaluated by:
  • libssl.so.1.1
16-127
701 ((void *)0)
item != ((void *)0)Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 127 times by 1 test
Evaluated by:
  • libssl.so.1.1
16-127
702 && frag_len != msg_hdr->msg_len
frag_len != msg_hdr->msg_lenDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
)
0-16
703 item =
executed 16 times by 1 test: item = ((void *)0) ;
Executed by:
  • libssl.so.1.1
16
704 ((void *)0)
executed 16 times by 1 test: item = ((void *)0) ;
Executed by:
  • libssl.so.1.1
16
705 ;
executed 16 times by 1 test: item = ((void *)0) ;
Executed by:
  • libssl.so.1.1
16
706-
707-
708-
709-
710-
711-
712 if (msg_hdr->seq <= s->d1->handshake_read_seq
msg_hdr->seq <...shake_read_seqDescription
TRUEevaluated 111 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
||
32-111
713 msg_hdr->seq > s->d1->handshake_read_seq + 10
msg_hdr->seq >..._read_seq + 10Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
|| item !=
item != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-32
714 ((void *)0)
item != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-32
715 ||-
716 (s->d1->handshake_read_seq == 0
s->d1->handshake_read_seq == 0Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& msg_hdr->type == 20
msg_hdr->type == 20Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
)) {
0-23
717 unsigned char devnull[256];-
718-
719 while (frag_len
frag_lenDescription
TRUEevaluated 99 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 111 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
99-111
720 i = s->method->ssl_read_bytes(s, 22, -
721 ((void *)0)-
722 ,-
723 devnull,-
724 frag_len >-
725 sizeof(devnull) ? sizeof(devnull) :-
726 frag_len, 0, &readbytes);-
727 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEevaluated 99 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-99
728 goto
never executed: goto err;
err;
never executed: goto err;
0
729 frag_len -= readbytes;-
730 }
executed 99 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
99
731 }
executed 111 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
111
732 if (frag_len != msg_hdr->msg_len
frag_len != msg_hdr->msg_lenDescription
TRUEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
9-23
733 return
executed 23 times by 1 test: return dtls1_reassemble_fragment(s, msg_hdr);
Executed by:
  • libssl.so.1.1
dtls1_reassemble_fragment(s, msg_hdr);
executed 23 times by 1 test: return dtls1_reassemble_fragment(s, msg_hdr);
Executed by:
  • libssl.so.1.1
23
734 }-
735-
736 if (frag_len > dtls1_max_handshake_message_len(s)
frag_len > dtl...message_len(s)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-9
737 goto
never executed: goto err;
err;
never executed: goto err;
0
738-
739 frag = dtls1_hm_fragment_new(frag_len, 0);-
740 if (frag ==
frag == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-9
741 ((void *)0)
frag == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-9
742 )-
743 goto
never executed: goto err;
err;
never executed: goto err;
0
744-
745 memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr));-
746-
747 if (frag_len
frag_lenDescription
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-9
748-
749-
750-
751 i = s->method->ssl_read_bytes(s, 22, -
752 ((void *)0)-
753 ,-
754 frag->fragment, frag_len, 0,-
755 &readbytes);-
756 if (i<=0
i<=0Description
TRUEnever evaluated
FALSEnever evaluated
|| readbytes != frag_len
readbytes != frag_lenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
757 i = -1;
never executed: i = -1;
0
758 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
759 goto
never executed: goto err;
err;
never executed: goto err;
0
760 }
never executed: end of block
0
761-
762 item = pitem_new(seq64be, frag);-
763 if (item ==
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-9
764 ((void *)0)
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-9
765 )-
766 goto
never executed: goto err;
err;
never executed: goto err;
0
767-
768 item = pqueue_insert(s->d1->buffered_messages, item);-
769 if (!((item !=
!((item != ((void *)0) ) != 0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-9
770 ((void *)0)
!((item != ((void *)0) ) != 0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-9
771 ) != 0)
!((item != ((void *)0) ) != 0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-9
772 goto
never executed: goto err;
err;
never executed: goto err;
0
773 }
executed 9 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
9
774-
775 return
executed 120 times by 1 test: return -3;
Executed by:
  • libssl.so.1.1
-3;
executed 120 times by 1 test: return -3;
Executed by:
  • libssl.so.1.1
120
776-
777 err:-
778 if (item ==
item == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
779 ((void *)0)
item == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
780 )-
781 dtls1_hm_fragment_free(frag);
never executed: dtls1_hm_fragment_free(frag);
0
782 return
never executed: return 0;
0;
never executed: return 0;
0
783}-
784-
785static int dtls_get_reassembled_message(SSL *s, int *errtype, size_t *len)-
786{-
787 unsigned char wire[12];-
788 size_t mlen, frag_off, frag_len;-
789 int i, ret, recvd_type;-
790 struct hm_header_st msg_hdr;-
791 size_t readbytes;-
792-
793 *errtype = 0;-
794-
795 redo:
code before this statement executed 4237 times by 1 test: redo:
Executed by:
  • libssl.so.1.1
4237
796-
797 ret = dtls1_retrieve_buffered_fragment(s, &frag_len);-
798 if (ret < 0
ret < 0Description
TRUEnever evaluated
FALSEevaluated 4237 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-4237
799-
800 return
never executed: return 0;
0;
never executed: return 0;
0
801 }-
802 if (ret > 0
ret > 0Description
TRUEevaluated 343 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3894 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
343-3894
803 s->init_num = frag_len;-
804 *len = frag_len;-
805 return
executed 343 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 343 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
343
806 }-
807-
808-
809 i = s->method->ssl_read_bytes(s, 22, &recvd_type, wire,-
810 12, 0, &readbytes);-
811 if (i <= 0
i <= 0Description
TRUEevaluated 975 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2919 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
975-2919
812 s->rwstate = 3;-
813 *len = 0;-
814 return
executed 975 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
0;
executed 975 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
975
815 }-
816 if (recvd_type == 20
recvd_type == 20Description
TRUEevaluated 358 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2561 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
358-2561
817 if (wire[0] != 1
wire[0] != 1Description
TRUEnever evaluated
FALSEevaluated 358 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-358
818 ossl_statem_fatal((s), (10), (370), (103),-
819-
820 __FILE__-
821 ,-
822-
823 772-
824 )-
825-
826 ;-
827 goto
never executed: goto f_err;
f_err;
never executed: goto f_err;
0
828 }-
829-
830 memcpy(s->init_buf->data, wire, readbytes);-
831 s->init_num = readbytes - 1;-
832 s->init_msg = s->init_buf->data + 1;-
833 s->s3->tmp.message_type = 0x0101;-
834 s->s3->tmp.message_size = readbytes - 1;-
835 *len = readbytes - 1;-
836 return
executed 358 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 358 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
358
837 }-
838-
839-
840 if (readbytes != 12
readbytes != 12Description
TRUEnever evaluated
FALSEevaluated 2561 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-2561
841 ossl_statem_fatal((s), (10), (370), (244),-
842 __FILE__-
843 ,-
844 788-
845 )-
846 ;-
847 goto
never executed: goto f_err;
f_err;
never executed: goto f_err;
0
848 }-
849-
850-
851 dtls1_get_message_header(wire, &msg_hdr);-
852-
853 mlen = msg_hdr.msg_len;-
854 frag_off = msg_hdr.frag_off;-
855 frag_len = msg_hdr.frag_len;-
856-
857-
858-
859-
860-
861 if (frag_len > RECORD_LAYER_get_rrec_length(&s->rlayer)
frag_len > REC...th(&s->rlayer)Description
TRUEnever evaluated
FALSEevaluated 2561 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-2561
862 ossl_statem_fatal((s), (47), (370), (271),-
863 __FILE__-
864 ,-
865 805-
866 )-
867 ;-
868 goto
never executed: goto f_err;
f_err;
never executed: goto f_err;
0
869 }-
870-
871-
872-
873-
874-
875-
876-
877 if (msg_hdr.seq != s->d1->handshake_read_seq
msg_hdr.seq !=...shake_read_seqDescription
TRUEevaluated 143 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2418 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
143-2418
878 *errtype = dtls1_process_out_of_seq_message(s, &msg_hdr);-
879 return
executed 143 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
0;
executed 143 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
143
880 }-
881-
882 if (frag_len
frag_lenDescription
TRUEevaluated 2258 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 160 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& frag_len < mlen
frag_len < mlenDescription
TRUEevaluated 1251 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1007 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
160-2258
883 *errtype = dtls1_reassemble_fragment(s, &msg_hdr);-
884 return
executed 1251 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
0;
executed 1251 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1251
885 }-
886-
887 if (!s->server
!s->serverDescription
TRUEevaluated 668 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 499 times by 1 test
Evaluated by:
  • libssl.so.1.1
499-668
888 && s->d1->r_msg_hdr.frag_off == 0
s->d1->r_msg_hdr.frag_off == 0Description
TRUEevaluated 668 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-668
889 && s->statem.hand_state != TLS_ST_OK
s->statem.hand...e != TLS_ST_OKDescription
TRUEevaluated 665 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
3-665
890 && wire[0] == 0
wire[0] == 0Description
TRUEnever evaluated
FALSEevaluated 665 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-665
891-
892-
893-
894-
895-
896 if (wire[1] == 0
wire[1] == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& wire[2] == 0
wire[2] == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& wire[3] == 0
wire[3] == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
897 if (s->msg_callback
s->msg_callbackDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
898 s->msg_callback(0, s->version, 22,
never executed: s->msg_callback(0, s->version, 22, wire, 12, s, s->msg_callback_arg);
0
899 wire, 12, s,
never executed: s->msg_callback(0, s->version, 22, wire, 12, s, s->msg_callback_arg);
0
900 s->msg_callback_arg);
never executed: s->msg_callback(0, s->version, 22, wire, 12, s, s->msg_callback_arg);
0
901-
902 s->init_num = 0;-
903 goto
never executed: goto redo;
redo;
never executed: goto redo;
0
904 } else {-
905-
906 ossl_statem_fatal((s), (10), (370), (244),-
907-
908 __FILE__-
909 ,-
910-
911 846-
912 )-
913-
914 ;-
915 goto
never executed: goto f_err;
f_err;
never executed: goto f_err;
0
916 }-
917 }-
918-
919 if (!dtls1_preprocess_fragment(s, &msg_hdr)
!dtls1_preproc...t(s, &msg_hdr)Description
TRUEnever evaluated
FALSEevaluated 1167 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1167
920-
921 goto
never executed: goto f_err;
f_err;
never executed: goto f_err;
0
922 }-
923-
924 if (frag_len > 0
frag_len > 0Description
TRUEevaluated 1007 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 160 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
160-1007
925 unsigned char *p =-
926 (unsigned char *)s->init_buf->data + 12;-
927-
928 i = s->method->ssl_read_bytes(s, 22, -
929 ((void *)0)-
930 ,-
931 &p[frag_off], frag_len, 0, &readbytes);-
932-
933-
934-
935-
936-
937 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEevaluated 1007 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1007
938 s->rwstate = 3;-
939 *len = 0;-
940 return
never executed: return 0;
0;
never executed: return 0;
0
941 }-
942 }
executed 1007 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
1007
943 readbytes = 0;-
944 }
executed 160 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
160
945-
946-
947-
948-
949-
950 if (readbytes != frag_len
readbytes != frag_lenDescription
TRUEnever evaluated
FALSEevaluated 1167 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1167
951 ossl_statem_fatal((s), (47), (370), (271),-
952 __FILE__-
953 ,-
954 882-
955 )-
956 ;-
957 goto
never executed: goto f_err;
f_err;
never executed: goto f_err;
0
958 }-
959-
960-
961-
962-
963-
964-
965-
966 *len = s->init_num = frag_len;-
967 return
executed 1167 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 1167 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1167
968-
969 f_err:-
970 s->init_num = 0;-
971 *len = 0;-
972 return
never executed: return 0;
0;
never executed: return 0;
0
973}-
974int dtls_construct_change_cipher_spec(SSL *s, WPACKET *pkt)-
975{-
976 if (s->version == 0x0100
s->version == 0x0100Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 358 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
1-358
977 s->d1->next_handshake_write_seq++;-
978-
979 if (!WPACKET_put_bytes__((pkt), (s->d1->handshake_write_seq), 2)
!WPACKET_put_b...write_seq), 2)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1
980 ossl_statem_fatal((s), (80), (371), ((4|64)),-
981-
982 __FILE__-
983 ,-
984-
985 918-
986 )-
987-
988 ;-
989 return
never executed: return 0;
0;
never executed: return 0;
0
990 }-
991 }
executed 1 time by 1 test: end of block
Executed by:
  • libssl.so.1.1
1
992-
993 return
executed 359 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 359 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
359
994}-
995int dtls1_read_failed(SSL *s, int code)-
996{-
997 if (code > 0
code > 0Description
TRUEnever evaluated
FALSEevaluated 1204 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1204
998 ossl_statem_fatal((s), (80), (339), ((4|64)),-
999 __FILE__-
1000 ,-
1001 972-
1002 )-
1003 ;-
1004 return
never executed: return 0;
0;
never executed: return 0;
0
1005 }-
1006-
1007 if (!dtls1_is_timer_expired(s)
!dtls1_is_timer_expired(s)Description
TRUEevaluated 1204 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
|| ossl_statem_in_error(s)
ossl_statem_in_error(s)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-1204
1008-
1009-
1010-
1011-
1012 return
executed 1204 times by 1 test: return code;
Executed by:
  • libssl.so.1.1
code;
executed 1204 times by 1 test: return code;
Executed by:
  • libssl.so.1.1
1204
1013 }-
1014-
1015 if (!SSL_in_init(s)
!SSL_in_init(s)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1016 {-
1017 BIO_set_flags(SSL_get_rbio(s), 0x01);-
1018 return
never executed: return code;
code;
never executed: return code;
0
1019 }-
1020-
1021 return
never executed: return dtls1_handle_timeout(s);
dtls1_handle_timeout(s);
never executed: return dtls1_handle_timeout(s);
0
1022}-
1023-
1024int dtls1_get_queue_priority(unsigned short seq, int is_ccs)-
1025{-
1026 return
executed 3904 times by 1 test: return seq * 2 - is_ccs;
Executed by:
  • libssl.so.1.1
seq * 2 - is_ccs;
executed 3904 times by 1 test: return seq * 2 - is_ccs;
Executed by:
  • libssl.so.1.1
3904
1027}-
1028-
1029int dtls1_retransmit_buffered_messages(SSL *s)-
1030{-
1031 pqueue *sent = s->d1->sent_messages;-
1032 piterator iter;-
1033 pitem *item;-
1034 hm_fragment *frag;-
1035 int found = 0;-
1036-
1037 iter = pqueue_iterator(sent);-
1038-
1039 for (item = pqueue_next(&iter); item !=
item != ((void *)0)Description
TRUEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 51 times by 1 test
Evaluated by:
  • libssl.so.1.1
51-122
1040 ((void *)0)
item != ((void *)0)Description
TRUEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 51 times by 1 test
Evaluated by:
  • libssl.so.1.1
51-122
1041 ; item = pqueue_next(&iter)) {-
1042 frag = (hm_fragment *)item->data;-
1043 if (dtls1_retransmit_message(s, (unsigned short)
dtls1_retransm..., &found) <= 0Description
TRUEnever evaluated
FALSEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-122
1044 dtls1_get_queue_priority
dtls1_retransm..., &found) <= 0Description
TRUEnever evaluated
FALSEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-122
1045 (frag->msg_header.seq,
dtls1_retransm..., &found) <= 0Description
TRUEnever evaluated
FALSEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-122
1046 frag->msg_header.is_ccs), &found) <= 0
dtls1_retransm..., &found) <= 0Description
TRUEnever evaluated
FALSEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-122
1047 return
never executed: return -1;
-1;
never executed: return -1;
0
1048 }
executed 122 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
122
1049-
1050 return
executed 51 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 51 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
51
1051}-
1052-
1053int dtls1_buffer_message(SSL *s, int is_ccs)-
1054{-
1055 pitem *item;-
1056 hm_fragment *frag;-
1057 unsigned char seq64be[8];-
1058-
1059-
1060-
1061-
1062-
1063 if (!((s->init_off == 0) != 0)
!((s->init_off == 0) != 0)Description
TRUEnever evaluated
FALSEevaluated 1891 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1891
1064 return
never executed: return 0;
0;
never executed: return 0;
0
1065-
1066 frag = dtls1_hm_fragment_new(s->init_num, 0);-
1067 if (frag ==
frag == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1891 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1891
1068 ((void *)0)
frag == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1891 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1891
1069 )-
1070 return
never executed: return 0;
0;
never executed: return 0;
0
1071-
1072 memcpy(frag->fragment, s->init_buf->data, s->init_num);-
1073-
1074 if (is_ccs
is_ccsDescription
TRUEevaluated 359 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1532 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
359-1532
1075-
1076 if (!((s->d1->w_msg_hdr.msg_len + ((
(s->version == 0x0100)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 358 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->version == 0x0100)
(s->version == 0x0100)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 358 times by 1 test
Evaluated by:
  • libssl.so.1.1
? 3 : 1) == (unsigned int)s->init_num) != 0)
!((s->d1->w_ms...nit_num) != 0)Description
TRUEnever evaluated
FALSEevaluated 359 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-359
1077-
1078-
1079 )-
1080 return
never executed: return 0;
0;
never executed: return 0;
0
1081 }
executed 359 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
359
1082 if (!((s->d1->w_msg_hdr.msg_len + 12 == (unsigned int)s->init_num) != 0)
!((s->d1->w_ms...nit_num) != 0)Description
TRUEnever evaluated
FALSEevaluated 1532 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1532
1083 )-
1084 return
never executed: return 0;
0;
never executed: return 0;
0
1085 }
executed 1532 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1532
1086-
1087 frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len;-
1088 frag->msg_header.seq = s->d1->w_msg_hdr.seq;-
1089 frag->msg_header.type = s->d1->w_msg_hdr.type;-
1090 frag->msg_header.frag_off = 0;-
1091 frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len;-
1092 frag->msg_header.is_ccs = is_ccs;-
1093-
1094-
1095 frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx;-
1096 frag->msg_header.saved_retransmit_state.write_hash = s->write_hash;-
1097 frag->msg_header.saved_retransmit_state.compress = s->compress;-
1098 frag->msg_header.saved_retransmit_state.session = s->session;-
1099 frag->msg_header.saved_retransmit_state.epoch =-
1100 ((&s->rlayer)->d->w_epoch);-
1101-
1102 memset(seq64be, 0, sizeof(seq64be));-
1103 seq64be[6] =-
1104 (unsigned-
1105 char)(dtls1_get_queue_priority(frag->msg_header.seq,-
1106 frag->msg_header.is_ccs) >> 8);-
1107 seq64be[7] =-
1108 (unsigned-
1109 char)(dtls1_get_queue_priority(frag->msg_header.seq,-
1110 frag->msg_header.is_ccs));-
1111-
1112 item = pitem_new(seq64be, frag);-
1113 if (item ==
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1891 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1891
1114 ((void *)0)
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1891 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1891
1115 ) {-
1116 dtls1_hm_fragment_free(frag);-
1117 return
never executed: return 0;
0;
never executed: return 0;
0
1118 }-
1119-
1120 pqueue_insert(s->d1->sent_messages, item);-
1121 return
executed 1891 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 1891 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1891
1122}-
1123-
1124int dtls1_retransmit_message(SSL *s, unsigned short seq, int *found)-
1125{-
1126 int ret;-
1127-
1128 pitem *item;-
1129 hm_fragment *frag;-
1130 unsigned long header_length;-
1131 unsigned char seq64be[8];-
1132 struct dtls1_retransmit_state saved_state;-
1133-
1134-
1135 memset(seq64be, 0, sizeof(seq64be));-
1136 seq64be[6] = (unsigned char)(seq >> 8);-
1137 seq64be[7] = (unsigned char)seq;-
1138-
1139 item = pqueue_find(s->d1->sent_messages, seq64be);-
1140 if (item ==
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-122
1141 ((void *)0)
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-122
1142 ) {-
1143 ossl_statem_fatal((s), (80), (390), ((4|64)),-
1144 __FILE__-
1145 ,-
1146 1115-
1147 )-
1148 ;-
1149 *found = 0;-
1150 return
never executed: return 0;
0;
never executed: return 0;
0
1151 }-
1152-
1153 *found = 1;-
1154 frag = (hm_fragment *)item->data;-
1155-
1156 if (frag->msg_header.is_ccs
frag->msg_header.is_ccsDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 102 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
20-102
1157 header_length = 1;
executed 20 times by 1 test: header_length = 1;
Executed by:
  • libssl.so.1.1
20
1158 else-
1159 header_length = 12;
executed 102 times by 1 test: header_length = 12;
Executed by:
  • libssl.so.1.1
102
1160-
1161 memcpy(s->init_buf->data, frag->fragment,-
1162 frag->msg_header.msg_len + header_length);-
1163 s->init_num = frag->msg_header.msg_len + header_length;-
1164-
1165 dtls1_set_message_header_int(s, frag->msg_header.type,-
1166 frag->msg_header.msg_len,-
1167 frag->msg_header.seq, 0,-
1168 frag->msg_header.frag_len);-
1169-
1170-
1171 saved_state.enc_write_ctx = s->enc_write_ctx;-
1172 saved_state.write_hash = s->write_hash;-
1173 saved_state.compress = s->compress;-
1174 saved_state.session = s->session;-
1175 saved_state.epoch = ((&s->rlayer)->d->w_epoch);-
1176-
1177 s->d1->retransmitting = 1;-
1178-
1179-
1180 s->enc_write_ctx = frag->msg_header.saved_retransmit_state.enc_write_ctx;-
1181 s->write_hash = frag->msg_header.saved_retransmit_state.write_hash;-
1182 s->compress = frag->msg_header.saved_retransmit_state.compress;-
1183 s->session = frag->msg_header.saved_retransmit_state.session;-
1184 DTLS_RECORD_LAYER_set_saved_w_epoch(&s->rlayer,-
1185 frag->msg_header.-
1186 saved_retransmit_state.epoch);-
1187-
1188 ret = dtls1_do_write(s, frag->msg_header.is_ccs ?-
1189 20 : 22);-
1190-
1191-
1192 s->enc_write_ctx = saved_state.enc_write_ctx;-
1193 s->write_hash = saved_state.write_hash;-
1194 s->compress = saved_state.compress;-
1195 s->session = saved_state.session;-
1196 DTLS_RECORD_LAYER_set_saved_w_epoch(&s->rlayer, saved_state.epoch);-
1197-
1198 s->d1->retransmitting = 0;-
1199-
1200 (void)(int)BIO_ctrl(s->wbio,11,0,-
1201 ((void *)0)-
1202 );-
1203 return
executed 122 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
ret;
executed 122 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
122
1204}-
1205-
1206void dtls1_set_message_header(SSL *s,-
1207 unsigned char mt, size_t len,-
1208 size_t frag_off, size_t frag_len)-
1209{-
1210 if (frag_off == 0
frag_off == 0Description
TRUEevaluated 1532 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
) {
0-1532
1211 s->d1->handshake_write_seq = s->d1->next_handshake_write_seq;-
1212 s->d1->next_handshake_write_seq++;-
1213 }
executed 1532 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1532
1214-
1215 dtls1_set_message_header_int(s, mt, len, s->d1->handshake_write_seq,-
1216 frag_off, frag_len);-
1217}
executed 1532 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1532
1218-
1219-
1220static void-
1221dtls1_set_message_header_int(SSL *s, unsigned char mt,-
1222 size_t len, unsigned short seq_num,-
1223 size_t frag_off, size_t frag_len)-
1224{-
1225 struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr;-
1226-
1227 msg_hdr->type = mt;-
1228 msg_hdr->msg_len = len;-
1229 msg_hdr->seq = seq_num;-
1230 msg_hdr->frag_off = frag_off;-
1231 msg_hdr->frag_len = frag_len;-
1232}
executed 2013 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2013
1233-
1234static void-
1235dtls1_fix_message_header(SSL *s, size_t frag_off, size_t frag_len)-
1236{-
1237 struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr;-
1238-
1239 msg_hdr->frag_off = frag_off;-
1240 msg_hdr->frag_len = frag_len;-
1241}
executed 3668 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
3668
1242-
1243static unsigned char *dtls1_write_message_header(SSL *s, unsigned char *p)-
1244{-
1245 struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr;-
1246-
1247 *p++ = msg_hdr->type;-
1248 (((p)[0]=(unsigned char)(((msg_hdr->msg_len)>>16)&0xff), (p)[1]=(unsigned char)(((msg_hdr->msg_len)>> 8)&0xff), (p)[2]=(unsigned char)(((msg_hdr->msg_len) )&0xff)),(p)+=3);-
1249-
1250 (((p)[0]=(unsigned char)(((msg_hdr->seq)>> 8)&0xff), (p)[1]=(unsigned char)(((msg_hdr->seq) )&0xff)),(p)+=2);-
1251 (((p)[0]=(unsigned char)(((msg_hdr->frag_off)>>16)&0xff), (p)[1]=(unsigned char)(((msg_hdr->frag_off)>> 8)&0xff), (p)[2]=(unsigned char)(((msg_hdr->frag_off) )&0xff)),(p)+=3);-
1252 (((p)[0]=(unsigned char)(((msg_hdr->frag_len)>>16)&0xff), (p)[1]=(unsigned char)(((msg_hdr->frag_len)>> 8)&0xff), (p)[2]=(unsigned char)(((msg_hdr->frag_len) )&0xff)),(p)+=3);-
1253-
1254 return
executed 2651 times by 1 test: return p;
Executed by:
  • libssl.so.1.1
p;
executed 2651 times by 1 test: return p;
Executed by:
  • libssl.so.1.1
2651
1255}-
1256-
1257void dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr)-
1258{-
1259 memset(msg_hdr, 0, sizeof(*msg_hdr));-
1260 msg_hdr->type = *(data++);-
1261 ((msg_hdr->msg_len =(((unsigned long)((data)[0]))<<16)| (((unsigned long)((data)[1]))<< 8)| (((unsigned long)((data)[2])) )),(data)+=3);-
1262-
1263 ((msg_hdr->seq=(((unsigned int)((data)[0]))<< 8)| (((unsigned int)((data)[1])) )),(data)+=2);-
1264 ((msg_hdr->frag_off =(((unsigned long)((data)[0]))<<16)| (((unsigned long)((data)[1]))<< 8)| (((unsigned long)((data)[2])) )),(data)+=3);-
1265 ((msg_hdr->frag_len =(((unsigned long)((data)[0]))<<16)| (((unsigned long)((data)[1]))<< 8)| (((unsigned long)((data)[2])) )),(data)+=3);-
1266}
executed 2579 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2579
1267-
1268int dtls1_set_handshake_header(SSL *s, WPACKET *pkt, int htype)-
1269{-
1270 unsigned char *header;-
1271-
1272 if (htype == 0x0101
htype == 0x0101Description
TRUEevaluated 359 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1532 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
359-1532
1273 s->d1->handshake_write_seq = s->d1->next_handshake_write_seq;-
1274 dtls1_set_message_header_int(s, 1, 0,-
1275 s->d1->handshake_write_seq, 0, 0);-
1276 if (!WPACKET_put_bytes__((pkt), (1), 1)
!WPACKET_put_b...(pkt), (1), 1)Description
TRUEnever evaluated
FALSEevaluated 359 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-359
1277 return
never executed: return 0;
0;
never executed: return 0;
0
1278 }
executed 359 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
359
1279 dtls1_set_message_header(s, htype, 0, 0, 0);-
1280-
1281-
1282-
1283-
1284 if (!WPACKET_allocate_bytes(pkt, 12, &header)
!WPACKET_alloc..., 12, &header)Description
TRUEnever evaluated
FALSEevaluated 1532 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1532
1285 || !WPACKET_start_sub_packet(pkt)
!WPACKET_start_sub_packet(pkt)Description
TRUEnever evaluated
FALSEevaluated 1532 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1532
1286 return
never executed: return 0;
0;
never executed: return 0;
0
1287 }
executed 1532 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1532
1288-
1289 return
executed 1891 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 1891 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1891
1290}-
1291-
1292int dtls1_close_construct_packet(SSL *s, WPACKET *pkt, int htype)-
1293{-
1294 size_t msglen;-
1295-
1296 if ((htype != 0x0101
htype != 0x0101Description
TRUEevaluated 1532 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 359 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& !WPACKET_close(pkt)
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 1532 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1532
1297 || !WPACKET_get_length(pkt, &msglen)
!WPACKET_get_l...(pkt, &msglen)Description
TRUEnever evaluated
FALSEevaluated 1891 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1891
1298 || msglen > 0x7fffffff
msglen > 0x7fffffffDescription
TRUEnever evaluated
FALSEevaluated 1891 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1891
1299 return
never executed: return 0;
0;
never executed: return 0;
0
1300-
1301 if (htype != 0x0101
htype != 0x0101Description
TRUEevaluated 1532 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 359 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
359-1532
1302 s->d1->w_msg_hdr.msg_len = msglen - 12;-
1303 s->d1->w_msg_hdr.frag_len = msglen - 12;-
1304 }
executed 1532 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1532
1305 s->init_num = (int)msglen;-
1306 s->init_off = 0;-
1307-
1308 if (htype != 3
htype != 3Description
TRUEevaluated 1891 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
) {
0-1891
1309-
1310 if (!dtls1_buffer_message(s, htype == 0x0101
!dtls1_buffer_...x0101 ? 1 : 0)Description
TRUEnever evaluated
FALSEevaluated 1891 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1891
1311 ? 1 : 0)
!dtls1_buffer_...x0101 ? 1 : 0)Description
TRUEnever evaluated
FALSEevaluated 1891 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-1891
1312 return
never executed: return 0;
0;
never executed: return 0;
0
1313 }
executed 1891 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1891
1314-
1315 return
executed 1891 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 1891 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1891
1316}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2