Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509v3/v3_purp.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | static void x509v3_cache_extensions(X509 *x); | - | ||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | static int check_ssl_ca(const X509 *x); | - | ||||||||||||||||||||||||
6 | static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
7 | int ca); | - | ||||||||||||||||||||||||
8 | static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
9 | int ca); | - | ||||||||||||||||||||||||
10 | static int check_purpose_ns_ssl_server(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
11 | int ca); | - | ||||||||||||||||||||||||
12 | static int purpose_smime(const X509 *x, int ca); | - | ||||||||||||||||||||||||
13 | static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
14 | int ca); | - | ||||||||||||||||||||||||
15 | static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
16 | int ca); | - | ||||||||||||||||||||||||
17 | static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
18 | int ca); | - | ||||||||||||||||||||||||
19 | static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
20 | int ca); | - | ||||||||||||||||||||||||
21 | static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca); | - | ||||||||||||||||||||||||
22 | static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca); | - | ||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||
24 | static int xp_cmp(const X509_PURPOSE *const *a, const X509_PURPOSE *const *b); | - | ||||||||||||||||||||||||
25 | static void xptable_free(X509_PURPOSE *p); | - | ||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||
27 | static X509_PURPOSE xstandard[] = { | - | ||||||||||||||||||||||||
28 | {1, 2, 0, | - | ||||||||||||||||||||||||
29 | check_purpose_ssl_client, "SSL client", "sslclient", | - | ||||||||||||||||||||||||
30 | ((void *)0) | - | ||||||||||||||||||||||||
31 | }, | - | ||||||||||||||||||||||||
32 | {2, 3, 0, | - | ||||||||||||||||||||||||
33 | check_purpose_ssl_server, "SSL server", "sslserver", | - | ||||||||||||||||||||||||
34 | ((void *)0) | - | ||||||||||||||||||||||||
35 | }, | - | ||||||||||||||||||||||||
36 | {3, 3, 0, | - | ||||||||||||||||||||||||
37 | check_purpose_ns_ssl_server, "Netscape SSL server", "nssslserver", | - | ||||||||||||||||||||||||
38 | ((void *)0) | - | ||||||||||||||||||||||||
39 | }, | - | ||||||||||||||||||||||||
40 | {4, 4, 0, check_purpose_smime_sign, | - | ||||||||||||||||||||||||
41 | "S/MIME signing", "smimesign", | - | ||||||||||||||||||||||||
42 | ((void *)0) | - | ||||||||||||||||||||||||
43 | }, | - | ||||||||||||||||||||||||
44 | {5, 4, 0, | - | ||||||||||||||||||||||||
45 | check_purpose_smime_encrypt, "S/MIME encryption", "smimeencrypt", | - | ||||||||||||||||||||||||
46 | ((void *)0) | - | ||||||||||||||||||||||||
47 | }, | - | ||||||||||||||||||||||||
48 | {6, 1, 0, check_purpose_crl_sign, | - | ||||||||||||||||||||||||
49 | "CRL signing", "crlsign", | - | ||||||||||||||||||||||||
50 | ((void *)0) | - | ||||||||||||||||||||||||
51 | }, | - | ||||||||||||||||||||||||
52 | {7, 0, 0, no_check, "Any Purpose", "any", | - | ||||||||||||||||||||||||
53 | - | |||||||||||||||||||||||||
54 | ((void *)0) | - | ||||||||||||||||||||||||
55 | }, | - | ||||||||||||||||||||||||
56 | {8, 1, 0, ocsp_helper, | - | ||||||||||||||||||||||||
57 | "OCSP helper", "ocsphelper", | - | ||||||||||||||||||||||||
58 | ((void *)0) | - | ||||||||||||||||||||||||
59 | }, | - | ||||||||||||||||||||||||
60 | {9, 8, 0, | - | ||||||||||||||||||||||||
61 | check_purpose_timestamp_sign, "Time Stamp signing", "timestampsign", | - | ||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||
63 | ((void *)0) | - | ||||||||||||||||||||||||
64 | }, | - | ||||||||||||||||||||||||
65 | }; | - | ||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||
69 | static struct stack_st_X509_PURPOSE *xptable = | - | ||||||||||||||||||||||||
70 | ((void *)0) | - | ||||||||||||||||||||||||
71 | ; | - | ||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||
73 | static int xp_cmp(const X509_PURPOSE *const *a, const X509_PURPOSE *const *b) | - | ||||||||||||||||||||||||
74 | { | - | ||||||||||||||||||||||||
75 | return never executed: (*a)->purpose - (*b)->purpose;return (*a)->purpose - (*b)->purpose; never executed: return (*a)->purpose - (*b)->purpose; | 0 | ||||||||||||||||||||||||
76 | } | - | ||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||
83 | int X509_check_purpose(X509 *x, int id, int ca) | - | ||||||||||||||||||||||||
84 | { | - | ||||||||||||||||||||||||
85 | int idx; | - | ||||||||||||||||||||||||
86 | const X509_PURPOSE *pt; | - | ||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||
88 | x509v3_cache_extensions(x); | - | ||||||||||||||||||||||||
89 | - | |||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||
91 | if (id == -1
| 2605-38737 | ||||||||||||||||||||||||
92 | return executed 38737 times by 1 test: 1;return 1; Executed by:
executed 38737 times by 1 test: return 1; Executed by:
| 38737 | ||||||||||||||||||||||||
93 | idx = X509_PURPOSE_get_by_id(id); | - | ||||||||||||||||||||||||
94 | if (idx == -1
| 0-2605 | ||||||||||||||||||||||||
95 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
96 | pt = X509_PURPOSE_get0(idx); | - | ||||||||||||||||||||||||
97 | return executed 2605 times by 1 test: pt->check_purpose(pt, x, ca);return pt->check_purpose(pt, x, ca); Executed by:
executed 2605 times by 1 test: return pt->check_purpose(pt, x, ca); Executed by:
| 2605 | ||||||||||||||||||||||||
98 | } | - | ||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | int X509_PURPOSE_set(int *p, int purpose) | - | ||||||||||||||||||||||||
101 | { | - | ||||||||||||||||||||||||
102 | if (X509_PURPOSE_get_by_id(purpose) == -1
| 0-134 | ||||||||||||||||||||||||
103 | ERR_put_error(34,(141),(146),__FILE__,98); | - | ||||||||||||||||||||||||
104 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
105 | } | - | ||||||||||||||||||||||||
106 | *p = purpose; | - | ||||||||||||||||||||||||
107 | return executed 134 times by 1 test: 1;return 1; Executed by:
executed 134 times by 1 test: return 1; Executed by:
| 134 | ||||||||||||||||||||||||
108 | } | - | ||||||||||||||||||||||||
109 | - | |||||||||||||||||||||||||
110 | int X509_PURPOSE_get_count(void) | - | ||||||||||||||||||||||||
111 | { | - | ||||||||||||||||||||||||
112 | if (!xptable
| 0-256 | ||||||||||||||||||||||||
113 | return executed 256 times by 1 test: (sizeof(xstandard)/sizeof((xstandard)[0]));return (sizeof(xstandard)/sizeof((xstandard)[0])); Executed by:
executed 256 times by 1 test: return (sizeof(xstandard)/sizeof((xstandard)[0])); Executed by:
| 256 | ||||||||||||||||||||||||
114 | return never executed: sk_X509_PURPOSE_num(xptable) + (sizeof(xstandard)/sizeof((xstandard)[0]));return sk_X509_PURPOSE_num(xptable) + (sizeof(xstandard)/sizeof((xstandard)[0])); never executed: return sk_X509_PURPOSE_num(xptable) + (sizeof(xstandard)/sizeof((xstandard)[0])); | 0 | ||||||||||||||||||||||||
115 | } | - | ||||||||||||||||||||||||
116 | - | |||||||||||||||||||||||||
117 | X509_PURPOSE *X509_PURPOSE_get0(int idx) | - | ||||||||||||||||||||||||
118 | { | - | ||||||||||||||||||||||||
119 | if (idx < 0
| 3153-4898 | ||||||||||||||||||||||||
120 | return executed 4898 times by 1 test: return ((void *)0) ; Executed by:
executed 4898 times by 1 test: return ((void *)0) ; Executed by:
| 4898 | ||||||||||||||||||||||||
121 | ((void *)0) executed 4898 times by 1 test: return ((void *)0) ; Executed by:
| 4898 | ||||||||||||||||||||||||
122 | ; executed 4898 times by 1 test: return ((void *)0) ; Executed by:
| 4898 | ||||||||||||||||||||||||
123 | if (idx < (int)(sizeof(xstandard)/sizeof((xstandard)[0]))
| 0-3153 | ||||||||||||||||||||||||
124 | return executed 3153 times by 1 test: xstandard + idx;return xstandard + idx; Executed by:
executed 3153 times by 1 test: return xstandard + idx; Executed by:
| 3153 | ||||||||||||||||||||||||
125 | return never executed: sk_X509_PURPOSE_value(xptable, idx - (sizeof(xstandard)/sizeof((xstandard)[0])));return sk_X509_PURPOSE_value(xptable, idx - (sizeof(xstandard)/sizeof((xstandard)[0]))); never executed: return sk_X509_PURPOSE_value(xptable, idx - (sizeof(xstandard)/sizeof((xstandard)[0]))); | 0 | ||||||||||||||||||||||||
126 | } | - | ||||||||||||||||||||||||
127 | - | |||||||||||||||||||||||||
128 | int X509_PURPOSE_get_by_sname(const char *sname) | - | ||||||||||||||||||||||||
129 | { | - | ||||||||||||||||||||||||
130 | int i; | - | ||||||||||||||||||||||||
131 | X509_PURPOSE *xptmp; | - | ||||||||||||||||||||||||
132 | for (i = 0; i < X509_PURPOSE_get_count()
| 0-256 | ||||||||||||||||||||||||
133 | xptmp = X509_PURPOSE_get0(i); | - | ||||||||||||||||||||||||
134 | if ( | - | ||||||||||||||||||||||||
135 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
| 122-134 | ||||||||||||||||||||||||
136 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
137 | ) && __builtin_constant_p (
| 122-134 | ||||||||||||||||||||||||
138 | sname
| 122-134 | ||||||||||||||||||||||||
139 | ) && (__s1_len = __builtin_strlen (
| 122-134 | ||||||||||||||||||||||||
140 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
141 | ), __s2_len = __builtin_strlen (
| 122-134 | ||||||||||||||||||||||||
142 | sname
| 122-134 | ||||||||||||||||||||||||
143 | ), (!((size_t)(const void *)((
| 122-134 | ||||||||||||||||||||||||
144 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
145 | ) + 1) - (size_t)(const void *)(
| 122-134 | ||||||||||||||||||||||||
146 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
147 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
| 122-134 | ||||||||||||||||||||||||
148 | sname
| 122-134 | ||||||||||||||||||||||||
149 | ) + 1) - (size_t)(const void *)(
| 122-134 | ||||||||||||||||||||||||
150 | sname
| 122-134 | ||||||||||||||||||||||||
151 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
| 122-134 | ||||||||||||||||||||||||
152 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
153 | ,
| 122-134 | ||||||||||||||||||||||||
154 | sname
| 122-134 | ||||||||||||||||||||||||
155 | ) : (__builtin_constant_p (
| 122-134 | ||||||||||||||||||||||||
156 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
157 | ) && ((size_t)(const void *)((
| 122-134 | ||||||||||||||||||||||||
158 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
159 | ) + 1) - (size_t)(const void *)(
| 122-134 | ||||||||||||||||||||||||
160 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
161 | ) == 1) && (__s1_len = __builtin_strlen (
| 122-134 | ||||||||||||||||||||||||
162 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
163 | ), __s1_len < 4) ? (__builtin_constant_p (
| 122-134 | ||||||||||||||||||||||||
164 | sname
| 122-134 | ||||||||||||||||||||||||
165 | ) && ((size_t)(const void *)((
| 122-134 | ||||||||||||||||||||||||
166 | sname
| 122-134 | ||||||||||||||||||||||||
167 | ) + 1) - (size_t)(const void *)(
| 122-134 | ||||||||||||||||||||||||
168 | sname
| 122-134 | ||||||||||||||||||||||||
169 | ) == 1) ? __builtin_strcmp (
| 122-134 | ||||||||||||||||||||||||
170 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
171 | ,
| 122-134 | ||||||||||||||||||||||||
172 | sname
| 122-134 | ||||||||||||||||||||||||
173 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 122-134 | ||||||||||||||||||||||||
174 | sname
| 122-134 | ||||||||||||||||||||||||
175 | ); int __result = (((const unsigned char *) (const char *) (
| 122-134 | ||||||||||||||||||||||||
176 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
177 | ))[0] - __s2[0]); if (__s1_len > 0
| 0-134 | ||||||||||||||||||||||||
178 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
179 | ))[1] - __s2[1]); if (__s1_len > 1
| 0-134 | ||||||||||||||||||||||||
180 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
181 | ))[2] - __s2[2]); if (__s1_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( xptmp->sname ))[3] - __s2[3]);
| 0-134 | ||||||||||||||||||||||||
182 | xptmp->sname
never executed: __result = (((const unsigned char *) (const char *) ( xptmp->sname ))[3] - __s2[3]); | 0-134 | ||||||||||||||||||||||||
183 | ))[3] - __s2[3]);
never executed: }__result = (((const unsigned char *) (const char *) ( xptmp->sname ))[3] - __s2[3]); never executed: }end of block never executed: __result; }))) : (__builtin_constant_p (end of block
| 0-134 | ||||||||||||||||||||||||
184 | sname
| 122-134 | ||||||||||||||||||||||||
185 | ) && ((size_t)(const void *)((
| 122-134 | ||||||||||||||||||||||||
186 | sname
| 122-134 | ||||||||||||||||||||||||
187 | ) + 1) - (size_t)(const void *)(
| 122-134 | ||||||||||||||||||||||||
188 | sname
| 122-134 | ||||||||||||||||||||||||
189 | ) == 1) && (__s2_len = __builtin_strlen (
| 122-134 | ||||||||||||||||||||||||
190 | sname
| 122-134 | ||||||||||||||||||||||||
191 | ), __s2_len < 4) ? (__builtin_constant_p (
| 122-134 | ||||||||||||||||||||||||
192 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
193 | ) && ((size_t)(const void *)((
| 122-134 | ||||||||||||||||||||||||
194 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
195 | ) + 1) - (size_t)(const void *)(
| 122-134 | ||||||||||||||||||||||||
196 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
197 | ) == 1) ? __builtin_strcmp (
| 122-134 | ||||||||||||||||||||||||
198 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
199 | ,
| 122-134 | ||||||||||||||||||||||||
200 | sname
| 122-134 | ||||||||||||||||||||||||
201 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 122-134 | ||||||||||||||||||||||||
202 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
203 | ); int __result = (((const unsigned char *) (const char *) (
| 122-134 | ||||||||||||||||||||||||
204 | sname
| 122-134 | ||||||||||||||||||||||||
205 | ))[0] - __s2[0]); if (__s2_len > 0
| 0-134 | ||||||||||||||||||||||||
206 | sname
| 122-134 | ||||||||||||||||||||||||
207 | ))[1] - __s2[1]); if (__s2_len > 1
| 0-134 | ||||||||||||||||||||||||
208 | sname
| 122-134 | ||||||||||||||||||||||||
209 | ))[2] - __s2[2]); if (__s2_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( sname ))[3] - __s2[3]);
| 0-134 | ||||||||||||||||||||||||
210 | sname
never executed: __result = (((const unsigned char *) (const char *) ( sname ))[3] - __s2[3]); | 0-134 | ||||||||||||||||||||||||
211 | ))[3] - __s2[3]);
never executed: }__result = (((const unsigned char *) (const char *) ( sname ))[3] - __s2[3]); never executed: }end of block never executed: __result; }))) : __builtin_strcmp (end of block
| 0-134 | ||||||||||||||||||||||||
212 | xptmp->sname
| 122-134 | ||||||||||||||||||||||||
213 | ,
| 122-134 | ||||||||||||||||||||||||
214 | sname
| 122-134 | ||||||||||||||||||||||||
215 | )))); })
| 122-134 | ||||||||||||||||||||||||
216 | == 0
| 122-134 | ||||||||||||||||||||||||
217 | return executed 134 times by 1 test: i;return i; Executed by:
executed 134 times by 1 test: return i; Executed by:
| 134 | ||||||||||||||||||||||||
218 | } executed 122 times by 1 test: end of block Executed by:
| 122 | ||||||||||||||||||||||||
219 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
220 | } | - | ||||||||||||||||||||||||
221 | - | |||||||||||||||||||||||||
222 | int X509_PURPOSE_get_by_id(int purpose) | - | ||||||||||||||||||||||||
223 | { | - | ||||||||||||||||||||||||
224 | X509_PURPOSE tmp; | - | ||||||||||||||||||||||||
225 | int idx; | - | ||||||||||||||||||||||||
226 | - | |||||||||||||||||||||||||
227 | if ((
| 0-4898 | ||||||||||||||||||||||||
228 | return executed 2897 times by 1 test: purpose - 1;return purpose - 1; Executed by:
executed 2897 times by 1 test: return purpose - 1; Executed by:
| 2897 | ||||||||||||||||||||||||
229 | if (xptable ==
| 0-4898 | ||||||||||||||||||||||||
230 | ((void *)0)
| 0-4898 | ||||||||||||||||||||||||
231 | ) | - | ||||||||||||||||||||||||
232 | return executed 4898 times by 1 test: -1;return -1; Executed by:
executed 4898 times by 1 test: return -1; Executed by:
| 4898 | ||||||||||||||||||||||||
233 | tmp.purpose = purpose; | - | ||||||||||||||||||||||||
234 | idx = sk_X509_PURPOSE_find(xptable, &tmp); | - | ||||||||||||||||||||||||
235 | if (idx < 0
| 0 | ||||||||||||||||||||||||
236 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
237 | return never executed: idx + (sizeof(xstandard)/sizeof((xstandard)[0]));return idx + (sizeof(xstandard)/sizeof((xstandard)[0])); never executed: return idx + (sizeof(xstandard)/sizeof((xstandard)[0])); | 0 | ||||||||||||||||||||||||
238 | } | - | ||||||||||||||||||||||||
239 | - | |||||||||||||||||||||||||
240 | int X509_PURPOSE_add(int id, int trust, int flags, | - | ||||||||||||||||||||||||
241 | int (*ck) (const X509_PURPOSE *, const X509 *, int), | - | ||||||||||||||||||||||||
242 | const char *name, const char *sname, void *arg) | - | ||||||||||||||||||||||||
243 | { | - | ||||||||||||||||||||||||
244 | int idx; | - | ||||||||||||||||||||||||
245 | X509_PURPOSE *ptmp; | - | ||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||
248 | - | |||||||||||||||||||||||||
249 | flags &= ~0x1; | - | ||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||
251 | flags |= 0x2; | - | ||||||||||||||||||||||||
252 | - | |||||||||||||||||||||||||
253 | idx = X509_PURPOSE_get_by_id(id); | - | ||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||
255 | if (idx == -1
| 0 | ||||||||||||||||||||||||
256 | if ((
| 0 | ||||||||||||||||||||||||
257 | ((void *)0)
| 0 | ||||||||||||||||||||||||
258 | ) { | - | ||||||||||||||||||||||||
259 | ERR_put_error(34,(137),((1|64)),__FILE__,166); | - | ||||||||||||||||||||||||
260 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
261 | } | - | ||||||||||||||||||||||||
262 | ptmp->flags = 0x1; | - | ||||||||||||||||||||||||
263 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
264 | ptmp = X509_PURPOSE_get0(idx); never executed: ptmp = X509_PURPOSE_get0(idx); | 0 | ||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | if (ptmp->flags & 0x2
| 0 | ||||||||||||||||||||||||
268 | CRYPTO_free(ptmp->name, __FILE__, 175); | - | ||||||||||||||||||||||||
269 | CRYPTO_free(ptmp->sname, __FILE__, 176); | - | ||||||||||||||||||||||||
270 | } never executed: end of block | 0 | ||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||
272 | ptmp->name = CRYPTO_strdup(name, __FILE__, 179); | - | ||||||||||||||||||||||||
273 | ptmp->sname = CRYPTO_strdup(sname, __FILE__, 180); | - | ||||||||||||||||||||||||
274 | if (!ptmp->name
| 0 | ||||||||||||||||||||||||
275 | ERR_put_error(34,(137),((1|64)),__FILE__,182); | - | ||||||||||||||||||||||||
276 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
277 | } | - | ||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||
279 | ptmp->flags &= 0x1; | - | ||||||||||||||||||||||||
280 | - | |||||||||||||||||||||||||
281 | ptmp->flags |= flags; | - | ||||||||||||||||||||||||
282 | - | |||||||||||||||||||||||||
283 | ptmp->purpose = id; | - | ||||||||||||||||||||||||
284 | ptmp->trust = trust; | - | ||||||||||||||||||||||||
285 | ptmp->check_purpose = ck; | - | ||||||||||||||||||||||||
286 | ptmp->usr_data = arg; | - | ||||||||||||||||||||||||
287 | - | |||||||||||||||||||||||||
288 | - | |||||||||||||||||||||||||
289 | if (idx == -1
| 0 | ||||||||||||||||||||||||
290 | if (xptable ==
| 0 | ||||||||||||||||||||||||
291 | ((void *)0)
| 0 | ||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||
293 | && (
| 0 | ||||||||||||||||||||||||
294 | ((void *)0)
| 0 | ||||||||||||||||||||||||
295 | ) { | - | ||||||||||||||||||||||||
296 | ERR_put_error(34,(137),((1|64)),__FILE__,199); | - | ||||||||||||||||||||||||
297 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
298 | } | - | ||||||||||||||||||||||||
299 | if (!sk_X509_PURPOSE_push(xptable, ptmp)
| 0 | ||||||||||||||||||||||||
300 | ERR_put_error(34,(137),((1|64)),__FILE__,203); | - | ||||||||||||||||||||||||
301 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
302 | } | - | ||||||||||||||||||||||||
303 | } never executed: end of block | 0 | ||||||||||||||||||||||||
304 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
305 | err: | - | ||||||||||||||||||||||||
306 | if (idx == -1
| 0 | ||||||||||||||||||||||||
307 | CRYPTO_free(ptmp->name, __FILE__, 210); | - | ||||||||||||||||||||||||
308 | CRYPTO_free(ptmp->sname, __FILE__, 211); | - | ||||||||||||||||||||||||
309 | CRYPTO_free(ptmp, __FILE__, 212); | - | ||||||||||||||||||||||||
310 | } never executed: end of block | 0 | ||||||||||||||||||||||||
311 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
312 | } | - | ||||||||||||||||||||||||
313 | - | |||||||||||||||||||||||||
314 | static void xptable_free(X509_PURPOSE *p) | - | ||||||||||||||||||||||||
315 | { | - | ||||||||||||||||||||||||
316 | if (!p
| 0 | ||||||||||||||||||||||||
317 | return; never executed: return; | 0 | ||||||||||||||||||||||||
318 | if (p->flags & 0x1
| 0 | ||||||||||||||||||||||||
319 | if (p->flags & 0x2
| 0 | ||||||||||||||||||||||||
320 | CRYPTO_free(p->name, __FILE__, 223); | - | ||||||||||||||||||||||||
321 | CRYPTO_free(p->sname, __FILE__, 224); | - | ||||||||||||||||||||||||
322 | } never executed: end of block | 0 | ||||||||||||||||||||||||
323 | CRYPTO_free(p, __FILE__, 226); | - | ||||||||||||||||||||||||
324 | } never executed: end of block | 0 | ||||||||||||||||||||||||
325 | } never executed: end of block | 0 | ||||||||||||||||||||||||
326 | - | |||||||||||||||||||||||||
327 | void X509_PURPOSE_cleanup(void) | - | ||||||||||||||||||||||||
328 | { | - | ||||||||||||||||||||||||
329 | sk_X509_PURPOSE_pop_free(xptable, xptable_free); | - | ||||||||||||||||||||||||
330 | xptable = | - | ||||||||||||||||||||||||
331 | ((void *)0) | - | ||||||||||||||||||||||||
332 | ; | - | ||||||||||||||||||||||||
333 | } never executed: end of block | 0 | ||||||||||||||||||||||||
334 | - | |||||||||||||||||||||||||
335 | int X509_PURPOSE_get_id(const X509_PURPOSE *xp) | - | ||||||||||||||||||||||||
336 | { | - | ||||||||||||||||||||||||
337 | return executed 134 times by 1 test: xp->purpose;return xp->purpose; Executed by:
executed 134 times by 1 test: return xp->purpose; Executed by:
| 134 | ||||||||||||||||||||||||
338 | } | - | ||||||||||||||||||||||||
339 | - | |||||||||||||||||||||||||
340 | char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp) | - | ||||||||||||||||||||||||
341 | { | - | ||||||||||||||||||||||||
342 | return never executed: xp->name;return xp->name; never executed: return xp->name; | 0 | ||||||||||||||||||||||||
343 | } | - | ||||||||||||||||||||||||
344 | - | |||||||||||||||||||||||||
345 | char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp) | - | ||||||||||||||||||||||||
346 | { | - | ||||||||||||||||||||||||
347 | return never executed: xp->sname;return xp->sname; never executed: return xp->sname; | 0 | ||||||||||||||||||||||||
348 | } | - | ||||||||||||||||||||||||
349 | - | |||||||||||||||||||||||||
350 | int X509_PURPOSE_get_trust(const X509_PURPOSE *xp) | - | ||||||||||||||||||||||||
351 | { | - | ||||||||||||||||||||||||
352 | return executed 133 times by 1 test: xp->trust;return xp->trust; Executed by:
executed 133 times by 1 test: return xp->trust; Executed by:
| 133 | ||||||||||||||||||||||||
353 | } | - | ||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||
355 | static int nid_cmp(const int *a, const int *b) | - | ||||||||||||||||||||||||
356 | { | - | ||||||||||||||||||||||||
357 | return executed 15812 times by 1 test: *a - *b;return *a - *b; Executed by:
executed 15812 times by 1 test: return *a - *b; Executed by:
| 15812 | ||||||||||||||||||||||||
358 | } | - | ||||||||||||||||||||||||
359 | - | |||||||||||||||||||||||||
360 | static int nid_cmp_BSEARCH_CMP_FN(const void *, const void *); static int nid_cmp(int const *, int const *); static int * OBJ_bsearch_nid(int *key, int const *base, int num); | - | ||||||||||||||||||||||||
361 | static int nid_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) { int const *a = a_; int const *b = b_; return executed 15812 times by 1 test: nid_cmp(a,b);return nid_cmp(a,b); Executed by:
executed 15812 times by 1 test: } static int *OBJ_bsearch_nid(int *key, int const *base, int num) { returnreturn nid_cmp(a,b); Executed by:
executed 6328 times by 1 test: (int *)OBJ_bsearch_(key, base, num, sizeof(int), nid_cmp_BSEARCH_CMP_FN);return (int *)OBJ_bsearch_(key, base, num, sizeof(int), nid_cmp_BSEARCH_CMP_FN); Executed by:
executed 6328 times by 1 test: } extern void dummy_prototype(void);return (int *)OBJ_bsearch_(key, base, num, sizeof(int), nid_cmp_BSEARCH_CMP_FN); Executed by:
| 6328-15812 | ||||||||||||||||||||||||
362 | - | |||||||||||||||||||||||||
363 | int X509_supported_extension(X509_EXTENSION *ex) | - | ||||||||||||||||||||||||
364 | { | - | ||||||||||||||||||||||||
365 | static const int supported_nids[] = { | - | ||||||||||||||||||||||||
366 | 71, | - | ||||||||||||||||||||||||
367 | 83, | - | ||||||||||||||||||||||||
368 | 85, | - | ||||||||||||||||||||||||
369 | 87, | - | ||||||||||||||||||||||||
370 | 89, | - | ||||||||||||||||||||||||
371 | 103, | - | ||||||||||||||||||||||||
372 | 126, | - | ||||||||||||||||||||||||
373 | - | |||||||||||||||||||||||||
374 | 290, | - | ||||||||||||||||||||||||
375 | 291, | - | ||||||||||||||||||||||||
376 | - | |||||||||||||||||||||||||
377 | 401, | - | ||||||||||||||||||||||||
378 | 663, | - | ||||||||||||||||||||||||
379 | 666, | - | ||||||||||||||||||||||||
380 | 747, | - | ||||||||||||||||||||||||
381 | 748 | - | ||||||||||||||||||||||||
382 | }; | - | ||||||||||||||||||||||||
383 | - | |||||||||||||||||||||||||
384 | int ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex)); | - | ||||||||||||||||||||||||
385 | - | |||||||||||||||||||||||||
386 | if (ex_nid == 0
| 94-6328 | ||||||||||||||||||||||||
387 | return executed 94 times by 1 test: 0;return 0; Executed by:
executed 94 times by 1 test: return 0; Executed by:
| 94 | ||||||||||||||||||||||||
388 | - | |||||||||||||||||||||||||
389 | if (OBJ_bsearch_nid(&ex_nid, supported_nids, (sizeof(supported_nids)/sizeof((supported_nids)[0])))
| 21-6307 | ||||||||||||||||||||||||
390 | return executed 6307 times by 1 test: 1;return 1; Executed by:
executed 6307 times by 1 test: return 1; Executed by:
| 6307 | ||||||||||||||||||||||||
391 | return executed 21 times by 1 test: 0;return 0; Executed by:
executed 21 times by 1 test: return 0; Executed by:
| 21 | ||||||||||||||||||||||||
392 | } | - | ||||||||||||||||||||||||
393 | - | |||||||||||||||||||||||||
394 | static void setup_dp(X509 *x, DIST_POINT *dp) | - | ||||||||||||||||||||||||
395 | { | - | ||||||||||||||||||||||||
396 | X509_NAME *iname = | - | ||||||||||||||||||||||||
397 | ((void *)0) | - | ||||||||||||||||||||||||
398 | ; | - | ||||||||||||||||||||||||
399 | int i; | - | ||||||||||||||||||||||||
400 | if (dp->reasons
| 1-38 | ||||||||||||||||||||||||
401 | if (dp->reasons->length > 0
| 0-1 | ||||||||||||||||||||||||
402 | dp->dp_reasons = dp->reasons->data[0]; executed 1 time by 1 test: dp->dp_reasons = dp->reasons->data[0]; Executed by:
| 1 | ||||||||||||||||||||||||
403 | if (dp->reasons->length > 1
| 0-1 | ||||||||||||||||||||||||
404 | dp->dp_reasons |= (dp->reasons->data[1] << 8); executed 1 time by 1 test: dp->dp_reasons |= (dp->reasons->data[1] << 8); Executed by:
| 1 | ||||||||||||||||||||||||
405 | dp->dp_reasons &= 0x807f; | - | ||||||||||||||||||||||||
406 | } executed 1 time by 1 test: elseend of block Executed by:
| 1 | ||||||||||||||||||||||||
407 | dp->dp_reasons = 0x807f; executed 38 times by 1 test: dp->dp_reasons = 0x807f; Executed by:
| 38 | ||||||||||||||||||||||||
408 | if (!dp->distpoint
| 0-38 | ||||||||||||||||||||||||
409 | return; executed 39 times by 1 test: return; Executed by:
| 39 | ||||||||||||||||||||||||
410 | for (i = 0; i < sk_GENERAL_NAME_num(dp->CRLissuer)
| 0 | ||||||||||||||||||||||||
411 | GENERAL_NAME *gen = sk_GENERAL_NAME_value(dp->CRLissuer, i); | - | ||||||||||||||||||||||||
412 | if (gen->type == 4
| 0 | ||||||||||||||||||||||||
413 | iname = gen->d.directoryName; | - | ||||||||||||||||||||||||
414 | break; never executed: break; | 0 | ||||||||||||||||||||||||
415 | } | - | ||||||||||||||||||||||||
416 | } never executed: end of block | 0 | ||||||||||||||||||||||||
417 | if (!iname
| 0 | ||||||||||||||||||||||||
418 | iname = X509_get_issuer_name(x); never executed: iname = X509_get_issuer_name(x); | 0 | ||||||||||||||||||||||||
419 | - | |||||||||||||||||||||||||
420 | DIST_POINT_set_dpname(dp->distpoint, iname); | - | ||||||||||||||||||||||||
421 | - | |||||||||||||||||||||||||
422 | } never executed: end of block | 0 | ||||||||||||||||||||||||
423 | - | |||||||||||||||||||||||||
424 | static void setup_crldp(X509 *x) | - | ||||||||||||||||||||||||
425 | { | - | ||||||||||||||||||||||||
426 | int i; | - | ||||||||||||||||||||||||
427 | x->crldp = X509_get_ext_d2i(x, 103, | - | ||||||||||||||||||||||||
428 | ((void *)0) | - | ||||||||||||||||||||||||
429 | , | - | ||||||||||||||||||||||||
430 | ((void *)0) | - | ||||||||||||||||||||||||
431 | ); | - | ||||||||||||||||||||||||
432 | for (i = 0; i < sk_DIST_POINT_num(x->crldp)
| 39-12501 | ||||||||||||||||||||||||
433 | setup_dp(x, sk_DIST_POINT_value(x->crldp, i)); executed 39 times by 1 test: setup_dp(x, sk_DIST_POINT_value(x->crldp, i)); Executed by:
| 39 | ||||||||||||||||||||||||
434 | } executed 12501 times by 1 test: end of block Executed by:
| 12501 | ||||||||||||||||||||||||
435 | static void x509v3_cache_extensions(X509 *x) | - | ||||||||||||||||||||||||
436 | { | - | ||||||||||||||||||||||||
437 | BASIC_CONSTRAINTS *bs; | - | ||||||||||||||||||||||||
438 | PROXY_CERT_INFO_EXTENSION *pci; | - | ||||||||||||||||||||||||
439 | ASN1_BIT_STRING *usage; | - | ||||||||||||||||||||||||
440 | ASN1_BIT_STRING *ns; | - | ||||||||||||||||||||||||
441 | EXTENDED_KEY_USAGE *extusage; | - | ||||||||||||||||||||||||
442 | X509_EXTENSION *ex; | - | ||||||||||||||||||||||||
443 | int i; | - | ||||||||||||||||||||||||
444 | - | |||||||||||||||||||||||||
445 | - | |||||||||||||||||||||||||
446 | - | |||||||||||||||||||||||||
447 | if ( | - | ||||||||||||||||||||||||
448 | __extension__ ({ __auto_type __atomic_load_ptr = (
| 12501-34901 | ||||||||||||||||||||||||
449 | ((_Atomic int *)&x->ex_cached)
| 12501-34901 | ||||||||||||||||||||||||
450 | ); __typeof__ (*__atomic_load_ptr) __atomic_load_tmp; __atomic_load (__atomic_load_ptr, &__atomic_load_tmp, (
| 12501-34901 | ||||||||||||||||||||||||
451 | memory_order_acquire
| 12501-34901 | ||||||||||||||||||||||||
452 | )); __atomic_load_tmp; })
| 12501-34901 | ||||||||||||||||||||||||
453 | ) | - | ||||||||||||||||||||||||
454 | return; executed 34901 times by 1 test: return; Executed by:
| 34901 | ||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||
456 | - | |||||||||||||||||||||||||
457 | CRYPTO_THREAD_write_lock(x->lock); | - | ||||||||||||||||||||||||
458 | if (x->ex_flags & 0x100
| 0-12501 | ||||||||||||||||||||||||
459 | CRYPTO_THREAD_unlock(x->lock); | - | ||||||||||||||||||||||||
460 | return; never executed: return; | 0 | ||||||||||||||||||||||||
461 | } | - | ||||||||||||||||||||||||
462 | - | |||||||||||||||||||||||||
463 | X509_digest(x, EVP_sha1(), x->sha1_hash, | - | ||||||||||||||||||||||||
464 | ((void *)0) | - | ||||||||||||||||||||||||
465 | ); | - | ||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||
467 | if (!X509_get_version(x)
| 9-12492 | ||||||||||||||||||||||||
468 | x->ex_flags |= 0x40; executed 9 times by 1 test: x->ex_flags |= 0x40; Executed by:
| 9 | ||||||||||||||||||||||||
469 | - | |||||||||||||||||||||||||
470 | if ((
| 513-11988 | ||||||||||||||||||||||||
471 | ((void *)0)
| 513-11988 | ||||||||||||||||||||||||
472 | ,
| 513-11988 | ||||||||||||||||||||||||
473 | ((void *)0)
| 513-11988 | ||||||||||||||||||||||||
474 | ))
| 513-11988 | ||||||||||||||||||||||||
475 | if (bs->ca
| 1726-10262 | ||||||||||||||||||||||||
476 | x->ex_flags |= 0x10; executed 1726 times by 1 test: x->ex_flags |= 0x10; Executed by:
| 1726 | ||||||||||||||||||||||||
477 | if (bs->pathlen
| 113-11875 | ||||||||||||||||||||||||
478 | if ((
| 3-110 | ||||||||||||||||||||||||
479 | || !bs->ca
| 48-62 | ||||||||||||||||||||||||
480 | x->ex_flags |= 0x80; | - | ||||||||||||||||||||||||
481 | x->ex_pathlen = 0; | - | ||||||||||||||||||||||||
482 | } executed 51 times by 1 test: elseend of block Executed by:
| 51 | ||||||||||||||||||||||||
483 | x->ex_pathlen = ASN1_INTEGER_get(bs->pathlen); executed 62 times by 1 test: x->ex_pathlen = ASN1_INTEGER_get(bs->pathlen); Executed by:
| 62 | ||||||||||||||||||||||||
484 | } else | - | ||||||||||||||||||||||||
485 | x->ex_pathlen = -1; executed 11875 times by 1 test: x->ex_pathlen = -1; Executed by:
| 11875 | ||||||||||||||||||||||||
486 | BASIC_CONSTRAINTS_free(bs); | - | ||||||||||||||||||||||||
487 | x->ex_flags |= 0x1; | - | ||||||||||||||||||||||||
488 | } executed 11988 times by 1 test: end of block Executed by:
| 11988 | ||||||||||||||||||||||||
489 | - | |||||||||||||||||||||||||
490 | if ((
| 34-12467 | ||||||||||||||||||||||||
491 | ((void *)0)
| 34-12467 | ||||||||||||||||||||||||
492 | ,
| 34-12467 | ||||||||||||||||||||||||
493 | ((void *)0)
| 34-12467 | ||||||||||||||||||||||||
494 | ))
| 34-12467 | ||||||||||||||||||||||||
495 | if (x->ex_flags & 0x10
| 1-33 | ||||||||||||||||||||||||
496 | || X509_get_ext_by_NID(x, 85, -1) >= 0
| 9-24 | ||||||||||||||||||||||||
497 | || X509_get_ext_by_NID(x, 86, -1) >= 0
| 4-20 | ||||||||||||||||||||||||
498 | x->ex_flags |= 0x80; | - | ||||||||||||||||||||||||
499 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||||||||||||||
500 | if (pci->pcPathLengthConstraint
| 13-21 | ||||||||||||||||||||||||
501 | x->ex_pcpathlen = ASN1_INTEGER_get(pci->pcPathLengthConstraint); | - | ||||||||||||||||||||||||
502 | } executed 13 times by 1 test: elseend of block Executed by:
| 13 | ||||||||||||||||||||||||
503 | x->ex_pcpathlen = -1; executed 21 times by 1 test: x->ex_pcpathlen = -1; Executed by:
| 21 | ||||||||||||||||||||||||
504 | PROXY_CERT_INFO_EXTENSION_free(pci); | - | ||||||||||||||||||||||||
505 | x->ex_flags |= 0x400; | - | ||||||||||||||||||||||||
506 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||||||||
507 | - | |||||||||||||||||||||||||
508 | if ((
| 4357-8144 | ||||||||||||||||||||||||
509 | ((void *)0)
| 4357-8144 | ||||||||||||||||||||||||
510 | ,
| 4357-8144 | ||||||||||||||||||||||||
511 | ((void *)0)
| 4357-8144 | ||||||||||||||||||||||||
512 | ))
| 4357-8144 | ||||||||||||||||||||||||
513 | if (usage->length > 0
| 3-8141 | ||||||||||||||||||||||||
514 | x->ex_kusage = usage->data[0]; | - | ||||||||||||||||||||||||
515 | if (usage->length > 1
| 3-8138 | ||||||||||||||||||||||||
516 | x->ex_kusage |= usage->data[1] << 8; executed 3 times by 1 test: x->ex_kusage |= usage->data[1] << 8; Executed by:
| 3 | ||||||||||||||||||||||||
517 | } executed 8141 times by 1 test: elseend of block Executed by:
| 8141 | ||||||||||||||||||||||||
518 | x->ex_kusage = 0; executed 3 times by 1 test: x->ex_kusage = 0; Executed by:
| 3 | ||||||||||||||||||||||||
519 | x->ex_flags |= 0x2; | - | ||||||||||||||||||||||||
520 | ASN1_BIT_STRING_free(usage); | - | ||||||||||||||||||||||||
521 | } executed 8144 times by 1 test: end of block Executed by:
| 8144 | ||||||||||||||||||||||||
522 | x->ex_xkusage = 0; | - | ||||||||||||||||||||||||
523 | if ((
| 4497-8004 | ||||||||||||||||||||||||
524 | ((void *)0)
| 4497-8004 | ||||||||||||||||||||||||
525 | ,
| 4497-8004 | ||||||||||||||||||||||||
526 | ((void *)0)
| 4497-8004 | ||||||||||||||||||||||||
527 | ))
| 4497-8004 | ||||||||||||||||||||||||
528 | x->ex_flags |= 0x4; | - | ||||||||||||||||||||||||
529 | for (i = 0; i < sk_ASN1_OBJECT_num(extusage)
| 8004-8096 | ||||||||||||||||||||||||
530 | switch (OBJ_obj2nid(sk_ASN1_OBJECT_value(extusage, i))) { | - | ||||||||||||||||||||||||
531 | case executed 7820 times by 1 test: 129:case 129: Executed by:
executed 7820 times by 1 test: case 129: Executed by:
| 7820 | ||||||||||||||||||||||||
532 | x->ex_xkusage |= 0x1; | - | ||||||||||||||||||||||||
533 | break; executed 7820 times by 1 test: break; Executed by:
| 7820 | ||||||||||||||||||||||||
534 | - | |||||||||||||||||||||||||
535 | case executed 141 times by 1 test: 130:case 130: Executed by:
executed 141 times by 1 test: case 130: Executed by:
| 141 | ||||||||||||||||||||||||
536 | x->ex_xkusage |= 0x2; | - | ||||||||||||||||||||||||
537 | break; executed 141 times by 1 test: break; Executed by:
| 141 | ||||||||||||||||||||||||
538 | - | |||||||||||||||||||||||||
539 | case executed 13 times by 1 test: 132:case 132: Executed by:
executed 13 times by 1 test: case 132: Executed by:
| 13 | ||||||||||||||||||||||||
540 | x->ex_xkusage |= 0x4; | - | ||||||||||||||||||||||||
541 | break; executed 13 times by 1 test: break; Executed by:
| 13 | ||||||||||||||||||||||||
542 | - | |||||||||||||||||||||||||
543 | case executed 1 time by 1 test: 131:case 131: Executed by:
executed 1 time by 1 test: case 131: Executed by:
| 1 | ||||||||||||||||||||||||
544 | x->ex_xkusage |= 0x8; | - | ||||||||||||||||||||||||
545 | break; executed 1 time by 1 test: break; Executed by:
| 1 | ||||||||||||||||||||||||
546 | - | |||||||||||||||||||||||||
547 | case executed 4 times by 1 test: 137:case 137: Executed by:
executed 4 times by 1 test: case 137: Executed by:
| 4 | ||||||||||||||||||||||||
548 | case never executed: 139:case 139: never executed: case 139: | 0 | ||||||||||||||||||||||||
549 | x->ex_xkusage |= 0x10; | - | ||||||||||||||||||||||||
550 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||||||||
551 | - | |||||||||||||||||||||||||
552 | case executed 21 times by 1 test: 180:case 180: Executed by:
executed 21 times by 1 test: case 180: Executed by:
| 21 | ||||||||||||||||||||||||
553 | x->ex_xkusage |= 0x20; | - | ||||||||||||||||||||||||
554 | break; executed 21 times by 1 test: break; Executed by:
| 21 | ||||||||||||||||||||||||
555 | - | |||||||||||||||||||||||||
556 | case executed 10 times by 1 test: 133:case 133: Executed by:
executed 10 times by 1 test: case 133: Executed by:
| 10 | ||||||||||||||||||||||||
557 | x->ex_xkusage |= 0x40; | - | ||||||||||||||||||||||||
558 | break; executed 10 times by 1 test: break; Executed by:
| 10 | ||||||||||||||||||||||||
559 | - | |||||||||||||||||||||||||
560 | case executed 10 times by 1 test: 297:case 297: Executed by:
executed 10 times by 1 test: case 297: Executed by:
| 10 | ||||||||||||||||||||||||
561 | x->ex_xkusage |= 0x80; | - | ||||||||||||||||||||||||
562 | break; executed 10 times by 1 test: break; Executed by:
| 10 | ||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||
564 | case never executed: 910:case 910: never executed: case 910: | 0 | ||||||||||||||||||||||||
565 | x->ex_xkusage |= 0x100; | - | ||||||||||||||||||||||||
566 | break; never executed: break; | 0 | ||||||||||||||||||||||||
567 | } | - | ||||||||||||||||||||||||
568 | } executed 8096 times by 1 test: end of block Executed by:
| 8096 | ||||||||||||||||||||||||
569 | sk_ASN1_OBJECT_pop_free(extusage, ASN1_OBJECT_free); | - | ||||||||||||||||||||||||
570 | } executed 8004 times by 1 test: end of block Executed by:
| 8004 | ||||||||||||||||||||||||
571 | - | |||||||||||||||||||||||||
572 | if ((
| 0-12501 | ||||||||||||||||||||||||
573 | ((void *)0)
| 0-12501 | ||||||||||||||||||||||||
574 | ,
| 0-12501 | ||||||||||||||||||||||||
575 | ((void *)0)
| 0-12501 | ||||||||||||||||||||||||
576 | ))
| 0-12501 | ||||||||||||||||||||||||
577 | if (ns->length > 0
| 0 | ||||||||||||||||||||||||
578 | x->ex_nscert = ns->data[0]; never executed: x->ex_nscert = ns->data[0]; | 0 | ||||||||||||||||||||||||
579 | else | - | ||||||||||||||||||||||||
580 | x->ex_nscert = 0; never executed: x->ex_nscert = 0; | 0 | ||||||||||||||||||||||||
581 | x->ex_flags |= 0x8; | - | ||||||||||||||||||||||||
582 | ASN1_BIT_STRING_free(ns); | - | ||||||||||||||||||||||||
583 | } never executed: end of block | 0 | ||||||||||||||||||||||||
584 | x->skid = X509_get_ext_d2i(x, 82, | - | ||||||||||||||||||||||||
585 | ((void *)0) | - | ||||||||||||||||||||||||
586 | , | - | ||||||||||||||||||||||||
587 | ((void *)0) | - | ||||||||||||||||||||||||
588 | ); | - | ||||||||||||||||||||||||
589 | x->akid = X509_get_ext_d2i(x, 90, | - | ||||||||||||||||||||||||
590 | ((void *)0) | - | ||||||||||||||||||||||||
591 | , | - | ||||||||||||||||||||||||
592 | ((void *)0) | - | ||||||||||||||||||||||||
593 | ); | - | ||||||||||||||||||||||||
594 | - | |||||||||||||||||||||||||
595 | if (!X509_NAME_cmp(X509_get_subject_name(x), X509_get_issuer_name(x))
| 5670-6831 | ||||||||||||||||||||||||
596 | x->ex_flags |= 0x20; | - | ||||||||||||||||||||||||
597 | - | |||||||||||||||||||||||||
598 | if (X509_check_akid(x, x->akid) == 0
| 16-6815 | ||||||||||||||||||||||||
599 | !(((
| 112-5697 | ||||||||||||||||||||||||
600 | x->ex_flags |= 0x2000; executed 1230 times by 1 test: x->ex_flags |= 0x2000; Executed by:
| 1230 | ||||||||||||||||||||||||
601 | } executed 6831 times by 1 test: end of block Executed by:
| 6831 | ||||||||||||||||||||||||
602 | x->altname = X509_get_ext_d2i(x, 85, | - | ||||||||||||||||||||||||
603 | ((void *)0) | - | ||||||||||||||||||||||||
604 | , | - | ||||||||||||||||||||||||
605 | ((void *)0) | - | ||||||||||||||||||||||||
606 | ); | - | ||||||||||||||||||||||||
607 | x->nc = X509_get_ext_d2i(x, 666, &i, | - | ||||||||||||||||||||||||
608 | ((void *)0) | - | ||||||||||||||||||||||||
609 | ); | - | ||||||||||||||||||||||||
610 | if (!x->nc
| 31-12470 | ||||||||||||||||||||||||
611 | x->ex_flags |= 0x80; executed 110 times by 1 test: x->ex_flags |= 0x80; Executed by:
| 110 | ||||||||||||||||||||||||
612 | setup_crldp(x); | - | ||||||||||||||||||||||||
613 | - | |||||||||||||||||||||||||
614 | - | |||||||||||||||||||||||||
615 | x->rfc3779_addr = X509_get_ext_d2i(x, 290, | - | ||||||||||||||||||||||||
616 | ((void *)0) | - | ||||||||||||||||||||||||
617 | , | - | ||||||||||||||||||||||||
618 | ((void *)0) | - | ||||||||||||||||||||||||
619 | ); | - | ||||||||||||||||||||||||
620 | x->rfc3779_asid = X509_get_ext_d2i(x, 291, | - | ||||||||||||||||||||||||
621 | - | |||||||||||||||||||||||||
622 | ((void *)0) | - | ||||||||||||||||||||||||
623 | , | - | ||||||||||||||||||||||||
624 | ((void *)0) | - | ||||||||||||||||||||||||
625 | ); | - | ||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||
627 | for (i = 0; i < X509_get_ext_count(x)
| 12386-51071 | ||||||||||||||||||||||||
628 | ex = X509_get_ext(x, i); | - | ||||||||||||||||||||||||
629 | if (OBJ_obj2nid(X509_EXTENSION_get_object(ex))
| 13-51058 | ||||||||||||||||||||||||
630 | == 857
| 13-51058 | ||||||||||||||||||||||||
631 | x->ex_flags |= 0x1000; executed 13 times by 1 test: x->ex_flags |= 0x1000; Executed by:
| 13 | ||||||||||||||||||||||||
632 | if (!X509_EXTENSION_get_critical(ex)
| 6422-44649 | ||||||||||||||||||||||||
633 | continue; executed 44649 times by 1 test: continue; Executed by:
| 44649 | ||||||||||||||||||||||||
634 | if (!X509_supported_extension(ex)
| 115-6307 | ||||||||||||||||||||||||
635 | x->ex_flags |= 0x200; | - | ||||||||||||||||||||||||
636 | break; executed 115 times by 1 test: break; Executed by:
| 115 | ||||||||||||||||||||||||
637 | } | - | ||||||||||||||||||||||||
638 | } executed 6307 times by 1 test: end of block Executed by:
| 6307 | ||||||||||||||||||||||||
639 | x509_init_sig_info(x); | - | ||||||||||||||||||||||||
640 | x->ex_flags |= 0x100; | - | ||||||||||||||||||||||||
641 | - | |||||||||||||||||||||||||
642 | - | |||||||||||||||||||||||||
643 | __extension__ ({ __auto_type __atomic_store_ptr = ( | - | ||||||||||||||||||||||||
644 | ((_Atomic int *)&x->ex_cached) | - | ||||||||||||||||||||||||
645 | ); __typeof__ (*__atomic_store_ptr) __atomic_store_tmp = ( | - | ||||||||||||||||||||||||
646 | (1) | - | ||||||||||||||||||||||||
647 | ); __atomic_store (__atomic_store_ptr, &__atomic_store_tmp, ( | - | ||||||||||||||||||||||||
648 | memory_order_release | - | ||||||||||||||||||||||||
649 | )); }) | - | ||||||||||||||||||||||||
650 | ; | - | ||||||||||||||||||||||||
651 | - | |||||||||||||||||||||||||
652 | - | |||||||||||||||||||||||||
653 | - | |||||||||||||||||||||||||
654 | - | |||||||||||||||||||||||||
655 | - | |||||||||||||||||||||||||
656 | - | |||||||||||||||||||||||||
657 | CRYPTO_THREAD_unlock(x->lock); | - | ||||||||||||||||||||||||
658 | } executed 12501 times by 1 test: end of block Executed by:
| 12501 | ||||||||||||||||||||||||
659 | static int check_ca(const X509 *x) | - | ||||||||||||||||||||||||
660 | { | - | ||||||||||||||||||||||||
661 | - | |||||||||||||||||||||||||
662 | if ((((
| 238-3461 | ||||||||||||||||||||||||
663 | return executed 238 times by 1 test: 0;return 0; Executed by:
executed 238 times by 1 test: return 0; Executed by:
| 238 | ||||||||||||||||||||||||
664 | if (x->ex_flags & 0x1
| 4-3701 | ||||||||||||||||||||||||
665 | if (x->ex_flags & 0x10
| 1110-2591 | ||||||||||||||||||||||||
666 | return executed 2591 times by 1 test: 1;return 1; Executed by:
executed 2591 times by 1 test: return 1; Executed by:
| 2591 | ||||||||||||||||||||||||
667 | - | |||||||||||||||||||||||||
668 | else | - | ||||||||||||||||||||||||
669 | return executed 1110 times by 1 test: 0;return 0; Executed by:
executed 1110 times by 1 test: return 0; Executed by:
| 1110 | ||||||||||||||||||||||||
670 | } else { | - | ||||||||||||||||||||||||
671 | - | |||||||||||||||||||||||||
672 | if ((
| 0-4 | ||||||||||||||||||||||||
673 | return never executed: 3;return 3; never executed: return 3; | 0 | ||||||||||||||||||||||||
674 | - | |||||||||||||||||||||||||
675 | - | |||||||||||||||||||||||||
676 | - | |||||||||||||||||||||||||
677 | else if (x->ex_flags & 0x2
| 0-4 | ||||||||||||||||||||||||
678 | return executed 4 times by 1 test: 4;return 4; Executed by:
executed 4 times by 1 test: return 4; Executed by:
| 4 | ||||||||||||||||||||||||
679 | - | |||||||||||||||||||||||||
680 | else if (x->ex_flags & 0x8
| 0 | ||||||||||||||||||||||||
681 | return never executed: 5;return 5; never executed: return 5; | 0 | ||||||||||||||||||||||||
682 | - | |||||||||||||||||||||||||
683 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
684 | } | - | ||||||||||||||||||||||||
685 | } | - | ||||||||||||||||||||||||
686 | - | |||||||||||||||||||||||||
687 | void X509_set_proxy_flag(X509 *x) | - | ||||||||||||||||||||||||
688 | { | - | ||||||||||||||||||||||||
689 | x->ex_flags |= 0x400; | - | ||||||||||||||||||||||||
690 | } never executed: end of block | 0 | ||||||||||||||||||||||||
691 | - | |||||||||||||||||||||||||
692 | void X509_set_proxy_pathlen(X509 *x, long l) | - | ||||||||||||||||||||||||
693 | { | - | ||||||||||||||||||||||||
694 | x->ex_pcpathlen = l; | - | ||||||||||||||||||||||||
695 | } never executed: end of block | 0 | ||||||||||||||||||||||||
696 | - | |||||||||||||||||||||||||
697 | int X509_check_ca(X509 *x) | - | ||||||||||||||||||||||||
698 | { | - | ||||||||||||||||||||||||
699 | x509v3_cache_extensions(x); | - | ||||||||||||||||||||||||
700 | - | |||||||||||||||||||||||||
701 | return executed 2668 times by 1 test: check_ca(x);return check_ca(x); Executed by:
executed 2668 times by 1 test: return check_ca(x); Executed by:
| 2668 | ||||||||||||||||||||||||
702 | } | - | ||||||||||||||||||||||||
703 | - | |||||||||||||||||||||||||
704 | - | |||||||||||||||||||||||||
705 | static int check_ssl_ca(const X509 *x) | - | ||||||||||||||||||||||||
706 | { | - | ||||||||||||||||||||||||
707 | int ca_ret; | - | ||||||||||||||||||||||||
708 | ca_ret = check_ca(x); | - | ||||||||||||||||||||||||
709 | if (!ca_ret
| 3-1170 | ||||||||||||||||||||||||
710 | return executed 3 times by 1 test: 0;return 0; Executed by:
executed 3 times by 1 test: return 0; Executed by:
| 3 | ||||||||||||||||||||||||
711 | - | |||||||||||||||||||||||||
712 | if (ca_ret != 5
| 0-1170 | ||||||||||||||||||||||||
713 | return executed 1170 times by 1 test: ca_ret;return ca_ret; Executed by:
executed 1170 times by 1 test: return ca_ret; Executed by:
| 1170 | ||||||||||||||||||||||||
714 | else | - | ||||||||||||||||||||||||
715 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
716 | } | - | ||||||||||||||||||||||||
717 | - | |||||||||||||||||||||||||
718 | static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
719 | int ca) | - | ||||||||||||||||||||||||
720 | { | - | ||||||||||||||||||||||||
721 | if ((((
| 1-84 | ||||||||||||||||||||||||
722 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
723 | if (ca
| 49-70 | ||||||||||||||||||||||||
724 | return executed 70 times by 1 test: check_ssl_ca(x);return check_ssl_ca(x); Executed by:
executed 70 times by 1 test: return check_ssl_ca(x); Executed by:
| 70 | ||||||||||||||||||||||||
725 | - | |||||||||||||||||||||||||
726 | if ((((
| 0-44 | ||||||||||||||||||||||||
727 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
728 | - | |||||||||||||||||||||||||
729 | if ((((
| 0-49 | ||||||||||||||||||||||||
730 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
731 | return executed 49 times by 1 test: 1;return 1; Executed by:
executed 49 times by 1 test: return 1; Executed by:
| 49 | ||||||||||||||||||||||||
732 | } | - | ||||||||||||||||||||||||
733 | static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
734 | int ca) | - | ||||||||||||||||||||||||
735 | { | - | ||||||||||||||||||||||||
736 | if ((((
| 5-1232 | ||||||||||||||||||||||||
737 | return executed 5 times by 1 test: 0;return 0; Executed by:
executed 5 times by 1 test: return 0; Executed by:
| 5 | ||||||||||||||||||||||||
738 | if (ca
| 1103-1165 | ||||||||||||||||||||||||
739 | return executed 1103 times by 1 test: check_ssl_ca(x);return check_ssl_ca(x); Executed by:
executed 1103 times by 1 test: return check_ssl_ca(x); Executed by:
| 1103 | ||||||||||||||||||||||||
740 | - | |||||||||||||||||||||||||
741 | if ((((
| 0-1165 | ||||||||||||||||||||||||
742 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
743 | if ((((
| 0-1038 | ||||||||||||||||||||||||
744 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
745 | - | |||||||||||||||||||||||||
746 | return executed 1165 times by 1 test: 1;return 1; Executed by:
executed 1165 times by 1 test: return 1; Executed by:
| 1165 | ||||||||||||||||||||||||
747 | - | |||||||||||||||||||||||||
748 | } | - | ||||||||||||||||||||||||
749 | - | |||||||||||||||||||||||||
750 | static int check_purpose_ns_ssl_server(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
751 | int ca) | - | ||||||||||||||||||||||||
752 | { | - | ||||||||||||||||||||||||
753 | int ret; | - | ||||||||||||||||||||||||
754 | ret = check_purpose_ssl_server(xp, x, ca); | - | ||||||||||||||||||||||||
755 | if (!ret
| 0 | ||||||||||||||||||||||||
756 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||
757 | - | |||||||||||||||||||||||||
758 | if ((((
| 0 | ||||||||||||||||||||||||
759 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
760 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||
761 | } | - | ||||||||||||||||||||||||
762 | - | |||||||||||||||||||||||||
763 | - | |||||||||||||||||||||||||
764 | static int purpose_smime(const X509 *x, int ca) | - | ||||||||||||||||||||||||
765 | { | - | ||||||||||||||||||||||||
766 | if ((((
| 0-176 | ||||||||||||||||||||||||
767 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
768 | if (ca
| 88 | ||||||||||||||||||||||||
769 | int ca_ret; | - | ||||||||||||||||||||||||
770 | ca_ret = check_ca(x); | - | ||||||||||||||||||||||||
771 | if (!ca_ret
| 0-88 | ||||||||||||||||||||||||
772 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
773 | - | |||||||||||||||||||||||||
774 | if (ca_ret != 5
| 0-88 | ||||||||||||||||||||||||
775 | return executed 88 times by 1 test: ca_ret;return ca_ret; Executed by:
executed 88 times by 1 test: return ca_ret; Executed by:
| 88 | ||||||||||||||||||||||||
776 | else | - | ||||||||||||||||||||||||
777 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
778 | } | - | ||||||||||||||||||||||||
779 | if (x->ex_flags & 0x8
| 0-88 | ||||||||||||||||||||||||
780 | if (x->ex_nscert & 0x20
| 0 | ||||||||||||||||||||||||
781 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
782 | - | |||||||||||||||||||||||||
783 | if (x->ex_nscert & 0x80
| 0 | ||||||||||||||||||||||||
784 | return never executed: 2;return 2; never executed: return 2; | 0 | ||||||||||||||||||||||||
785 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
786 | } | - | ||||||||||||||||||||||||
787 | return executed 88 times by 1 test: 1;return 1; Executed by:
executed 88 times by 1 test: return 1; Executed by:
| 88 | ||||||||||||||||||||||||
788 | } | - | ||||||||||||||||||||||||
789 | - | |||||||||||||||||||||||||
790 | static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
791 | int ca) | - | ||||||||||||||||||||||||
792 | { | - | ||||||||||||||||||||||||
793 | int ret; | - | ||||||||||||||||||||||||
794 | ret = purpose_smime(x, ca); | - | ||||||||||||||||||||||||
795 | if (!ret
| 0-176 | ||||||||||||||||||||||||
796 | return executed 88 times by 1 test: ret;return ret; Executed by:
executed 88 times by 1 test: return ret; Executed by:
| 88 | ||||||||||||||||||||||||
797 | if ((((
| 0-88 | ||||||||||||||||||||||||
798 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
799 | return executed 88 times by 1 test: ret;return ret; Executed by:
executed 88 times by 1 test: return ret; Executed by:
| 88 | ||||||||||||||||||||||||
800 | } | - | ||||||||||||||||||||||||
801 | - | |||||||||||||||||||||||||
802 | static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
803 | int ca) | - | ||||||||||||||||||||||||
804 | { | - | ||||||||||||||||||||||||
805 | int ret; | - | ||||||||||||||||||||||||
806 | ret = purpose_smime(x, ca); | - | ||||||||||||||||||||||||
807 | if (!ret
| 0 | ||||||||||||||||||||||||
808 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||
809 | if ((((
| 0 | ||||||||||||||||||||||||
810 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
811 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||
812 | } | - | ||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||
814 | static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
815 | int ca) | - | ||||||||||||||||||||||||
816 | { | - | ||||||||||||||||||||||||
817 | if (ca
| 0 | ||||||||||||||||||||||||
818 | int ca_ret; | - | ||||||||||||||||||||||||
819 | if ((
| 0 | ||||||||||||||||||||||||
820 | return never executed: ca_ret;return ca_ret; never executed: return ca_ret; | 0 | ||||||||||||||||||||||||
821 | else | - | ||||||||||||||||||||||||
822 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
823 | } | - | ||||||||||||||||||||||||
824 | if ((((
| 0 | ||||||||||||||||||||||||
825 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
826 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
827 | } | - | ||||||||||||||||||||||||
828 | - | |||||||||||||||||||||||||
829 | - | |||||||||||||||||||||||||
830 | - | |||||||||||||||||||||||||
831 | - | |||||||||||||||||||||||||
832 | - | |||||||||||||||||||||||||
833 | - | |||||||||||||||||||||||||
834 | static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca) | - | ||||||||||||||||||||||||
835 | { | - | ||||||||||||||||||||||||
836 | - | |||||||||||||||||||||||||
837 | - | |||||||||||||||||||||||||
838 | - | |||||||||||||||||||||||||
839 | - | |||||||||||||||||||||||||
840 | if (ca
| 14-22 | ||||||||||||||||||||||||
841 | return executed 14 times by 1 test: check_ca(x);return check_ca(x); Executed by:
executed 14 times by 1 test: return check_ca(x); Executed by:
| 14 | ||||||||||||||||||||||||
842 | - | |||||||||||||||||||||||||
843 | return executed 22 times by 1 test: 1;return 1; Executed by:
executed 22 times by 1 test: return 1; Executed by:
| 22 | ||||||||||||||||||||||||
844 | } | - | ||||||||||||||||||||||||
845 | - | |||||||||||||||||||||||||
846 | static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x, | - | ||||||||||||||||||||||||
847 | int ca) | - | ||||||||||||||||||||||||
848 | { | - | ||||||||||||||||||||||||
849 | int i_ext; | - | ||||||||||||||||||||||||
850 | - | |||||||||||||||||||||||||
851 | - | |||||||||||||||||||||||||
852 | if (ca
| 0 | ||||||||||||||||||||||||
853 | return never executed: check_ca(x);return check_ca(x); never executed: return check_ca(x); | 0 | ||||||||||||||||||||||||
854 | - | |||||||||||||||||||||||||
855 | - | |||||||||||||||||||||||||
856 | - | |||||||||||||||||||||||||
857 | - | |||||||||||||||||||||||||
858 | - | |||||||||||||||||||||||||
859 | - | |||||||||||||||||||||||||
860 | - | |||||||||||||||||||||||||
861 | if ((
| 0 | ||||||||||||||||||||||||
862 | && ((
| 0 | ||||||||||||||||||||||||
863 | !(x->ex_kusage & (0x0040 | 0x0080))
| 0 | ||||||||||||||||||||||||
864 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
865 | - | |||||||||||||||||||||||||
866 | - | |||||||||||||||||||||||||
867 | if (!(x->ex_flags & 0x4)
| 0 | ||||||||||||||||||||||||
868 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
869 | - | |||||||||||||||||||||||||
870 | - | |||||||||||||||||||||||||
871 | i_ext = X509_get_ext_by_NID(x, 126, -1); | - | ||||||||||||||||||||||||
872 | if (i_ext >= 0
| 0 | ||||||||||||||||||||||||
873 | X509_EXTENSION *ext = X509_get_ext((X509 *)x, i_ext); | - | ||||||||||||||||||||||||
874 | if (!X509_EXTENSION_get_critical(ext)
| 0 | ||||||||||||||||||||||||
875 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
876 | } never executed: end of block | 0 | ||||||||||||||||||||||||
877 | - | |||||||||||||||||||||||||
878 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
879 | } | - | ||||||||||||||||||||||||
880 | - | |||||||||||||||||||||||||
881 | static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca) | - | ||||||||||||||||||||||||
882 | { | - | ||||||||||||||||||||||||
883 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
884 | } | - | ||||||||||||||||||||||||
885 | int X509_check_issued(X509 *issuer, X509 *subject) | - | ||||||||||||||||||||||||
886 | { | - | ||||||||||||||||||||||||
887 | if (X509_NAME_cmp(X509_get_subject_name(issuer),
| 715-1696 | ||||||||||||||||||||||||
888 | X509_get_issuer_name(subject))
| 715-1696 | ||||||||||||||||||||||||
889 | return executed 715 times by 1 test: 29;return 29; Executed by:
executed 715 times by 1 test: return 29; Executed by:
| 715 | ||||||||||||||||||||||||
890 | - | |||||||||||||||||||||||||
891 | x509v3_cache_extensions(issuer); | - | ||||||||||||||||||||||||
892 | x509v3_cache_extensions(subject); | - | ||||||||||||||||||||||||
893 | - | |||||||||||||||||||||||||
894 | if (subject->akid
| 264-1432 | ||||||||||||||||||||||||
895 | int ret = X509_check_akid(issuer, subject->akid); | - | ||||||||||||||||||||||||
896 | if (ret != 0
| 23-1409 | ||||||||||||||||||||||||
897 | return executed 23 times by 1 test: ret;return ret; Executed by:
executed 23 times by 1 test: return ret; Executed by:
| 23 | ||||||||||||||||||||||||
898 | } executed 1409 times by 1 test: end of block Executed by:
| 1409 | ||||||||||||||||||||||||
899 | - | |||||||||||||||||||||||||
900 | if (subject->ex_flags & 0x400
| 26-1647 | ||||||||||||||||||||||||
901 | if ((((
| 1-22 | ||||||||||||||||||||||||
902 | return executed 1 time by 1 test: 39;return 39; Executed by:
executed 1 time by 1 test: return 39; Executed by:
| 1 | ||||||||||||||||||||||||
903 | } executed 25 times by 1 test: else if ((((end of block Executed by:
| 21-1415 | ||||||||||||||||||||||||
904 | return executed 21 times by 1 test: 32;return 32; Executed by:
executed 21 times by 1 test: return 32; Executed by:
| 21 | ||||||||||||||||||||||||
905 | return executed 1651 times by 1 test: 0;return 0; Executed by:
executed 1651 times by 1 test: return 0; Executed by:
| 1651 | ||||||||||||||||||||||||
906 | } | - | ||||||||||||||||||||||||
907 | - | |||||||||||||||||||||||||
908 | int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid) | - | ||||||||||||||||||||||||
909 | { | - | ||||||||||||||||||||||||
910 | - | |||||||||||||||||||||||||
911 | if (!akid
| 2574-5695 | ||||||||||||||||||||||||
912 | return executed 5695 times by 1 test: 0;return 0; Executed by:
executed 5695 times by 1 test: return 0; Executed by:
| 5695 | ||||||||||||||||||||||||
913 | - | |||||||||||||||||||||||||
914 | - | |||||||||||||||||||||||||
915 | if (akid->keyid
| 7-2555 | ||||||||||||||||||||||||
916 | ASN1_OCTET_STRING_cmp(akid->keyid, issuer->skid)
| 22-2526 | ||||||||||||||||||||||||
917 | return executed 22 times by 1 test: 30;return 30; Executed by:
executed 22 times by 1 test: return 30; Executed by:
| 22 | ||||||||||||||||||||||||
918 | - | |||||||||||||||||||||||||
919 | if (akid->serial
| 85-2467 | ||||||||||||||||||||||||
920 | ASN1_INTEGER_cmp(X509_get_serialNumber(issuer), akid->serial)
| 14-71 | ||||||||||||||||||||||||
921 | return executed 14 times by 1 test: 31;return 31; Executed by:
executed 14 times by 1 test: return 31; Executed by:
| 14 | ||||||||||||||||||||||||
922 | - | |||||||||||||||||||||||||
923 | if (akid->issuer
| 74-2464 | ||||||||||||||||||||||||
924 | - | |||||||||||||||||||||||||
925 | - | |||||||||||||||||||||||||
926 | - | |||||||||||||||||||||||||
927 | - | |||||||||||||||||||||||||
928 | - | |||||||||||||||||||||||||
929 | GENERAL_NAMES *gens; | - | ||||||||||||||||||||||||
930 | GENERAL_NAME *gen; | - | ||||||||||||||||||||||||
931 | X509_NAME *nm = | - | ||||||||||||||||||||||||
932 | ((void *)0) | - | ||||||||||||||||||||||||
933 | ; | - | ||||||||||||||||||||||||
934 | int i; | - | ||||||||||||||||||||||||
935 | gens = akid->issuer; | - | ||||||||||||||||||||||||
936 | for (i = 0; i < sk_GENERAL_NAME_num(gens)
| 6-89 | ||||||||||||||||||||||||
937 | gen = sk_GENERAL_NAME_value(gens, i); | - | ||||||||||||||||||||||||
938 | if (gen->type == 4
| 21-68 | ||||||||||||||||||||||||
939 | nm = gen->d.dirn; | - | ||||||||||||||||||||||||
940 | break; executed 68 times by 1 test: break; Executed by:
| 68 | ||||||||||||||||||||||||
941 | } | - | ||||||||||||||||||||||||
942 | } executed 21 times by 1 test: end of block Executed by:
| 21 | ||||||||||||||||||||||||
943 | if (nm
| 3-68 | ||||||||||||||||||||||||
944 | return executed 3 times by 1 test: 31;return 31; Executed by:
executed 3 times by 1 test: return 31; Executed by:
| 3 | ||||||||||||||||||||||||
945 | } executed 71 times by 1 test: end of block Executed by:
| 71 | ||||||||||||||||||||||||
946 | return executed 2535 times by 1 test: 0;return 0; Executed by:
executed 2535 times by 1 test: return 0; Executed by:
| 2535 | ||||||||||||||||||||||||
947 | } | - | ||||||||||||||||||||||||
948 | - | |||||||||||||||||||||||||
949 | uint32_t X509_get_extension_flags(X509 *x) | - | ||||||||||||||||||||||||
950 | { | - | ||||||||||||||||||||||||
951 | - | |||||||||||||||||||||||||
952 | X509_check_purpose(x, -1, -1); | - | ||||||||||||||||||||||||
953 | return executed 10377 times by 1 test: x->ex_flags;return x->ex_flags; Executed by:
executed 10377 times by 1 test: return x->ex_flags; Executed by:
| 10377 | ||||||||||||||||||||||||
954 | } | - | ||||||||||||||||||||||||
955 | - | |||||||||||||||||||||||||
956 | uint32_t X509_get_key_usage(X509 *x) | - | ||||||||||||||||||||||||
957 | { | - | ||||||||||||||||||||||||
958 | - | |||||||||||||||||||||||||
959 | X509_check_purpose(x, -1, -1); | - | ||||||||||||||||||||||||
960 | if (x->ex_flags & 0x2
| 32-524 | ||||||||||||||||||||||||
961 | return executed 524 times by 1 test: x->ex_kusage;return x->ex_kusage; Executed by:
executed 524 times by 1 test: return x->ex_kusage; Executed by:
| 524 | ||||||||||||||||||||||||
962 | return executed 32 times by 1 test: return (4294967295U) ; Executed by:
executed 32 times by 1 test: return (4294967295U) ; Executed by:
| 32 | ||||||||||||||||||||||||
963 | (4294967295U) executed 32 times by 1 test: return (4294967295U) ; Executed by:
| 32 | ||||||||||||||||||||||||
964 | ; executed 32 times by 1 test: return (4294967295U) ; Executed by:
| 32 | ||||||||||||||||||||||||
965 | } | - | ||||||||||||||||||||||||
966 | - | |||||||||||||||||||||||||
967 | uint32_t X509_get_extended_key_usage(X509 *x) | - | ||||||||||||||||||||||||
968 | { | - | ||||||||||||||||||||||||
969 | - | |||||||||||||||||||||||||
970 | X509_check_purpose(x, -1, -1); | - | ||||||||||||||||||||||||
971 | if (x->ex_flags & 0x4
| 0-6 | ||||||||||||||||||||||||
972 | return executed 6 times by 1 test: x->ex_xkusage;return x->ex_xkusage; Executed by:
executed 6 times by 1 test: return x->ex_xkusage; Executed by:
| 6 | ||||||||||||||||||||||||
973 | return never executed: return (4294967295U) ; never executed: return (4294967295U) ; | 0 | ||||||||||||||||||||||||
974 | (4294967295U) never executed: return (4294967295U) ; | 0 | ||||||||||||||||||||||||
975 | ; never executed: return (4294967295U) ; | 0 | ||||||||||||||||||||||||
976 | } | - | ||||||||||||||||||||||||
977 | - | |||||||||||||||||||||||||
978 | const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x) | - | ||||||||||||||||||||||||
979 | { | - | ||||||||||||||||||||||||
980 | - | |||||||||||||||||||||||||
981 | X509_check_purpose(x, -1, -1); | - | ||||||||||||||||||||||||
982 | return executed 21 times by 1 test: x->skid;return x->skid; Executed by:
executed 21 times by 1 test: return x->skid; Executed by:
| 21 | ||||||||||||||||||||||||
983 | } | - | ||||||||||||||||||||||||
984 | - | |||||||||||||||||||||||||
985 | const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x) | - | ||||||||||||||||||||||||
986 | { | - | ||||||||||||||||||||||||
987 | - | |||||||||||||||||||||||||
988 | X509_check_purpose(x, -1, -1); | - | ||||||||||||||||||||||||
989 | return never executed: (x->akid != return (x->akid != ((void *)0) ? x->akid->keyid : ((void *)0) );
never executed: return (x->akid != ((void *)0) ? x->akid->keyid : ((void *)0) ); | 0 | ||||||||||||||||||||||||
990 | ((void *)0)
never executed: return (x->akid != ((void *)0) ? x->akid->keyid : ((void *)0) ); | 0 | ||||||||||||||||||||||||
991 | ? x->akid->keyid : never executed: return (x->akid != ((void *)0) ? x->akid->keyid : ((void *)0) ); | 0 | ||||||||||||||||||||||||
992 | ((void *)0) never executed: return (x->akid != ((void *)0) ? x->akid->keyid : ((void *)0) ); | 0 | ||||||||||||||||||||||||
993 | ); never executed: return (x->akid != ((void *)0) ? x->akid->keyid : ((void *)0) ); | 0 | ||||||||||||||||||||||||
994 | } | - | ||||||||||||||||||||||||
995 | - | |||||||||||||||||||||||||
996 | long X509_get_pathlen(X509 *x) | - | ||||||||||||||||||||||||
997 | { | - | ||||||||||||||||||||||||
998 | - | |||||||||||||||||||||||||
999 | if (X509_check_purpose(x, -1, -1) != 1
| 0-1 | ||||||||||||||||||||||||
1000 | || (
| 0-1 | ||||||||||||||||||||||||
1001 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1002 | return executed 1 time by 1 test: x->ex_pathlen;return x->ex_pathlen; Executed by:
executed 1 time by 1 test: return x->ex_pathlen; Executed by:
| 1 | ||||||||||||||||||||||||
1003 | } | - | ||||||||||||||||||||||||
1004 | - | |||||||||||||||||||||||||
1005 | long X509_get_proxy_pathlen(X509 *x) | - | ||||||||||||||||||||||||
1006 | { | - | ||||||||||||||||||||||||
1007 | - | |||||||||||||||||||||||||
1008 | if (X509_check_purpose(x, -1, -1) != 1
| 0 | ||||||||||||||||||||||||
1009 | || (
| 0 | ||||||||||||||||||||||||
1010 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1011 | return never executed: x->ex_pcpathlen;return x->ex_pcpathlen; never executed: return x->ex_pcpathlen; | 0 | ||||||||||||||||||||||||
1012 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |