Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509/x509_cmp.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b) | - | ||||||||||||
3 | { | - | ||||||||||||
4 | int i; | - | ||||||||||||
5 | const X509_CINF *ai, *bi; | - | ||||||||||||
6 | - | |||||||||||||
7 | ai = &a->cert_info; | - | ||||||||||||
8 | bi = &b->cert_info; | - | ||||||||||||
9 | i = ASN1_INTEGER_cmp(&ai->serialNumber, &bi->serialNumber); | - | ||||||||||||
10 | if (i
| 50 | ||||||||||||
11 | return executed 50 times by 1 test: i;return i; Executed by:
executed 50 times by 1 test: return i; Executed by:
| 50 | ||||||||||||
12 | return executed 50 times by 1 test: X509_NAME_cmp(ai->issuer, bi->issuer);return X509_NAME_cmp(ai->issuer, bi->issuer); Executed by:
executed 50 times by 1 test: return X509_NAME_cmp(ai->issuer, bi->issuer); Executed by:
| 50 | ||||||||||||
13 | } | - | ||||||||||||
14 | - | |||||||||||||
15 | - | |||||||||||||
16 | unsigned long X509_issuer_and_serial_hash(X509 *a) | - | ||||||||||||
17 | { | - | ||||||||||||
18 | unsigned long ret = 0; | - | ||||||||||||
19 | EVP_MD_CTX *ctx = EVP_MD_CTX_new(); | - | ||||||||||||
20 | unsigned char md[16]; | - | ||||||||||||
21 | char *f; | - | ||||||||||||
22 | - | |||||||||||||
23 | if (ctx ==
| 0 | ||||||||||||
24 | ((void *)0)
| 0 | ||||||||||||
25 | ) | - | ||||||||||||
26 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
27 | f = X509_NAME_oneline(a->cert_info.issuer, | - | ||||||||||||
28 | ((void *)0) | - | ||||||||||||
29 | , 0); | - | ||||||||||||
30 | if (!EVP_DigestInit_ex(ctx, EVP_md5(),
| 0 | ||||||||||||
31 | ((void *)0)
| 0 | ||||||||||||
32 | )
| 0 | ||||||||||||
33 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
34 | if (!EVP_DigestUpdate(ctx, (unsigned char *)f, strlen(f))
| 0 | ||||||||||||
35 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
36 | CRYPTO_free(f, __FILE__, 46); | - | ||||||||||||
37 | if (!EVP_DigestUpdate
| 0 | ||||||||||||
38 | (ctx, (unsigned char *)a->cert_info.serialNumber.data,
| 0 | ||||||||||||
39 | (unsigned long)a->cert_info.serialNumber.length)
| 0 | ||||||||||||
40 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
41 | if (!EVP_DigestFinal_ex(ctx, &(md[0]),
| 0 | ||||||||||||
42 | ((void *)0)
| 0 | ||||||||||||
43 | )
| 0 | ||||||||||||
44 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
45 | ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) | | - | ||||||||||||
46 | ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L) | - | ||||||||||||
47 | ) & 0xffffffffL; | - | ||||||||||||
48 | err: code before this statement never executed: err: | 0 | ||||||||||||
49 | EVP_MD_CTX_free(ctx); | - | ||||||||||||
50 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
51 | } | - | ||||||||||||
52 | - | |||||||||||||
53 | - | |||||||||||||
54 | int X509_issuer_name_cmp(const X509 *a, const X509 *b) | - | ||||||||||||
55 | { | - | ||||||||||||
56 | return never executed: X509_NAME_cmp(a->cert_info.issuer, b->cert_info.issuer);return X509_NAME_cmp(a->cert_info.issuer, b->cert_info.issuer); never executed: return X509_NAME_cmp(a->cert_info.issuer, b->cert_info.issuer); | 0 | ||||||||||||
57 | } | - | ||||||||||||
58 | - | |||||||||||||
59 | int X509_subject_name_cmp(const X509 *a, const X509 *b) | - | ||||||||||||
60 | { | - | ||||||||||||
61 | return executed 1197 times by 1 test: X509_NAME_cmp(a->cert_info.subject, b->cert_info.subject);return X509_NAME_cmp(a->cert_info.subject, b->cert_info.subject); Executed by:
executed 1197 times by 1 test: return X509_NAME_cmp(a->cert_info.subject, b->cert_info.subject); Executed by:
| 1197 | ||||||||||||
62 | } | - | ||||||||||||
63 | - | |||||||||||||
64 | int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b) | - | ||||||||||||
65 | { | - | ||||||||||||
66 | return never executed: X509_NAME_cmp(a->crl.issuer, b->crl.issuer);return X509_NAME_cmp(a->crl.issuer, b->crl.issuer); never executed: return X509_NAME_cmp(a->crl.issuer, b->crl.issuer); | 0 | ||||||||||||
67 | } | - | ||||||||||||
68 | - | |||||||||||||
69 | int X509_CRL_match(const X509_CRL *a, const X509_CRL *b) | - | ||||||||||||
70 | { | - | ||||||||||||
71 | return never executed: memcmp(a->sha1_hash, b->sha1_hash, 20);return memcmp(a->sha1_hash, b->sha1_hash, 20); never executed: return memcmp(a->sha1_hash, b->sha1_hash, 20); | 0 | ||||||||||||
72 | } | - | ||||||||||||
73 | - | |||||||||||||
74 | X509_NAME *X509_get_issuer_name(const X509 *a) | - | ||||||||||||
75 | { | - | ||||||||||||
76 | return executed 23517 times by 1 test: a->cert_info.issuer;return a->cert_info.issuer; Executed by:
executed 23517 times by 1 test: return a->cert_info.issuer; Executed by:
| 23517 | ||||||||||||
77 | } | - | ||||||||||||
78 | - | |||||||||||||
79 | unsigned long X509_issuer_name_hash(X509 *x) | - | ||||||||||||
80 | { | - | ||||||||||||
81 | return never executed: X509_NAME_hash(x->cert_info.issuer);return X509_NAME_hash(x->cert_info.issuer); never executed: return X509_NAME_hash(x->cert_info.issuer); | 0 | ||||||||||||
82 | } | - | ||||||||||||
83 | - | |||||||||||||
84 | - | |||||||||||||
85 | unsigned long X509_issuer_name_hash_old(X509 *x) | - | ||||||||||||
86 | { | - | ||||||||||||
87 | return never executed: X509_NAME_hash_old(x->cert_info.issuer);return X509_NAME_hash_old(x->cert_info.issuer); never executed: return X509_NAME_hash_old(x->cert_info.issuer); | 0 | ||||||||||||
88 | } | - | ||||||||||||
89 | - | |||||||||||||
90 | - | |||||||||||||
91 | X509_NAME *X509_get_subject_name(const X509 *a) | - | ||||||||||||
92 | { | - | ||||||||||||
93 | return executed 87226 times by 1 test: a->cert_info.subject;return a->cert_info.subject; Executed by:
executed 87226 times by 1 test: return a->cert_info.subject; Executed by:
| 87226 | ||||||||||||
94 | } | - | ||||||||||||
95 | - | |||||||||||||
96 | ASN1_INTEGER *X509_get_serialNumber(X509 *a) | - | ||||||||||||
97 | { | - | ||||||||||||
98 | return executed 1854 times by 1 test: &a->cert_info.serialNumber;return &a->cert_info.serialNumber; Executed by:
executed 1854 times by 1 test: return &a->cert_info.serialNumber; Executed by:
| 1854 | ||||||||||||
99 | } | - | ||||||||||||
100 | - | |||||||||||||
101 | const ASN1_INTEGER *X509_get0_serialNumber(const X509 *a) | - | ||||||||||||
102 | { | - | ||||||||||||
103 | return never executed: &a->cert_info.serialNumber;return &a->cert_info.serialNumber; never executed: return &a->cert_info.serialNumber; | 0 | ||||||||||||
104 | } | - | ||||||||||||
105 | - | |||||||||||||
106 | unsigned long X509_subject_name_hash(X509 *x) | - | ||||||||||||
107 | { | - | ||||||||||||
108 | return never executed: X509_NAME_hash(x->cert_info.subject);return X509_NAME_hash(x->cert_info.subject); never executed: return X509_NAME_hash(x->cert_info.subject); | 0 | ||||||||||||
109 | } | - | ||||||||||||
110 | - | |||||||||||||
111 | - | |||||||||||||
112 | unsigned long X509_subject_name_hash_old(X509 *x) | - | ||||||||||||
113 | { | - | ||||||||||||
114 | return never executed: X509_NAME_hash_old(x->cert_info.subject);return X509_NAME_hash_old(x->cert_info.subject); never executed: return X509_NAME_hash_old(x->cert_info.subject); | 0 | ||||||||||||
115 | } | - | ||||||||||||
116 | int X509_cmp(const X509 *a, const X509 *b) | - | ||||||||||||
117 | { | - | ||||||||||||
118 | int rv; | - | ||||||||||||
119 | - | |||||||||||||
120 | X509_check_purpose((X509 *)a, -1, 0); | - | ||||||||||||
121 | X509_check_purpose((X509 *)b, -1, 0); | - | ||||||||||||
122 | - | |||||||||||||
123 | rv = memcmp(a->sha1_hash, b->sha1_hash, 20); | - | ||||||||||||
124 | if (rv
| 19-583 | ||||||||||||
125 | return executed 583 times by 1 test: rv;return rv; Executed by:
executed 583 times by 1 test: return rv; Executed by:
| 583 | ||||||||||||
126 | - | |||||||||||||
127 | if (!a->cert_info.enc.modified
| 0-19 | ||||||||||||
128 | if (a->cert_info.enc.len < b->cert_info.enc.len
| 0-19 | ||||||||||||
129 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
130 | if (a->cert_info.enc.len > b->cert_info.enc.len
| 0-19 | ||||||||||||
131 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||
132 | return executed 19 times by 1 test: memcmp(a->cert_info.enc.enc, b->cert_info.enc.enc,return memcmp(a->cert_info.enc.enc, b->cert_info.enc.enc, a->cert_info.enc.len); Executed by:
executed 19 times by 1 test: return memcmp(a->cert_info.enc.enc, b->cert_info.enc.enc, a->cert_info.enc.len); Executed by:
| 19 | ||||||||||||
133 | a->cert_info.enc.len); executed 19 times by 1 test: return memcmp(a->cert_info.enc.enc, b->cert_info.enc.enc, a->cert_info.enc.len); Executed by:
| 19 | ||||||||||||
134 | } | - | ||||||||||||
135 | return never executed: rv;return rv; never executed: return rv; | 0 | ||||||||||||
136 | } | - | ||||||||||||
137 | - | |||||||||||||
138 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b) | - | ||||||||||||
139 | { | - | ||||||||||||
140 | int ret; | - | ||||||||||||
141 | - | |||||||||||||
142 | - | |||||||||||||
143 | - | |||||||||||||
144 | if (!a->canon_enc
| 0-16426 | ||||||||||||
145 | ret = i2d_X509_NAME((X509_NAME *)a, | - | ||||||||||||
146 | ((void *)0) | - | ||||||||||||
147 | ); | - | ||||||||||||
148 | if (ret < 0
| 0-6 | ||||||||||||
149 | return never executed: -2;return -2; never executed: return -2; | 0 | ||||||||||||
150 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
151 | - | |||||||||||||
152 | if (!b->canon_enc
| 0-16426 | ||||||||||||
153 | ret = i2d_X509_NAME((X509_NAME *)b, | - | ||||||||||||
154 | ((void *)0) | - | ||||||||||||
155 | ); | - | ||||||||||||
156 | if (ret < 0
| 0 | ||||||||||||
157 | return never executed: -2;return -2; never executed: return -2; | 0 | ||||||||||||
158 | } never executed: end of block | 0 | ||||||||||||
159 | - | |||||||||||||
160 | ret = a->canon_enclen - b->canon_enclen; | - | ||||||||||||
161 | - | |||||||||||||
162 | if (ret != 0
| 0-10442 | ||||||||||||
163 | return executed 5984 times by 1 test: ret;return ret; Executed by:
executed 5984 times by 1 test: return ret; Executed by:
| 5984 | ||||||||||||
164 | - | |||||||||||||
165 | return executed 10442 times by 1 test: memcmp(a->canon_enc, b->canon_enc, a->canon_enclen);return memcmp(a->canon_enc, b->canon_enc, a->canon_enclen); Executed by:
executed 10442 times by 1 test: return memcmp(a->canon_enc, b->canon_enc, a->canon_enclen); Executed by:
| 10442 | ||||||||||||
166 | - | |||||||||||||
167 | } | - | ||||||||||||
168 | - | |||||||||||||
169 | unsigned long X509_NAME_hash(X509_NAME *x) | - | ||||||||||||
170 | { | - | ||||||||||||
171 | unsigned long ret = 0; | - | ||||||||||||
172 | unsigned char md[20]; | - | ||||||||||||
173 | - | |||||||||||||
174 | - | |||||||||||||
175 | i2d_X509_NAME(x, | - | ||||||||||||
176 | ((void *)0) | - | ||||||||||||
177 | ); | - | ||||||||||||
178 | if (!EVP_Digest(x->canon_enc, x->canon_enclen, md,
| 0-416 | ||||||||||||
179 | ((void *)0)
| 0-416 | ||||||||||||
180 | , EVP_sha1(),
| 0-416 | ||||||||||||
181 |
| 0-416 | ||||||||||||
182 | ((void *)0)
| 0-416 | ||||||||||||
183 | )
| 0-416 | ||||||||||||
184 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
185 | - | |||||||||||||
186 | ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) | | - | ||||||||||||
187 | ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L) | - | ||||||||||||
188 | ) & 0xffffffffL; | - | ||||||||||||
189 | return executed 416 times by 1 test: ret;return ret; Executed by:
executed 416 times by 1 test: return ret; Executed by:
| 416 | ||||||||||||
190 | } | - | ||||||||||||
191 | - | |||||||||||||
192 | - | |||||||||||||
193 | - | |||||||||||||
194 | - | |||||||||||||
195 | - | |||||||||||||
196 | - | |||||||||||||
197 | - | |||||||||||||
198 | unsigned long X509_NAME_hash_old(X509_NAME *x) | - | ||||||||||||
199 | { | - | ||||||||||||
200 | EVP_MD_CTX *md_ctx = EVP_MD_CTX_new(); | - | ||||||||||||
201 | unsigned long ret = 0; | - | ||||||||||||
202 | unsigned char md[16]; | - | ||||||||||||
203 | - | |||||||||||||
204 | if (md_ctx ==
| 0 | ||||||||||||
205 | ((void *)0)
| 0 | ||||||||||||
206 | ) | - | ||||||||||||
207 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
208 | - | |||||||||||||
209 | - | |||||||||||||
210 | i2d_X509_NAME(x, | - | ||||||||||||
211 | ((void *)0) | - | ||||||||||||
212 | ); | - | ||||||||||||
213 | EVP_MD_CTX_set_flags(md_ctx, 0x0008); | - | ||||||||||||
214 | if (EVP_DigestInit_ex(md_ctx, EVP_md5(),
| 0 | ||||||||||||
215 | ((void *)0)
| 0 | ||||||||||||
216 | )
| 0 | ||||||||||||
217 | && EVP_DigestUpdate(md_ctx, x->bytes->data, x->bytes->length)
| 0 | ||||||||||||
218 | && EVP_DigestFinal_ex(md_ctx, md,
| 0 | ||||||||||||
219 | ((void *)0)
| 0 | ||||||||||||
220 | )
| 0 | ||||||||||||
221 | ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) | never executed: ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) | ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L) ) & 0xffffffffL; | 0 | ||||||||||||
222 | ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L) never executed: ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) | ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L) ) & 0xffffffffL; | 0 | ||||||||||||
223 | ) & 0xffffffffL; never executed: ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) | ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L) ) & 0xffffffffL; | 0 | ||||||||||||
224 | EVP_MD_CTX_free(md_ctx); | - | ||||||||||||
225 | - | |||||||||||||
226 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
227 | } | - | ||||||||||||
228 | - | |||||||||||||
229 | - | |||||||||||||
230 | - | |||||||||||||
231 | X509 *X509_find_by_issuer_and_serial(struct stack_st_X509 *sk, X509_NAME *name, | - | ||||||||||||
232 | ASN1_INTEGER *serial) | - | ||||||||||||
233 | { | - | ||||||||||||
234 | int i; | - | ||||||||||||
235 | X509 x, *x509 = | - | ||||||||||||
236 | ((void *)0) | - | ||||||||||||
237 | ; | - | ||||||||||||
238 | - | |||||||||||||
239 | if (!sk
| 0-50 | ||||||||||||
240 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
241 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
242 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
243 | - | |||||||||||||
244 | x.cert_info.serialNumber = *serial; | - | ||||||||||||
245 | x.cert_info.issuer = name; | - | ||||||||||||
246 | - | |||||||||||||
247 | for (i = 0; i < sk_X509_num(sk)
| 0-100 | ||||||||||||
248 | x509 = sk_X509_value(sk, i); | - | ||||||||||||
249 | if (X509_issuer_and_serial_cmp(x509, &x) == 0
| 50 | ||||||||||||
250 | return executed 50 times by 1 test: x509;return x509; Executed by:
executed 50 times by 1 test: return x509; Executed by:
| 50 | ||||||||||||
251 | } executed 50 times by 1 test: end of block Executed by:
| 50 | ||||||||||||
252 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
253 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
254 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
255 | } | - | ||||||||||||
256 | - | |||||||||||||
257 | X509 *X509_find_by_subject(struct stack_st_X509 *sk, X509_NAME *name) | - | ||||||||||||
258 | { | - | ||||||||||||
259 | X509 *x509; | - | ||||||||||||
260 | int i; | - | ||||||||||||
261 | - | |||||||||||||
262 | for (i = 0; i < sk_X509_num(sk)
| 12-29 | ||||||||||||
263 | x509 = sk_X509_value(sk, i); | - | ||||||||||||
264 | if (X509_NAME_cmp(X509_get_subject_name(x509), name) == 0
| 11-18 | ||||||||||||
265 | return executed 11 times by 1 test: x509;return x509; Executed by:
executed 11 times by 1 test: return x509; Executed by:
| 11 | ||||||||||||
266 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||
267 | return executed 12 times by 1 test: return ((void *)0) ; Executed by:
executed 12 times by 1 test: return ((void *)0) ; Executed by:
| 12 | ||||||||||||
268 | ((void *)0) executed 12 times by 1 test: return ((void *)0) ; Executed by:
| 12 | ||||||||||||
269 | ; executed 12 times by 1 test: return ((void *)0) ; Executed by:
| 12 | ||||||||||||
270 | } | - | ||||||||||||
271 | - | |||||||||||||
272 | EVP_PKEY *X509_get0_pubkey(const X509 *x) | - | ||||||||||||
273 | { | - | ||||||||||||
274 | if (x ==
| 0-53470 | ||||||||||||
275 | ((void *)0)
| 0-53470 | ||||||||||||
276 | ) | - | ||||||||||||
277 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
278 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
279 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
280 | return executed 53470 times by 1 test: X509_PUBKEY_get0(x->cert_info.key);return X509_PUBKEY_get0(x->cert_info.key); Executed by:
executed 53470 times by 1 test: return X509_PUBKEY_get0(x->cert_info.key); Executed by:
| 53470 | ||||||||||||
281 | } | - | ||||||||||||
282 | - | |||||||||||||
283 | EVP_PKEY *X509_get_pubkey(X509 *x) | - | ||||||||||||
284 | { | - | ||||||||||||
285 | if (x ==
| 0-63 | ||||||||||||
286 | ((void *)0)
| 0-63 | ||||||||||||
287 | ) | - | ||||||||||||
288 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
289 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
290 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
291 | return executed 63 times by 1 test: X509_PUBKEY_get(x->cert_info.key);return X509_PUBKEY_get(x->cert_info.key); Executed by:
executed 63 times by 1 test: return X509_PUBKEY_get(x->cert_info.key); Executed by:
| 63 | ||||||||||||
292 | } | - | ||||||||||||
293 | - | |||||||||||||
294 | int X509_check_private_key(const X509 *x, const EVP_PKEY *k) | - | ||||||||||||
295 | { | - | ||||||||||||
296 | const EVP_PKEY *xk; | - | ||||||||||||
297 | int ret; | - | ||||||||||||
298 | - | |||||||||||||
299 | xk = X509_get0_pubkey(x); | - | ||||||||||||
300 | - | |||||||||||||
301 | if (xk
| 0-8648 | ||||||||||||
302 | ret = EVP_PKEY_cmp(xk, k); executed 8648 times by 1 test: ret = EVP_PKEY_cmp(xk, k); Executed by:
| 8648 | ||||||||||||
303 | else | - | ||||||||||||
304 | ret = -2; never executed: ret = -2; | 0 | ||||||||||||
305 | - | |||||||||||||
306 | switch (ret) { | - | ||||||||||||
307 | case executed 8647 times by 1 test: 1:case 1: Executed by:
executed 8647 times by 1 test: case 1: Executed by:
| 8647 | ||||||||||||
308 | break; executed 8647 times by 1 test: break; Executed by:
| 8647 | ||||||||||||
309 | case executed 1 time by 1 test: 0:case 0: Executed by:
executed 1 time by 1 test: case 0: Executed by:
| 1 | ||||||||||||
310 | ERR_put_error(11,(128),(116),__FILE__,294); | - | ||||||||||||
311 | break; executed 1 time by 1 test: break; Executed by:
| 1 | ||||||||||||
312 | case never executed: -1:case -1: never executed: case -1: | 0 | ||||||||||||
313 | ERR_put_error(11,(128),(115),__FILE__,297); | - | ||||||||||||
314 | break; never executed: break; | 0 | ||||||||||||
315 | case never executed: -2:case -2: never executed: case -2: | 0 | ||||||||||||
316 | ERR_put_error(11,(128),(117),__FILE__,300); | - | ||||||||||||
317 | } never executed: end of block | 0 | ||||||||||||
318 | if (ret > 0
| 1-8647 | ||||||||||||
319 | return executed 8647 times by 1 test: 1;return 1; Executed by:
executed 8647 times by 1 test: return 1; Executed by:
| 8647 | ||||||||||||
320 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||
321 | } | - | ||||||||||||
322 | static int check_suite_b(EVP_PKEY *pkey, int sign_nid, unsigned long *pflags) | - | ||||||||||||
323 | { | - | ||||||||||||
324 | const EC_GROUP *grp = | - | ||||||||||||
325 | ((void *)0) | - | ||||||||||||
326 | ; | - | ||||||||||||
327 | int curve_nid; | - | ||||||||||||
328 | if (pkey
| 0-4 | ||||||||||||
329 | grp = EC_KEY_get0_group(EVP_PKEY_get0_EC_KEY(pkey)); executed 2 times by 1 test: grp = EC_KEY_get0_group(EVP_PKEY_get0_EC_KEY(pkey)); Executed by:
| 2 | ||||||||||||
330 | if (!grp
| 2 | ||||||||||||
331 | return executed 2 times by 1 test: 57;return 57; Executed by:
executed 2 times by 1 test: return 57; Executed by:
| 2 | ||||||||||||
332 | curve_nid = EC_GROUP_get_curve_name(grp); | - | ||||||||||||
333 | - | |||||||||||||
334 | if (curve_nid == 715
| 1 | ||||||||||||
335 | - | |||||||||||||
336 | - | |||||||||||||
337 | - | |||||||||||||
338 | if (sign_nid != -1
| 0-1 | ||||||||||||
339 | return never executed: 59;return 59; never executed: return 59; | 0 | ||||||||||||
340 | if (!(*pflags & 0x20000)
| 0-1 | ||||||||||||
341 | return never executed: 60;return 60; never executed: return 60; | 0 | ||||||||||||
342 | - | |||||||||||||
343 | *pflags &= ~0x10000; | - | ||||||||||||
344 | } executed 1 time by 1 test: else if (curve_nid == 415end of block Executed by:
| 0-1 | ||||||||||||
345 | if (sign_nid != -1
| 0-1 | ||||||||||||
346 | return never executed: 59;return 59; never executed: return 59; | 0 | ||||||||||||
347 | if (!(*pflags & 0x10000)
| 0-1 | ||||||||||||
348 | return never executed: 60;return 60; never executed: return 60; | 0 | ||||||||||||
349 | } executed 1 time by 1 test: elseend of block Executed by:
| 1 | ||||||||||||
350 | return never executed: 58;return 58; never executed: return 58; | 0 | ||||||||||||
351 | - | |||||||||||||
352 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||
353 | } | - | ||||||||||||
354 | - | |||||||||||||
355 | int X509_chain_check_suiteb(int *perror_depth, X509 *x, struct stack_st_X509 *chain, | - | ||||||||||||
356 | unsigned long flags) | - | ||||||||||||
357 | { | - | ||||||||||||
358 | int rv, i, sign_nid; | - | ||||||||||||
359 | EVP_PKEY *pk; | - | ||||||||||||
360 | unsigned long tflags = flags; | - | ||||||||||||
361 | - | |||||||||||||
362 | if (!(flags & 0x30000)
| 4-1342 | ||||||||||||
363 | return executed 1342 times by 1 test: 0;return 0; Executed by:
executed 1342 times by 1 test: return 0; Executed by:
| 1342 | ||||||||||||
364 | - | |||||||||||||
365 | - | |||||||||||||
366 | if (x ==
| 0-4 | ||||||||||||
367 | ((void *)0)
| 0-4 | ||||||||||||
368 | ) { | - | ||||||||||||
369 | x = sk_X509_value(chain, 0); | - | ||||||||||||
370 | i = 1; | - | ||||||||||||
371 | } never executed: elseend of block | 0 | ||||||||||||
372 | i = 0; executed 4 times by 1 test: i = 0; Executed by:
| 4 | ||||||||||||
373 | - | |||||||||||||
374 | pk = X509_get0_pubkey(x); | - | ||||||||||||
375 | - | |||||||||||||
376 | - | |||||||||||||
377 | - | |||||||||||||
378 | - | |||||||||||||
379 | - | |||||||||||||
380 | - | |||||||||||||
381 | - | |||||||||||||
382 | if (chain ==
| 0-4 | ||||||||||||
383 | ((void *)0)
| 0-4 | ||||||||||||
384 | ) | - | ||||||||||||
385 | return executed 4 times by 1 test: check_suite_b(pk, -1, &tflags);return check_suite_b(pk, -1, &tflags); Executed by:
executed 4 times by 1 test: return check_suite_b(pk, -1, &tflags); Executed by:
| 4 | ||||||||||||
386 | - | |||||||||||||
387 | if (X509_get_version(x) != 2
| 0 | ||||||||||||
388 | rv = 56; | - | ||||||||||||
389 | - | |||||||||||||
390 | i = 0; | - | ||||||||||||
391 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||
392 | } | - | ||||||||||||
393 | - | |||||||||||||
394 | - | |||||||||||||
395 | rv = check_suite_b(pk, -1, &tflags); | - | ||||||||||||
396 | if (rv != 0
| 0 | ||||||||||||
397 | - | |||||||||||||
398 | i = 0; | - | ||||||||||||
399 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||
400 | } | - | ||||||||||||
401 | for (; i < sk_X509_num(chain)
| 0 | ||||||||||||
402 | sign_nid = X509_get_signature_nid(x); | - | ||||||||||||
403 | x = sk_X509_value(chain, i); | - | ||||||||||||
404 | if (X509_get_version(x) != 2
| 0 | ||||||||||||
405 | rv = 56; | - | ||||||||||||
406 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||
407 | } | - | ||||||||||||
408 | pk = X509_get0_pubkey(x); | - | ||||||||||||
409 | rv = check_suite_b(pk, sign_nid, &tflags); | - | ||||||||||||
410 | if (rv != 0
| 0 | ||||||||||||
411 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||
412 | } never executed: end of block | 0 | ||||||||||||
413 | - | |||||||||||||
414 | - | |||||||||||||
415 | rv = check_suite_b(pk, X509_get_signature_nid(x), &tflags); | - | ||||||||||||
416 | end: code before this statement never executed: end: | 0 | ||||||||||||
417 | if (rv != 0
| 0 | ||||||||||||
418 | - | |||||||||||||
419 | if ((rv == 59
| 0 | ||||||||||||
420 | || rv == 60
| 0 | ||||||||||||
421 | i--; never executed: i--; | 0 | ||||||||||||
422 | - | |||||||||||||
423 | - | |||||||||||||
424 | - | |||||||||||||
425 | - | |||||||||||||
426 | if (rv == 60
| 0 | ||||||||||||
427 | rv = 61; never executed: rv = 61; | 0 | ||||||||||||
428 | if (perror_depth
| 0 | ||||||||||||
429 | * never executed: perror_depth = i;*perror_depth = i; never executed: *perror_depth = i; | 0 | ||||||||||||
430 | } never executed: end of block | 0 | ||||||||||||
431 | return never executed: rv;return rv; never executed: return rv; | 0 | ||||||||||||
432 | } | - | ||||||||||||
433 | - | |||||||||||||
434 | int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags) | - | ||||||||||||
435 | { | - | ||||||||||||
436 | int sign_nid; | - | ||||||||||||
437 | if (!(flags & 0x30000)
| 0-5 | ||||||||||||
438 | return executed 5 times by 1 test: 0;return 0; Executed by:
executed 5 times by 1 test: return 0; Executed by:
| 5 | ||||||||||||
439 | sign_nid = OBJ_obj2nid(crl->crl.sig_alg.algorithm); | - | ||||||||||||
440 | return never executed: check_suite_b(pk, sign_nid, &flags);return check_suite_b(pk, sign_nid, &flags); never executed: return check_suite_b(pk, sign_nid, &flags); | 0 | ||||||||||||
441 | } | - | ||||||||||||
442 | struct stack_st_X509 *X509_chain_up_ref(struct stack_st_X509 *chain) | - | ||||||||||||
443 | { | - | ||||||||||||
444 | struct stack_st_X509 *ret; | - | ||||||||||||
445 | int i; | - | ||||||||||||
446 | ret = sk_X509_dup(chain); | - | ||||||||||||
447 | for (i = 0; i < sk_X509_num(ret)
| 3673-5071 | ||||||||||||
448 | X509 *x = sk_X509_value(ret, i); | - | ||||||||||||
449 | X509_up_ref(x); | - | ||||||||||||
450 | } executed 5071 times by 1 test: end of block Executed by:
| 5071 | ||||||||||||
451 | return executed 3673 times by 1 test: ret;return ret; Executed by:
executed 3673 times by 1 test: return ret; Executed by:
| 3673 | ||||||||||||
452 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |