Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/ssl_asn1.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | typedef struct { | - | ||||||||||||||||||
4 | uint32_t version; | - | ||||||||||||||||||
5 | int32_t ssl_version; | - | ||||||||||||||||||
6 | ASN1_OCTET_STRING *cipher; | - | ||||||||||||||||||
7 | ASN1_OCTET_STRING *comp_id; | - | ||||||||||||||||||
8 | ASN1_OCTET_STRING *master_key; | - | ||||||||||||||||||
9 | ASN1_OCTET_STRING *session_id; | - | ||||||||||||||||||
10 | ASN1_OCTET_STRING *key_arg; | - | ||||||||||||||||||
11 | int64_t time; | - | ||||||||||||||||||
12 | int64_t timeout; | - | ||||||||||||||||||
13 | X509 *peer; | - | ||||||||||||||||||
14 | ASN1_OCTET_STRING *session_id_context; | - | ||||||||||||||||||
15 | int32_t verify_result; | - | ||||||||||||||||||
16 | ASN1_OCTET_STRING *tlsext_hostname; | - | ||||||||||||||||||
17 | uint64_t tlsext_tick_lifetime_hint; | - | ||||||||||||||||||
18 | uint32_t tlsext_tick_age_add; | - | ||||||||||||||||||
19 | ASN1_OCTET_STRING *tlsext_tick; | - | ||||||||||||||||||
20 | - | |||||||||||||||||||
21 | ASN1_OCTET_STRING *psk_identity_hint; | - | ||||||||||||||||||
22 | ASN1_OCTET_STRING *psk_identity; | - | ||||||||||||||||||
23 | - | |||||||||||||||||||
24 | - | |||||||||||||||||||
25 | ASN1_OCTET_STRING *srp_username; | - | ||||||||||||||||||
26 | - | |||||||||||||||||||
27 | uint64_t flags; | - | ||||||||||||||||||
28 | uint32_t max_early_data; | - | ||||||||||||||||||
29 | ASN1_OCTET_STRING *alpn_selected; | - | ||||||||||||||||||
30 | uint32_t tlsext_max_fragment_len_mode; | - | ||||||||||||||||||
31 | ASN1_OCTET_STRING *ticket_appdata; | - | ||||||||||||||||||
32 | } SSL_SESSION_ASN1; | - | ||||||||||||||||||
33 | - | |||||||||||||||||||
34 | static const ASN1_TEMPLATE SSL_SESSION_ASN1_seq_tt[] = { | - | ||||||||||||||||||
35 | { ((0x1 << 12)), (0), | - | ||||||||||||||||||
36 | __builtin_offsetof ( | - | ||||||||||||||||||
37 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
38 | , | - | ||||||||||||||||||
39 | version | - | ||||||||||||||||||
40 | ) | - | ||||||||||||||||||
41 | , "version", (&(UINT32_it)) }, | - | ||||||||||||||||||
42 | { ((0x1 << 12)), (0), | - | ||||||||||||||||||
43 | __builtin_offsetof ( | - | ||||||||||||||||||
44 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
45 | , | - | ||||||||||||||||||
46 | ssl_version | - | ||||||||||||||||||
47 | ) | - | ||||||||||||||||||
48 | , "ssl_version", (&(INT32_it)) }, | - | ||||||||||||||||||
49 | { (0), (0), | - | ||||||||||||||||||
50 | __builtin_offsetof ( | - | ||||||||||||||||||
51 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
52 | , | - | ||||||||||||||||||
53 | cipher | - | ||||||||||||||||||
54 | ) | - | ||||||||||||||||||
55 | , "cipher", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
56 | { (0), (0), | - | ||||||||||||||||||
57 | __builtin_offsetof ( | - | ||||||||||||||||||
58 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
59 | , | - | ||||||||||||||||||
60 | session_id | - | ||||||||||||||||||
61 | ) | - | ||||||||||||||||||
62 | , "session_id", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
63 | { (0), (0), | - | ||||||||||||||||||
64 | __builtin_offsetof ( | - | ||||||||||||||||||
65 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
66 | , | - | ||||||||||||||||||
67 | master_key | - | ||||||||||||||||||
68 | ) | - | ||||||||||||||||||
69 | , "master_key", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
70 | { (((0x1 << 3)|(0x2<<6)) | ((0x1))), (0), | - | ||||||||||||||||||
71 | __builtin_offsetof ( | - | ||||||||||||||||||
72 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
73 | , | - | ||||||||||||||||||
74 | key_arg | - | ||||||||||||||||||
75 | ) | - | ||||||||||||||||||
76 | , "key_arg", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
77 | { (((0x2 << 3)|(0x2<<6)) | ((0x1)|(0x1 << 12))), (1), | - | ||||||||||||||||||
78 | __builtin_offsetof ( | - | ||||||||||||||||||
79 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
80 | , | - | ||||||||||||||||||
81 | time | - | ||||||||||||||||||
82 | ) | - | ||||||||||||||||||
83 | , "time", (&(ZINT64_it)) }, | - | ||||||||||||||||||
84 | { (((0x2 << 3)|(0x2<<6)) | ((0x1)|(0x1 << 12))), (2), | - | ||||||||||||||||||
85 | __builtin_offsetof ( | - | ||||||||||||||||||
86 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
87 | , | - | ||||||||||||||||||
88 | timeout | - | ||||||||||||||||||
89 | ) | - | ||||||||||||||||||
90 | , "timeout", (&(ZINT64_it)) }, | - | ||||||||||||||||||
91 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (3), | - | ||||||||||||||||||
92 | __builtin_offsetof ( | - | ||||||||||||||||||
93 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
94 | , | - | ||||||||||||||||||
95 | peer | - | ||||||||||||||||||
96 | ) | - | ||||||||||||||||||
97 | , "peer", (&(X509_it)) }, | - | ||||||||||||||||||
98 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (4), | - | ||||||||||||||||||
99 | __builtin_offsetof ( | - | ||||||||||||||||||
100 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
101 | , | - | ||||||||||||||||||
102 | session_id_context | - | ||||||||||||||||||
103 | ) | - | ||||||||||||||||||
104 | , "session_id_context", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
105 | { (((0x2 << 3)|(0x2<<6)) | ((0x1)|(0x1 << 12))), (5), | - | ||||||||||||||||||
106 | __builtin_offsetof ( | - | ||||||||||||||||||
107 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
108 | , | - | ||||||||||||||||||
109 | verify_result | - | ||||||||||||||||||
110 | ) | - | ||||||||||||||||||
111 | , "verify_result", (&(ZINT32_it)) }, | - | ||||||||||||||||||
112 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (6), | - | ||||||||||||||||||
113 | __builtin_offsetof ( | - | ||||||||||||||||||
114 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
115 | , | - | ||||||||||||||||||
116 | tlsext_hostname | - | ||||||||||||||||||
117 | ) | - | ||||||||||||||||||
118 | , "tlsext_hostname", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
119 | - | |||||||||||||||||||
120 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (7), | - | ||||||||||||||||||
121 | __builtin_offsetof ( | - | ||||||||||||||||||
122 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
123 | , | - | ||||||||||||||||||
124 | psk_identity_hint | - | ||||||||||||||||||
125 | ) | - | ||||||||||||||||||
126 | , "psk_identity_hint", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
127 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (8), | - | ||||||||||||||||||
128 | __builtin_offsetof ( | - | ||||||||||||||||||
129 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
130 | , | - | ||||||||||||||||||
131 | psk_identity | - | ||||||||||||||||||
132 | ) | - | ||||||||||||||||||
133 | , "psk_identity", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
134 | - | |||||||||||||||||||
135 | { (((0x2 << 3)|(0x2<<6)) | ((0x1)|(0x1 << 12))), (9), | - | ||||||||||||||||||
136 | __builtin_offsetof ( | - | ||||||||||||||||||
137 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
138 | , | - | ||||||||||||||||||
139 | tlsext_tick_lifetime_hint | - | ||||||||||||||||||
140 | ) | - | ||||||||||||||||||
141 | , "tlsext_tick_lifetime_hint", (&(ZUINT64_it)) }, | - | ||||||||||||||||||
142 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (10), | - | ||||||||||||||||||
143 | __builtin_offsetof ( | - | ||||||||||||||||||
144 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
145 | , | - | ||||||||||||||||||
146 | tlsext_tick | - | ||||||||||||||||||
147 | ) | - | ||||||||||||||||||
148 | , "tlsext_tick", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
149 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (11), | - | ||||||||||||||||||
150 | __builtin_offsetof ( | - | ||||||||||||||||||
151 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
152 | , | - | ||||||||||||||||||
153 | comp_id | - | ||||||||||||||||||
154 | ) | - | ||||||||||||||||||
155 | , "comp_id", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
156 | - | |||||||||||||||||||
157 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (12), | - | ||||||||||||||||||
158 | __builtin_offsetof ( | - | ||||||||||||||||||
159 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
160 | , | - | ||||||||||||||||||
161 | srp_username | - | ||||||||||||||||||
162 | ) | - | ||||||||||||||||||
163 | , "srp_username", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
164 | - | |||||||||||||||||||
165 | { (((0x2 << 3)|(0x2<<6)) | ((0x1)|(0x1 << 12))), (13), | - | ||||||||||||||||||
166 | __builtin_offsetof ( | - | ||||||||||||||||||
167 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
168 | , | - | ||||||||||||||||||
169 | flags | - | ||||||||||||||||||
170 | ) | - | ||||||||||||||||||
171 | , "flags", (&(ZUINT64_it)) }, | - | ||||||||||||||||||
172 | { (((0x2 << 3)|(0x2<<6)) | ((0x1)|(0x1 << 12))), (14), | - | ||||||||||||||||||
173 | __builtin_offsetof ( | - | ||||||||||||||||||
174 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
175 | , | - | ||||||||||||||||||
176 | tlsext_tick_age_add | - | ||||||||||||||||||
177 | ) | - | ||||||||||||||||||
178 | , "tlsext_tick_age_add", (&(ZUINT32_it)) }, | - | ||||||||||||||||||
179 | { (((0x2 << 3)|(0x2<<6)) | ((0x1)|(0x1 << 12))), (15), | - | ||||||||||||||||||
180 | __builtin_offsetof ( | - | ||||||||||||||||||
181 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
182 | , | - | ||||||||||||||||||
183 | max_early_data | - | ||||||||||||||||||
184 | ) | - | ||||||||||||||||||
185 | , "max_early_data", (&(ZUINT32_it)) }, | - | ||||||||||||||||||
186 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (16), | - | ||||||||||||||||||
187 | __builtin_offsetof ( | - | ||||||||||||||||||
188 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
189 | , | - | ||||||||||||||||||
190 | alpn_selected | - | ||||||||||||||||||
191 | ) | - | ||||||||||||||||||
192 | , "alpn_selected", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||
193 | { (((0x2 << 3)|(0x2<<6)) | ((0x1)|(0x1 << 12))), (17), | - | ||||||||||||||||||
194 | __builtin_offsetof ( | - | ||||||||||||||||||
195 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
196 | , | - | ||||||||||||||||||
197 | tlsext_max_fragment_len_mode | - | ||||||||||||||||||
198 | ) | - | ||||||||||||||||||
199 | , "tlsext_max_fragment_len_mode", (&(ZUINT32_it)) }, | - | ||||||||||||||||||
200 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (18), | - | ||||||||||||||||||
201 | __builtin_offsetof ( | - | ||||||||||||||||||
202 | SSL_SESSION_ASN1 | - | ||||||||||||||||||
203 | , | - | ||||||||||||||||||
204 | ticket_appdata | - | ||||||||||||||||||
205 | ) | - | ||||||||||||||||||
206 | , "ticket_appdata", (&(ASN1_OCTET_STRING_it)) } | - | ||||||||||||||||||
207 | } ; static const ASN1_ITEM SSL_SESSION_ASN1_it = { 0x1, 16, SSL_SESSION_ASN1_seq_tt, sizeof(SSL_SESSION_ASN1_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||
208 | ((void *)0) | - | ||||||||||||||||||
209 | , sizeof(SSL_SESSION_ASN1), "SSL_SESSION_ASN1" }; | - | ||||||||||||||||||
210 | - | |||||||||||||||||||
211 | static SSL_SESSION_ASN1 *d2i_SSL_SESSION_ASN1(SSL_SESSION_ASN1 **a, const unsigned char **in, long len) { return executed 5314 times by 1 test: (SSL_SESSION_ASN1 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(SSL_SESSION_ASN1_it)));return (SSL_SESSION_ASN1 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(SSL_SESSION_ASN1_it))); Executed by:
executed 5314 times by 1 test: } static int i2d_SSL_SESSION_ASN1(SSL_SESSION_ASN1 *a, unsigned char **out) { returnreturn (SSL_SESSION_ASN1 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(SSL_SESSION_ASN1_it))); Executed by:
executed 7274 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(SSL_SESSION_ASN1_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(SSL_SESSION_ASN1_it))); Executed by:
executed 7274 times by 1 test: }return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(SSL_SESSION_ASN1_it))); Executed by:
| 5314-7274 | ||||||||||||||||||
212 | - | |||||||||||||||||||
213 | - | |||||||||||||||||||
214 | - | |||||||||||||||||||
215 | - | |||||||||||||||||||
216 | - | |||||||||||||||||||
217 | static void ssl_session_oinit(ASN1_OCTET_STRING **dest, ASN1_OCTET_STRING *os, | - | ||||||||||||||||||
218 | unsigned char *data, size_t len) | - | ||||||||||||||||||
219 | { | - | ||||||||||||||||||
220 | os->data = data; | - | ||||||||||||||||||
221 | os->length = (int)len; | - | ||||||||||||||||||
222 | os->flags = 0; | - | ||||||||||||||||||
223 | *dest = os; | - | ||||||||||||||||||
224 | } executed 29714 times by 1 test: end of block Executed by:
| 29714 | ||||||||||||||||||
225 | - | |||||||||||||||||||
226 | - | |||||||||||||||||||
227 | static void ssl_session_sinit(ASN1_OCTET_STRING **dest, ASN1_OCTET_STRING *os, | - | ||||||||||||||||||
228 | char *data) | - | ||||||||||||||||||
229 | { | - | ||||||||||||||||||
230 | if (data !=
| 319-28777 | ||||||||||||||||||
231 | ((void *)0)
| 319-28777 | ||||||||||||||||||
232 | ) | - | ||||||||||||||||||
233 | ssl_session_oinit(dest, os, (unsigned char *)data, strlen(data)); executed 319 times by 1 test: ssl_session_oinit(dest, os, (unsigned char *)data, strlen(data)); Executed by:
| 319 | ||||||||||||||||||
234 | else | - | ||||||||||||||||||
235 | * executed 28777 times by 1 test: dest = *dest = ((void *)0) ; Executed by:
executed 28777 times by 1 test: *dest = ((void *)0) ; Executed by:
| 28777 | ||||||||||||||||||
236 | ((void *)0) executed 28777 times by 1 test: *dest = ((void *)0) ; Executed by:
| 28777 | ||||||||||||||||||
237 | ; executed 28777 times by 1 test: *dest = ((void *)0) ; Executed by:
| 28777 | ||||||||||||||||||
238 | } | - | ||||||||||||||||||
239 | - | |||||||||||||||||||
240 | int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) | - | ||||||||||||||||||
241 | { | - | ||||||||||||||||||
242 | - | |||||||||||||||||||
243 | SSL_SESSION_ASN1 as; | - | ||||||||||||||||||
244 | - | |||||||||||||||||||
245 | ASN1_OCTET_STRING cipher; | - | ||||||||||||||||||
246 | unsigned char cipher_data[2]; | - | ||||||||||||||||||
247 | ASN1_OCTET_STRING master_key, session_id, sid_ctx; | - | ||||||||||||||||||
248 | - | |||||||||||||||||||
249 | - | |||||||||||||||||||
250 | ASN1_OCTET_STRING comp_id; | - | ||||||||||||||||||
251 | unsigned char comp_id_data; | - | ||||||||||||||||||
252 | - | |||||||||||||||||||
253 | ASN1_OCTET_STRING tlsext_hostname, tlsext_tick; | - | ||||||||||||||||||
254 | - | |||||||||||||||||||
255 | ASN1_OCTET_STRING srp_username; | - | ||||||||||||||||||
256 | - | |||||||||||||||||||
257 | - | |||||||||||||||||||
258 | ASN1_OCTET_STRING psk_identity, psk_identity_hint; | - | ||||||||||||||||||
259 | - | |||||||||||||||||||
260 | ASN1_OCTET_STRING alpn_selected; | - | ||||||||||||||||||
261 | ASN1_OCTET_STRING ticket_appdata; | - | ||||||||||||||||||
262 | - | |||||||||||||||||||
263 | long l; | - | ||||||||||||||||||
264 | - | |||||||||||||||||||
265 | if ((
| 0-7274 | ||||||||||||||||||
266 | ((void *)0)
| 0-7274 | ||||||||||||||||||
267 | )
| 0-7274 | ||||||||||||||||||
268 | ((void *)0)
| 0-7274 | ||||||||||||||||||
269 | )
| 0-7274 | ||||||||||||||||||
270 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
271 | - | |||||||||||||||||||
272 | memset(&as, 0, sizeof(as)); | - | ||||||||||||||||||
273 | - | |||||||||||||||||||
274 | as.version = 0x0001; | - | ||||||||||||||||||
275 | as.ssl_version = in->ssl_version; | - | ||||||||||||||||||
276 | - | |||||||||||||||||||
277 | if (in->cipher ==
| 0-7274 | ||||||||||||||||||
278 | ((void *)0)
| 0-7274 | ||||||||||||||||||
279 | ) | - | ||||||||||||||||||
280 | l = in->cipher_id; never executed: l = in->cipher_id; | 0 | ||||||||||||||||||
281 | else | - | ||||||||||||||||||
282 | l = in->cipher->id; executed 7274 times by 1 test: l = in->cipher->id; Executed by:
| 7274 | ||||||||||||||||||
283 | cipher_data[0] = ((unsigned char)(l >> 8L)) & 0xff; | - | ||||||||||||||||||
284 | cipher_data[1] = ((unsigned char)(l)) & 0xff; | - | ||||||||||||||||||
285 | - | |||||||||||||||||||
286 | ssl_session_oinit(&as.cipher, &cipher, cipher_data, 2); | - | ||||||||||||||||||
287 | - | |||||||||||||||||||
288 | - | |||||||||||||||||||
289 | if (in->compress_meth
| 0-7274 | ||||||||||||||||||
290 | comp_id_data = (unsigned char)in->compress_meth; | - | ||||||||||||||||||
291 | ssl_session_oinit(&as.comp_id, &comp_id, &comp_id_data, 1); | - | ||||||||||||||||||
292 | } never executed: end of block | 0 | ||||||||||||||||||
293 | - | |||||||||||||||||||
294 | - | |||||||||||||||||||
295 | ssl_session_oinit(&as.master_key, &master_key, | - | ||||||||||||||||||
296 | in->master_key, in->master_key_length); | - | ||||||||||||||||||
297 | - | |||||||||||||||||||
298 | ssl_session_oinit(&as.session_id, &session_id, | - | ||||||||||||||||||
299 | in->session_id, in->session_id_length); | - | ||||||||||||||||||
300 | - | |||||||||||||||||||
301 | ssl_session_oinit(&as.session_id_context, &sid_ctx, | - | ||||||||||||||||||
302 | in->sid_ctx, in->sid_ctx_length); | - | ||||||||||||||||||
303 | - | |||||||||||||||||||
304 | as.time = in->time; | - | ||||||||||||||||||
305 | as.timeout = in->timeout; | - | ||||||||||||||||||
306 | as.verify_result = in->verify_result; | - | ||||||||||||||||||
307 | - | |||||||||||||||||||
308 | as.peer = in->peer; | - | ||||||||||||||||||
309 | - | |||||||||||||||||||
310 | ssl_session_sinit(&as.tlsext_hostname, &tlsext_hostname, | - | ||||||||||||||||||
311 | in->ext.hostname); | - | ||||||||||||||||||
312 | if (in->ext.tick
| 41-7233 | ||||||||||||||||||
313 | ssl_session_oinit(&as.tlsext_tick, &tlsext_tick, | - | ||||||||||||||||||
314 | in->ext.tick, in->ext.ticklen); | - | ||||||||||||||||||
315 | } executed 41 times by 1 test: end of block Executed by:
| 41 | ||||||||||||||||||
316 | if (in->ext.tick_lifetime_hint > 0
| 41-7233 | ||||||||||||||||||
317 | as. executed 41 times by 1 test: tlsext_tick_lifetime_hint = in->ext.tick_lifetime_hint;as.tlsext_tick_lifetime_hint = in->ext.tick_lifetime_hint; Executed by:
executed 41 times by 1 test: as.tlsext_tick_lifetime_hint = in->ext.tick_lifetime_hint; Executed by:
| 41 | ||||||||||||||||||
318 | as.tlsext_tick_age_add = in->ext.tick_age_add; | - | ||||||||||||||||||
319 | - | |||||||||||||||||||
320 | ssl_session_sinit(&as.psk_identity_hint, &psk_identity_hint, | - | ||||||||||||||||||
321 | in->psk_identity_hint); | - | ||||||||||||||||||
322 | ssl_session_sinit(&as.psk_identity, &psk_identity, in->psk_identity); | - | ||||||||||||||||||
323 | - | |||||||||||||||||||
324 | - | |||||||||||||||||||
325 | ssl_session_sinit(&as.srp_username, &srp_username, in->srp_username); | - | ||||||||||||||||||
326 | - | |||||||||||||||||||
327 | - | |||||||||||||||||||
328 | as.flags = in->flags; | - | ||||||||||||||||||
329 | as.max_early_data = in->ext.max_early_data; | - | ||||||||||||||||||
330 | - | |||||||||||||||||||
331 | if (in->ext.alpn_selected ==
| 141-7133 | ||||||||||||||||||
332 | ((void *)0)
| 141-7133 | ||||||||||||||||||
333 | ) | - | ||||||||||||||||||
334 | as. executed 7133 times by 1 test: alpn_selected = as.alpn_selected = ((void *)0) ; Executed by:
executed 7133 times by 1 test: as.alpn_selected = ((void *)0) ; Executed by:
| 7133 | ||||||||||||||||||
335 | ((void *)0) executed 7133 times by 1 test: as.alpn_selected = ((void *)0) ; Executed by:
| 7133 | ||||||||||||||||||
336 | ; executed 7133 times by 1 test: as.alpn_selected = ((void *)0) ; Executed by:
| 7133 | ||||||||||||||||||
337 | else | - | ||||||||||||||||||
338 | ssl_session_oinit(&as.alpn_selected, &alpn_selected, executed 141 times by 1 test: ssl_session_oinit(&as.alpn_selected, &alpn_selected, in->ext.alpn_selected, in->ext.alpn_selected_len); Executed by:
| 141 | ||||||||||||||||||
339 | in->ext.alpn_selected, in->ext.alpn_selected_len); executed 141 times by 1 test: ssl_session_oinit(&as.alpn_selected, &alpn_selected, in->ext.alpn_selected, in->ext.alpn_selected_len); Executed by:
| 141 | ||||||||||||||||||
340 | - | |||||||||||||||||||
341 | as.tlsext_max_fragment_len_mode = in->ext.max_fragment_len_mode; | - | ||||||||||||||||||
342 | - | |||||||||||||||||||
343 | if (in->ticket_appdata ==
| 117-7157 | ||||||||||||||||||
344 | ((void *)0)
| 117-7157 | ||||||||||||||||||
345 | ) | - | ||||||||||||||||||
346 | as. executed 7157 times by 1 test: ticket_appdata = as.ticket_appdata = ((void *)0) ; Executed by:
executed 7157 times by 1 test: as.ticket_appdata = ((void *)0) ; Executed by:
| 7157 | ||||||||||||||||||
347 | ((void *)0) executed 7157 times by 1 test: as.ticket_appdata = ((void *)0) ; Executed by:
| 7157 | ||||||||||||||||||
348 | ; executed 7157 times by 1 test: as.ticket_appdata = ((void *)0) ; Executed by:
| 7157 | ||||||||||||||||||
349 | else | - | ||||||||||||||||||
350 | ssl_session_oinit(&as.ticket_appdata, &ticket_appdata, executed 117 times by 1 test: ssl_session_oinit(&as.ticket_appdata, &ticket_appdata, in->ticket_appdata, in->ticket_appdata_len); Executed by:
| 117 | ||||||||||||||||||
351 | in->ticket_appdata, in->ticket_appdata_len); executed 117 times by 1 test: ssl_session_oinit(&as.ticket_appdata, &ticket_appdata, in->ticket_appdata, in->ticket_appdata_len); Executed by:
| 117 | ||||||||||||||||||
352 | - | |||||||||||||||||||
353 | return executed 7274 times by 1 test: i2d_SSL_SESSION_ASN1(&as, pp);return i2d_SSL_SESSION_ASN1(&as, pp); Executed by:
executed 7274 times by 1 test: return i2d_SSL_SESSION_ASN1(&as, pp); Executed by:
| 7274 | ||||||||||||||||||
354 | - | |||||||||||||||||||
355 | } | - | ||||||||||||||||||
356 | - | |||||||||||||||||||
357 | - | |||||||||||||||||||
358 | - | |||||||||||||||||||
359 | - | |||||||||||||||||||
360 | - | |||||||||||||||||||
361 | static int ssl_session_strndup(char **pdst, ASN1_OCTET_STRING *src) | - | ||||||||||||||||||
362 | { | - | ||||||||||||||||||
363 | CRYPTO_free(*pdst, __FILE__, 213); | - | ||||||||||||||||||
364 | *pdst = | - | ||||||||||||||||||
365 | ((void *)0) | - | ||||||||||||||||||
366 | ; | - | ||||||||||||||||||
367 | if (src ==
| 132-7886 | ||||||||||||||||||
368 | ((void *)0)
| 132-7886 | ||||||||||||||||||
369 | ) | - | ||||||||||||||||||
370 | return executed 7886 times by 1 test: 1;return 1; Executed by:
executed 7886 times by 1 test: return 1; Executed by:
| 7886 | ||||||||||||||||||
371 | *pdst = CRYPTO_strndup((char *)src->data, src->length, __FILE__, 217); | - | ||||||||||||||||||
372 | if (*
| 0-132 | ||||||||||||||||||
373 | ((void *)0)
| 0-132 | ||||||||||||||||||
374 | ) | - | ||||||||||||||||||
375 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
376 | return executed 132 times by 1 test: 1;return 1; Executed by:
executed 132 times by 1 test: return 1; Executed by:
| 132 | ||||||||||||||||||
377 | } | - | ||||||||||||||||||
378 | - | |||||||||||||||||||
379 | - | |||||||||||||||||||
380 | - | |||||||||||||||||||
381 | static int ssl_session_memcpy(unsigned char *dst, size_t *pdstlen, | - | ||||||||||||||||||
382 | ASN1_OCTET_STRING *src, size_t maxlen) | - | ||||||||||||||||||
383 | { | - | ||||||||||||||||||
384 | if (src ==
| 72-5945 | ||||||||||||||||||
385 | ((void *)0)
| 72-5945 | ||||||||||||||||||
386 | ) { | - | ||||||||||||||||||
387 | *pdstlen = 0; | - | ||||||||||||||||||
388 | return executed 72 times by 1 test: 1;return 1; Executed by:
executed 72 times by 1 test: return 1; Executed by:
| 72 | ||||||||||||||||||
389 | } | - | ||||||||||||||||||
390 | if (src->length < 0
| 0-5945 | ||||||||||||||||||
391 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||||||||
392 | memcpy(dst, src->data, src->length); | - | ||||||||||||||||||
393 | *pdstlen = src->length; | - | ||||||||||||||||||
394 | return executed 5943 times by 1 test: 1;return 1; Executed by:
executed 5943 times by 1 test: return 1; Executed by:
| 5943 | ||||||||||||||||||
395 | } | - | ||||||||||||||||||
396 | - | |||||||||||||||||||
397 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, | - | ||||||||||||||||||
398 | long length) | - | ||||||||||||||||||
399 | { | - | ||||||||||||||||||
400 | long id; | - | ||||||||||||||||||
401 | size_t tmpl; | - | ||||||||||||||||||
402 | const unsigned char *p = *pp; | - | ||||||||||||||||||
403 | SSL_SESSION_ASN1 *as = | - | ||||||||||||||||||
404 | ((void *)0) | - | ||||||||||||||||||
405 | ; | - | ||||||||||||||||||
406 | SSL_SESSION *ret = | - | ||||||||||||||||||
407 | ((void *)0) | - | ||||||||||||||||||
408 | ; | - | ||||||||||||||||||
409 | - | |||||||||||||||||||
410 | as = d2i_SSL_SESSION_ASN1( | - | ||||||||||||||||||
411 | ((void *)0) | - | ||||||||||||||||||
412 | , &p, length); | - | ||||||||||||||||||
413 | - | |||||||||||||||||||
414 | if (as
| 2016-3298 | ||||||||||||||||||
415 | ((void *)0)
| 2016-3298 | ||||||||||||||||||
416 | ) | - | ||||||||||||||||||
417 | goto executed 3298 times by 1 test: err;goto err; Executed by:
executed 3298 times by 1 test: goto err; Executed by:
| 3298 | ||||||||||||||||||
418 | - | |||||||||||||||||||
419 | if (!a
| 0-2016 | ||||||||||||||||||
420 | ret = SSL_SESSION_new(); | - | ||||||||||||||||||
421 | if (ret ==
| 0-2016 | ||||||||||||||||||
422 | ((void *)0)
| 0-2016 | ||||||||||||||||||
423 | ) | - | ||||||||||||||||||
424 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
425 | } executed 2016 times by 1 test: else {end of block Executed by:
| 2016 | ||||||||||||||||||
426 | ret = *a; | - | ||||||||||||||||||
427 | } never executed: end of block | 0 | ||||||||||||||||||
428 | - | |||||||||||||||||||
429 | if (as->
| 2-2014 | ||||||||||||||||||
430 | ERR_put_error(20,(103),(254),__FILE__,262); | - | ||||||||||||||||||
431 | goto executed 2 times by 1 test: err;goto err; Executed by:
executed 2 times by 1 test: goto err; Executed by:
| 2 | ||||||||||||||||||
432 | } | - | ||||||||||||||||||
433 | - | |||||||||||||||||||
434 | if ((as->
| 165-1849 | ||||||||||||||||||
435 | && (as->
| 5-160 | ||||||||||||||||||
436 | && as->
| 2-3 | ||||||||||||||||||
437 | ERR_put_error(20,(103),(259),__FILE__,269); | - | ||||||||||||||||||
438 | goto executed 2 times by 1 test: err;goto err; Executed by:
executed 2 times by 1 test: goto err; Executed by:
| 2 | ||||||||||||||||||
439 | } | - | ||||||||||||||||||
440 | - | |||||||||||||||||||
441 | ret->ssl_version = (int)as->ssl_version; | - | ||||||||||||||||||
442 | - | |||||||||||||||||||
443 | if (as->
| 1-2011 | ||||||||||||||||||
444 | ERR_put_error(20,(103),(137),__FILE__,276); | - | ||||||||||||||||||
445 | goto executed 1 time by 1 test: err;goto err; Executed by:
executed 1 time by 1 test: goto err; Executed by:
| 1 | ||||||||||||||||||
446 | } | - | ||||||||||||||||||
447 | - | |||||||||||||||||||
448 | id = 0x03000000L | ((unsigned long)as->cipher->data[0] << 8L) | - | ||||||||||||||||||
449 | | (unsigned long)as->cipher->data[1]; | - | ||||||||||||||||||
450 | - | |||||||||||||||||||
451 | ret->cipher_id = id; | - | ||||||||||||||||||
452 | ret->cipher = ssl3_get_cipher_by_id(id); | - | ||||||||||||||||||
453 | if (ret->cipher ==
| 4-2007 | ||||||||||||||||||
454 | ((void *)0)
| 4-2007 | ||||||||||||||||||
455 | ) | - | ||||||||||||||||||
456 | goto executed 4 times by 1 test: err;goto err; Executed by:
executed 4 times by 1 test: goto err; Executed by:
| 4 | ||||||||||||||||||
457 | - | |||||||||||||||||||
458 | if (!ssl_session_memcpy(ret->session_id, &ret->session_id_length,
| 2-2005 | ||||||||||||||||||
459 | as->session_id, 32)
| 2-2005 | ||||||||||||||||||
460 | goto executed 2 times by 1 test: err;goto err; Executed by:
executed 2 times by 1 test: goto err; Executed by:
| 2 | ||||||||||||||||||
461 | - | |||||||||||||||||||
462 | if (!ssl_session_memcpy(ret->master_key, &tmpl,
| 0-2005 | ||||||||||||||||||
463 | as->master_key, 256)
| 0-2005 | ||||||||||||||||||
464 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
465 | - | |||||||||||||||||||
466 | ret->master_key_length = tmpl; | - | ||||||||||||||||||
467 | - | |||||||||||||||||||
468 | if (as->
| 45-1960 | ||||||||||||||||||
469 | ret->time = (long)as->time; executed 1960 times by 1 test: ret->time = (long)as->time; Executed by:
| 1960 | ||||||||||||||||||
470 | else | - | ||||||||||||||||||
471 | ret->time = (long)time( executed 45 times by 1 test: ret->time = (long)time( ((void *)0) ); Executed by:
| 45 | ||||||||||||||||||
472 | ((void *)0) executed 45 times by 1 test: ret->time = (long)time( ((void *)0) ); Executed by:
| 45 | ||||||||||||||||||
473 | ); executed 45 times by 1 test: ret->time = (long)time( ((void *)0) ); Executed by:
| 45 | ||||||||||||||||||
474 | - | |||||||||||||||||||
475 | if (as->
| 44-1961 | ||||||||||||||||||
476 | ret->timeout = (long)as->timeout; executed 1961 times by 1 test: ret->timeout = (long)as->timeout; Executed by:
| 1961 | ||||||||||||||||||
477 | else | - | ||||||||||||||||||
478 | ret->timeout = 3; executed 44 times by 1 test: ret->timeout = 3; Executed by:
| 44 | ||||||||||||||||||
479 | - | |||||||||||||||||||
480 | X509_free(ret->peer); | - | ||||||||||||||||||
481 | ret->peer = as->peer; | - | ||||||||||||||||||
482 | as->peer = | - | ||||||||||||||||||
483 | ((void *)0) | - | ||||||||||||||||||
484 | ; | - | ||||||||||||||||||
485 | - | |||||||||||||||||||
486 | if (!ssl_session_memcpy(ret->sid_ctx, &ret->sid_ctx_length,
| 0-2005 | ||||||||||||||||||
487 | as->session_id_context, 32)
| 0-2005 | ||||||||||||||||||
488 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
489 | - | |||||||||||||||||||
490 | - | |||||||||||||||||||
491 | ret->verify_result = as->verify_result; | - | ||||||||||||||||||
492 | - | |||||||||||||||||||
493 | if (!ssl_session_strndup(&ret->ext.hostname, as->tlsext_hostname)
| 0-2005 | ||||||||||||||||||
494 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
495 | - | |||||||||||||||||||
496 | - | |||||||||||||||||||
497 | if (!ssl_session_strndup(&ret->psk_identity_hint, as->psk_identity_hint)
| 0-2005 | ||||||||||||||||||
498 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
499 | if (!ssl_session_strndup(&ret->psk_identity, as->psk_identity)
| 0-2005 | ||||||||||||||||||
500 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
501 | - | |||||||||||||||||||
502 | - | |||||||||||||||||||
503 | ret->ext.tick_lifetime_hint = (unsigned long)as->tlsext_tick_lifetime_hint; | - | ||||||||||||||||||
504 | ret->ext.tick_age_add = as->tlsext_tick_age_add; | - | ||||||||||||||||||
505 | CRYPTO_free(ret->ext.tick, __FILE__, 331); | - | ||||||||||||||||||
506 | if (as->
| 35-1970 | ||||||||||||||||||
507 | ((void *)0)
| 35-1970 | ||||||||||||||||||
508 | ) { | - | ||||||||||||||||||
509 | ret->ext.tick = as->tlsext_tick->data; | - | ||||||||||||||||||
510 | ret->ext.ticklen = as->tlsext_tick->length; | - | ||||||||||||||||||
511 | as->tlsext_tick->data = | - | ||||||||||||||||||
512 | ((void *)0) | - | ||||||||||||||||||
513 | ; | - | ||||||||||||||||||
514 | } executed 35 times by 1 test: else {end of block Executed by:
| 35 | ||||||||||||||||||
515 | ret->ext.tick = | - | ||||||||||||||||||
516 | ((void *)0) | - | ||||||||||||||||||
517 | ; | - | ||||||||||||||||||
518 | } executed 1970 times by 1 test: end of block Executed by:
| 1970 | ||||||||||||||||||
519 | - | |||||||||||||||||||
520 | if (as->
| 2-2003 | ||||||||||||||||||
521 | if (as->
| 0-2 | ||||||||||||||||||
522 | ERR_put_error(20,(103),(271),__FILE__,342); | - | ||||||||||||||||||
523 | goto executed 2 times by 1 test: err;goto err; Executed by:
executed 2 times by 1 test: goto err; Executed by:
| 2 | ||||||||||||||||||
524 | } | - | ||||||||||||||||||
525 | ret->compress_meth = as->comp_id->data[0]; | - | ||||||||||||||||||
526 | } never executed: else {end of block | 0 | ||||||||||||||||||
527 | ret->compress_meth = 0; | - | ||||||||||||||||||
528 | } executed 2003 times by 1 test: end of block Executed by:
| 2003 | ||||||||||||||||||
529 | - | |||||||||||||||||||
530 | - | |||||||||||||||||||
531 | - | |||||||||||||||||||
532 | if (!ssl_session_strndup(&ret->srp_username, as->srp_username)
| 0-2003 | ||||||||||||||||||
533 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
534 | - | |||||||||||||||||||
535 | - | |||||||||||||||||||
536 | ret->flags = (int32_t)as->flags; | - | ||||||||||||||||||
537 | ret->ext.max_early_data = as->max_early_data; | - | ||||||||||||||||||
538 | - | |||||||||||||||||||
539 | CRYPTO_free(ret->ext.alpn_selected, __FILE__, 359); | - | ||||||||||||||||||
540 | if (as->
| 43-1960 | ||||||||||||||||||
541 | ((void *)0)
| 43-1960 | ||||||||||||||||||
542 | ) { | - | ||||||||||||||||||
543 | ret->ext.alpn_selected = as->alpn_selected->data; | - | ||||||||||||||||||
544 | ret->ext.alpn_selected_len = as->alpn_selected->length; | - | ||||||||||||||||||
545 | as->alpn_selected->data = | - | ||||||||||||||||||
546 | ((void *)0) | - | ||||||||||||||||||
547 | ; | - | ||||||||||||||||||
548 | } executed 43 times by 1 test: else {end of block Executed by:
| 43 | ||||||||||||||||||
549 | ret->ext.alpn_selected = | - | ||||||||||||||||||
550 | ((void *)0) | - | ||||||||||||||||||
551 | ; | - | ||||||||||||||||||
552 | ret->ext.alpn_selected_len = 0; | - | ||||||||||||||||||
553 | } executed 1960 times by 1 test: end of block Executed by:
| 1960 | ||||||||||||||||||
554 | - | |||||||||||||||||||
555 | ret->ext.max_fragment_len_mode = as->tlsext_max_fragment_len_mode; | - | ||||||||||||||||||
556 | - | |||||||||||||||||||
557 | CRYPTO_free(ret->ticket_appdata, __FILE__, 371); | - | ||||||||||||||||||
558 | if (as->
| 44-1959 | ||||||||||||||||||
559 | ((void *)0)
| 44-1959 | ||||||||||||||||||
560 | ) { | - | ||||||||||||||||||
561 | ret->ticket_appdata = as->ticket_appdata->data; | - | ||||||||||||||||||
562 | ret->ticket_appdata_len = as->ticket_appdata->length; | - | ||||||||||||||||||
563 | as->ticket_appdata->data = | - | ||||||||||||||||||
564 | ((void *)0) | - | ||||||||||||||||||
565 | ; | - | ||||||||||||||||||
566 | } executed 44 times by 1 test: else {end of block Executed by:
| 44 | ||||||||||||||||||
567 | ret->ticket_appdata = | - | ||||||||||||||||||
568 | ((void *)0) | - | ||||||||||||||||||
569 | ; | - | ||||||||||||||||||
570 | ret->ticket_appdata_len = 0; | - | ||||||||||||||||||
571 | } executed 1959 times by 1 test: end of block Executed by:
| 1959 | ||||||||||||||||||
572 | - | |||||||||||||||||||
573 | ASN1_item_free(((void*) (1 ? as : (SSL_SESSION_ASN1*)0)), (&(SSL_SESSION_ASN1_it))); | - | ||||||||||||||||||
574 | - | |||||||||||||||||||
575 | if ((
| 0-2003 | ||||||||||||||||||
576 | ((void *)0)
| 0-2003 | ||||||||||||||||||
577 | )
| 0-2003 | ||||||||||||||||||
578 | ((void *)0)
| 0 | ||||||||||||||||||
579 | )
| 0 | ||||||||||||||||||
580 | * never executed: a = ret;*a = ret; never executed: *a = ret; | 0 | ||||||||||||||||||
581 | *pp = p; | - | ||||||||||||||||||
582 | return executed 2003 times by 1 test: ret;return ret; Executed by:
executed 2003 times by 1 test: return ret; Executed by:
| 2003 | ||||||||||||||||||
583 | - | |||||||||||||||||||
584 | err: | - | ||||||||||||||||||
585 | ASN1_item_free(((void*) (1 ? as : (SSL_SESSION_ASN1*)0)), (&(SSL_SESSION_ASN1_it))); | - | ||||||||||||||||||
586 | if ((
| 0-3311 | ||||||||||||||||||
587 | ((void *)0)
| 0-3311 | ||||||||||||||||||
588 | )
| 0-3311 | ||||||||||||||||||
589 | SSL_SESSION_free(ret); executed 3311 times by 1 test: SSL_SESSION_free(ret); Executed by:
| 3311 | ||||||||||||||||||
590 | return executed 3311 times by 1 test: return ((void *)0) ; Executed by:
executed 3311 times by 1 test: return ((void *)0) ; Executed by:
| 3311 | ||||||||||||||||||
591 | ((void *)0) executed 3311 times by 1 test: return ((void *)0) ; Executed by:
| 3311 | ||||||||||||||||||
592 | ; executed 3311 times by 1 test: return ((void *)0) ; Executed by:
| 3311 | ||||||||||||||||||
593 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |