OpenCoverage

x_x509.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509/x_x509.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2static const ASN1_AUX X509_CINF_aux = {-
3((void *)0)-
4, 2, 0, 0, 0, -
5__builtin_offsetof (-
6X509_CINF-
7, -
8enc-
9)-
10}; static const ASN1_TEMPLATE X509_CINF_seq_tt[] = {-
11 { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (0), -
12 __builtin_offsetof (-
13 X509_CINF-
14 , -
15 version-
16 )-
17 , "version", (&(ASN1_INTEGER_it)) },-
18 { ((0x1 << 12)), (0), -
19 __builtin_offsetof (-
20 X509_CINF-
21 , -
22 serialNumber-
23 )-
24 , "serialNumber", (&(ASN1_INTEGER_it)) },-
25 { ((0x1 << 12)), (0), -
26 __builtin_offsetof (-
27 X509_CINF-
28 , -
29 signature-
30 )-
31 , "signature", (&(X509_ALGOR_it)) },-
32 { (0), (0), -
33 __builtin_offsetof (-
34 X509_CINF-
35 , -
36 issuer-
37 )-
38 , "issuer", (&(X509_NAME_it)) },-
39 { ((0x1 << 12)), (0), -
40 __builtin_offsetof (-
41 X509_CINF-
42 , -
43 validity-
44 )-
45 , "validity", (&(X509_VAL_it)) },-
46 { (0), (0), -
47 __builtin_offsetof (-
48 X509_CINF-
49 , -
50 subject-
51 )-
52 , "subject", (&(X509_NAME_it)) },-
53 { (0), (0), -
54 __builtin_offsetof (-
55 X509_CINF-
56 , -
57 key-
58 )-
59 , "key", (&(X509_PUBKEY_it)) },-
60 { (((0x1 << 3)|(0x2<<6)) | ((0x1))), (1), -
61 __builtin_offsetof (-
62 X509_CINF-
63 , -
64 issuerUID-
65 )-
66 , "issuerUID", (&(ASN1_BIT_STRING_it)) },-
67 { (((0x1 << 3)|(0x2<<6)) | ((0x1))), (2), -
68 __builtin_offsetof (-
69 X509_CINF-
70 , -
71 subjectUID-
72 )-
73 , "subjectUID", (&(ASN1_BIT_STRING_it)) },-
74 { (((0x2 << 3)|(0x2<<6)) | ((0x2 << 1)|(0x1))), (3), -
75 __builtin_offsetof (-
76 X509_CINF-
77 , -
78 extensions-
79 )-
80 , "extensions", (&(X509_EXTENSION_it)) }-
81} ; const ASN1_ITEM X509_CINF_it = { 0x1, 16, X509_CINF_seq_tt, sizeof(X509_CINF_seq_tt) / sizeof(ASN1_TEMPLATE), &X509_CINF_aux, sizeof(X509_CINF), "X509_CINF" };-
82-
83X509_CINF *d2i_X509_CINF(X509_CINF **a, const unsigned char **in, long len) { return
never executed: return (X509_CINF *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_CINF_it)));
(X509_CINF *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_CINF_it)));
never executed: return (X509_CINF *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_CINF_it)));
} int i2d_X509_CINF(X509_CINF *a, unsigned char **out) { return
executed 9 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_CINF_it)));
Executed by:
  • libcrypto.so.1.1
ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_CINF_it)));
executed 9 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_CINF_it)));
Executed by:
  • libcrypto.so.1.1
} X509_CINF *X509_CINF_new(void) { return
never executed: return (X509_CINF *)ASN1_item_new((&(X509_CINF_it)));
(X509_CINF *)ASN1_item_new((&(X509_CINF_it)));
never executed: return (X509_CINF *)ASN1_item_new((&(X509_CINF_it)));
} void X509_CINF_free(X509_CINF *a) { ASN1_item_free((ASN1_VALUE *)a, (&(X509_CINF_it))); }
never executed: end of block
0-9
84-
85-
86extern void policy_cache_free(X509_POLICY_CACHE *cache);-
87-
88static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,-
89 void *exarg)-
90{-
91 X509 *ret = (X509 *)*pval;-
92-
93 switch (operation) {-
94-
95 case
executed 39780 times by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
1:
executed 39780 times by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
39780
96 ret->ex_flags = 0;-
97 ret->ex_pathlen = -1;-
98 ret->ex_pcpathlen = -1;-
99 ret->skid = -
100 ((void *)0)-
101 ;-
102 ret->akid = -
103 ((void *)0)-
104 ;-
105-
106 ret->rfc3779_addr = -
107 ((void *)0)-
108 ;-
109 ret->rfc3779_asid = -
110 ((void *)0)-
111 ;-
112-
113 ret->aux = -
114 ((void *)0)-
115 ;-
116 ret->crldp = -
117 ((void *)0)-
118 ;-
119 if (!CRYPTO_new_ex_data(3, ret, &ret->ex_data)
!CRYPTO_new_ex...&ret->ex_data)Description
TRUEnever evaluated
FALSEevaluated 39780 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-39780
120 return
never executed: return 0;
0;
never executed: return 0;
0
121 break;
executed 39780 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
39780
122-
123 case
executed 39780 times by 1 test: case 3:
Executed by:
  • libcrypto.so.1.1
3:
executed 39780 times by 1 test: case 3:
Executed by:
  • libcrypto.so.1.1
39780
124 CRYPTO_free_ex_data(3, ret, &ret->ex_data);-
125 X509_CERT_AUX_free(ret->aux);-
126 ASN1_OCTET_STRING_free(ret->skid);-
127 AUTHORITY_KEYID_free(ret->akid);-
128 CRL_DIST_POINTS_free(ret->crldp);-
129 policy_cache_free(ret->policy_cache);-
130 GENERAL_NAMES_free(ret->altname);-
131 NAME_CONSTRAINTS_free(ret->nc);-
132-
133 sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free);-
134 ASIdentifiers_free(ret->rfc3779_asid);-
135-
136 break;
executed 39780 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
39780
137-
138 }-
139-
140 return
executed 284875 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 284875 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
284875
141-
142}-
143-
144static const ASN1_AUX X509_aux = {-
145((void *)0)-
146, 1, -
147__builtin_offsetof (-
148X509-
149, -
150references-
151)-
152, -
153__builtin_offsetof (-
154X509-
155, -
156lock-
157)-
158, x509_cb, 0}; static const ASN1_TEMPLATE X509_seq_tt[] = {-
159 { ((0x1 << 12)), (0), -
160 __builtin_offsetof (-
161 X509-
162 , -
163 cert_info-
164 )-
165 , "cert_info", (&(X509_CINF_it)) },-
166 { ((0x1 << 12)), (0), -
167 __builtin_offsetof (-
168 X509-
169 , -
170 sig_alg-
171 )-
172 , "sig_alg", (&(X509_ALGOR_it)) },-
173 { ((0x1 << 12)), (0), -
174 __builtin_offsetof (-
175 X509-
176 , -
177 signature-
178 )-
179 , "signature", (&(ASN1_BIT_STRING_it)) }-
180} ; const ASN1_ITEM X509_it = { 0x1, 16, X509_seq_tt, sizeof(X509_seq_tt) / sizeof(ASN1_TEMPLATE), &X509_aux, sizeof(X509), "X509" };-
181-
182X509 *d2i_X509(X509 **a, const unsigned char **in, long len) { return
executed 16420 times by 1 test: return (X509 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_it)));
Executed by:
  • libcrypto.so.1.1
(X509 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_it)));
executed 16420 times by 1 test: return (X509 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_it)));
Executed by:
  • libcrypto.so.1.1
} int i2d_X509(X509 *a, unsigned char **out) { return
executed 6462 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_it)));
Executed by:
  • libcrypto.so.1.1
ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_it)));
executed 6462 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_it)));
Executed by:
  • libcrypto.so.1.1
} X509 *X509_new(void) { return
executed 519 times by 1 test: return (X509 *)ASN1_item_new((&(X509_it)));
Executed by:
  • libcrypto.so.1.1
(X509 *)ASN1_item_new((&(X509_it)));
executed 519 times by 1 test: return (X509 *)ASN1_item_new((&(X509_it)));
Executed by:
  • libcrypto.so.1.1
} void X509_free(X509 *a) { ASN1_item_free((ASN1_VALUE *)a, (&(X509_it))); }
executed 237382 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
519-237382
183-
184X509 * X509_dup(X509 *x) { return
executed 9 times by 1 test: return ASN1_item_dup((&(X509_it)), x);
Executed by:
  • libcrypto.so.1.1
ASN1_item_dup((&(X509_it)), x);
executed 9 times by 1 test: return ASN1_item_dup((&(X509_it)), x);
Executed by:
  • libcrypto.so.1.1
}
9
185-
186int X509_set_ex_data(X509 *r, int idx, void *arg)-
187{-
188 return
never executed: return CRYPTO_set_ex_data(&r->ex_data, idx, arg);
CRYPTO_set_ex_data(&r->ex_data, idx, arg);
never executed: return CRYPTO_set_ex_data(&r->ex_data, idx, arg);
0
189}-
190-
191void *X509_get_ex_data(X509 *r, int idx)-
192{-
193 return
never executed: return CRYPTO_get_ex_data(&r->ex_data, idx);
CRYPTO_get_ex_data(&r->ex_data, idx);
never executed: return CRYPTO_get_ex_data(&r->ex_data, idx);
0
194}-
195X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length)-
196{-
197 const unsigned char *q;-
198 X509 *ret;-
199 int freeret = 0;-
200-
201-
202 q = *pp;-
203-
204 if (a ==
a == ((void *)0)Description
TRUEevaluated 2747 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 57 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
57-2747
205 ((void *)0)
a == ((void *)0)Description
TRUEevaluated 2747 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 57 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
57-2747
206 || *
*a == ((void *)0)Description
TRUEevaluated 57 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
a ==
*a == ((void *)0)Description
TRUEevaluated 57 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-57
207 ((void *)0)
*a == ((void *)0)Description
TRUEevaluated 57 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-57
208 )-
209 freeret = 1;
executed 2804 times by 1 test: freeret = 1;
Executed by:
  • libcrypto.so.1.1
2804
210 ret = d2i_X509(a, &q, length);-
211-
212 if (ret ==
ret == ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2803 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-2803
213 ((void *)0)
ret == ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2803 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-2803
214 )-
215 return
executed 1 time by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
executed 1 time by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
1
216 ((void *)0)
executed 1 time by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
1
217 ;
executed 1 time by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
1
218-
219 length -= q - *pp;-
220 if (length > 0
length > 0Description
TRUEevaluated 59 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2744 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !d2i_X509_CERT_AUX(&ret->aux, &q, length)
!d2i_X509_CERT...x, &q, length)Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2744
221 goto
never executed: goto err;
err;
never executed: goto err;
0
222 *pp = q;-
223 return
executed 2803 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 2803 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
2803
224 err:-
225 if (freeret
freeretDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
226 X509_free(ret);-
227 if (a
aDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
228 *
never executed: *a = ((void *)0) ;
a =
never executed: *a = ((void *)0) ;
0
229 ((void *)0)
never executed: *a = ((void *)0) ;
0
230 ;
never executed: *a = ((void *)0) ;
0
231 }
never executed: end of block
0
232 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
233 ((void *)0)
never executed: return ((void *)0) ;
0
234 ;
never executed: return ((void *)0) ;
0
235}-
236-
237-
238-
239-
240-
241-
242-
243static int i2d_x509_aux_internal(X509 *a, unsigned char **pp)-
244{-
245 int length, tmplen;-
246 unsigned char *start = pp !=
pp != ((void *)0)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
6
247 ((void *)0)
pp != ((void *)0)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
6
248 ? *pp : -
249 ((void *)0)-
250 ;-
251-
252-
253-
254-
255-
256-
257 length = i2d_X509(a, pp);-
258 if (length <= 0
length <= 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-12
259 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-12
260 )-
261 return
never executed: return length;
length;
never executed: return length;
0
262-
263 tmplen = i2d_X509_CERT_AUX(a->aux, pp);-
264 if (tmplen < 0
tmplen < 0Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-12
265 if (start !=
start != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
266 ((void *)0)
start != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
267 )-
268 *
never executed: *pp = start;
pp = start;
never executed: *pp = start;
0
269 return
never executed: return tmplen;
tmplen;
never executed: return tmplen;
0
270 }-
271 length += tmplen;-
272-
273 return
executed 12 times by 1 test: return length;
Executed by:
  • libcrypto.so.1.1
length;
executed 12 times by 1 test: return length;
Executed by:
  • libcrypto.so.1.1
12
274}-
275int i2d_X509_AUX(X509 *a, unsigned char **pp)-
276{-
277 int length;-
278 unsigned char *tmp;-
279-
280-
281 if (pp ==
pp == ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-6
282 ((void *)0)
pp == ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-6
283 || *
*pp != ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
pp !=
*pp != ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-4
284 ((void *)0)
*pp != ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-4
285 )-
286 return
executed 4 times by 1 test: return i2d_x509_aux_internal(a, pp);
Executed by:
  • libcrypto.so.1.1
i2d_x509_aux_internal(a, pp);
executed 4 times by 1 test: return i2d_x509_aux_internal(a, pp);
Executed by:
  • libcrypto.so.1.1
4
287-
288-
289 if ((
(length = i2d_...d *)0) )) <= 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
length = i2d_x509_aux_internal(a,
(length = i2d_...d *)0) )) <= 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
290 ((void *)0)
(length = i2d_...d *)0) )) <= 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
291 )) <= 0
(length = i2d_...d *)0) )) <= 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4
292 return
never executed: return length;
length;
never executed: return length;
0
293-
294-
295 *pp = tmp = CRYPTO_malloc(length, __FILE__, 191);-
296 if (tmp ==
tmp == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
297 ((void *)0)
tmp == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
298 ) {-
299 ERR_put_error(11,(151),((1|64)),__FILE__,193);-
300 return
never executed: return -1;
-1;
never executed: return -1;
0
301 }-
302-
303-
304 length = i2d_x509_aux_internal(a, &tmp);-
305 if (length <= 0
length <= 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-4
306 CRYPTO_free(*pp, __FILE__, 200);-
307 *pp = -
308 ((void *)0)-
309 ;-
310 }
never executed: end of block
0
311 return
executed 4 times by 1 test: return length;
Executed by:
  • libcrypto.so.1.1
length;
executed 4 times by 1 test: return length;
Executed by:
  • libcrypto.so.1.1
4
312}-
313-
314int i2d_re_X509_tbs(X509 *x, unsigned char **pp)-
315{-
316 x->cert_info.enc.modified = 1;-
317 return
executed 9 times by 1 test: return i2d_X509_CINF(&x->cert_info, pp);
Executed by:
  • libcrypto.so.1.1
i2d_X509_CINF(&x->cert_info, pp);
executed 9 times by 1 test: return i2d_X509_CINF(&x->cert_info, pp);
Executed by:
  • libcrypto.so.1.1
9
318}-
319-
320void X509_get0_signature(const ASN1_BIT_STRING **psig,-
321 const X509_ALGOR **palg, const X509 *x)-
322{-
323 if (psig
psigDescription
TRUEevaluated 1344 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-1344
324 *
executed 1344 times by 1 test: *psig = &x->signature;
Executed by:
  • libcrypto.so.1.1
psig = &x->signature;
executed 1344 times by 1 test: *psig = &x->signature;
Executed by:
  • libcrypto.so.1.1
1344
325 if (palg
palgDescription
TRUEevaluated 1344 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-1344
326 *
executed 1344 times by 1 test: *palg = &x->sig_alg;
Executed by:
  • libcrypto.so.1.1
palg = &x->sig_alg;
executed 1344 times by 1 test: *palg = &x->sig_alg;
Executed by:
  • libcrypto.so.1.1
1344
327}
executed 1344 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1344
328-
329int X509_get_signature_nid(const X509 *x)-
330{-
331 return
executed 2 times by 1 test: return OBJ_obj2nid(x->sig_alg.algorithm);
Executed by:
  • libcrypto.so.1.1
OBJ_obj2nid(x->sig_alg.algorithm);
executed 2 times by 1 test: return OBJ_obj2nid(x->sig_alg.algorithm);
Executed by:
  • libcrypto.so.1.1
2
332}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2