OpenCoverage

x509_lu.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509/x509_lu.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.-
3 *-
4 * Licensed under the OpenSSL license (the "License"). You may not use-
5 * this file except in compliance with the License. You can obtain a copy-
6 * in the file LICENSE in the source distribution or at-
7 * https://www.openssl.org/source/license.html-
8 */-
9-
10#include <stdio.h>-
11#include "internal/cryptlib.h"-
12#include "internal/refcount.h"-
13#include <openssl/x509.h>-
14#include "internal/x509_int.h"-
15#include <openssl/x509v3.h>-
16#include "x509_lcl.h"-
17-
18X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method)-
19{-
20 X509_LOOKUP *ret = OPENSSL_zalloc(sizeof(*ret));-
21-
22 if (ret == NULL) {
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2281 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2281
23 X509err(X509_F_X509_LOOKUP_NEW, ERR_R_MALLOC_FAILURE);-
24 return NULL;
never executed: return ((void *)0) ;
0
25 }-
26-
27 ret->method = method;-
28 if (method->new_item != NULL && method->new_item(ret) == 0) {
method->new_it...!= ((void *)0)Description
TRUEevaluated 492 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1789 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
method->new_item(ret) == 0Description
TRUEnever evaluated
FALSEevaluated 492 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1789
29 OPENSSL_free(ret);-
30 return NULL;
never executed: return ((void *)0) ;
0
31 }-
32 return ret;
executed 2281 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
2281
33}-
34-
35void X509_LOOKUP_free(X509_LOOKUP *ctx)-
36{-
37 if (ctx == NULL)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2281 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2281
38 return;
never executed: return;
0
39 if ((ctx->method != NULL) && (ctx->method->free != NULL))
(ctx->method != ((void *)0) )Description
TRUEevaluated 2281 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
(ctx->method->... ((void *)0) )Description
TRUEevaluated 492 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1789 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2281
40 (*ctx->method->free) (ctx);
executed 492 times by 1 test: (*ctx->method->free) (ctx);
Executed by:
  • libcrypto.so.1.1
492
41 OPENSSL_free(ctx);-
42}
executed 2281 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2281
43-
44int X509_STORE_lock(X509_STORE *s)-
45{-
46 return CRYPTO_THREAD_write_lock(s->lock);
never executed: return CRYPTO_THREAD_write_lock(s->lock);
0
47}-
48-
49int X509_STORE_unlock(X509_STORE *s)-
50{-
51 return CRYPTO_THREAD_unlock(s->lock);
never executed: return CRYPTO_THREAD_unlock(s->lock);
0
52}-
53-
54int X509_LOOKUP_init(X509_LOOKUP *ctx)-
55{-
56 if (ctx->method == NULL)
ctx->method == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
57 return 0;
never executed: return 0;
0
58 if (ctx->method->init != NULL)
ctx->method->i...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
59 return ctx->method->init(ctx);
never executed: return ctx->method->init(ctx);
0
60 else-
61 return 1;
never executed: return 1;
0
62}-
63-
64int X509_LOOKUP_shutdown(X509_LOOKUP *ctx)-
65{-
66 if (ctx->method == NULL)
ctx->method == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2281 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2281
67 return 0;
never executed: return 0;
0
68 if (ctx->method->shutdown != NULL)
ctx->method->s...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2281 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2281
69 return ctx->method->shutdown(ctx);
never executed: return ctx->method->shutdown(ctx);
0
70 else-
71 return 1;
executed 2281 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
2281
72}-
73-
74int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,-
75 char **ret)-
76{-
77 if (ctx->method == NULL)
ctx->method == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2292 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2292
78 return -1;
never executed: return -1;
0
79 if (ctx->method->ctrl != NULL)
ctx->method->c...!= ((void *)0)Description
TRUEevaluated 2292 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2292
80 return ctx->method->ctrl(ctx, cmd, argc, argl, ret);
executed 2292 times by 1 test: return ctx->method->ctrl(ctx, cmd, argc, argl, ret);
Executed by:
  • libcrypto.so.1.1
2292
81 else-
82 return 1;
never executed: return 1;
0
83}-
84-
85int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,-
86 X509_NAME *name, X509_OBJECT *ret)-
87{-
88 if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL))
(ctx->method == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 857 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(ctx->method->... ((void *)0) )Description
TRUEevaluated 461 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 396 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-857
89 return 0;
executed 461 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
461
90 if (ctx->skip)
ctx->skipDescription
TRUEnever evaluated
FALSEevaluated 396 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-396
91 return 0;
never executed: return 0;
0
92 return ctx->method->get_by_subject(ctx, type, name, ret);
executed 396 times by 1 test: return ctx->method->get_by_subject(ctx, type, name, ret);
Executed by:
  • libcrypto.so.1.1
396
93}-
94-
95int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,-
96 X509_NAME *name, ASN1_INTEGER *serial,-
97 X509_OBJECT *ret)-
98{-
99 if ((ctx->method == NULL) || (ctx->method->get_by_issuer_serial == NULL))
(ctx->method == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
(ctx->method->... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
100 return 0;
never executed: return 0;
0
101 return ctx->method->get_by_issuer_serial(ctx, type, name, serial, ret);
never executed: return ctx->method->get_by_issuer_serial(ctx, type, name, serial, ret);
0
102}-
103-
104int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,-
105 const unsigned char *bytes, int len,-
106 X509_OBJECT *ret)-
107{-
108 if ((ctx->method == NULL) || (ctx->method->get_by_fingerprint == NULL))
(ctx->method == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
(ctx->method->... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
109 return 0;
never executed: return 0;
0
110 return ctx->method->get_by_fingerprint(ctx, type, bytes, len, ret);
never executed: return ctx->method->get_by_fingerprint(ctx, type, bytes, len, ret);
0
111}-
112-
113int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,-
114 const char *str, int len, X509_OBJECT *ret)-
115{-
116 if ((ctx->method == NULL) || (ctx->method->get_by_alias == NULL))
(ctx->method == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
(ctx->method->... ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
117 return 0;
never executed: return 0;
0
118 return ctx->method->get_by_alias(ctx, type, str, len, ret);
never executed: return ctx->method->get_by_alias(ctx, type, str, len, ret);
0
119}-
120-
121int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data)-
122{-
123 ctx->method_data = data;-
124 return 1;
never executed: return 1;
0
125}-
126-
127void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx)-
128{-
129 return ctx->method_data;
never executed: return ctx->method_data;
0
130}-
131-
132X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx)-
133{-
134 return ctx->store_ctx;
never executed: return ctx->store_ctx;
0
135}-
136-
137-
138static int x509_object_cmp(const X509_OBJECT *const *a,-
139 const X509_OBJECT *const *b)-
140{-
141 int ret;-
142-
143 ret = ((*a)->type - (*b)->type);-
144 if (ret)
retDescription
TRUEnever evaluated
FALSEevaluated 1197 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1197
145 return ret;
never executed: return ret;
0
146 switch ((*a)->type) {-
147 case X509_LU_X509:
executed 1197 times by 1 test: case X509_LU_X509:
Executed by:
  • libcrypto.so.1.1
1197
148 ret = X509_subject_name_cmp((*a)->data.x509, (*b)->data.x509);-
149 break;
executed 1197 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
1197
150 case X509_LU_CRL:
never executed: case X509_LU_CRL:
0
151 ret = X509_CRL_cmp((*a)->data.crl, (*b)->data.crl);-
152 break;
never executed: break;
0
153 case X509_LU_NONE:
never executed: case X509_LU_NONE:
0
154 /* abort(); */-
155 return 0;
never executed: return 0;
0
156 }-
157 return ret;
executed 1197 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
1197
158}-
159-
160X509_STORE *X509_STORE_new(void)-
161{-
162 X509_STORE *ret = OPENSSL_zalloc(sizeof(*ret));-
163-
164 if (ret == NULL) {
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9559
165 X509err(X509_F_X509_STORE_NEW, ERR_R_MALLOC_FAILURE);-
166 return NULL;
never executed: return ((void *)0) ;
0
167 }-
168 if ((ret->objs = sk_X509_OBJECT_new(x509_object_cmp)) == NULL) {
(ret->objs = s...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9559
169 X509err(X509_F_X509_STORE_NEW, ERR_R_MALLOC_FAILURE);-
170 goto err;
never executed: goto err;
0
171 }-
172 ret->cache = 1;-
173 if ((ret->get_cert_methods = sk_X509_LOOKUP_new_null()) == NULL) {
(ret->get_cert...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9559
174 X509err(X509_F_X509_STORE_NEW, ERR_R_MALLOC_FAILURE);-
175 goto err;
never executed: goto err;
0
176 }-
177-
178 if ((ret->param = X509_VERIFY_PARAM_new()) == NULL) {
(ret->param = ...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9559
179 X509err(X509_F_X509_STORE_NEW, ERR_R_MALLOC_FAILURE);-
180 goto err;
never executed: goto err;
0
181 }-
182 if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data)) {
!CRYPTO_new_ex...&ret->ex_data)Description
TRUEnever evaluated
FALSEevaluated 9559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9559
183 X509err(X509_F_X509_STORE_NEW, ERR_R_MALLOC_FAILURE);-
184 goto err;
never executed: goto err;
0
185 }-
186-
187 ret->lock = CRYPTO_THREAD_lock_new();-
188 if (ret->lock == NULL) {
ret->lock == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9559
189 X509err(X509_F_X509_STORE_NEW, ERR_R_MALLOC_FAILURE);-
190 goto err;
never executed: goto err;
0
191 }-
192-
193 ret->references = 1;-
194 return ret;
executed 9559 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
9559
195-
196err:-
197 X509_VERIFY_PARAM_free(ret->param);-
198 sk_X509_OBJECT_free(ret->objs);-
199 sk_X509_LOOKUP_free(ret->get_cert_methods);-
200 OPENSSL_free(ret);-
201 return NULL;
never executed: return ((void *)0) ;
0
202}-
203-
204void X509_STORE_free(X509_STORE *vfy)-
205{-
206 int i;-
207 STACK_OF(X509_LOOKUP) *sk;-
208 X509_LOOKUP *lu;-
209-
210 if (vfy == NULL)
vfy == ((void *)0)Description
TRUEevaluated 30954 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 10798 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
10798-30954
211 return;
executed 30954 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
30954
212 CRYPTO_DOWN_REF(&vfy->references, &i, vfy->lock);-
213 REF_PRINT_COUNT("X509_STORE", vfy);-
214 if (i > 0)
i > 0Description
TRUEevaluated 1239 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1239-9559
215 return;
executed 1239 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
1239
216 REF_ASSERT_ISNT(i < 0);-
217-
218 sk = vfy->get_cert_methods;-
219 for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
i < sk_X509_LOOKUP_num(sk)Description
TRUEevaluated 2281 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9559 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2281-9559
220 lu = sk_X509_LOOKUP_value(sk, i);-
221 X509_LOOKUP_shutdown(lu);-
222 X509_LOOKUP_free(lu);-
223 }
executed 2281 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2281
224 sk_X509_LOOKUP_free(sk);-
225 sk_X509_OBJECT_pop_free(vfy->objs, X509_OBJECT_free);-
226-
227 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, vfy, &vfy->ex_data);-
228 X509_VERIFY_PARAM_free(vfy->param);-
229 CRYPTO_THREAD_lock_free(vfy->lock);-
230 OPENSSL_free(vfy);-
231}
executed 9559 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
9559
232-
233int X509_STORE_up_ref(X509_STORE *vfy)-
234{-
235 int i;-
236-
237 if (CRYPTO_UP_REF(&vfy->references, &i, vfy->lock) <= 0)
CRYPTO_UP_REF(...fy->lock) <= 0Description
TRUEnever evaluated
FALSEevaluated 1239 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1239
238 return 0;
never executed: return 0;
0
239-
240 REF_PRINT_COUNT("X509_STORE", a);-
241 REF_ASSERT_ISNT(i < 2);-
242 return ((i > 1) ? 1 : 0);
executed 1239 times by 1 test: return ((i > 1) ? 1 : 0);
Executed by:
  • libcrypto.so.1.1
(i > 1)Description
TRUEevaluated 1239 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1239
243}-
244-
245X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)-
246{-
247 int i;-
248 STACK_OF(X509_LOOKUP) *sk;-
249 X509_LOOKUP *lu;-
250-
251 sk = v->get_cert_methods;-
252 for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
i < sk_X509_LOOKUP_num(sk)Description
TRUEevaluated 504 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2281 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
504-2281
253 lu = sk_X509_LOOKUP_value(sk, i);-
254 if (m == lu->method) {
m == lu->methodDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 492 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
12-492
255 return lu;
executed 12 times by 1 test: return lu;
Executed by:
  • libcrypto.so.1.1
12
256 }-
257 }
executed 492 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
492
258 /* a new one */-
259 lu = X509_LOOKUP_new(m);-
260 if (lu == NULL) {
lu == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2281 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2281
261 X509err(X509_F_X509_STORE_ADD_LOOKUP, ERR_R_MALLOC_FAILURE);-
262 return NULL;
never executed: return ((void *)0) ;
0
263 }-
264-
265 lu->store_ctx = v;-
266 if (sk_X509_LOOKUP_push(v->get_cert_methods, lu))
sk_X509_LOOKUP...t_methods, lu)Description
TRUEevaluated 2281 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2281
267 return lu;
executed 2281 times by 1 test: return lu;
Executed by:
  • libcrypto.so.1.1
