Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/ts/ts_rsp_verify.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | static int TS_verify_cert(X509_STORE *store, struct stack_st_X509 *untrusted, | - | ||||||||||||||||||
6 | X509 *signer, struct stack_st_X509 **chain); | - | ||||||||||||||||||
7 | static int TS_check_signing_certs(PKCS7_SIGNER_INFO *si, struct stack_st_X509 *chain); | - | ||||||||||||||||||
8 | static ESS_SIGNING_CERT *ESS_get_signing_cert(PKCS7_SIGNER_INFO *si); | - | ||||||||||||||||||
9 | static int TS_find_cert(struct stack_st_ESS_CERT_ID *cert_ids, X509 *cert); | - | ||||||||||||||||||
10 | static int TS_issuer_serial_cmp(ESS_ISSUER_SERIAL *is, X509_CINF *cinfo); | - | ||||||||||||||||||
11 | static int int_TS_RESP_verify_token(TS_VERIFY_CTX *ctx, | - | ||||||||||||||||||
12 | PKCS7 *token, TS_TST_INFO *tst_info); | - | ||||||||||||||||||
13 | static int TS_check_status_info(TS_RESP *response); | - | ||||||||||||||||||
14 | static char *TS_get_status_text(struct stack_st_ASN1_UTF8STRING *text); | - | ||||||||||||||||||
15 | static int TS_check_policy(ASN1_OBJECT *req_oid, TS_TST_INFO *tst_info); | - | ||||||||||||||||||
16 | static int TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info, | - | ||||||||||||||||||
17 | X509_ALGOR **md_alg, | - | ||||||||||||||||||
18 | unsigned char **imprint, unsigned *imprint_len); | - | ||||||||||||||||||
19 | static int TS_check_imprints(X509_ALGOR *algor_a, | - | ||||||||||||||||||
20 | unsigned char *imprint_a, unsigned len_a, | - | ||||||||||||||||||
21 | TS_TST_INFO *tst_info); | - | ||||||||||||||||||
22 | static int TS_check_nonces(const ASN1_INTEGER *a, TS_TST_INFO *tst_info); | - | ||||||||||||||||||
23 | static int TS_check_signer_name(GENERAL_NAME *tsa_name, X509 *signer); | - | ||||||||||||||||||
24 | static int TS_find_name(struct stack_st_GENERAL_NAME *gen_names, GENERAL_NAME *name); | - | ||||||||||||||||||
25 | - | |||||||||||||||||||
26 | - | |||||||||||||||||||
27 | - | |||||||||||||||||||
28 | - | |||||||||||||||||||
29 | - | |||||||||||||||||||
30 | - | |||||||||||||||||||
31 | static const char *TS_status_text[] = { | - | ||||||||||||||||||
32 | "granted", | - | ||||||||||||||||||
33 | "grantedWithMods", | - | ||||||||||||||||||
34 | "rejection", | - | ||||||||||||||||||
35 | "waiting", | - | ||||||||||||||||||
36 | "revocationWarning", | - | ||||||||||||||||||
37 | "revocationNotification" | - | ||||||||||||||||||
38 | }; | - | ||||||||||||||||||
39 | static struct { | - | ||||||||||||||||||
40 | int code; | - | ||||||||||||||||||
41 | const char *text; | - | ||||||||||||||||||
42 | } TS_failure_info[] = { | - | ||||||||||||||||||
43 | { 0, "badAlg" }, | - | ||||||||||||||||||
44 | { 2, "badRequest" }, | - | ||||||||||||||||||
45 | { 5, "badDataFormat" }, | - | ||||||||||||||||||
46 | { 14, "timeNotAvailable" }, | - | ||||||||||||||||||
47 | { 15, "unacceptedPolicy" }, | - | ||||||||||||||||||
48 | { 16, "unacceptedExtension" }, | - | ||||||||||||||||||
49 | { 17, "addInfoNotAvailable" }, | - | ||||||||||||||||||
50 | { 25, "systemFailure" } | - | ||||||||||||||||||
51 | }; | - | ||||||||||||||||||
52 | int | - | ||||||||||||||||||
53 | TS_RESP_verify_signature(PKCS7 *token, struct stack_st_X509 *certs, | - | ||||||||||||||||||
54 | X509_STORE *store, X509 **signer_out) | - | ||||||||||||||||||
55 | { | - | ||||||||||||||||||
56 | struct stack_st_PKCS7_SIGNER_INFO *sinfos = | - | ||||||||||||||||||
57 | ((void *)0) | - | ||||||||||||||||||
58 | ; | - | ||||||||||||||||||
59 | PKCS7_SIGNER_INFO *si; | - | ||||||||||||||||||
60 | struct stack_st_X509 *signers = | - | ||||||||||||||||||
61 | ((void *)0) | - | ||||||||||||||||||
62 | ; | - | ||||||||||||||||||
63 | X509 *signer; | - | ||||||||||||||||||
64 | struct stack_st_X509 *chain = | - | ||||||||||||||||||
65 | ((void *)0) | - | ||||||||||||||||||
66 | ; | - | ||||||||||||||||||
67 | char buf[4096]; | - | ||||||||||||||||||
68 | int i, j = 0, ret = 0; | - | ||||||||||||||||||
69 | BIO *p7bio = | - | ||||||||||||||||||
70 | ((void *)0) | - | ||||||||||||||||||
71 | ; | - | ||||||||||||||||||
72 | - | |||||||||||||||||||
73 | - | |||||||||||||||||||
74 | if (!token
| 0 | ||||||||||||||||||
75 | ERR_put_error(47,(0xfff),(102),__FILE__,158); | - | ||||||||||||||||||
76 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
77 | } | - | ||||||||||||||||||
78 | - | |||||||||||||||||||
79 | - | |||||||||||||||||||
80 | if (!(OBJ_obj2nid((token)->type) == 22)
| 0 | ||||||||||||||||||
81 | ERR_put_error(47,(0xfff),(114),__FILE__,164); | - | ||||||||||||||||||
82 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
83 | } | - | ||||||||||||||||||
84 | - | |||||||||||||||||||
85 | - | |||||||||||||||||||
86 | sinfos = PKCS7_get_signer_info(token); | - | ||||||||||||||||||
87 | if (!sinfos
| 0 | ||||||||||||||||||
88 | ERR_put_error(47,(0xfff),(110),__FILE__,171); | - | ||||||||||||||||||
89 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
90 | } | - | ||||||||||||||||||
91 | si = ((PKCS7_SIGNER_INFO *)sk_value(((_STACK*) (1 ? (sinfos) : (struct stack_st_PKCS7_SIGNER_INFO*)0)), (0))); | - | ||||||||||||||||||
92 | - | |||||||||||||||||||
93 | - | |||||||||||||||||||
94 | if (PKCS7_ctrl(token,2,0,
| 0 | ||||||||||||||||||
95 | ((void *)0)
| 0 | ||||||||||||||||||
96 | )
| 0 | ||||||||||||||||||
97 | ERR_put_error(47,(0xfff),(106),__FILE__,178); | - | ||||||||||||||||||
98 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
99 | } | - | ||||||||||||||||||
100 | - | |||||||||||||||||||
101 | - | |||||||||||||||||||
102 | - | |||||||||||||||||||
103 | signers = PKCS7_get0_signers(token, certs, 0); | - | ||||||||||||||||||
104 | if (!signers
| 0 | ||||||||||||||||||
105 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
106 | signer = ((X509 *)sk_value(((_STACK*) (1 ? (signers) : (struct stack_st_X509*)0)), (0))); | - | ||||||||||||||||||
107 | - | |||||||||||||||||||
108 | - | |||||||||||||||||||
109 | if (!TS_verify_cert(store, certs, signer, &chain)
| 0 | ||||||||||||||||||
110 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
111 | - | |||||||||||||||||||
112 | - | |||||||||||||||||||
113 | - | |||||||||||||||||||
114 | if (!TS_check_signing_certs(si, chain)
| 0 | ||||||||||||||||||
115 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
116 | - | |||||||||||||||||||
117 | - | |||||||||||||||||||
118 | p7bio = PKCS7_dataInit(token, | - | ||||||||||||||||||
119 | ((void *)0) | - | ||||||||||||||||||
120 | ); | - | ||||||||||||||||||
121 | - | |||||||||||||||||||
122 | - | |||||||||||||||||||
123 | while ((
| 0 | ||||||||||||||||||
124 | ; never executed: ; | 0 | ||||||||||||||||||
125 | - | |||||||||||||||||||
126 | - | |||||||||||||||||||
127 | j = PKCS7_signatureVerify(p7bio, token, si, signer); | - | ||||||||||||||||||
128 | if (j <= 0
| 0 | ||||||||||||||||||
129 | ERR_put_error(47,(0xfff),(109),__FILE__,208); | - | ||||||||||||||||||
130 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
131 | } | - | ||||||||||||||||||
132 | - | |||||||||||||||||||
133 | - | |||||||||||||||||||
134 | if (signer_out
| 0 | ||||||||||||||||||
135 | *signer_out = signer; | - | ||||||||||||||||||
136 | CRYPTO_add_lock(&signer->references,1,3,__FILE__,215); | - | ||||||||||||||||||
137 | } never executed: end of block | 0 | ||||||||||||||||||
138 | - | |||||||||||||||||||
139 | ret = 1; | - | ||||||||||||||||||
140 | - | |||||||||||||||||||
141 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||
142 | BIO_free_all(p7bio); | - | ||||||||||||||||||
143 | sk_pop_free(((_STACK*) (1 ? (chain) : (struct stack_st_X509*)0)), ((void (*)(void *)) ((1 ? (X509_free) : (void (*)(X509 *))0)))); | - | ||||||||||||||||||
144 | sk_free(((_STACK*) (1 ? (signers) : (struct stack_st_X509*)0))); | - | ||||||||||||||||||
145 | - | |||||||||||||||||||
146 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
147 | } | - | ||||||||||||||||||
148 | - | |||||||||||||||||||
149 | - | |||||||||||||||||||
150 | - | |||||||||||||||||||
151 | - | |||||||||||||||||||
152 | - | |||||||||||||||||||
153 | static int | - | ||||||||||||||||||
154 | TS_verify_cert(X509_STORE *store, struct stack_st_X509 *untrusted, X509 *signer, | - | ||||||||||||||||||
155 | struct stack_st_X509 **chain) | - | ||||||||||||||||||
156 | { | - | ||||||||||||||||||
157 | X509_STORE_CTX cert_ctx; | - | ||||||||||||||||||
158 | int i; | - | ||||||||||||||||||
159 | int ret = 0; | - | ||||||||||||||||||
160 | - | |||||||||||||||||||
161 | - | |||||||||||||||||||
162 | *chain = | - | ||||||||||||||||||
163 | ((void *)0) | - | ||||||||||||||||||
164 | ; | - | ||||||||||||||||||
165 | if (X509_STORE_CTX_init(&cert_ctx, store, signer, untrusted) == 0
| 0 | ||||||||||||||||||
166 | ERR_put_error(47,(0xfff),(11),__FILE__,243); | - | ||||||||||||||||||
167 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
168 | } | - | ||||||||||||||||||
169 | if (X509_STORE_CTX_set_purpose(&cert_ctx,
| 0 | ||||||||||||||||||
170 | 9) == 0
| 0 | ||||||||||||||||||
171 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
172 | i = X509_verify_cert(&cert_ctx); | - | ||||||||||||||||||
173 | if (i <= 0
| 0 | ||||||||||||||||||
174 | int j = X509_STORE_CTX_get_error(&cert_ctx); | - | ||||||||||||||||||
175 | - | |||||||||||||||||||
176 | ERR_put_error(47,(0xfff),(100),__FILE__,253); | - | ||||||||||||||||||
177 | ERR_asprintf_error_data("Verify error:%s", | - | ||||||||||||||||||
178 | X509_verify_cert_error_string(j)); | - | ||||||||||||||||||
179 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
180 | } else { | - | ||||||||||||||||||
181 | - | |||||||||||||||||||
182 | *chain = X509_STORE_CTX_get1_chain(&cert_ctx); | - | ||||||||||||||||||
183 | ret = 1; | - | ||||||||||||||||||
184 | } never executed: end of block | 0 | ||||||||||||||||||
185 | - | |||||||||||||||||||
186 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||
187 | X509_STORE_CTX_cleanup(&cert_ctx); | - | ||||||||||||||||||
188 | - | |||||||||||||||||||
189 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
190 | } | - | ||||||||||||||||||
191 | - | |||||||||||||||||||
192 | static int | - | ||||||||||||||||||
193 | TS_check_signing_certs(PKCS7_SIGNER_INFO *si, struct stack_st_X509 *chain) | - | ||||||||||||||||||
194 | { | - | ||||||||||||||||||
195 | ESS_SIGNING_CERT *ss = ESS_get_signing_cert(si); | - | ||||||||||||||||||
196 | struct stack_st_ESS_CERT_ID *cert_ids = | - | ||||||||||||||||||
197 | ((void *)0) | - | ||||||||||||||||||
198 | ; | - | ||||||||||||||||||
199 | X509 *cert; | - | ||||||||||||||||||
200 | int i = 0; | - | ||||||||||||||||||
201 | int ret = 0; | - | ||||||||||||||||||
202 | - | |||||||||||||||||||
203 | if (!ss
| 0 | ||||||||||||||||||
204 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
205 | cert_ids = ss->cert_ids; | - | ||||||||||||||||||
206 | - | |||||||||||||||||||
207 | cert = ((X509 *)sk_value(((_STACK*) (1 ? (chain) : (struct stack_st_X509*)0)), (0))); | - | ||||||||||||||||||
208 | if (TS_find_cert(cert_ids, cert) != 0
| 0 | ||||||||||||||||||
209 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
210 | - | |||||||||||||||||||
211 | - | |||||||||||||||||||
212 | - | |||||||||||||||||||
213 | if (sk_num(((_STACK*) (1 ? (cert_ids) : (struct stack_st_ESS_CERT_ID*)0))) > 1
| 0 | ||||||||||||||||||
214 | - | |||||||||||||||||||
215 | for (i = 1; i < sk_num(((_STACK*) (1 ? (chain) : (struct stack_st_X509*)0)))
| 0 | ||||||||||||||||||
216 | cert = ((X509 *)sk_value(((_STACK*) (1 ? (chain) : (struct stack_st_X509*)0)), (i))); | - | ||||||||||||||||||
217 | if (TS_find_cert(cert_ids, cert) < 0
| 0 | ||||||||||||||||||
218 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
219 | } never executed: end of block | 0 | ||||||||||||||||||
220 | } never executed: end of block | 0 | ||||||||||||||||||
221 | ret = 1; | - | ||||||||||||||||||
222 | - | |||||||||||||||||||
223 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||
224 | if (!ret
| 0 | ||||||||||||||||||
225 | ERR_put_error(47,(0xfff),(101),__FILE__,300); never executed: ERR_put_error(47,(0xfff),(101),__FILE__,300); | 0 | ||||||||||||||||||
226 | ESS_SIGNING_CERT_free(ss); | - | ||||||||||||||||||
227 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
228 | } | - | ||||||||||||||||||
229 | - | |||||||||||||||||||
230 | static ESS_SIGNING_CERT * | - | ||||||||||||||||||
231 | ESS_get_signing_cert(PKCS7_SIGNER_INFO *si) | - | ||||||||||||||||||
232 | { | - | ||||||||||||||||||
233 | ASN1_TYPE *attr; | - | ||||||||||||||||||
234 | const unsigned char *p; | - | ||||||||||||||||||
235 | - | |||||||||||||||||||
236 | attr = PKCS7_get_signed_attribute(si, | - | ||||||||||||||||||
237 | 223); | - | ||||||||||||||||||
238 | if (!attr
| 0 | ||||||||||||||||||
239 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
240 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
241 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
242 | if (attr->type != 16
| 0 | ||||||||||||||||||
243 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
244 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
245 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
246 | p = attr->value.sequence->data; | - | ||||||||||||||||||
247 | return never executed: d2i_ESS_SIGNING_CERT(return d2i_ESS_SIGNING_CERT( ((void *)0) , &p, attr->value.sequence->length); never executed: return d2i_ESS_SIGNING_CERT( ((void *)0) , &p, attr->value.sequence->length); | 0 | ||||||||||||||||||
248 | ((void *)0) never executed: return d2i_ESS_SIGNING_CERT( ((void *)0) , &p, attr->value.sequence->length); | 0 | ||||||||||||||||||
249 | , &p, attr->value.sequence->length); never executed: return d2i_ESS_SIGNING_CERT( ((void *)0) , &p, attr->value.sequence->length); | 0 | ||||||||||||||||||
250 | } | - | ||||||||||||||||||
251 | - | |||||||||||||||||||
252 | - | |||||||||||||||||||
253 | static int | - | ||||||||||||||||||
254 | TS_find_cert(struct stack_st_ESS_CERT_ID *cert_ids, X509 *cert) | - | ||||||||||||||||||
255 | { | - | ||||||||||||||||||
256 | int i; | - | ||||||||||||||||||
257 | - | |||||||||||||||||||
258 | if (!cert_ids
| 0 | ||||||||||||||||||
259 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
260 | - | |||||||||||||||||||
261 | - | |||||||||||||||||||
262 | X509_check_purpose(cert, -1, 0); | - | ||||||||||||||||||
263 | - | |||||||||||||||||||
264 | - | |||||||||||||||||||
265 | for (i = 0; i < sk_num(((_STACK*) (1 ? (cert_ids) : (struct stack_st_ESS_CERT_ID*)0)))
| 0 | ||||||||||||||||||
266 | ESS_CERT_ID *cid = ((ESS_CERT_ID *)sk_value(((_STACK*) (1 ? (cert_ids) : (struct stack_st_ESS_CERT_ID*)0)), (i))); | - | ||||||||||||||||||
267 | - | |||||||||||||||||||
268 | - | |||||||||||||||||||
269 | if (cid->hash->length == sizeof(cert->sha1_hash)
| 0 | ||||||||||||||||||
270 | !memcmp(cid->hash->data, cert->sha1_hash,
| 0 | ||||||||||||||||||
271 | sizeof(cert->sha1_hash))
| 0 | ||||||||||||||||||
272 | - | |||||||||||||||||||
273 | ESS_ISSUER_SERIAL *is = cid->issuer_serial; | - | ||||||||||||||||||
274 | if (!is
| 0 | ||||||||||||||||||
275 | return never executed: i;return i; never executed: return i; | 0 | ||||||||||||||||||
276 | } never executed: end of block | 0 | ||||||||||||||||||
277 | } never executed: end of block | 0 | ||||||||||||||||||
278 | - | |||||||||||||||||||
279 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
280 | } | - | ||||||||||||||||||
281 | - | |||||||||||||||||||
282 | static int | - | ||||||||||||||||||
283 | TS_issuer_serial_cmp(ESS_ISSUER_SERIAL *is, X509_CINF *cinfo) | - | ||||||||||||||||||
284 | { | - | ||||||||||||||||||
285 | GENERAL_NAME *issuer; | - | ||||||||||||||||||
286 | - | |||||||||||||||||||
287 | if (!is
| 0 | ||||||||||||||||||
288 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
289 | - | |||||||||||||||||||
290 | - | |||||||||||||||||||
291 | issuer = ((GENERAL_NAME *)sk_value(((_STACK*) (1 ? (is->issuer) : (struct stack_st_GENERAL_NAME*)0)), (0))); | - | ||||||||||||||||||
292 | if (issuer->type != 4
| 0 | ||||||||||||||||||
293 | X509_NAME_cmp(issuer->d.dirn, cinfo->issuer)
| 0 | ||||||||||||||||||
294 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
295 | - | |||||||||||||||||||
296 | - | |||||||||||||||||||
297 | if (ASN1_INTEGER_cmp(is->serial, cinfo->serialNumber)
| 0 | ||||||||||||||||||
298 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
299 | - | |||||||||||||||||||
300 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
301 | } | - | ||||||||||||||||||
302 | - | |||||||||||||||||||
303 | - | |||||||||||||||||||
304 | - | |||||||||||||||||||
305 | - | |||||||||||||||||||
306 | - | |||||||||||||||||||
307 | - | |||||||||||||||||||
308 | - | |||||||||||||||||||
309 | int | - | ||||||||||||||||||
310 | TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response) | - | ||||||||||||||||||
311 | { | - | ||||||||||||||||||
312 | PKCS7 *token = TS_RESP_get_token(response); | - | ||||||||||||||||||
313 | TS_TST_INFO *tst_info = TS_RESP_get_tst_info(response); | - | ||||||||||||||||||
314 | int ret = 0; | - | ||||||||||||||||||
315 | - | |||||||||||||||||||
316 | - | |||||||||||||||||||
317 | if (!TS_check_status_info(response)
| 0 | ||||||||||||||||||
318 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
319 | - | |||||||||||||||||||
320 | - | |||||||||||||||||||
321 | if (!int_TS_RESP_verify_token(ctx, token, tst_info)
| 0 | ||||||||||||||||||
322 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
323 | - | |||||||||||||||||||
324 | ret = 1; | - | ||||||||||||||||||
325 | - | |||||||||||||||||||
326 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||
327 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
328 | } | - | ||||||||||||||||||
329 | - | |||||||||||||||||||
330 | - | |||||||||||||||||||
331 | - | |||||||||||||||||||
332 | - | |||||||||||||||||||
333 | - | |||||||||||||||||||
334 | int | - | ||||||||||||||||||
335 | TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token) | - | ||||||||||||||||||
336 | { | - | ||||||||||||||||||
337 | TS_TST_INFO *tst_info = PKCS7_to_TS_TST_INFO(token); | - | ||||||||||||||||||
338 | int ret = 0; | - | ||||||||||||||||||
339 | - | |||||||||||||||||||
340 | if (tst_info
| 0 | ||||||||||||||||||
341 | ret = int_TS_RESP_verify_token(ctx, token, tst_info); | - | ||||||||||||||||||
342 | TS_TST_INFO_free(tst_info); | - | ||||||||||||||||||
343 | } never executed: end of block | 0 | ||||||||||||||||||
344 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
345 | } | - | ||||||||||||||||||
346 | static int | - | ||||||||||||||||||
347 | int_TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token, | - | ||||||||||||||||||
348 | TS_TST_INFO *tst_info) | - | ||||||||||||||||||
349 | { | - | ||||||||||||||||||
350 | X509 *signer = | - | ||||||||||||||||||
351 | ((void *)0) | - | ||||||||||||||||||
352 | ; | - | ||||||||||||||||||
353 | GENERAL_NAME *tsa_name = TS_TST_INFO_get_tsa(tst_info); | - | ||||||||||||||||||
354 | X509_ALGOR *md_alg = | - | ||||||||||||||||||
355 | ((void *)0) | - | ||||||||||||||||||
356 | ; | - | ||||||||||||||||||
357 | unsigned char *imprint = | - | ||||||||||||||||||
358 | ((void *)0) | - | ||||||||||||||||||
359 | ; | - | ||||||||||||||||||
360 | unsigned imprint_len = 0; | - | ||||||||||||||||||
361 | int ret = 0; | - | ||||||||||||||||||
362 | - | |||||||||||||||||||
363 | - | |||||||||||||||||||
364 | if ((
| 0 | ||||||||||||||||||
365 | !TS_RESP_verify_signature(token, ctx->certs, ctx->store, &signer)
| 0 | ||||||||||||||||||
366 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
367 | - | |||||||||||||||||||
368 | - | |||||||||||||||||||
369 | if ((
| 0 | ||||||||||||||||||
370 | TS_TST_INFO_get_version(tst_info) != 1
| 0 | ||||||||||||||||||
371 | ERR_put_error(47,(0xfff),(113),__FILE__,447); | - | ||||||||||||||||||
372 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
373 | } | - | ||||||||||||||||||
374 | - | |||||||||||||||||||
375 | - | |||||||||||||||||||
376 | if ((
| 0 | ||||||||||||||||||
377 | !TS_check_policy(ctx->policy, tst_info)
| 0 | ||||||||||||||||||
378 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
379 | - | |||||||||||||||||||
380 | - | |||||||||||||||||||
381 | if ((
| 0 | ||||||||||||||||||
382 | !TS_check_imprints(ctx->md_alg, ctx->imprint, ctx->imprint_len,
| 0 | ||||||||||||||||||
383 | tst_info)
| 0 | ||||||||||||||||||
384 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
385 | - | |||||||||||||||||||
386 | - | |||||||||||||||||||
387 | if ((
| 0 | ||||||||||||||||||
388 | (!TS_compute_imprint(ctx->data, tst_info,
| 0 | ||||||||||||||||||
389 | &md_alg, &imprint, &imprint_len)
| 0 | ||||||||||||||||||
390 | !TS_check_imprints(md_alg, imprint, imprint_len, tst_info)
| 0 | ||||||||||||||||||
391 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
392 | - | |||||||||||||||||||
393 | - | |||||||||||||||||||
394 | if ((
| 0 | ||||||||||||||||||
395 | !TS_check_nonces(ctx->nonce, tst_info)
| 0 | ||||||||||||||||||
396 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
397 | - | |||||||||||||||||||
398 | - | |||||||||||||||||||
399 | if ((
| 0 | ||||||||||||||||||
400 | tsa_name
| 0 | ||||||||||||||||||
401 | ERR_put_error(47,(0xfff),(111),__FILE__,477); | - | ||||||||||||||||||
402 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
403 | } | - | ||||||||||||||||||
404 | - | |||||||||||||||||||
405 | - | |||||||||||||||||||
406 | if ((
| 0 | ||||||||||||||||||
407 | !TS_check_signer_name(ctx->tsa_name, signer)
| 0 | ||||||||||||||||||
408 | ERR_put_error(47,(0xfff),(112),__FILE__,484); | - | ||||||||||||||||||
409 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
410 | } | - | ||||||||||||||||||
411 | - | |||||||||||||||||||
412 | ret = 1; | - | ||||||||||||||||||
413 | - | |||||||||||||||||||
414 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||
415 | X509_free(signer); | - | ||||||||||||||||||
416 | X509_ALGOR_free(md_alg); | - | ||||||||||||||||||
417 | free(imprint); | - | ||||||||||||||||||
418 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
419 | } | - | ||||||||||||||||||
420 | - | |||||||||||||||||||
421 | static int | - | ||||||||||||||||||
422 | TS_check_status_info(TS_RESP *response) | - | ||||||||||||||||||
423 | { | - | ||||||||||||||||||
424 | TS_STATUS_INFO *info = TS_RESP_get_status_info(response); | - | ||||||||||||||||||
425 | long status = ASN1_INTEGER_get(info->status); | - | ||||||||||||||||||
426 | const char *status_text = | - | ||||||||||||||||||
427 | ((void *)0) | - | ||||||||||||||||||
428 | ; | - | ||||||||||||||||||
429 | char *embedded_status_text = | - | ||||||||||||||||||
430 | ((void *)0) | - | ||||||||||||||||||
431 | ; | - | ||||||||||||||||||
432 | char failure_text[256] = ""; | - | ||||||||||||||||||
433 | - | |||||||||||||||||||
434 | - | |||||||||||||||||||
435 | if (status == 0
| 0 | ||||||||||||||||||
436 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
437 | - | |||||||||||||||||||
438 | - | |||||||||||||||||||
439 | if (0 <= status
| 0 | ||||||||||||||||||
440 | status_text = TS_status_text[status]; never executed: status_text = TS_status_text[status]; | 0 | ||||||||||||||||||
441 | else | - | ||||||||||||||||||
442 | status_text = "unknown code"; never executed: status_text = "unknown code"; | 0 | ||||||||||||||||||
443 | - | |||||||||||||||||||
444 | - | |||||||||||||||||||
445 | if (sk_num(((_STACK*) (1 ? (info->text) : (struct stack_st_ASN1_UTF8STRING*)0))) > 0
| 0 | ||||||||||||||||||
446 | !(embedded_status_text = TS_get_status_text(info->text))
| 0 | ||||||||||||||||||
447 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
448 | - | |||||||||||||||||||
449 | - | |||||||||||||||||||
450 | if (info->failure_info
| 0 | ||||||||||||||||||
451 | int i; | - | ||||||||||||||||||
452 | int first = 1; | - | ||||||||||||||||||
453 | for (i = 0; i < (int)(sizeof(TS_failure_info) / sizeof(*TS_failure_info))
| 0 | ||||||||||||||||||
454 | if (ASN1_BIT_STRING_get_bit(info->failure_info,
| 0 | ||||||||||||||||||
455 | TS_failure_info[i].code)
| 0 | ||||||||||||||||||
456 | if (!first
| 0 | ||||||||||||||||||
457 | strlcat(failure_text, ",", never executed: strlcat(failure_text, ",", 256); | 0 | ||||||||||||||||||
458 | 256); never executed: strlcat(failure_text, ",", 256); | 0 | ||||||||||||||||||
459 | else | - | ||||||||||||||||||
460 | first = 0; never executed: first = 0; | 0 | ||||||||||||||||||
461 | strlcat(failure_text, TS_failure_info[i].text, | - | ||||||||||||||||||
462 | 256); | - | ||||||||||||||||||
463 | } never executed: end of block | 0 | ||||||||||||||||||
464 | } never executed: end of block | 0 | ||||||||||||||||||
465 | } never executed: end of block | 0 | ||||||||||||||||||
466 | if (failure_text[0] == '\0'
| 0 | ||||||||||||||||||
467 | strlcpy(failure_text, "unspecified", 256); never executed: strlcpy(failure_text, "unspecified", 256); | 0 | ||||||||||||||||||
468 | - | |||||||||||||||||||
469 | - | |||||||||||||||||||
470 | ERR_put_error(47,(0xfff),(107),__FILE__,542); | - | ||||||||||||||||||
471 | ERR_asprintf_error_data | - | ||||||||||||||||||
472 | ("status code: %s, status text: %s, failure codes: %s", | - | ||||||||||||||||||
473 | status_text, | - | ||||||||||||||||||
474 | embedded_status_text ? embedded_status_text : "unspecified", | - | ||||||||||||||||||
475 | failure_text); | - | ||||||||||||||||||
476 | free(embedded_status_text); | - | ||||||||||||||||||
477 | - | |||||||||||||||||||
478 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
479 | } | - | ||||||||||||||||||
480 | - | |||||||||||||||||||
481 | static char * | - | ||||||||||||||||||
482 | TS_get_status_text(struct stack_st_ASN1_UTF8STRING *text) | - | ||||||||||||||||||
483 | { | - | ||||||||||||||||||
484 | int i; | - | ||||||||||||||||||
485 | unsigned int length = 0; | - | ||||||||||||||||||
486 | char *result = | - | ||||||||||||||||||
487 | ((void *)0) | - | ||||||||||||||||||
488 | ; | - | ||||||||||||||||||
489 | - | |||||||||||||||||||
490 | - | |||||||||||||||||||
491 | for (i = 0; i < sk_num(((_STACK*) (1 ? (text) : (struct stack_st_ASN1_UTF8STRING*)0)))
| 0 | ||||||||||||||||||
492 | ASN1_UTF8STRING *current = ((ASN1_UTF8STRING *)sk_value(((_STACK*) (1 ? (text) : (struct stack_st_ASN1_UTF8STRING*)0)), (i))); | - | ||||||||||||||||||
493 | length += ASN1_STRING_length(current); | - | ||||||||||||||||||
494 | length += 1; | - | ||||||||||||||||||
495 | } never executed: end of block | 0 | ||||||||||||||||||
496 | - | |||||||||||||||||||
497 | if (!(result = malloc(length))
| 0 | ||||||||||||||||||
498 | ERR_put_error(47,(0xfff),((1|64)),__FILE__,568); | - | ||||||||||||||||||
499 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
500 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
501 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
502 | } | - | ||||||||||||||||||
503 | - | |||||||||||||||||||
504 | result[0] = '\0'; | - | ||||||||||||||||||
505 | for (i = 0; i < sk_num(((_STACK*) (1 ? (text) : (struct stack_st_ASN1_UTF8STRING*)0)))
| 0 | ||||||||||||||||||
506 | ASN1_UTF8STRING *current = ((ASN1_UTF8STRING *)sk_value(((_STACK*) (1 ? (text) : (struct stack_st_ASN1_UTF8STRING*)0)), (i))); | - | ||||||||||||||||||
507 | if (i > 0
| 0 | ||||||||||||||||||
508 | strlcat(result, "/", length); never executed: strlcat(result, "/", length); | 0 | ||||||||||||||||||
509 | strlcat(result, (const char *)ASN1_STRING_data(current), length); | - | ||||||||||||||||||
510 | } never executed: end of block | 0 | ||||||||||||||||||
511 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||
512 | } | - | ||||||||||||||||||
513 | - | |||||||||||||||||||
514 | static int | - | ||||||||||||||||||
515 | TS_check_policy(ASN1_OBJECT *req_oid, TS_TST_INFO *tst_info) | - | ||||||||||||||||||
516 | { | - | ||||||||||||||||||
517 | ASN1_OBJECT *resp_oid = TS_TST_INFO_get_policy_id(tst_info); | - | ||||||||||||||||||
518 | - | |||||||||||||||||||
519 | if (OBJ_cmp(req_oid, resp_oid) != 0
| 0 | ||||||||||||||||||
520 | ERR_put_error(47,(0xfff),(108),__FILE__,588); | - | ||||||||||||||||||
521 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
522 | } | - | ||||||||||||||||||
523 | - | |||||||||||||||||||
524 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
525 | } | - | ||||||||||||||||||
526 | - | |||||||||||||||||||
527 | static int | - | ||||||||||||||||||
528 | TS_compute_imprint(BIO *data, TS_TST_INFO *tst_info, X509_ALGOR **md_alg, | - | ||||||||||||||||||
529 | unsigned char **imprint, unsigned *imprint_len) | - | ||||||||||||||||||
530 | { | - | ||||||||||||||||||
531 | TS_MSG_IMPRINT *msg_imprint = TS_TST_INFO_get_msg_imprint(tst_info); | - | ||||||||||||||||||
532 | X509_ALGOR *md_alg_resp = TS_MSG_IMPRINT_get_algo(msg_imprint); | - | ||||||||||||||||||
533 | const EVP_MD *md; | - | ||||||||||||||||||
534 | EVP_MD_CTX md_ctx; | - | ||||||||||||||||||
535 | unsigned char buffer[4096]; | - | ||||||||||||||||||
536 | int length; | - | ||||||||||||||||||
537 | - | |||||||||||||||||||
538 | *md_alg = | - | ||||||||||||||||||
539 | ((void *)0) | - | ||||||||||||||||||
540 | ; | - | ||||||||||||||||||
541 | *imprint = | - | ||||||||||||||||||
542 | ((void *)0) | - | ||||||||||||||||||
543 | ; | - | ||||||||||||||||||
544 | - | |||||||||||||||||||
545 | - | |||||||||||||||||||
546 | if (!(*md_alg = X509_ALGOR_dup(md_alg_resp))
| 0 | ||||||||||||||||||
547 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
548 | - | |||||||||||||||||||
549 | - | |||||||||||||||||||
550 | if (!(md = EVP_get_digestbyname(OBJ_nid2sn(OBJ_obj2nid((*md_alg)->algorithm))))
| 0 | ||||||||||||||||||
551 | ERR_put_error(47,(0xfff),(126),__FILE__,615); | - | ||||||||||||||||||
552 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
553 | } | - | ||||||||||||||||||
554 | - | |||||||||||||||||||
555 | - | |||||||||||||||||||
556 | length = EVP_MD_size(md); | - | ||||||||||||||||||
557 | if (length < 0
| 0 | ||||||||||||||||||
558 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
559 | *imprint_len = length; | - | ||||||||||||||||||
560 | if (!(*imprint = malloc(*imprint_len))
| 0 | ||||||||||||||||||
561 | ERR_put_error(47,(0xfff),((1|64)),__FILE__,625); | - | ||||||||||||||||||
562 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
563 | } | - | ||||||||||||||||||
564 | - | |||||||||||||||||||
565 | if (!EVP_DigestInit(&md_ctx, md)
| 0 | ||||||||||||||||||
566 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
567 | while ((
| 0 | ||||||||||||||||||
568 | if (!EVP_DigestUpdate(&md_ctx, buffer, length)
| 0 | ||||||||||||||||||
569 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
570 | } never executed: end of block | 0 | ||||||||||||||||||
571 | if (!EVP_DigestFinal(&md_ctx, *imprint,
| 0 | ||||||||||||||||||
572 | ((void *)0)
| 0 | ||||||||||||||||||
573 | )
| 0 | ||||||||||||||||||
574 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
575 | - | |||||||||||||||||||
576 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
577 | - | |||||||||||||||||||
578 | err: | - | ||||||||||||||||||
579 | X509_ALGOR_free(*md_alg); | - | ||||||||||||||||||
580 | free(*imprint); | - | ||||||||||||||||||
581 | *imprint = | - | ||||||||||||||||||
582 | ((void *)0) | - | ||||||||||||||||||
583 | ; | - | ||||||||||||||||||
584 | *imprint_len = 0; | - | ||||||||||||||||||
585 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
586 | } | - | ||||||||||||||||||
587 | - | |||||||||||||||||||
588 | static int | - | ||||||||||||||||||
589 | TS_check_imprints(X509_ALGOR *algor_a, unsigned char *imprint_a, unsigned len_a, | - | ||||||||||||||||||
590 | TS_TST_INFO *tst_info) | - | ||||||||||||||||||
591 | { | - | ||||||||||||||||||
592 | TS_MSG_IMPRINT *b = TS_TST_INFO_get_msg_imprint(tst_info); | - | ||||||||||||||||||
593 | X509_ALGOR *algor_b = TS_MSG_IMPRINT_get_algo(b); | - | ||||||||||||||||||
594 | int ret = 0; | - | ||||||||||||||||||
595 | - | |||||||||||||||||||
596 | - | |||||||||||||||||||
597 | if (algor_a
| 0 | ||||||||||||||||||
598 | - | |||||||||||||||||||
599 | if (OBJ_cmp(algor_a->algorithm, algor_b->algorithm)
| 0 | ||||||||||||||||||
600 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
601 | - | |||||||||||||||||||
602 | - | |||||||||||||||||||
603 | if ((algor_a->parameter
| 0 | ||||||||||||||||||
604 | ASN1_TYPE_get(algor_a->parameter) != 5
| 0 | ||||||||||||||||||
605 | (algor_b->parameter
| 0 | ||||||||||||||||||
606 | ASN1_TYPE_get(algor_b->parameter) != 5
| 0 | ||||||||||||||||||
607 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
608 | } never executed: end of block | 0 | ||||||||||||||||||
609 | - | |||||||||||||||||||
610 | - | |||||||||||||||||||
611 | ret = len_a == (unsigned) ASN1_STRING_length(b->hashed_msg)
| 0 | ||||||||||||||||||
612 | memcmp(imprint_a, ASN1_STRING_data(b->hashed_msg), len_a) == 0
| 0 | ||||||||||||||||||
613 | - | |||||||||||||||||||
614 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||
615 | if (!ret
| 0 | ||||||||||||||||||
616 | ERR_put_error(47,(0xfff),(103),__FILE__,676); never executed: ERR_put_error(47,(0xfff),(103),__FILE__,676); | 0 | ||||||||||||||||||
617 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
618 | } | - | ||||||||||||||||||
619 | - | |||||||||||||||||||
620 | static int | - | ||||||||||||||||||
621 | TS_check_nonces(const ASN1_INTEGER *a, TS_TST_INFO *tst_info) | - | ||||||||||||||||||
622 | { | - | ||||||||||||||||||
623 | const ASN1_INTEGER *b = TS_TST_INFO_get_nonce(tst_info); | - | ||||||||||||||||||
624 | - | |||||||||||||||||||
625 | - | |||||||||||||||||||
626 | if (!b
| 0 | ||||||||||||||||||
627 | ERR_put_error(47,(0xfff),(105),__FILE__,687); | - | ||||||||||||||||||
628 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
629 | } | - | ||||||||||||||||||
630 | - | |||||||||||||||||||
631 | - | |||||||||||||||||||
632 | if (ASN1_INTEGER_cmp(a, b) != 0
| 0 | ||||||||||||||||||
633 | ERR_put_error(47,(0xfff),(104),__FILE__,693); | - | ||||||||||||||||||
634 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
635 | } | - | ||||||||||||||||||
636 | - | |||||||||||||||||||
637 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
638 | } | - | ||||||||||||||||||
639 | - | |||||||||||||||||||
640 | - | |||||||||||||||||||
641 | - | |||||||||||||||||||
642 | static int | - | ||||||||||||||||||
643 | TS_check_signer_name(GENERAL_NAME *tsa_name, X509 *signer) | - | ||||||||||||||||||
644 | { | - | ||||||||||||||||||
645 | struct stack_st_GENERAL_NAME *gen_names = | - | ||||||||||||||||||
646 | ((void *)0) | - | ||||||||||||||||||
647 | ; | - | ||||||||||||||||||
648 | int idx = -1; | - | ||||||||||||||||||
649 | int found = 0; | - | ||||||||||||||||||
650 | - | |||||||||||||||||||
651 | if (signer ==
| 0 | ||||||||||||||||||
652 | ((void *)0)
| 0 | ||||||||||||||||||
653 | ) | - | ||||||||||||||||||
654 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
655 | - | |||||||||||||||||||
656 | - | |||||||||||||||||||
657 | if (tsa_name->type == 4
| 0 | ||||||||||||||||||
658 | X509_NAME_cmp((tsa_name->d.dirn),(signer->cert_info->subject)) == 0
| 0 | ||||||||||||||||||
659 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
660 | - | |||||||||||||||||||
661 | - | |||||||||||||||||||
662 | gen_names = X509_get_ext_d2i(signer, 85, | - | ||||||||||||||||||
663 | - | |||||||||||||||||||
664 | ((void *)0) | - | ||||||||||||||||||
665 | , &idx); | - | ||||||||||||||||||
666 | while (gen_names !=
| 0 | ||||||||||||||||||
667 | ((void *)0)
| 0 | ||||||||||||||||||
668 | && | - | ||||||||||||||||||
669 | !(found = (TS_find_name(gen_names, tsa_name) >= 0))
| 0 | ||||||||||||||||||
670 | - | |||||||||||||||||||
671 | - | |||||||||||||||||||
672 | GENERAL_NAMES_free(gen_names); | - | ||||||||||||||||||
673 | gen_names = X509_get_ext_d2i(signer, 85, | - | ||||||||||||||||||
674 | - | |||||||||||||||||||
675 | ((void *)0) | - | ||||||||||||||||||
676 | , &idx); | - | ||||||||||||||||||
677 | } never executed: end of block | 0 | ||||||||||||||||||
678 | if (gen_names
| 0 | ||||||||||||||||||
679 | GENERAL_NAMES_free(gen_names); never executed: GENERAL_NAMES_free(gen_names); | 0 | ||||||||||||||||||
680 | - | |||||||||||||||||||
681 | return never executed: found;return found; never executed: return found; | 0 | ||||||||||||||||||
682 | } | - | ||||||||||||||||||
683 | - | |||||||||||||||||||
684 | - | |||||||||||||||||||
685 | static int | - | ||||||||||||||||||
686 | TS_find_name(struct stack_st_GENERAL_NAME *gen_names, GENERAL_NAME *name) | - | ||||||||||||||||||
687 | { | - | ||||||||||||||||||
688 | int i, found; | - | ||||||||||||||||||
689 | for (i = 0, found = 0; !found
| 0 | ||||||||||||||||||
690 | ++i) { | - | ||||||||||||||||||
691 | GENERAL_NAME *current = ((GENERAL_NAME *)sk_value(((_STACK*) (1 ? (gen_names) : (struct stack_st_GENERAL_NAME*)0)), (i))); | - | ||||||||||||||||||
692 | found = GENERAL_NAME_cmp(current, name) == 0; | - | ||||||||||||||||||
693 | } never executed: end of block | 0 | ||||||||||||||||||
694 | return never executed: foundreturn found ? i - 1 : -1;
never executed: return found ? i - 1 : -1; | 0 | ||||||||||||||||||
695 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |