Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509/x_x509.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | static const ASN1_AUX X509_CINF_aux = { | - | ||||||||||||
3 | ((void *)0) | - | ||||||||||||
4 | , 2, 0, 0, 0, | - | ||||||||||||
5 | __builtin_offsetof ( | - | ||||||||||||
6 | X509_CINF | - | ||||||||||||
7 | , | - | ||||||||||||
8 | enc | - | ||||||||||||
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 | - | |||||||||||||
83 | X509_CINF *d2i_X509_CINF(X509_CINF **a, const unsigned char **in, long len) { return never executed: (X509_CINF *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_CINF_it)));return (X509_CINF *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_CINF_it))); never executed: } int i2d_X509_CINF(X509_CINF *a, unsigned char **out) { returnreturn (X509_CINF *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_CINF_it))); executed 9 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_CINF_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_CINF_it))); Executed by:
executed 9 times by 1 test: } X509_CINF *X509_CINF_new(void) { returnreturn ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_CINF_it))); Executed by:
never executed: (X509_CINF *)ASN1_item_new((&(X509_CINF_it)));return (X509_CINF *)ASN1_item_new((&(X509_CINF_it))); never executed: } void X509_CINF_free(X509_CINF *a) { ASN1_item_free((ASN1_VALUE *)a, (&(X509_CINF_it))); }return (X509_CINF *)ASN1_item_new((&(X509_CINF_it))); never executed: end of block | 0-9 | ||||||||||||
84 | - | |||||||||||||
85 | - | |||||||||||||
86 | extern void policy_cache_free(X509_POLICY_CACHE *cache); | - | ||||||||||||
87 | - | |||||||||||||
88 | static 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: 1:case 1: Executed by:
executed 39780 times by 1 test: case 1: Executed by:
| 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)
| 0-39780 | ||||||||||||
120 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
121 | break; executed 39780 times by 1 test: break; Executed by:
| 39780 | ||||||||||||
122 | - | |||||||||||||
123 | case executed 39780 times by 1 test: 3:case 3: Executed by:
executed 39780 times by 1 test: case 3: Executed by:
| 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:
| 39780 | ||||||||||||
137 | - | |||||||||||||
138 | } | - | ||||||||||||
139 | - | |||||||||||||
140 | return executed 284875 times by 1 test: 1;return 1; Executed by:
executed 284875 times by 1 test: return 1; Executed by:
| 284875 | ||||||||||||
141 | - | |||||||||||||
142 | } | - | ||||||||||||
143 | - | |||||||||||||
144 | static const ASN1_AUX X509_aux = { | - | ||||||||||||
145 | ((void *)0) | - | ||||||||||||
146 | , 1, | - | ||||||||||||
147 | __builtin_offsetof ( | - | ||||||||||||
148 | X509 | - | ||||||||||||
149 | , | - | ||||||||||||
150 | references | - | ||||||||||||
151 | ) | - | ||||||||||||
152 | , | - | ||||||||||||
153 | __builtin_offsetof ( | - | ||||||||||||
154 | X509 | - | ||||||||||||
155 | , | - | ||||||||||||
156 | lock | - | ||||||||||||
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 | - | |||||||||||||
182 | X509 *d2i_X509(X509 **a, const unsigned char **in, long len) { return executed 16420 times by 1 test: (X509 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_it)));return (X509 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_it))); Executed by:
executed 16420 times by 1 test: } int i2d_X509(X509 *a, unsigned char **out) { returnreturn (X509 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_it))); Executed by:
executed 6462 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_it))); Executed by:
executed 6462 times by 1 test: } X509 *X509_new(void) { returnreturn ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_it))); Executed by:
executed 519 times by 1 test: (X509 *)ASN1_item_new((&(X509_it)));return (X509 *)ASN1_item_new((&(X509_it))); Executed by:
executed 519 times by 1 test: } void X509_free(X509 *a) { ASN1_item_free((ASN1_VALUE *)a, (&(X509_it))); }return (X509 *)ASN1_item_new((&(X509_it))); Executed by:
executed 237382 times by 1 test: end of block Executed by:
| 519-237382 | ||||||||||||
183 | - | |||||||||||||
184 | X509 * X509_dup(X509 *x) { return executed 9 times by 1 test: ASN1_item_dup((&(X509_it)), x);return ASN1_item_dup((&(X509_it)), x); Executed by:
executed 9 times by 1 test: }return ASN1_item_dup((&(X509_it)), x); Executed by:
| 9 | ||||||||||||
185 | - | |||||||||||||
186 | int X509_set_ex_data(X509 *r, int idx, void *arg) | - | ||||||||||||
187 | { | - | ||||||||||||
188 | return never executed: CRYPTO_set_ex_data(&r->ex_data, idx, arg);return CRYPTO_set_ex_data(&r->ex_data, idx, arg); never executed: return CRYPTO_set_ex_data(&r->ex_data, idx, arg); | 0 | ||||||||||||
189 | } | - | ||||||||||||
190 | - | |||||||||||||
191 | void *X509_get_ex_data(X509 *r, int idx) | - | ||||||||||||
192 | { | - | ||||||||||||
193 | return never executed: CRYPTO_get_ex_data(&r->ex_data, idx);return CRYPTO_get_ex_data(&r->ex_data, idx); never executed: return CRYPTO_get_ex_data(&r->ex_data, idx); | 0 | ||||||||||||
194 | } | - | ||||||||||||
195 | X509 *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 ==
| 57-2747 | ||||||||||||
205 | ((void *)0)
| 57-2747 | ||||||||||||
206 | || *
| 0-57 | ||||||||||||
207 | ((void *)0)
| 0-57 | ||||||||||||
208 | ) | - | ||||||||||||
209 | freeret = 1; executed 2804 times by 1 test: freeret = 1; Executed by:
| 2804 | ||||||||||||
210 | ret = d2i_X509(a, &q, length); | - | ||||||||||||
211 | - | |||||||||||||
212 | if (ret ==
| 1-2803 | ||||||||||||
213 | ((void *)0)
| 1-2803 | ||||||||||||
214 | ) | - | ||||||||||||
215 | return executed 1 time by 1 test: return ((void *)0) ; Executed by:
executed 1 time by 1 test: return ((void *)0) ; Executed by:
| 1 | ||||||||||||
216 | ((void *)0) executed 1 time by 1 test: return ((void *)0) ; Executed by:
| 1 | ||||||||||||
217 | ; executed 1 time by 1 test: return ((void *)0) ; Executed by:
| 1 | ||||||||||||
218 | - | |||||||||||||
219 | length -= q - *pp; | - | ||||||||||||
220 | if (length > 0
| 0-2744 | ||||||||||||
221 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
222 | *pp = q; | - | ||||||||||||
223 | return executed 2803 times by 1 test: ret;return ret; Executed by:
executed 2803 times by 1 test: return ret; Executed by:
| 2803 | ||||||||||||
224 | err: | - | ||||||||||||
225 | if (freeret
| 0 | ||||||||||||
226 | X509_free(ret); | - | ||||||||||||
227 | if (a
| 0 | ||||||||||||
228 | * never executed: a = *a = ((void *)0) ; 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 | - | |||||||||||||
243 | static int i2d_x509_aux_internal(X509 *a, unsigned char **pp) | - | ||||||||||||
244 | { | - | ||||||||||||
245 | int length, tmplen; | - | ||||||||||||
246 | unsigned char *start = pp !=
| 6 | ||||||||||||
247 | ((void *)0)
| 6 | ||||||||||||
248 | ? *pp : | - | ||||||||||||
249 | ((void *)0) | - | ||||||||||||
250 | ; | - | ||||||||||||
251 | - | |||||||||||||
252 | - | |||||||||||||
253 | - | |||||||||||||
254 | - | |||||||||||||
255 | - | |||||||||||||
256 | - | |||||||||||||
257 | length = i2d_X509(a, pp); | - | ||||||||||||
258 | if (length <= 0
| 0-12 | ||||||||||||
259 | ((void *)0)
| 0-12 | ||||||||||||
260 | ) | - | ||||||||||||
261 | return never executed: length;return length; never executed: return length; | 0 | ||||||||||||
262 | - | |||||||||||||
263 | tmplen = i2d_X509_CERT_AUX(a->aux, pp); | - | ||||||||||||
264 | if (tmplen < 0
| 0-12 | ||||||||||||
265 | if (start !=
| 0 | ||||||||||||
266 | ((void *)0)
| 0 | ||||||||||||
267 | ) | - | ||||||||||||
268 | * never executed: pp = start;*pp = start; never executed: *pp = start; | 0 | ||||||||||||
269 | return never executed: tmplen;return tmplen; never executed: return tmplen; | 0 | ||||||||||||
270 | } | - | ||||||||||||
271 | length += tmplen; | - | ||||||||||||
272 | - | |||||||||||||
273 | return executed 12 times by 1 test: length;return length; Executed by:
executed 12 times by 1 test: return length; Executed by:
| 12 | ||||||||||||
274 | } | - | ||||||||||||
275 | int i2d_X509_AUX(X509 *a, unsigned char **pp) | - | ||||||||||||
276 | { | - | ||||||||||||
277 | int length; | - | ||||||||||||
278 | unsigned char *tmp; | - | ||||||||||||
279 | - | |||||||||||||
280 | - | |||||||||||||
281 | if (pp ==
| 2-6 | ||||||||||||
282 | ((void *)0)
| 2-6 | ||||||||||||
283 | || *
| 2-4 | ||||||||||||
284 | ((void *)0)
| 2-4 | ||||||||||||
285 | ) | - | ||||||||||||
286 | return executed 4 times by 1 test: i2d_x509_aux_internal(a, pp);return i2d_x509_aux_internal(a, pp); Executed by:
executed 4 times by 1 test: return i2d_x509_aux_internal(a, pp); Executed by:
| 4 | ||||||||||||
287 | - | |||||||||||||
288 | - | |||||||||||||
289 | if ((
| 0-4 | ||||||||||||
290 | ((void *)0)
| 0-4 | ||||||||||||
291 | )) <= 0
| 0-4 | ||||||||||||
292 | return never executed: length;return length; never executed: return length; | 0 | ||||||||||||
293 | - | |||||||||||||
294 | - | |||||||||||||
295 | *pp = tmp = CRYPTO_malloc(length, __FILE__, 191); | - | ||||||||||||
296 | if (tmp ==
| 0-4 | ||||||||||||
297 | ((void *)0)
| 0-4 | ||||||||||||
298 | ) { | - | ||||||||||||
299 | ERR_put_error(11,(151),((1|64)),__FILE__,193); | - | ||||||||||||
300 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
301 | } | - | ||||||||||||
302 | - | |||||||||||||
303 | - | |||||||||||||
304 | length = i2d_x509_aux_internal(a, &tmp); | - | ||||||||||||
305 | if (length <= 0
| 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: length;return length; Executed by:
executed 4 times by 1 test: return length; Executed by:
| 4 | ||||||||||||
312 | } | - | ||||||||||||
313 | - | |||||||||||||
314 | int 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: i2d_X509_CINF(&x->cert_info, pp);return i2d_X509_CINF(&x->cert_info, pp); Executed by:
executed 9 times by 1 test: return i2d_X509_CINF(&x->cert_info, pp); Executed by:
| 9 | ||||||||||||
318 | } | - | ||||||||||||
319 | - | |||||||||||||
320 | void X509_get0_signature(const ASN1_BIT_STRING **psig, | - | ||||||||||||
321 | const X509_ALGOR **palg, const X509 *x) | - | ||||||||||||
322 | { | - | ||||||||||||
323 | if (psig
| 0-1344 | ||||||||||||
324 | * executed 1344 times by 1 test: psig = &x->signature;*psig = &x->signature; Executed by:
executed 1344 times by 1 test: *psig = &x->signature; Executed by:
| 1344 | ||||||||||||
325 | if (palg
| 0-1344 | ||||||||||||
326 | * executed 1344 times by 1 test: palg = &x->sig_alg;*palg = &x->sig_alg; Executed by:
executed 1344 times by 1 test: *palg = &x->sig_alg; Executed by:
| 1344 | ||||||||||||
327 | } executed 1344 times by 1 test: end of block Executed by:
| 1344 | ||||||||||||
328 | - | |||||||||||||
329 | int X509_get_signature_nid(const X509 *x) | - | ||||||||||||
330 | { | - | ||||||||||||
331 | return executed 2 times by 1 test: OBJ_obj2nid(x->sig_alg.algorithm);return OBJ_obj2nid(x->sig_alg.algorithm); Executed by:
executed 2 times by 1 test: return OBJ_obj2nid(x->sig_alg.algorithm); Executed by:
| 2 | ||||||||||||
332 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |