Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/a_verify.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | int | - | ||||||||||||
7 | ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, | - | ||||||||||||
8 | ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey) | - | ||||||||||||
9 | { | - | ||||||||||||
10 | EVP_MD_CTX ctx; | - | ||||||||||||
11 | unsigned char *buf_in = | - | ||||||||||||
12 | ((void *)0) | - | ||||||||||||
13 | ; | - | ||||||||||||
14 | int ret = -1, inl; | - | ||||||||||||
15 | - | |||||||||||||
16 | int mdnid, pknid; | - | ||||||||||||
17 | - | |||||||||||||
18 | if (!pkey
| 0-72 | ||||||||||||
19 | ERR_put_error(13,(0xfff),((3|64)),__FILE__,85); | - | ||||||||||||
20 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
21 | } | - | ||||||||||||
22 | - | |||||||||||||
23 | if (signature->type == 3
| 0-72 | ||||||||||||
24 | { | - | ||||||||||||
25 | ERR_put_error(13,(0xfff),(220),__FILE__,91); | - | ||||||||||||
26 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
27 | } | - | ||||||||||||
28 | - | |||||||||||||
29 | EVP_MD_CTX_init(&ctx); | - | ||||||||||||
30 | - | |||||||||||||
31 | - | |||||||||||||
32 | if (!OBJ_find_sigid_algs(OBJ_obj2nid(a->algorithm), &mdnid, &pknid)
| 0-72 | ||||||||||||
33 | ERR_put_error(13,(0xfff),(199),__FILE__,99); | - | ||||||||||||
34 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
35 | } | - | ||||||||||||
36 | if (mdnid == 0
| 0-72 | ||||||||||||
37 | if (!pkey->ameth
| 0 | ||||||||||||
38 | ERR_put_error(13,(0xfff),(199),__FILE__,104); | - | ||||||||||||
39 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
40 | } | - | ||||||||||||
41 | ret = pkey->ameth->item_verify(&ctx, it, asn, a, | - | ||||||||||||
42 | signature, pkey); | - | ||||||||||||
43 | - | |||||||||||||
44 | - | |||||||||||||
45 | - | |||||||||||||
46 | - | |||||||||||||
47 | if (ret != 2
| 0 | ||||||||||||
48 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
49 | ret = -1; | - | ||||||||||||
50 | } never executed: else {end of block | 0 | ||||||||||||
51 | const EVP_MD *type; | - | ||||||||||||
52 | type = EVP_get_digestbyname(OBJ_nid2sn(mdnid)); | - | ||||||||||||
53 | if (type ==
| 0-72 | ||||||||||||
54 | ((void *)0)
| 0-72 | ||||||||||||
55 | ) { | - | ||||||||||||
56 | ERR_put_error(13,(0xfff),(161),__FILE__,120); | - | ||||||||||||
57 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
58 | } | - | ||||||||||||
59 | - | |||||||||||||
60 | - | |||||||||||||
61 | if (EVP_PKEY_type(pknid) != pkey->ameth->pkey_id
| 0-72 | ||||||||||||
62 | ERR_put_error(13,(0xfff),(200),__FILE__,126); | - | ||||||||||||
63 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
64 | } | - | ||||||||||||
65 | - | |||||||||||||
66 | if (!EVP_DigestVerifyInit(&ctx,
| 0-72 | ||||||||||||
67 | ((void *)0)
| 0-72 | ||||||||||||
68 | , type,
| 0-72 | ||||||||||||
69 | ((void *)0)
| 0-72 | ||||||||||||
70 | , pkey)
| 0-72 | ||||||||||||
71 | ERR_put_error(13,(0xfff),(6),__FILE__,131); | - | ||||||||||||
72 | ret = 0; | - | ||||||||||||
73 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
74 | } | - | ||||||||||||
75 | - | |||||||||||||
76 | } executed 72 times by 2 tests: end of block Executed by:
| 72 | ||||||||||||
77 | - | |||||||||||||
78 | inl = ASN1_item_i2d(asn, &buf_in, it); | - | ||||||||||||
79 | - | |||||||||||||
80 | if (buf_in ==
| 0-72 | ||||||||||||
81 | ((void *)0)
| 0-72 | ||||||||||||
82 | ) { | - | ||||||||||||
83 | ERR_put_error(13,(0xfff),((1|64)),__FILE__,141); | - | ||||||||||||
84 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
85 | } | - | ||||||||||||
86 | - | |||||||||||||
87 | if (!EVP_DigestUpdate(&ctx,buf_in,inl)
| 0-72 | ||||||||||||
88 | ERR_put_error(13,(0xfff),(6),__FILE__,146); | - | ||||||||||||
89 | ret = 0; | - | ||||||||||||
90 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
91 | } | - | ||||||||||||
92 | - | |||||||||||||
93 | freezero(buf_in, (unsigned int)inl); | - | ||||||||||||
94 | - | |||||||||||||
95 | if (EVP_DigestVerifyFinal(&ctx, signature->data,
| 0-72 | ||||||||||||
96 | (size_t)signature->length) <= 0
| 0-72 | ||||||||||||
97 | ERR_put_error(13,(0xfff),(6),__FILE__,155); | - | ||||||||||||
98 | ret = 0; | - | ||||||||||||
99 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
100 | } | - | ||||||||||||
101 | - | |||||||||||||
102 | - | |||||||||||||
103 | - | |||||||||||||
104 | ret = 1; | - | ||||||||||||
105 | - | |||||||||||||
106 | err: code before this statement executed 72 times by 2 tests: err: Executed by:
| 72 | ||||||||||||
107 | EVP_MD_CTX_cleanup(&ctx); | - | ||||||||||||
108 | return executed 72 times by 2 tests: (ret);return (ret); Executed by:
executed 72 times by 2 tests: return (ret); Executed by:
| 72 | ||||||||||||
109 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |