OpenCoverage

tls13_enc.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/tls13_enc.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6static const unsigned char default_zeros[64];-
7-
8-
9-
10-
11-
12-
13-
14int tls13_hkdf_expand(SSL *s, const EVP_MD *md, const unsigned char *secret,-
15 const unsigned char *label, size_t labellen,-
16 const unsigned char *data, size_t datalen,-
17 unsigned char *out, size_t outlen)-
18{-
19 const unsigned char label_prefix[] = "tls13 ";-
20 EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(1036, -
21 ((void *)0)-
22 );-
23 int ret;-
24 size_t hkdflabellen;-
25 size_t hashlen;-
26-
27-
28-
29-
30 unsigned char hkdflabel[sizeof(uint16_t) + sizeof(uint8_t) +-
31 + sizeof(label_prefix) + 246-
32 + 64];-
33 WPACKET pkt;-
34-
35 if (pctx ==
pctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
36 ((void *)0)
pctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
37 )-
38 return
never executed: return 0;
0;
never executed: return 0;
0
39-
40 hashlen = EVP_MD_size(md);-
41-
42 if (!WPACKET_init_static_len(&pkt, hkdflabel, sizeof(hkdflabel), 0)
!WPACKET_init_...hkdflabel), 0)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
43 || !WPACKET_put_bytes__((&pkt), (outlen), 2)
!WPACKET_put_b..., (outlen), 2)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
44 || !WPACKET_start_sub_packet_len__((&pkt), 1)
!WPACKET_start...n__((&pkt), 1)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
45 || !WPACKET_memcpy(&pkt, label_prefix, sizeof(label_prefix) - 1)
!WPACKET_memcp...l_prefix) - 1)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
46 || !WPACKET_memcpy(&pkt, label, labellen)
!WPACKET_memcp...bel, labellen)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
47 || !WPACKET_close(&pkt)
!WPACKET_close(&pkt)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
48 || !WPACKET_sub_memcpy__((&pkt), (data), ((data ==
!WPACKET_sub_m...: datalen), 1)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
49 ((void *)0)
!WPACKET_sub_m...: datalen), 1)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
50 ) ? 0 : datalen), 1)
!WPACKET_sub_m...: datalen), 1)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
51 || !WPACKET_get_total_written(&pkt, &hkdflabellen)
!WPACKET_get_t...&hkdflabellen)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
52 || !WPACKET_finish(&pkt)
!WPACKET_finish(&pkt)Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
) {
0-27761
53 EVP_PKEY_CTX_free(pctx);-
54 WPACKET_cleanup(&pkt);-
55 ossl_statem_fatal((s), (80), (561), ((4|64)),-
56 __FILE__-
57 ,-
58 63-
59 )-
60 ;-
61 return
never executed: return 0;
0;
never executed: return 0;
0
62 }-
63-
64 ret = EVP_PKEY_derive_init(pctx) <= 0
EVP_PKEY_deriv...nit(pctx) <= 0Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
65 || EVP_PKEY_CTX_ctrl(pctx, -1, (1<<10), (0x1000 + 7), 2,
EVP_PKEY_CTX_c...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
66 ((void *)0)
EVP_PKEY_CTX_c...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
67 )
EVP_PKEY_CTX_c...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
68 <= 0
EVP_PKEY_CTX_c...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
69 || EVP_PKEY_CTX_ctrl(pctx, -1, (1<<10), (0x1000 + 3), 0, (void *)(md)) <= 0
EVP_PKEY_CTX_c...d *)(md)) <= 0Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
70 || EVP_PKEY_CTX_ctrl(pctx, -1, (1<<10), (0x1000 + 5), hashlen, (void *)(secret)) <= 0
EVP_PKEY_CTX_c...(secret)) <= 0Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
71 || EVP_PKEY_CTX_ctrl(pctx, -1, (1<<10), (0x1000 + 6), hkdflabellen, (void *)(hkdflabel)) <= 0
EVP_PKEY_CTX_c...dflabel)) <= 0Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-27761
72 || EVP_PKEY_derive(pctx, out, &outlen) <= 0
EVP_PKEY_deriv... &outlen) <= 0Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
;
0-27761
73-
74 EVP_PKEY_CTX_free(pctx);-
75-
76 if (ret != 0
ret != 0Description
TRUEnever evaluated
FALSEevaluated 27761 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
)
0-27761
77 ossl_statem_fatal((s), (80), (561), ((4|64)),
never executed: ossl_statem_fatal((s), (80), (561), ((4|64)), __FILE__ , 79 ) ;
0
78 __FILE__
never executed: ossl_statem_fatal((s), (80), (561), ((4|64)), __FILE__ , 79 ) ;
0
79 ,
never executed: ossl_statem_fatal((s), (80), (561), ((4|64)), __FILE__ , 79 ) ;
0
80 79
never executed: ossl_statem_fatal((s), (80), (561), ((4|64)), __FILE__ , 79 ) ;
0
81 )
never executed: ossl_statem_fatal((s), (80), (561), ((4|64)), __FILE__ , 79 ) ;
0
82 ;
never executed: ossl_statem_fatal((s), (80), (561), ((4|64)), __FILE__ , 79 ) ;
0
83-
84 return
executed 27761 times by 2 tests: return ret == 0;
Executed by:
  • libssl.so.1.1
  • tls13secretstest
ret == 0;
executed 27761 times by 2 tests: return ret == 0;
Executed by:
  • libssl.so.1.1
  • tls13secretstest
27761
85}-
86-
87-
88-
89-
90-
91int tls13_derive_key(SSL *s, const EVP_MD *md, const unsigned char *secret,-
92 unsigned char *key, size_t keylen)-
93{-
94 static const unsigned char keylabel[] = "key";-
95-
96 return
executed 5550 times by 2 tests: return tls13_hkdf_expand(s, md, secret, keylabel, sizeof(keylabel) - 1, ((void *)0) , 0, key, keylen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
tls13_hkdf_expand(s, md, secret, keylabel, sizeof(keylabel) - 1,
executed 5550 times by 2 tests: return tls13_hkdf_expand(s, md, secret, keylabel, sizeof(keylabel) - 1, ((void *)0) , 0, key, keylen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
5550
97
executed 5550 times by 2 tests: return tls13_hkdf_expand(s, md, secret, keylabel, sizeof(keylabel) - 1, ((void *)0) , 0, key, keylen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
5550
98 ((void *)0)
executed 5550 times by 2 tests: return tls13_hkdf_expand(s, md, secret, keylabel, sizeof(keylabel) - 1, ((void *)0) , 0, key, keylen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
5550
99 , 0, key, keylen);
executed 5550 times by 2 tests: return tls13_hkdf_expand(s, md, secret, keylabel, sizeof(keylabel) - 1, ((void *)0) , 0, key, keylen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
5550
100}-
101-
102-
103-
104-
105-
106int tls13_derive_iv(SSL *s, const EVP_MD *md, const unsigned char *secret,-
107 unsigned char *iv, size_t ivlen)-
108{-
109 static const unsigned char ivlabel[] = "iv";-
110-
111 return
executed 5550 times by 2 tests: return tls13_hkdf_expand(s, md, secret, ivlabel, sizeof(ivlabel) - 1, ((void *)0) , 0, iv, ivlen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
tls13_hkdf_expand(s, md, secret, ivlabel, sizeof(ivlabel) - 1,
executed 5550 times by 2 tests: return tls13_hkdf_expand(s, md, secret, ivlabel, sizeof(ivlabel) - 1, ((void *)0) , 0, iv, ivlen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
5550
112
executed 5550 times by 2 tests: return tls13_hkdf_expand(s, md, secret, ivlabel, sizeof(ivlabel) - 1, ((void *)0) , 0, iv, ivlen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
5550
113 ((void *)0)
executed 5550 times by 2 tests: return tls13_hkdf_expand(s, md, secret, ivlabel, sizeof(ivlabel) - 1, ((void *)0) , 0, iv, ivlen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
5550
114 , 0, iv, ivlen);
executed 5550 times by 2 tests: return tls13_hkdf_expand(s, md, secret, ivlabel, sizeof(ivlabel) - 1, ((void *)0) , 0, iv, ivlen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
5550
115}-
116-
117int tls13_derive_finishedkey(SSL *s, const EVP_MD *md,-
118 const unsigned char *secret,-
119 unsigned char *fin, size_t finlen)-
120{-
121 static const unsigned char finishedlabel[] = "finished";-
122-
123 return
executed 3248 times by 1 test: return tls13_hkdf_expand(s, md, secret, finishedlabel, sizeof(finishedlabel) - 1, ((void *)0) , 0, fin, finlen);
Executed by:
  • libssl.so.1.1
tls13_hkdf_expand(s, md, secret, finishedlabel,
executed 3248 times by 1 test: return tls13_hkdf_expand(s, md, secret, finishedlabel, sizeof(finishedlabel) - 1, ((void *)0) , 0, fin, finlen);
Executed by:
  • libssl.so.1.1
3248
124 sizeof(finishedlabel) - 1,
executed 3248 times by 1 test: return tls13_hkdf_expand(s, md, secret, finishedlabel, sizeof(finishedlabel) - 1, ((void *)0) , 0, fin, finlen);
Executed by:
  • libssl.so.1.1
3248
125 ((void *)0)
executed 3248 times by 1 test: return tls13_hkdf_expand(s, md, secret, finishedlabel, sizeof(finishedlabel) - 1, ((void *)0) , 0, fin, finlen);
Executed by:
  • libssl.so.1.1
3248
126 , 0, fin, finlen);
executed 3248 times by 1 test: return tls13_hkdf_expand(s, md, secret, finishedlabel, sizeof(finishedlabel) - 1, ((void *)0) , 0, fin, finlen);
Executed by:
  • libssl.so.1.1
3248
127}-
128-
129-
130-
131-
132-
133-
134int tls13_generate_secret(SSL *s, const EVP_MD *md,-
135 const unsigned char *prevsecret,-
136 const unsigned char *insecret,-
137 size_t insecretlen,-
138 unsigned char *outsecret)-
139{-
140 size_t mdlen, prevsecretlen;-
141 int mdleni;-
142 int ret;-
143 EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(1036, -
144 ((void *)0)-
145 );-
146 static const char derived_secret_label[] = "derived";-
147 unsigned char preextractsec[64];-
148-
149 if (pctx ==
pctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
150 ((void *)0)
pctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
151 ) {-
152 ossl_statem_fatal((s), (80), (591), ((4|64)),-
153 __FILE__-
154 ,-
155 140-
156 )-
157 ;-
158 return
never executed: return 0;
0;
never executed: return 0;
0
159 }-
160-
161 mdleni = EVP_MD_size(md);-
162-
163 if (!((mdleni >= 0) != 0)
!((mdleni >= 0) != 0)Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
) {
0-4462
164 ossl_statem_fatal((s), (80), (591), ((4|64)),-
165 __FILE__-
166 ,-
167 148-
168 )-
169 ;-
170 return
never executed: return 0;
0;
never executed: return 0;
0
171 }-
172 mdlen = (size_t)mdleni;-
173-
174 if (insecret ==
insecret == ((void *)0)Description
TRUEevaluated 2686 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
FALSEevaluated 1776 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
1776-2686
175 ((void *)0)
insecret == ((void *)0)Description
TRUEevaluated 2686 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
FALSEevaluated 1776 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
1776-2686
176 ) {-
177 insecret = default_zeros;-
178 insecretlen = mdlen;-
179 }
executed 2686 times by 2 tests: end of block
Executed by:
  • libssl.so.1.1
  • tls13secretstest
2686
180 if (prevsecret ==
prevsecret == ((void *)0)Description
TRUEevaluated 1561 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
1561-2901
181 ((void *)0)
prevsecret == ((void *)0)Description
TRUEevaluated 1561 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
1561-2901
182 ) {-
183 prevsecret = default_zeros;-
184 prevsecretlen = 0;-
185 }
executed 1561 times by 2 tests: end of block
Executed by:
  • libssl.so.1.1
  • tls13secretstest
else {
1561
186 EVP_MD_CTX *mctx = EVP_MD_CTX_new();-
187 unsigned char hash[64];-
188-
189-
190 if (mctx ==
mctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-2901
191 ((void *)0)
mctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-2901
192 -
193 || EVP_DigestInit_ex(mctx, md,
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-2901
194 ((void *)0)
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-2901
195 ) <= 0
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-2901
196 || EVP_DigestFinal_ex(mctx, hash,
EVP_DigestFina...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-2901
197 ((void *)0)
EVP_DigestFina...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-2901
198 ) <= 0
EVP_DigestFina...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
) {
0-2901
199 ossl_statem_fatal((s), (80), (591), ((4|64)),-
200 __FILE__-
201 ,-
202 169-
203 )-
204 ;-
205 EVP_MD_CTX_free(mctx);-
206 EVP_PKEY_CTX_free(pctx);-
207 return
never executed: return 0;
0;
never executed: return 0;
0
208 }-
209 EVP_MD_CTX_free(mctx);-
210-
211-
212 if (!tls13_hkdf_expand(s, md, prevsecret,
!tls13_hkdf_ex...actsec, mdlen)Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-2901
213 (unsigned char *)derived_secret_label,
!tls13_hkdf_ex...actsec, mdlen)Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-2901
214 sizeof(derived_secret_label) - 1, hash, mdlen,
!tls13_hkdf_ex...actsec, mdlen)Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-2901
215 preextractsec, mdlen)
!tls13_hkdf_ex...actsec, mdlen)Description
TRUEnever evaluated
FALSEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
) {
0-2901
216-
217 EVP_PKEY_CTX_free(pctx);-
218 return
never executed: return 0;
0;
never executed: return 0;
0
219 }-
220-
221 prevsecret = preextractsec;-
222 prevsecretlen = mdlen;-
223 }
executed 2901 times by 2 tests: end of block
Executed by:
  • libssl.so.1.1
  • tls13secretstest
2901
224-
225 ret = EVP_PKEY_derive_init(pctx) <= 0
EVP_PKEY_deriv...nit(pctx) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
226 || EVP_PKEY_CTX_ctrl(pctx, -1, (1<<10), (0x1000 + 7), 1,
EVP_PKEY_CTX_c...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
227 ((void *)0)
EVP_PKEY_CTX_c...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
228 )
EVP_PKEY_CTX_c...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
229 <= 0
EVP_PKEY_CTX_c...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
230 || EVP_PKEY_CTX_ctrl(pctx, -1, (1<<10), (0x1000 + 3), 0, (void *)(md)) <= 0
EVP_PKEY_CTX_c...d *)(md)) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
231 || EVP_PKEY_CTX_ctrl(pctx, -1, (1<<10), (0x1000 + 5), insecretlen, (void *)(insecret)) <= 0
EVP_PKEY_CTX_c...nsecret)) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
232 || EVP_PKEY_CTX_ctrl(pctx, -1, (1<<10), (0x1000 + 4), prevsecretlen, (void *)(prevsecret))
EVP_PKEY_CTX_c...vsecret)) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
233 <= 0
EVP_PKEY_CTX_c...vsecret)) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
234 || EVP_PKEY_derive(pctx, outsecret, &mdlen)
EVP_PKEY_deriv..., &mdlen) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
0-4462
235 <= 0
EVP_PKEY_deriv..., &mdlen) <= 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
;
0-4462
236-
237 if (ret != 0
ret != 0Description
TRUEnever evaluated
FALSEevaluated 4462 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
)
0-4462
238 ossl_statem_fatal((s), (80), (591), ((4|64)),
never executed: ossl_statem_fatal((s), (80), (591), ((4|64)), __FILE__ , 202 ) ;
0
239 __FILE__
never executed: ossl_statem_fatal((s), (80), (591), ((4|64)), __FILE__ , 202 ) ;
0
240 ,
never executed: ossl_statem_fatal((s), (80), (591), ((4|64)), __FILE__ , 202 ) ;
0
241 202
never executed: ossl_statem_fatal((s), (80), (591), ((4|64)), __FILE__ , 202 ) ;
0
242 )
never executed: ossl_statem_fatal((s), (80), (591), ((4|64)), __FILE__ , 202 ) ;
0
243 ;
never executed: ossl_statem_fatal((s), (80), (591), ((4|64)), __FILE__ , 202 ) ;
0
244-
245 EVP_PKEY_CTX_free(pctx);-
246 if (prevsecret == preextractsec
prevsecret == preextractsecDescription
TRUEevaluated 2901 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
FALSEevaluated 1561 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13secretstest
)
1561-2901
247 OPENSSL_cleanse(preextractsec, mdlen);
executed 2901 times by 2 tests: OPENSSL_cleanse(preextractsec, mdlen);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
2901
248 return
executed 4462 times by 2 tests: return ret == 0;
Executed by:
  • libssl.so.1.1
  • tls13secretstest
ret == 0;
executed 4462 times by 2 tests: return ret == 0;
Executed by:
  • libssl.so.1.1
  • tls13secretstest
4462
249}-
250-
251-
252-
253-
254-
255-
256int tls13_generate_handshake_secret(SSL *s, const unsigned char *insecret,-
257 size_t insecretlen)-
258{-
259-
260 return
executed 1472 times by 2 tests: return tls13_generate_secret(s, ssl_handshake_md(s), s->early_secret, insecret, insecretlen, (unsigned char *)&s->handshake_secret);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
tls13_generate_secret(s, ssl_handshake_md(s), s->early_secret,
executed 1472 times by 2 tests: return tls13_generate_secret(s, ssl_handshake_md(s), s->early_secret, insecret, insecretlen, (unsigned char *)&s->handshake_secret);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
1472
261 insecret, insecretlen,
executed 1472 times by 2 tests: return tls13_generate_secret(s, ssl_handshake_md(s), s->early_secret, insecret, insecretlen, (unsigned char *)&s->handshake_secret);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
1472
262 (unsigned char *)&s->handshake_secret);
executed 1472 times by 2 tests: return tls13_generate_secret(s, ssl_handshake_md(s), s->early_secret, insecret, insecretlen, (unsigned char *)&s->handshake_secret);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
1472
263}-
264-
265-
266-
267-
268-
269-
270int tls13_generate_master_secret(SSL *s, unsigned char *out,-
271 unsigned char *prev, size_t prevlen,-
272 size_t *secret_size)-
273{-
274 const EVP_MD *md = ssl_handshake_md(s);-
275-
276 *secret_size = EVP_MD_size(md);-
277-
278 return
executed 1429 times by 2 tests: return tls13_generate_secret(s, md, prev, ((void *)0) , 0, out);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
tls13_generate_secret(s, md, prev,
executed 1429 times by 2 tests: return tls13_generate_secret(s, md, prev, ((void *)0) , 0, out);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
1429
279 ((void *)0)
executed 1429 times by 2 tests: return tls13_generate_secret(s, md, prev, ((void *)0) , 0, out);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
1429
280 , 0, out);
executed 1429 times by 2 tests: return tls13_generate_secret(s, md, prev, ((void *)0) , 0, out);
Executed by:
  • libssl.so.1.1
  • tls13secretstest
1429
281}-
282-
283-
284-
285-
286-
287size_t tls13_final_finish_mac(SSL *s, const char *str, size_t slen,-
288 unsigned char *out)-
289{-
290 const EVP_MD *md = ssl_handshake_md(s);-
291 unsigned char hash[64];-
292 size_t hashlen, ret = 0;-
293 EVP_PKEY *key = -
294 ((void *)0)-
295 ;-
296 EVP_MD_CTX *ctx = EVP_MD_CTX_new();-
297-
298 if (!ssl_handshake_hash(s, hash, sizeof(hash), &hashlen)
!ssl_handshake...sh), &hashlen)Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-2614
299-
300 goto
never executed: goto err;
err;
never executed: goto err;
0
301 }-
302-
303 if (str == s->method->ssl3_enc->server_finished_label
str == s->meth...finished_labelDescription
TRUEevaluated 1429 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1185 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
1185-1429
304 key = EVP_PKEY_new_raw_private_key(855, -
305 ((void *)0)-
306 ,-
307 s->server_finished_secret, hashlen);-
308 }
executed 1429 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else if (((
(s)->s3->tmp.f...sh_md_len == 0Description
TRUEevaluated 573 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 612 times by 1 test
Evaluated by:
  • libssl.so.1.1
s)->s3->tmp.finish_md_len == 0
(s)->s3->tmp.f...sh_md_len == 0Description
TRUEevaluated 573 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 612 times by 1 test
Evaluated by:
  • libssl.so.1.1
|| (
(s)->s3->tmp.p...sh_md_len == 0Description
TRUEevaluated 565 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 47 times by 1 test
Evaluated by:
  • libssl.so.1.1
s)->s3->tmp.peer_finish_md_len == 0
(s)->s3->tmp.p...sh_md_len == 0Description
TRUEevaluated 565 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 47 times by 1 test
Evaluated by:
  • libssl.so.1.1
)) {
47-1429
309 key = EVP_PKEY_new_raw_private_key(855, -
310 ((void *)0)-
311 ,-
312 s->client_finished_secret, hashlen);-
313 }
executed 1138 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
1138
314 unsigned char finsecret[64];-
315-
316 if (!tls13_derive_finishedkey(s, ssl_handshake_md(s),
!tls13_derive_...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 47 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-47
317 s->client_app_traffic_secret,
!tls13_derive_...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 47 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-47
318 finsecret, hashlen)
!tls13_derive_...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 47 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-47
319 goto
never executed: goto err;
err;
never executed: goto err;
0
320-
321 key = EVP_PKEY_new_raw_private_key(855, -
322 ((void *)0)-
323 , finsecret,-
324 hashlen);-
325 OPENSSL_cleanse(finsecret, sizeof(finsecret));-
326 }
executed 47 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
47
327-
328 if (key ==
key == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2614
329 ((void *)0)
key == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2614
330 -
331 || ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2614
332 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2614
333 -
334 || EVP_DigestSignInit(ctx,
EVP_DigestSign...0) , key) <= 0Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2614
335 ((void *)0)
EVP_DigestSign...0) , key) <= 0Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2614
336 , md,
EVP_DigestSign...0) , key) <= 0Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2614
337 ((void *)0)
EVP_DigestSign...0) , key) <= 0Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2614
338 , key) <= 0
EVP_DigestSign...0) , key) <= 0Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2614
339 || EVP_DigestUpdate(ctx,hash,hashlen) <= 0
EVP_DigestUpda...,hashlen) <= 0Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2614
340 || EVP_DigestSignFinal(ctx, out, &hashlen) <= 0
EVP_DigestSign...&hashlen) <= 0Description
TRUEnever evaluated
FALSEevaluated 2614 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-2614
341 ossl_statem_fatal((s), (80), (605), ((4|64)),-
342 __FILE__-
343 ,-
344 283-
345 )-
346 ;-
347 goto
never executed: goto err;
err;
never executed: goto err;
0
348 }-
349-
350 ret = hashlen;-
351 err:
code before this statement executed 2614 times by 1 test: err:
Executed by:
  • libssl.so.1.1
2614
352 EVP_PKEY_free(key);-
353 EVP_MD_CTX_free(ctx);-
354 return
executed 2614 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
ret;
executed 2614 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
2614
355}-
356-
357-
358-
359-
360-
361int tls13_setup_key_block(SSL *s)-
362{-
363 const EVP_CIPHER *c;-
364 const EVP_MD *hash;-
365 int mac_type = 0;-
366-
367 s->session->cipher = s->s3->tmp.new_cipher;-
368 if (!ssl_cipher_get_evp
!ssl_cipher_ge...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1471
369 (s->session, &c, &hash, &mac_type,
!ssl_cipher_ge...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1471
370 ((void *)0)
!ssl_cipher_ge...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1471
371 ,
!ssl_cipher_ge...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1471
372 ((void *)0)
!ssl_cipher_ge...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1471
373 , 0)
!ssl_cipher_ge...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1471
374 ossl_statem_fatal((s), (80), (441), (138),-
375 __FILE__-
376 ,-
377 308-
378 )-
379 ;-
380 return
never executed: return 0;
0;
never executed: return 0;
0
381 }-
382-
383 s->s3->tmp.new_sym_enc = c;-
384 s->s3->tmp.new_hash = hash;-
385-
386 return
executed 1471 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 1471 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1471
387}-
388-
389static int derive_secret_key_and_iv(SSL *s, int sending, const EVP_MD *md,-
390 const EVP_CIPHER *ciph,-
391 const unsigned char *insecret,-
392 const unsigned char *hash,-
393 const unsigned char *label,-
394 size_t labellen, unsigned char *secret,-
395 unsigned char *iv, EVP_CIPHER_CTX *ciph_ctx)-
396{-
397 unsigned char key[64];-
398 size_t ivlen, keylen, taglen;-
399 int hashleni = EVP_MD_size(md);-
400 size_t hashlen;-
401-
402-
403 if (!((hashleni >= 0) != 0)
!((hashleni >= 0) != 0)Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-5546
404 ossl_statem_fatal((s), (80), (514), (6),-
405 __FILE__-
406 ,-
407 334-
408 )-
409 ;-
410 goto
never executed: goto err;
err;
never executed: goto err;
0
411 }-
412 hashlen = (size_t)hashleni;-
413-
414 if (!tls13_hkdf_expand(s, md, insecret, label, labellen, hash, hashlen,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
415 secret, hashlen)
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-5546
416-
417 goto
never executed: goto err;
err;
never executed: goto err;
0
418 }-
419-
420-
421 keylen = EVP_CIPHER_key_length(ciph);-
422 if ((
(EVP_CIPHER_fl...xF0007) == 0x7Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 5522 times by 1 test
Evaluated by:
  • libssl.so.1.1
EVP_CIPHER_flags(ciph) & 0xF0007) == 0x7
(EVP_CIPHER_fl...xF0007) == 0x7Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 5522 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
24-5522
423 uint32_t algenc;-
424-
425 ivlen = 12;-
426 if (s->s3->tmp.new_cipher ==
s->s3->tmp.new...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-24
427 ((void *)0)
s->s3->tmp.new...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-24
428 ) {-
429-
430 algenc = s->session->cipher->algorithm_enc;-
431 }
never executed: end of block
else {
0
432 algenc = s->s3->tmp.new_cipher->algorithm_enc;-
433 }
executed 24 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
24
434 if (algenc & (0x00010000U | 0x00020000U)
algenc & (0x00...| 0x00020000U)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-24
435 taglen = 8;
never executed: taglen = 8;
0
436 else-
437 taglen = 16;
executed 24 times by 1 test: taglen = 16;
Executed by:
  • libssl.so.1.1
24
438 } else {-
439 ivlen = EVP_CIPHER_iv_length(ciph);-
440 taglen = 0;-
441 }
executed 5522 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
5522
442-
443 if (!tls13_derive_key(s, md, secret, key, keylen)
!tls13_derive_..., key, keylen)Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
444 || !tls13_derive_iv(s, md, secret, iv, ivlen)
!tls13_derive_...et, iv, ivlen)Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-5546
445-
446 goto
never executed: goto err;
err;
never executed: goto err;
0
447 }-
448-
449 if (EVP_CipherInit_ex(ciph_ctx, ciph,
EVP_CipherInit... sending) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
450 ((void *)0)
EVP_CipherInit... sending) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
451 ,
EVP_CipherInit... sending) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
452 ((void *)0)
EVP_CipherInit... sending) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
453 ,
EVP_CipherInit... sending) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
454 ((void *)0)
EVP_CipherInit... sending) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
455 , sending) <= 0
EVP_CipherInit... sending) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
456 || !EVP_CIPHER_CTX_ctrl(ciph_ctx, 0x9, ivlen,
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
457 ((void *)0)
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
458 )
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
459 || (taglen != 0
taglen != 0Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 5522 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& !EVP_CIPHER_CTX_ctrl(ciph_ctx, 0x11,
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5522
460 taglen,
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-24
461 ((void *)0)
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-24
462 )
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-24
463 || EVP_CipherInit_ex(ciph_ctx,
EVP_CipherInit...)0) , -1) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
464 ((void *)0)
EVP_CipherInit...)0) , -1) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
465 ,
EVP_CipherInit...)0) , -1) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
466 ((void *)0)
EVP_CipherInit...)0) , -1) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
467 , key,
EVP_CipherInit...)0) , -1) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
468 ((void *)0)
EVP_CipherInit...)0) , -1) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5546
469 , -1) <= 0
EVP_CipherInit...)0) , -1) <= 0Description
TRUEnever evaluated
FALSEevaluated 5546 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-5546
470 ossl_statem_fatal((s), (80), (514), (6),-
471 __FILE__-
472 ,-
473 378-
474 )-
475 ;-
476 goto
never executed: goto err;
err;
never executed: goto err;
0
477 }-
478-
479 return
executed 5546 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 5546 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
5546
480 err:-
481 OPENSSL_cleanse(key, sizeof(key));-
482 return
never executed: return 0;
0;
never executed: return 0;
0
483}-
484-
485int tls13_change_cipher_state(SSL *s, int which)-
486{-
487 static const unsigned char client_early_traffic[] = "c e traffic";-
488 static const unsigned char client_handshake_traffic[] = "c hs traffic";-
489 static const unsigned char client_application_traffic[] = "c ap traffic";-
490 static const unsigned char server_handshake_traffic[] = "s hs traffic";-
491 static const unsigned char server_application_traffic[] = "s ap traffic";-
492 static const unsigned char exporter_master_secret[] = "exp master";-
493 static const unsigned char resumption_master_secret[] = "res master";-
494 static const unsigned char early_exporter_master_secret[] = "e exp master";-
495 unsigned char *iv;-
496 unsigned char secret[64];-
497 unsigned char hashval[64];-
498 unsigned char *hash = hashval;-
499 unsigned char *insecret;-
500 unsigned char *finsecret = -
501 ((void *)0)-
502 ;-
503 const char *log_label = -
504 ((void *)0)-
505 ;-
506 EVP_CIPHER_CTX *ciph_ctx;-
507 size_t finsecretlen = 0;-
508 const unsigned char *label;-
509 size_t labellen, hashlen = 0;-
510 int ret = 0;-
511 const EVP_MD *md = -
512 ((void *)0)-
513 ;-
514 const EVP_CIPHER *cipher = -
515 ((void *)0)-
516 ;-
517-
518 if (which & 0x001
which & 0x001Description
TRUEevaluated 2627 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2904 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
2627-2904
519 if (s->enc_read_ctx !=
s->enc_read_ctx != ((void *)0)Description
TRUEevaluated 1156 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
1156-1471
520 ((void *)0)
s->enc_read_ctx != ((void *)0)Description
TRUEevaluated 1156 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
1156-1471
521 ) {-
522 EVP_CIPHER_CTX_reset(s->enc_read_ctx);-
523 }
executed 1156 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
1156
524 s->enc_read_ctx = EVP_CIPHER_CTX_new();-
525 if (s->enc_read_ctx ==
s->enc_read_ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1471
526 ((void *)0)
s->enc_read_ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1471
527 ) {-
528 ossl_statem_fatal((s), (80), (440), ((1|64)),-
529 __FILE__-
530 ,-
531 420-
532 )-
533 ;-
534 goto
never executed: goto err;
err;
never executed: goto err;
0
535 }-
536 }
executed 1471 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1471
537 ciph_ctx = s->enc_read_ctx;-
538 iv = s->read_iv;-
539-
540 RECORD_LAYER_reset_read_sequence(&s->rlayer);-
541 }
executed 2627 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
2627
542 s->statem.enc_write_state = ENC_WRITE_STATE_INVALID;-
543 if (s->enc_write_ctx !=
s->enc_write_c...!= ((void *)0)Description
TRUEevaluated 1443 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1461 times by 1 test
Evaluated by:
  • libssl.so.1.1
1443-1461
544 ((void *)0)
s->enc_write_c...!= ((void *)0)Description
TRUEevaluated 1443 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1461 times by 1 test
Evaluated by:
  • libssl.so.1.1
1443-1461
545 ) {-
546 EVP_CIPHER_CTX_reset(s->enc_write_ctx);-
547 }
executed 1443 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
1443
548 s->enc_write_ctx = EVP_CIPHER_CTX_new();-
549 if (s->enc_write_ctx ==
s->enc_write_c...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1461 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1461
550 ((void *)0)
s->enc_write_c...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1461 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1461
551 ) {-
552 ossl_statem_fatal((s), (80), (440), ((1|64)),-
553 __FILE__-
554 ,-
555 436-
556 )-
557 ;-
558 goto
never executed: goto err;
err;
never executed: goto err;
0
559 }-
560 }
executed 1461 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1461
561 ciph_ctx = s->enc_write_ctx;-
562 iv = s->write_iv;-
563-
564 RECORD_LAYER_reset_write_sequence(&s->rlayer);-
565 }
executed 2904 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2904
566-
567 if (((
(which & 0x010)Description
TRUEevaluated 2389 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3142 times by 1 test
Evaluated by:
  • libssl.so.1.1
which & 0x010)
(which & 0x010)Description
TRUEevaluated 2389 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3142 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& (
(which & 0x002)Description
TRUEevaluated 1197 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1192 times by 1 test
Evaluated by:
  • libssl.so.1.1
which & 0x002)
(which & 0x002)Description
TRUEevaluated 1197 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1192 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
1192-3142
568 || ((
(which & 0x020)Description
TRUEevaluated 3142 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1192 times by 1 test
Evaluated by:
  • libssl.so.1.1
which & 0x020)
(which & 0x020)Description
TRUEevaluated 3142 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1192 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& (
(which & 0x001)Description
TRUEevaluated 1435 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1707 times by 1 test
Evaluated by:
  • libssl.so.1.1
which & 0x001)
(which & 0x001)Description
TRUEevaluated 1435 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1707 times by 1 test
Evaluated by:
  • libssl.so.1.1
)) {
1192-3142
569 if (which & 0x040
which & 0x040Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2560 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
72-2560
570 EVP_MD_CTX *mdctx = -
571 ((void *)0)-
572 ;-
573 long handlen;-
574 void *hdata;-
575 unsigned int hashlenui;-
576 const SSL_CIPHER *sslcipher = SSL_SESSION_get0_cipher(s->session);-
577-
578 insecret = s->early_secret;-
579 label = client_early_traffic;-
580 labellen = sizeof(client_early_traffic) - 1;-
581 log_label = "CLIENT_EARLY_TRAFFIC_SECRET";-
582-
583 handlen = BIO_ctrl(s->s3->handshake_buffer,3,0,(char *)(&hdata));-
584 if (handlen <= 0
handlen <= 0Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-72
585 ossl_statem_fatal((s), (80), (440), (332),-
586-
587 __FILE__-
588 ,-
589-
590 464-
591 )-
592-
593 ;-
594 goto
never executed: goto err;
err;
never executed: goto err;
0
595 }-
596-
597 if (s->early_data_state == SSL_EARLY_DATA_CONNECTING
s->early_data_...ATA_CONNECTINGDescription
TRUEevaluated 50 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
22-50
598 && s->max_early_data > 0
s->max_early_data > 0Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-50
599 && s->session->ext.max_early_data == 0
s->session->ex...arly_data == 0Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 38 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
12-38
600-
601-
602-
603-
604-
605 if (!((s->psksession !=
s->psksession != ((void *)0)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
!((s->psksessi...ly_data) != 0)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
606 ((void *)0)
s->psksession != ((void *)0)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
!((s->psksessi...ly_data) != 0)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
607 && s->max_early_data == s->psksession->ext.max_early_data
s->max_early_d...max_early_dataDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
) != 0)
!((s->psksessi...ly_data) != 0)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
608-
609 ) {-
610 ossl_statem_fatal((s), (80), (440), ((4|64)),-
611-
612 __FILE__-
613 ,-
614-
615 481-
616 )-
617-
618 ;-
619 goto
never executed: goto err;
err;
never executed: goto err;
0
620 }-
621 sslcipher = SSL_SESSION_get0_cipher(s->psksession);-
622 }
executed 12 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
12
623 if (sslcipher ==
sslcipher == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
624 ((void *)0)
sslcipher == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
625 ) {-
626 ossl_statem_fatal((s), (80), (440), (219),-
627 __FILE__-
628 ,-
629 488-
630 )-
631 ;-
632 goto
never executed: goto err;
err;
never executed: goto err;
0
633 }-
634-
635-
636-
637-
638-
639-
640 mdctx = EVP_MD_CTX_new();-
641 if (mdctx ==
mdctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
642 ((void *)0)
mdctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
643 ) {-
644 ossl_statem_fatal((s), (80), (440), ((1|64)),-
645 __FILE__-
646 ,-
647 500-
648 )-
649 ;-
650 goto
never executed: goto err;
err;
never executed: goto err;
0
651 }-
652 cipher = EVP_get_cipherbyname(OBJ_nid2sn(SSL_CIPHER_get_cipher_nid(sslcipher)));-
653 md = ssl_md(sslcipher->algorithm2);-
654 if (md ==
md == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
655 ((void *)0)
md == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
656 || !EVP_DigestInit_ex(mdctx, md,
!EVP_DigestIni... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
657 ((void *)0)
!EVP_DigestIni... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
658 )
!EVP_DigestIni... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
659 || !EVP_DigestUpdate(mdctx, hdata, handlen)
!EVP_DigestUpd...data, handlen)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
660 || !EVP_DigestFinal_ex(mdctx, hashval, &hashlenui)
!EVP_DigestFin...l, &hashlenui)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-72
661 ossl_statem_fatal((s), (80), (440), ((4|64)),-
662 __FILE__-
663 ,-
664 509-
665 )-
666 ;-
667 EVP_MD_CTX_free(mdctx);-
668 goto
never executed: goto err;
err;
never executed: goto err;
0
669 }-
670 hashlen = hashlenui;-
671 EVP_MD_CTX_free(mdctx);-
672-
673 if (!tls13_hkdf_expand(s, md, insecret,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
674 early_exporter_master_secret,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
675 sizeof(early_exporter_master_secret) - 1,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
676 hashval, hashlen,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
677 s->early_exporter_master_secret, hashlen)
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-72
678 ossl_statem_fatal((s), (80), (440), ((4|64)),-
679 __FILE__-
680 ,-
681 522-
682 )-
683 ;-
684 goto
never executed: goto err;
err;
never executed: goto err;
0
685 }-
686-
687 if (!ssl_log_secret(s, "EARLY_EXPORTER_SECRET",
!ssl_log_secre...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-72
688 s->early_exporter_master_secret, hashlen)
!ssl_log_secre...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-72
689-
690 goto
never executed: goto err;
err;
never executed: goto err;
0
691 }-
692 }
executed 72 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else if (which & 0x080
which & 0x080Description
TRUEevaluated 1422 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1138 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
72-1422
693 insecret = s->handshake_secret;-
694 finsecret = s->client_finished_secret;-
695 finsecretlen = EVP_MD_size(ssl_handshake_md(s));-
696 label = client_handshake_traffic;-
697 labellen = sizeof(client_handshake_traffic) - 1;-
698 log_label = "CLIENT_HANDSHAKE_TRAFFIC_SECRET";-
699 hash = s->handshake_traffic_hash;-
700 }
executed 1422 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
1422
701 insecret = s->master_secret;-
702 label = client_application_traffic;-
703 labellen = sizeof(client_application_traffic) - 1;-
704 log_label = "CLIENT_TRAFFIC_SECRET_0";-
705-
706-
707-
708-
709-
710-
711 hash = s->server_finished_hash;-
712 }
executed 1138 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1138
713 } else {-
714-
715 if (which & 0x080
which & 0x080Description
TRUEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1428 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
1428-1471
716 insecret = s->handshake_secret;-
717 finsecret = s->server_finished_secret;-
718 finsecretlen = EVP_MD_size(ssl_handshake_md(s));-
719 label = server_handshake_traffic;-
720 labellen = sizeof(server_handshake_traffic) - 1;-
721 log_label = "SERVER_HANDSHAKE_TRAFFIC_SECRET";-
722 }
executed 1471 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
1471
723 insecret = s->master_secret;-
724 label = server_application_traffic;-
725 labellen = sizeof(server_application_traffic) - 1;-
726 log_label = "SERVER_TRAFFIC_SECRET_0";-
727 }
executed 1428 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1428
728 }-
729-
730 if (!(which & 0x040)
!(which & 0x040)Description
TRUEevaluated 5459 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 72 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
72-5459
731 md = ssl_handshake_md(s);-
732 cipher = s->s3->tmp.new_sym_enc;-
733 if (!ssl3_digest_cached_records(s, 1)
!ssl3_digest_c..._records(s, 1)Description
TRUEnever evaluated
FALSEevaluated 5459 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5459
734 || !ssl_handshake_hash(s, hashval, sizeof(hashval), &hashlen)
!ssl_handshake...al), &hashlen)Description
TRUEnever evaluated
FALSEevaluated 5459 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-5459
735 ;-
736 goto
never executed: goto err;
err;
never executed: goto err;
0
737 }-
738 }
executed 5459 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
5459
739-
740-
741-
742-
743-
744 if (label == server_application_traffic
label == serve...cation_trafficDescription
TRUEevaluated 1428 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4103 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
1428-4103
745 memcpy(s->server_finished_hash, hashval, hashlen);
executed 1428 times by 1 test: memcpy(s->server_finished_hash, hashval, hashlen);
Executed by:
  • libssl.so.1.1
1428
746-
747 if (label == server_handshake_traffic
label == serve...dshake_trafficDescription
TRUEevaluated 1471 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4060 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
1471-4060
748 memcpy(s->handshake_traffic_hash, hashval, hashlen);
executed 1471 times by 1 test: memcpy(s->handshake_traffic_hash, hashval, hashlen);
Executed by:
  • libssl.so.1.1
1471
749-
750 if (label == client_application_traffic
label == clien...cation_trafficDescription
TRUEevaluated 1138 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4393 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
1138-4393
751-
752-
753-
754-
755 if (!tls13_hkdf_expand(s, ssl_handshake_md(s), insecret,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1138 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1138
756 resumption_master_secret,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1138 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1138
757 sizeof(resumption_master_secret) - 1,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1138 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1138
758 hashval, hashlen, s->resumption_master_secret,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1138 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1138
759 hashlen)
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1138 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1138
760-
761 goto
never executed: goto err;
err;
never executed: goto err;
0
762 }-
763 }
executed 1138 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1138
764-
765 if (!derive_secret_key_and_iv(s, which & 0x002, md, cipher,
!derive_secret... iv, ciph_ctx)Description
TRUEnever evaluated
FALSEevaluated 5531 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5531
766 insecret, hash, label, labellen, secret, iv,
!derive_secret... iv, ciph_ctx)Description
TRUEnever evaluated
FALSEevaluated 5531 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-5531
767 ciph_ctx)
!derive_secret... iv, ciph_ctx)Description
TRUEnever evaluated
FALSEevaluated 5531 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-5531
768-
769 goto
never executed: goto err;
err;
never executed: goto err;
0
770 }-
771-
772 if (label == server_application_traffic
label == serve...cation_trafficDescription
TRUEevaluated 1428 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4103 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
1428-4103
773 memcpy(s->server_app_traffic_secret, secret, hashlen);-
774-
775 if (!tls13_hkdf_expand(s, ssl_handshake_md(s), insecret,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1428 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1428
776 exporter_master_secret,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1428 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1428
777 sizeof(exporter_master_secret) - 1,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1428 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1428
778 hash, hashlen, s->exporter_master_secret,
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1428 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1428
779 hashlen)
!tls13_hkdf_ex...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1428 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1428
780-
781 goto
never executed: goto err;
err;
never executed: goto err;
0
782 }-
783-
784 if (!ssl_log_secret(s, "EXPORTER_SECRET", s->exporter_master_secret,
!ssl_log_secre...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1428 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1428
785 hashlen)
!ssl_log_secre...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 1428 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-1428
786-
787 goto
never executed: goto err;
err;
never executed: goto err;
0
788 }-
789 }
executed 1428 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else if (label == client_application_traffic
label == clien...cation_trafficDescription
TRUEevaluated 1138 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2965 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
1138-2965
790 memcpy(s->client_app_traffic_secret, secret, hashlen);
executed 1138 times by 1 test: memcpy(s->client_app_traffic_secret, secret, hashlen);
Executed by:
  • libssl.so.1.1
1138
791-
792 if (!ssl_log_secret(s, log_label, secret, hashlen)
!ssl_log_secre...cret, hashlen)Description
TRUEnever evaluated
FALSEevaluated 5531 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-5531
793-
794 goto
never executed: goto err;
err;
never executed: goto err;
0
795 }-
796-
797 if (finsecret !=
finsecret != ((void *)0)Description
TRUEevaluated 2893 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2638 times by 1 test
Evaluated by:
  • libssl.so.1.1
2638-2893
798 ((void *)0)
finsecret != ((void *)0)Description
TRUEevaluated 2893 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2638 times by 1 test
Evaluated by:
  • libssl.so.1.1
2638-2893
799 -
800 && !tls13_derive_finishedkey(s, ssl_handshake_md(s), secret,
!tls13_derive_... finsecretlen)Description
TRUEnever evaluated
FALSEevaluated 2893 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2893
801 finsecret, finsecretlen)
!tls13_derive_... finsecretlen)Description
TRUEnever evaluated
FALSEevaluated 2893 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-2893
802-
803 goto
never executed: goto err;
err;
never executed: goto err;
0
804 }-
805-
806 if (!s->server
!s->serverDescription
TRUEevaluated 2389 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3142 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& label == client_early_traffic
label == client_early_trafficDescription
TRUEevaluated 50 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2339 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
50-3142
807 s->statem.enc_write_state = ENC_WRITE_STATE_WRITE_PLAIN_ALERTS;
executed 50 times by 1 test: s->statem.enc_write_state = ENC_WRITE_STATE_WRITE_PLAIN_ALERTS;
Executed by:
  • libssl.so.1.1
50
808 else-
809 s->statem.enc_write_state = ENC_WRITE_STATE_VALID;
executed 5481 times by 1 test: s->statem.enc_write_state = ENC_WRITE_STATE_VALID;
Executed by:
  • libssl.so.1.1
5481
810 ret = 1;-
811 err:
code before this statement executed 5531 times by 1 test: err:
Executed by:
  • libssl.so.1.1
5531
812 OPENSSL_cleanse(secret, sizeof(secret));-
813 return
executed 5531 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
ret;
executed 5531 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
5531
814}-
815-
816int tls13_update_key(SSL *s, int sending)-
817{-
818 static const unsigned char application_traffic[] = "traffic upd";-
819 const EVP_MD *md = ssl_handshake_md(s);-
820 size_t hashlen = EVP_MD_size(md);-
821 unsigned char *insecret, *iv;-
822 unsigned char secret[64];-
823 EVP_CIPHER_CTX *ciph_ctx;-
824 int ret = 0;-
825-
826 if (s->server == sending
s->server == sendingDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
7-8
827 insecret = s->server_app_traffic_secret;
executed 8 times by 1 test: insecret = s->server_app_traffic_secret;
Executed by:
  • libssl.so.1.1
8
828 else-
829 insecret = s->client_app_traffic_secret;
executed 7 times by 1 test: insecret = s->client_app_traffic_secret;
Executed by:
  • libssl.so.1.1
7
830-
831 if (sending
sendingDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
7-8
832 s->statem.enc_write_state = ENC_WRITE_STATE_INVALID;-
833 iv = s->write_iv;-
834 ciph_ctx = s->enc_write_ctx;-
835 RECORD_LAYER_reset_write_sequence(&s->rlayer);-
836 }
executed 8 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
else {
8
837 iv = s->read_iv;-
838 ciph_ctx = s->enc_read_ctx;-
839 RECORD_LAYER_reset_read_sequence(&s->rlayer);-
840 }
executed 7 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
7
841-
842 if (!derive_secret_key_and_iv(s, sending, ssl_handshake_md(s),
!derive_secret... iv, ciph_ctx)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-15
843 s->s3->tmp.new_sym_enc, insecret,
!derive_secret... iv, ciph_ctx)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-15
844 ((void *)0)
!derive_secret... iv, ciph_ctx)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-15
845 ,
!derive_secret... iv, ciph_ctx)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-15
846 application_traffic,
!derive_secret... iv, ciph_ctx)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-15
847 sizeof(application_traffic) - 1, secret, iv,
!derive_secret... iv, ciph_ctx)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-15
848 ciph_ctx)
!derive_secret... iv, ciph_ctx)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-15
849-
850 goto
never executed: goto err;
err;
never executed: goto err;
0
851 }-
852-
853 memcpy(insecret, secret, hashlen);-
854-
855 s->statem.enc_write_state = ENC_WRITE_STATE_VALID;-
856 ret = 1;-
857 err:
code before this statement executed 15 times by 1 test: err:
Executed by:
  • libssl.so.1.1
15
858 OPENSSL_cleanse(secret, sizeof(secret));-
859 return
executed 15 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
ret;
executed 15 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
15
860}-
861-
862int tls13_alert_code(int code)-
863{-
864-
865 if (code == 109
code == 109Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1320 times by 1 test
Evaluated by:
  • libssl.so.1.1
|| code == 116
code == 116Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1318 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
2-1320
866 return
executed 24 times by 1 test: return code;
Executed by:
  • libssl.so.1.1
code;
executed 24 times by 1 test: return code;
Executed by:
  • libssl.so.1.1
24
867-
868 return
executed 1318 times by 1 test: return tls1_alert_code(code);
Executed by:
  • libssl.so.1.1
tls1_alert_code(code);
executed 1318 times by 1 test: return tls1_alert_code(code);
Executed by:
  • libssl.so.1.1
1318
869}-
870-
871int tls13_export_keying_material(SSL *s, unsigned char *out, size_t olen,-
872 const char *label, size_t llen,-
873 const unsigned char *context,-
874 size_t contextlen, int use_context)-
875{-
876 unsigned char exportsecret[64];-
877 static const unsigned char exporterlabel[] = "exporter";-
878 unsigned char hash[64], data[64];-
879 const EVP_MD *md = ssl_handshake_md(s);-
880 EVP_MD_CTX *ctx = EVP_MD_CTX_new();-
881 unsigned int hashsize, datalen;-
882 int ret = 0;-
883-
884 if (ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
885 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
886 || !ossl_statem_export_allowed(s)
!ossl_statem_export_allowed(s)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-6
887 goto
never executed: goto err;
err;
never executed: goto err;
0
888-
889 if (!use_context
!use_contextDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
2-4
890 contextlen = 0;
executed 2 times by 1 test: contextlen = 0;
Executed by:
  • libssl.so.1.1
2
891-
892 if (EVP_DigestInit_ex(ctx, md,
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
893 ((void *)0)
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
894 ) <= 0
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
895 || EVP_DigestUpdate(ctx, context, contextlen) <= 0
EVP_DigestUpda...ntextlen) <= 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
896 || EVP_DigestFinal_ex(ctx, hash, &hashsize) <= 0
EVP_DigestFina...hashsize) <= 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
897 || EVP_DigestInit_ex(ctx, md,
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
898 ((void *)0)
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
899 ) <= 0
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
900 || EVP_DigestFinal_ex(ctx, data, &datalen) <= 0
EVP_DigestFina...&datalen) <= 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
901 || !tls13_hkdf_expand(s, md, s->exporter_master_secret,
!tls13_hkdf_ex...ret, hashsize)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
902 (const unsigned char *)label, llen,
!tls13_hkdf_ex...ret, hashsize)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
903 data, datalen, exportsecret, hashsize)
!tls13_hkdf_ex...ret, hashsize)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
904 || !tls13_hkdf_expand(s, md, exportsecret, exporterlabel,
!tls13_hkdf_ex...ze, out, olen)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
905 sizeof(exporterlabel) - 1, hash, hashsize,
!tls13_hkdf_ex...ze, out, olen)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
906 out, olen)
!tls13_hkdf_ex...ze, out, olen)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-6
907 goto
never executed: goto err;
err;
never executed: goto err;
0
908-
909 ret = 1;-
910 err:
code before this statement executed 6 times by 1 test: err:
Executed by:
  • libssl.so.1.1
6
911 EVP_MD_CTX_free(ctx);-
912 return
executed 6 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
ret;
executed 6 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
6
913}-
914-
915int tls13_export_keying_material_early(SSL *s, unsigned char *out, size_t olen,-
916 const char *label, size_t llen,-
917 const unsigned char *context,-
918 size_t contextlen)-
919{-
920 static const unsigned char exporterlabel[] = "exporter";-
921 unsigned char exportsecret[64];-
922 unsigned char hash[64], data[64];-
923 const EVP_MD *md;-
924 EVP_MD_CTX *ctx = EVP_MD_CTX_new();-
925 unsigned int hashsize, datalen;-
926 int ret = 0;-
927 const SSL_CIPHER *sslcipher;-
928-
929 if (ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
930 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
931 || !ossl_statem_export_early_allowed(s)
!ossl_statem_e...rly_allowed(s)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-12
932 goto
never executed: goto err;
err;
never executed: goto err;
0
933-
934 if (!s->server
!s->serverDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
&& s->max_early_data > 0
s->max_early_data > 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-6
935 && s->session->ext.max_early_data == 0
s->session->ex...arly_data == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
2-4
936 sslcipher = SSL_SESSION_get0_cipher(s->psksession);
executed 2 times by 1 test: sslcipher = SSL_SESSION_get0_cipher(s->psksession);
Executed by:
  • libssl.so.1.1
2
937 else-
938 sslcipher = SSL_SESSION_get0_cipher(s->session);
executed 10 times by 1 test: sslcipher = SSL_SESSION_get0_cipher(s->session);
Executed by:
  • libssl.so.1.1
10
939-
940 md = ssl_md(sslcipher->algorithm2);-
941 if (EVP_DigestInit_ex(ctx, md,
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
942 ((void *)0)
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
943 ) <= 0
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
944 || EVP_DigestUpdate(ctx, context, contextlen) <= 0
EVP_DigestUpda...ntextlen) <= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
945 || EVP_DigestFinal_ex(ctx, hash, &hashsize) <= 0
EVP_DigestFina...hashsize) <= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
946 || EVP_DigestInit_ex(ctx, md,
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
947 ((void *)0)
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
948 ) <= 0
EVP_DigestInit...id *)0) ) <= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
949 || EVP_DigestFinal_ex(ctx, data, &datalen) <= 0
EVP_DigestFina...&datalen) <= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
950 || !tls13_hkdf_expand(s, md, s->early_exporter_master_secret,
!tls13_hkdf_ex...ret, hashsize)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
951 (const unsigned char *)label, llen,
!tls13_hkdf_ex...ret, hashsize)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
952 data, datalen, exportsecret, hashsize)
!tls13_hkdf_ex...ret, hashsize)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
953 || !tls13_hkdf_expand(s, md, exportsecret, exporterlabel,
!tls13_hkdf_ex...ze, out, olen)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
954 sizeof(exporterlabel) - 1, hash, hashsize,
!tls13_hkdf_ex...ze, out, olen)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
955 out, olen)
!tls13_hkdf_ex...ze, out, olen)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-12
956 goto
never executed: goto err;
err;
never executed: goto err;
0
957-
958 ret = 1;-
959 err:
code before this statement executed 12 times by 1 test: err:
Executed by:
  • libssl.so.1.1
12
960 EVP_MD_CTX_free(ctx);-
961 return
executed 12 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
ret;
executed 12 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
12
962}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2