2281
268 /* malloc failed */-
269 X509err(X509_F_X509_STORE_ADD_LOOKUP, ERR_R_MALLOC_FAILURE);-
270 X509_LOOKUP_free(lu);-
271 return NULL;
never executed: return ((void *)0) ;
0
272}-
273-
274X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs,-
275 X509_LOOKUP_TYPE type,-
276 X509_NAME *name)-
277{-
278 X509_OBJECT *ret = X509_OBJECT_new();-
279-
280 if (ret == NULL)
ret == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
281 return NULL;
never executed: return ((void *)0) ;
0
282 if (!X509_STORE_CTX_get_by_subject(vs, type, name, ret)) {
!X509_STORE_CT...pe, name, ret)Description
TRUEnever evaluated
FALSEnever evaluated
0
283 X509_OBJECT_free(ret);-
284 return NULL;
never executed: return ((void *)0) ;
0
285 }-
286 return ret;
never executed: return ret;
0
287}-
288-
289int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type,-
290 X509_NAME *name, X509_OBJECT *ret)-
291{-
292 X509_STORE *ctx = vs->ctx;-
293 X509_LOOKUP *lu;-
294 X509_OBJECT stmp, *tmp;-
295 int i, j;-
296-
297 if (ctx == NULL)
ctx == ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6504 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-6504
298 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
1
299-
300 CRYPTO_THREAD_write_lock(ctx->lock);-
301 tmp = X509_OBJECT_retrieve_by_subject(ctx->objs, type, name);-
302 CRYPTO_THREAD_unlock(ctx->lock);-
303-
304 if (tmp == NULL || type == X509_LU_CRL) {
tmp == ((void *)0)Description
TRUEevaluated 5403 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1101 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
type == X509_LU_CRLDescription
TRUEnever evaluated
FALSEevaluated 1101 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5403
305 for (i = 0; i < sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) {
i < sk_X509_LO..._cert_methods)Description
TRUEevaluated 857 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5403 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
857-5403
306 lu = sk_X509_LOOKUP_value(ctx->get_cert_methods, i);-
307 j = X509_LOOKUP_by_subject(lu, type, name, &stmp);-
308 if (j) {
jDescription
TRUEnever evaluated
FALSEevaluated 857 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-857
309 tmp = &stmp;-
310 break;
never executed: break;
0
311 }-
312 }
executed 857 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
857
313 if (tmp == NULL)
tmp == ((void *)0)Description
TRUEevaluated 5403 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-5403
314 return 0;
executed 5403 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
5403
315 }
never executed: end of block
0
316-
317 ret->type = tmp->type;-
318 ret->data.ptr = tmp->data.ptr;-
319-
320 X509_OBJECT_up_ref_count(ret);-
321-
322 return 1;
executed 1101 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1101
323}-
324-
325static int x509_store_add(X509_STORE *ctx, void *x, int crl) {-
326 X509_OBJECT *obj;-
327 int ret = 0, added = 0;-
328-
329 if (x == NULL)
x == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1368 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1368
330 return 0;
never executed: return 0;
0
331 obj = X509_OBJECT_new();-
332 if (obj == NULL)
obj == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1368 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1368
333 return 0;
never executed: return 0;
0
334-
335 if (crl) {
crlDescription
TRUEnever evaluated
FALSEevaluated 1368 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1368
336 obj->type = X509_LU_CRL;-
337 obj->data.crl = (X509_CRL *)x;-
338 } else {
never executed: end of block
0
339 obj->type = X509_LU_X509;-
340 obj->data.x509 = (X509 *)x;-
341 }
executed 1368 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1368
342 X509_OBJECT_up_ref_count(obj);-
343-
344 CRYPTO_THREAD_write_lock(ctx->lock);-
345-
346 if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {
X509_OBJECT_re...tx->objs, obj)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-1367
347 ret = 1;-
348 } else {
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
349 added = sk_X509_OBJECT_push(ctx->objs, obj);-
350 ret = added != 0;-
351 }
executed 1367 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1367
352-
353 CRYPTO_THREAD_unlock(ctx->lock);-
354-
355 if (added == 0) /* obj not pushed */
added == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-1367
356 X509_OBJECT_free(obj);
executed 1 time by 1 test: X509_OBJECT_free(obj);
Executed by:
  • libcrypto.so.1.1
1
357-
358 return ret;
executed 1368 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
1368
359}-
360-
361int X509_STORE_add_cert(X509_STORE *ctx, X509 *x)-
362{-
363 if (!x509_store_add(ctx, x, 0)) {
!x509_store_add(ctx, x, 0)Description
TRUEnever evaluated
FALSEevaluated 1368 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1368
364 X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE);-
365 return 0;
never executed: return 0;
0
366 }-
367 return 1;
executed 1368 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1368
368}-
369-
370int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)-
371{-
372 if (!x509_store_add(ctx, x, 1)) {
!x509_store_add(ctx, x, 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
373 X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);-
374 return 0;
never executed: return 0;
0
375 }-
376 return 1;
never executed: return 1;
0
377}-
378-
379int X509_OBJECT_up_ref_count(X509_OBJECT *a)-
380{-
381 switch (a->type) {-
382 case X509_LU_NONE:
never executed: case X509_LU_NONE:
0
383 break;
never executed: break;
0
384 case X509_LU_X509:
executed 2469 times by 1 test: case X509_LU_X509:
Executed by:
  • libcrypto.so.1.1
2469
385 return X509_up_ref(a->data.x509);
executed 2469 times by 1 test: return X509_up_ref(a->data.x509);
Executed by:
  • libcrypto.so.1.1
2469
386 case X509_LU_CRL:
never executed: case X509_LU_CRL:
0
387 return X509_CRL_up_ref(a->data.crl);
never executed: return X509_CRL_up_ref(a->data.crl);
0
388 }-
389 return 1;
never executed: return 1;
0
390}-
391-
392X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a)-
393{-
394 if (a == NULL || a->type != X509_LU_X509)
a == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
a->type != X509_LU_X509Description
TRUEnever evaluated
FALSEnever evaluated
0
395 return NULL;
never executed: return ((void *)0) ;
0
396 return a->data.x509;
never executed: return a->data.x509;
0
397}-
398-
399X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a)-
400{-
401 if (a == NULL || a->type != X509_LU_CRL)
a == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
a->type != X509_LU_CRLDescription
TRUEnever evaluated
FALSEnever evaluated
0
402 return NULL;
never executed: return ((void *)0) ;
0
403 return a->data.crl;
never executed: return a->data.crl;
0
404}-
405-
406X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a)-
407{-
408 return a->type;
never executed: return a->type;
0
409}-
410-
411X509_OBJECT *X509_OBJECT_new(void)-
412{-
413 X509_OBJECT *ret = OPENSSL_zalloc(sizeof(*ret));-
414-
415 if (ret == NULL) {
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 7873 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-7873
416 X509err(X509_F_X509_OBJECT_NEW, ERR_R_MALLOC_FAILURE);-
417 return NULL;
never executed: return ((void *)0) ;
0
418 }-
419 ret->type = X509_LU_NONE;-
420 return ret;
executed 7873 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
7873
421}-
422-
423static void x509_object_free_internal(X509_OBJECT *a)-
424{-
425 if (a == NULL)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 7873 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-7873
426 return;
never executed: return;
0
427 switch (a->type) {-
428 case X509_LU_NONE:
executed 5404 times by 1 test: case X509_LU_NONE:
Executed by:
  • libcrypto.so.1.1
5404
429 break;
executed 5404 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
5404
430 case X509_LU_X509:
executed 2469 times by 1 test: case X509_LU_X509:
Executed by:
  • libcrypto.so.1.1
2469
431 X509_free(a->data.x509);-
432 break;
executed 2469 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
2469
433 case X509_LU_CRL:
never executed: case X509_LU_CRL:
0
434 X509_CRL_free(a->data.crl);-
435 break;
never executed: break;
0
436 }-
437}
executed 7873 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
7873
438-
439int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj)-
440{-
441 if (a == NULL || !X509_up_ref(obj))
a == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
!X509_up_ref(obj)Description
TRUEnever evaluated
FALSEnever evaluated
0
442 return 0;
never executed: return 0;
0
443-
444 x509_object_free_internal(a);-
445 a->type = X509_LU_X509;-
446 a->data.x509 = obj;-
447 return 1;
never executed: return 1;
0
448}-
449-
450int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj)-
451{-
452 if (a == NULL || !X509_CRL_up_ref(obj))
a == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
!X509_CRL_up_ref(obj)Description
TRUEnever evaluated
FALSEnever evaluated
0
453 return 0;
never executed: return 0;
0
454-
455 x509_object_free_internal(a);-
456 a->type = X509_LU_CRL;-
457 a->data.crl = obj;-
458 return 1;
never executed: return 1;
0
459}-
460-
461void X509_OBJECT_free(X509_OBJECT *a)-
462{-
463 x509_object_free_internal(a);-
464 OPENSSL_free(a);-
465}
executed 7873 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
7873
466-
467static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type,-
468 X509_NAME *name, int *pnmatch)-
469{-
470 X509_OBJECT stmp;-
471 X509 x509_s;-
472 X509_CRL crl_s;-
473 int idx;-
474-
475 stmp.type = type;-
476 switch (type) {-
477 case X509_LU_X509:
executed 6510 times by 1 test: case X509_LU_X509:
Executed by:
  • libcrypto.so.1.1
6510
478 stmp.data.x509 = &x509_s;-
479 x509_s.cert_info.subject = name;-
480 break;
executed 6510 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
6510
481 case X509_LU_CRL:
executed 4 times by 1 test: case X509_LU_CRL:
Executed by:
  • libcrypto.so.1.1
4
482 stmp.data.crl = &crl_s;-
483 crl_s.crl.issuer = name;-
484 break;
executed 4 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
4
485 case X509_LU_NONE:
never executed: case X509_LU_NONE:
0
486 /* abort(); */-
487 return -1;
never executed: return -1;
0
488 }-
489-
490 idx = sk_X509_OBJECT_find(h, &stmp);-
491 if (idx >= 0 && pnmatch) {
idx >= 0Description
TRUEevaluated 1106 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5408 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
pnmatchDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1101 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5-5408
492 int tidx;-
493 const X509_OBJECT *tobj, *pstmp;-
494 *pnmatch = 1;-
495 pstmp = &stmp;-
496 for (tidx = idx + 1; tidx < sk_X509_OBJECT_num(h); tidx++) {
tidx < sk_X509_OBJECT_num(h)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5
497 tobj = sk_X509_OBJECT_value(h, tidx);-
498 if (x509_object_cmp(&tobj, &pstmp))
x509_object_cmp(&tobj, &pstmp)Description
TRUEnever evaluated
FALSEnever evaluated
0
499 break;
never executed: break;
0
500 (*pnmatch)++;-
501 }
never executed: end of block
0
502 }
executed 5 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5
503 return idx;
executed 6514 times by 1 test: return idx;
Executed by:
  • libcrypto.so.1.1
6514
504}-
505-
506int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type,-
507 X509_NAME *name)-
508{-
509 return x509_object_idx_cnt(h, type, name, NULL);
executed 6504 times by 1 test: return x509_object_idx_cnt(h, type, name, ((void *)0) );
Executed by:
  • libcrypto.so.1.1
6504
510}-
511-
512X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,-
513 X509_LOOKUP_TYPE type,-
514 X509_NAME *name)-
515{-
516 int idx;-
517 idx = X509_OBJECT_idx_by_subject(h, type, name);-
518 if (idx == -1)
idx == -1Description
TRUEevaluated 5403 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1101 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1101-5403
519 return NULL;
executed 5403 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
5403
520 return sk_X509_OBJECT_value(h, idx);
executed 1101 times by 1 test: return sk_X509_OBJECT_value(h, idx);
Executed by:
  • libcrypto.so.1.1
1101
521}-
522-
523STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v)-
524{-
525 return v->objs;
never executed: return v->objs;
0
526}-
527-
528STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)-
529{-
530 int i, idx, cnt;-
531 STACK_OF(X509) *sk = NULL;-
532 X509 *x;-
533 X509_OBJECT *obj;-
534-
535 if (ctx->ctx == NULL)
ctx->ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-10
536 return NULL;
never executed: return ((void *)0) ;
0
537-
538 CRYPTO_THREAD_write_lock(ctx->ctx->lock);-
539 idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);-
540 if (idx < 0) {
idx < 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5
541 /*-
542 * Nothing found in cache: do lookup to possibly add new objects to-
543 * cache-
544 */-
545 X509_OBJECT *xobj = X509_OBJECT_new();-
546-
547 CRYPTO_THREAD_unlock(ctx->ctx->lock);-
548 if (xobj == NULL)
xobj == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5
549 return NULL;
never executed: return ((void *)0) ;
0
550 if (!X509_STORE_CTX_get_by_subject(ctx, X509_LU_X509, nm, xobj)) {
!X509_STORE_CT...509, nm, xobj)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-5
551 X509_OBJECT_free(xobj);-
552 return NULL;
executed 5 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
5
553 }-
554 X509_OBJECT_free(xobj);-
555 CRYPTO_THREAD_write_lock(ctx->ctx->lock);-
556 idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);-
557 if (idx < 0) {
idx < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
558 CRYPTO_THREAD_unlock(ctx->ctx->lock);-
559 return NULL;
never executed: return ((void *)0) ;
0
560 }-
561 }
never executed: end of block
0
562-
563 sk = sk_X509_new_null();-
564 for (i = 0; i < cnt; i++, idx++) {
i < cntDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5
565 obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);-
566 x = obj->data.x509;-
567 X509_up_ref(x);-
568 if (!sk_X509_push(sk, x)) {
!sk_X509_push(sk, x)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5
569 CRYPTO_THREAD_unlock(ctx->ctx->lock);-
570 X509_free(x);-
571 sk_X509_pop_free(sk, X509_free);-
572 return NULL;
never executed: return ((void *)0) ;
0
573 }-
574 }
executed 5 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5
575 CRYPTO_THREAD_unlock(ctx->ctx->lock);-
576 return sk;
executed 5 times by 1 test: return sk;
Executed by:
  • libcrypto.so.1.1
5
577}-
578-
579STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *ctx, X509_NAME *nm)-
580{-
581 int i, idx, cnt;-
582 STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();-
583 X509_CRL *x;-
584 X509_OBJECT *obj, *xobj = X509_OBJECT_new();-
585-
586 /* Always do lookup to possibly add new CRLs to cache */-
587 if (sk == NULL
sk == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
588 || xobj == NULL
xobj == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
589 || ctx->ctx == NULL
ctx->ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
590 || !X509_STORE_CTX_get_by_subject(ctx, X509_LU_CRL, nm, xobj)) {
!X509_STORE_CT...CRL, nm, xobj)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-4
591 X509_OBJECT_free(xobj);-
592 sk_X509_CRL_free(sk);-
593 return NULL;
executed 4 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
4
594 }-
595 X509_OBJECT_free(xobj);-
596 CRYPTO_THREAD_write_lock(ctx->ctx->lock);-
597 idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_CRL, nm, &cnt);-
598 if (idx < 0) {
idx < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
599 CRYPTO_THREAD_unlock(ctx->ctx->lock);-
600 sk_X509_CRL_free(sk);-
601 return NULL;
never executed: return ((void *)0) ;
0
602 }-
603-
604 for (i = 0; i < cnt; i++, idx++) {
i < cntDescription
TRUEnever evaluated
FALSEnever evaluated
0
605 obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);-
606 x = obj->data.crl;-
607 X509_CRL_up_ref(x);-
608 if (!sk_X509_CRL_push(sk, x)) {
!sk_X509_CRL_push(sk, x)Description
TRUEnever evaluated
FALSEnever evaluated
0
609 CRYPTO_THREAD_unlock(ctx->ctx->lock);-
610 X509_CRL_free(x);-
611 sk_X509_CRL_pop_free(sk, X509_CRL_free);-
612 return NULL;
never executed: return ((void *)0) ;
0
613 }-
614 }
never executed: end of block
0
615 CRYPTO_THREAD_unlock(ctx->ctx->lock);-
616 return sk;
never executed: return sk;
0
617}-
618-
619X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,-
620 X509_OBJECT *x)-
621{-
622 int idx, i, num;-
623 X509_OBJECT *obj;-
624-
625 idx = sk_X509_OBJECT_find(h, x);-
626 if (idx < 0)
idx < 0Description
TRUEevaluated 1367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-1367
627 return NULL;
executed 1367 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
1367
628 if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
(x->type != X509_LU_X509)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
(x->type != X509_LU_CRL)Description
TRUEnever evaluated
FALSEnever evaluated
0-1
629 return sk_X509_OBJECT_value(h, idx);
never executed: return sk_X509_OBJECT_value(h, idx);
0
630 for (i = idx, num = sk_X509_OBJECT_num(h); i < num; i++) {
i < numDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1
631 obj = sk_X509_OBJECT_value(h, i);-
632 if (x509_object_cmp((const X509_OBJECT **)&obj,
x509_object_cm..._OBJECT **)&x)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
633 (const X509_OBJECT **)&x))
x509_object_cm..._OBJECT **)&x)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
634 return NULL;
never executed: return ((void *)0) ;
0
635 if (x->type == X509_LU_X509) {
x->type == X509_LU_X509Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1
636 if (!X509_cmp(obj->data.x509, x->data.x509))
!X509_cmp(obj-... x->data.x509)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1
637 return obj;
executed 1 time by 1 test: return obj;
Executed by:
  • libcrypto.so.1.1
1
638 } else if (x->type == X509_LU_CRL) {
never executed: end of block
x->type == X509_LU_CRLDescription
TRUEnever evaluated
FALSEnever evaluated
0
639 if (!X509_CRL_match(obj->data.crl, x->data.crl))
!X509_CRL_matc..., x->data.crl)Description
TRUEnever evaluated
FALSEnever evaluated
0
640 return obj;
never executed: return obj;
0
641 } else
never executed: end of block
0
642 return obj;
never executed: return obj;
0
643 }-
644 return NULL;
never executed: return ((void *)0) ;
0
645}-
646-
647/*--
648 * Try to get issuer certificate from store. Due to limitations-
649 * of the API this can only retrieve a single certificate matching-
650 * a given subject name. However it will fill the cache with all-
651 * matching certificates, so we can examine the cache for all-
652 * matches.-
653 *-
654 * Return values are:-
655 * 1 lookup successful.-
656 * 0 certificate not found.-
657 * -1 some other error.-
658 */-
659int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x)-
660{-
661 X509_NAME *xn;-
662 X509_OBJECT *obj = X509_OBJECT_new(), *pobj = NULL;-
663 int i, ok, idx, ret;-
664-
665 if (obj == NULL)
obj == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6496 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6496
666 return -1;
never executed: return -1;
0
667 *issuer = NULL;-
668 xn = X509_get_issuer_name(x);-
669 ok = X509_STORE_CTX_get_by_subject(ctx, X509_LU_X509, xn, obj);-
670 if (ok != 1) {
ok != 1Description
TRUEevaluated 5395 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1101 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1101-5395
671 X509_OBJECT_free(obj);-
672 return 0;
executed 5395 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
5395
673 }-
674 /* If certificate matches all OK */-
675 if (ctx->check_issued(ctx, x, obj->data.x509)) {
ctx->check_iss...bj->data.x509)Description
TRUEevaluated 1101 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1101
676 if (x509_check_cert_time(ctx, obj->data.x509, -1)) {
x509_check_cer...data.x509, -1)Description
TRUEevaluated 1101 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1101
677 *issuer = obj->data.x509;-
678 X509_up_ref(*issuer);-
679 X509_OBJECT_free(obj);-
680 return 1;
executed 1101 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1101
681 }-
682 }
never executed: end of block
0
683 X509_OBJECT_free(obj);-
684-
685 if (ctx->ctx == NULL)
ctx->ctx == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
686 return 0;
never executed: return 0;
0
687-
688 /* Else find index of first cert accepted by 'check_issued' */-
689 ret = 0;-
690 CRYPTO_THREAD_write_lock(ctx->ctx->lock);-
691 idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn);-
692 if (idx != -1) { /* should be true as we've had at least one
idx != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
693 * match */-
694 /* Look through all matching certs for suitable issuer */-
695 for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) {
i < sk_X509_OB...tx->ctx->objs)Description
TRUEnever evaluated
FALSEnever evaluated
0
696 pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i);-
697 /* See if we've run past the matches */-
698 if (pobj->type != X509_LU_X509)
pobj->type != X509_LU_X509Description
TRUEnever evaluated
FALSEnever evaluated
0
699 break;
never executed: break;
0
700 if (X509_NAME_cmp(xn, X509_get_subject_name(pobj->data.x509)))
X509_NAME_cmp(...j->data.x509))Description
TRUEnever evaluated
FALSEnever evaluated
0
701 break;
never executed: break;
0
702 if (ctx->check_issued(ctx, x, pobj->data.x509)) {
ctx->check_iss...bj->data.x509)Description
TRUEnever evaluated
FALSEnever evaluated
0
703 *issuer = pobj->data.x509;-
704 ret = 1;-
705 /*-
706 * If times check, exit with match,-
707 * otherwise keep looking. Leave last-
708 * match in issuer so we return nearest-
709 * match if no certificate time is OK.-
710 */-
711-
712 if (x509_check_cert_time(ctx, *issuer, -1))
x509_check_cer..., *issuer, -1)Description
TRUEnever evaluated
FALSEnever evaluated
0
713 break;
never executed: break;
0
714 }
never executed: end of block
0
715 }
never executed: end of block
0
716 }
never executed: end of block
0
717 CRYPTO_THREAD_unlock(ctx->ctx->lock);-
718 if (*issuer)
*issuerDescription
TRUEnever evaluated
FALSEnever evaluated
0
719 X509_up_ref(*issuer);
never executed: X509_up_ref(*issuer);
0
720 return ret;
never executed: return ret;
0
721}-
722-
723int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags)-
724{-
725 return X509_VERIFY_PARAM_set_flags(ctx->param, flags);
executed 140 times by 1 test: return X509_VERIFY_PARAM_set_flags(ctx->param, flags);
Executed by:
  • libcrypto.so.1.1
140
726}-
727-
728int X509_STORE_set_depth(X509_STORE *ctx, int depth)-
729{-
730 X509_VERIFY_PARAM_set_depth(ctx->param, depth);-
731 return 1;
never executed: return 1;
0
732}-
733-
734int X509_STORE_set_purpose(X509_STORE *ctx, int purpose)-
735{-
736 return X509_VERIFY_PARAM_set_purpose(ctx->param, purpose);
never executed: return X509_VERIFY_PARAM_set_purpose(ctx->param, purpose);
0
737}-
738-
739int X509_STORE_set_trust(X509_STORE *ctx, int trust)-
740{-
741 return X509_VERIFY_PARAM_set_trust(ctx->param, trust);
never executed: return X509_VERIFY_PARAM_set_trust(ctx->param, trust);
0
742}-
743-
744int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *param)-
745{-
746 return X509_VERIFY_PARAM_set1(ctx->param, param);
executed 189 times by 1 test: return X509_VERIFY_PARAM_set1(ctx->param, param);
Executed by:
  • libcrypto.so.1.1
189
747}-
748-
749X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx)-
750{-
751 return ctx->param;
never executed: return ctx->param;
0
752}-
753-
754void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify)-
755{-
756 ctx->verify = verify;-
757}
never executed: end of block
0
758-
759X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx)-
760{-
761 return ctx->verify;
never executed: return ctx->verify;
0
762}-
763-
764void X509_STORE_set_verify_cb(X509_STORE *ctx,-
765 X509_STORE_CTX_verify_cb verify_cb)-
766{-
767 ctx->verify_cb = verify_cb;-
768}
executed 239 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
239
769-
770X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *ctx)-
771{-
772 return ctx->verify_cb;
never executed: return ctx->verify_cb;
0
773}-
774-
775void X509_STORE_set_get_issuer(X509_STORE *ctx,-
776 X509_STORE_CTX_get_issuer_fn get_issuer)-
777{-
778 ctx->get_issuer = get_issuer;-
779}
never executed: end of block
0
780-
781X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE *ctx)-
782{-
783 return ctx->get_issuer;
never executed: return ctx->get_issuer;
0
784}-
785-
786void X509_STORE_set_check_issued(X509_STORE *ctx,-
787 X509_STORE_CTX_check_issued_fn check_issued)-
788{-
789 ctx->check_issued = check_issued;-
790}
never executed: end of block
0
791-
792X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE *ctx)-
793{-
794 return ctx->check_issued;
never executed: return ctx->check_issued;
0
795}-
796-
797void X509_STORE_set_check_revocation(X509_STORE *ctx,-
798 X509_STORE_CTX_check_revocation_fn check_revocation)-
799{-
800 ctx->check_revocation = check_revocation;-
801}
never executed: end of block
0
802-
803X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE *ctx)-
804{-
805 return ctx->check_revocation;
never executed: return ctx->check_revocation;
0
806}-
807-
808void X509_STORE_set_get_crl(X509_STORE *ctx,-
809 X509_STORE_CTX_get_crl_fn get_crl)-
810{-
811 ctx->get_crl = get_crl;-
812}
never executed: end of block
0
813-
814X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE *ctx)-
815{-
816 return ctx->get_crl;
never executed: return ctx->get_crl;
0
817}-
818-
819void X509_STORE_set_check_crl(X509_STORE *ctx,-
820 X509_STORE_CTX_check_crl_fn check_crl)-
821{-
822 ctx->check_crl = check_crl;-
823}
never executed: end of block
0
824-
825X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE *ctx)-
826{-
827 return ctx->check_crl;
never executed: return ctx->check_crl;
0
828}-
829-
830void X509_STORE_set_cert_crl(X509_STORE *ctx,-
831 X509_STORE_CTX_cert_crl_fn cert_crl)-
832{-
833 ctx->cert_crl = cert_crl;-
834}
never executed: end of block
0
835-
836X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE *ctx)-
837{-
838 return ctx->cert_crl;
never executed: return ctx->cert_crl;
0
839}-
840-
841void X509_STORE_set_check_policy(X509_STORE *ctx,-
842 X509_STORE_CTX_check_policy_fn check_policy)-
843{-
844 ctx->check_policy = check_policy;-
845}
never executed: end of block
0
846-
847X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE *ctx)-
848{-
849 return ctx->check_policy;
never executed: return ctx->check_policy;
0
850}-
851-
852void X509_STORE_set_lookup_certs(X509_STORE *ctx,-
853 X509_STORE_CTX_lookup_certs_fn lookup_certs)-
854{-
855 ctx->lookup_certs = lookup_certs;-
856}
never executed: end of block
0
857-
858X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE *ctx)-
859{-
860 return ctx->lookup_certs;
never executed: return ctx->lookup_certs;
0
861}-
862-
863void X509_STORE_set_lookup_crls(X509_STORE *ctx,-
864 X509_STORE_CTX_lookup_crls_fn lookup_crls)-
865{-
866 ctx->lookup_crls = lookup_crls;-
867}
never executed: end of block
0
868-
869X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE *ctx)-
870{-
871 return ctx->lookup_crls;
never executed: return ctx->lookup_crls;
0
872}-
873-
874void X509_STORE_set_cleanup(X509_STORE *ctx,-
875 X509_STORE_CTX_cleanup_fn ctx_cleanup)-
876{-
877 ctx->cleanup = ctx_cleanup;-
878}
never executed: end of block
0
879-
880X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE *ctx)-
881{-
882 return ctx->cleanup;
never executed: return ctx->cleanup;
0
883}-
884-
885int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data)-
886{-
887 return CRYPTO_set_ex_data(&ctx->ex_data, idx, data);
never executed: return CRYPTO_set_ex_data(&ctx->ex_data, idx, data);
0
888}-
889-
890void *X509_STORE_get_ex_data(X509_STORE *ctx, int idx)-
891{-
892 return CRYPTO_get_ex_data(&ctx->ex_data, idx);
never executed: return CRYPTO_get_ex_data(&ctx->ex_data, idx);
0
893}-
894-
895X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx)-
896{-
897 return ctx->ctx;
never executed: return ctx->ctx;
0
898}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2