Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/objects/obj_xref.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | static struct stack_st_nid_triple *sig_app, *sigx_app; | - | ||||||||||||
3 | - | |||||||||||||
4 | static int sig_cmp(const nid_triple *a, const nid_triple *b) | - | ||||||||||||
5 | { | - | ||||||||||||
6 | return executed 75759 times by 1 test: a->sign_id - b->sign_id;return a->sign_id - b->sign_id; Executed by:
executed 75759 times by 1 test: return a->sign_id - b->sign_id; Executed by:
| 75759 | ||||||||||||
7 | } | - | ||||||||||||
8 | - | |||||||||||||
9 | static int sig_cmp_BSEARCH_CMP_FN(const void *, const void *); static int sig_cmp(nid_triple const *, nid_triple const *); static nid_triple * OBJ_bsearch_sig(nid_triple *key, nid_triple const *base, int num); | - | ||||||||||||
10 | static int sig_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) { nid_triple const *a = a_; nid_triple const *b = b_; return executed 75759 times by 1 test: sig_cmp(a,b);return sig_cmp(a,b); Executed by:
executed 75759 times by 1 test: } static nid_triple *OBJ_bsearch_sig(nid_triple *key, nid_triple const *base, int num) { returnreturn sig_cmp(a,b); Executed by:
executed 15550 times by 1 test: (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN);return (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN); Executed by:
executed 15550 times by 1 test: } extern void dummy_prototype(void);return (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple), sig_cmp_BSEARCH_CMP_FN); Executed by:
| 15550-75759 | ||||||||||||
11 | - | |||||||||||||
12 | static int sig_sk_cmp(const nid_triple *const *a, const nid_triple *const *b) | - | ||||||||||||
13 | { | - | ||||||||||||
14 | return never executed: (*a)->sign_id - (*b)->sign_id;return (*a)->sign_id - (*b)->sign_id; never executed: return (*a)->sign_id - (*b)->sign_id; | 0 | ||||||||||||
15 | } | - | ||||||||||||
16 | - | |||||||||||||
17 | static int sigx_cmp_BSEARCH_CMP_FN(const void *, const void *); static int sigx_cmp(const nid_triple * const *, const nid_triple * const *); static const nid_triple * * OBJ_bsearch_sigx(const nid_triple * *key, const nid_triple * const *base, int num); | - | ||||||||||||
18 | - | |||||||||||||
19 | static int sigx_cmp(const nid_triple *const *a, const nid_triple *const *b) | - | ||||||||||||
20 | { | - | ||||||||||||
21 | int ret; | - | ||||||||||||
22 | ret = (*a)->hash_id - (*b)->hash_id; | - | ||||||||||||
23 | if (ret
| 91-124 | ||||||||||||
24 | return executed 124 times by 1 test: ret;return ret; Executed by:
executed 124 times by 1 test: return ret; Executed by:
| 124 | ||||||||||||
25 | return executed 91 times by 1 test: (*a)->pkey_id - (*b)->pkey_id;return (*a)->pkey_id - (*b)->pkey_id; Executed by:
executed 91 times by 1 test: return (*a)->pkey_id - (*b)->pkey_id; Executed by:
| 91 | ||||||||||||
26 | } | - | ||||||||||||
27 | - | |||||||||||||
28 | static int sigx_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) { const nid_triple * const *a = a_; const nid_triple * const *b = b_; return executed 215 times by 1 test: sigx_cmp(a,b);return sigx_cmp(a,b); Executed by:
executed 215 times by 1 test: } static const nid_triple * *OBJ_bsearch_sigx(const nid_triple * *key, const nid_triple * const *base, int num) { returnreturn sigx_cmp(a,b); Executed by:
executed 65 times by 1 test: (const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *), sigx_cmp_BSEARCH_CMP_FN);return (const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *), sigx_cmp_BSEARCH_CMP_FN); Executed by:
executed 65 times by 1 test: } extern void dummy_prototype(void);return (const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *), sigx_cmp_BSEARCH_CMP_FN); Executed by:
| 65-215 | ||||||||||||
29 | - | |||||||||||||
30 | int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid) | - | ||||||||||||
31 | { | - | ||||||||||||
32 | nid_triple tmp; | - | ||||||||||||
33 | const nid_triple *rv = | - | ||||||||||||
34 | ((void *)0) | - | ||||||||||||
35 | ; | - | ||||||||||||
36 | tmp.sign_id = signid; | - | ||||||||||||
37 | - | |||||||||||||
38 | if (sig_app !=
| 0-15550 | ||||||||||||
39 | ((void *)0)
| 0-15550 | ||||||||||||
40 | ) { | - | ||||||||||||
41 | int idx = sk_nid_triple_find(sig_app, &tmp); | - | ||||||||||||
42 | rv = sk_nid_triple_value(sig_app, idx); | - | ||||||||||||
43 | } never executed: end of block | 0 | ||||||||||||
44 | - | |||||||||||||
45 | if (rv ==
| 0-15550 | ||||||||||||
46 | ((void *)0)
| 0-15550 | ||||||||||||
47 | ) { | - | ||||||||||||
48 | rv = OBJ_bsearch_sig(&tmp, sigoid_srt, (sizeof(sigoid_srt)/sizeof((sigoid_srt)[0]))); | - | ||||||||||||
49 | } executed 15550 times by 1 test: end of block Executed by:
| 15550 | ||||||||||||
50 | - | |||||||||||||
51 | if (rv ==
| 828-14722 | ||||||||||||
52 | ((void *)0)
| 828-14722 | ||||||||||||
53 | ) | - | ||||||||||||
54 | return executed 828 times by 1 test: 0;return 0; Executed by:
executed 828 times by 1 test: return 0; Executed by:
| 828 | ||||||||||||
55 | if (pdig_nid
| 0-14722 | ||||||||||||
56 | * executed 14722 times by 1 test: pdig_nid = rv->hash_id;*pdig_nid = rv->hash_id; Executed by:
executed 14722 times by 1 test: *pdig_nid = rv->hash_id; Executed by:
| 14722 | ||||||||||||
57 | if (ppkey_nid
| 0-14722 | ||||||||||||
58 | * executed 14722 times by 1 test: ppkey_nid = rv->pkey_id;*ppkey_nid = rv->pkey_id; Executed by:
executed 14722 times by 1 test: *ppkey_nid = rv->pkey_id; Executed by:
| 14722 | ||||||||||||
59 | return executed 14722 times by 1 test: 1;return 1; Executed by:
executed 14722 times by 1 test: return 1; Executed by:
| 14722 | ||||||||||||
60 | } | - | ||||||||||||
61 | - | |||||||||||||
62 | int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) | - | ||||||||||||
63 | { | - | ||||||||||||
64 | nid_triple tmp; | - | ||||||||||||
65 | const nid_triple *t = &tmp; | - | ||||||||||||
66 | const nid_triple **rv = | - | ||||||||||||
67 | ((void *)0) | - | ||||||||||||
68 | ; | - | ||||||||||||
69 | - | |||||||||||||
70 | tmp.hash_id = dig_nid; | - | ||||||||||||
71 | tmp.pkey_id = pkey_nid; | - | ||||||||||||
72 | - | |||||||||||||
73 | if (sigx_app
| 0-65 | ||||||||||||
74 | int idx = sk_nid_triple_find(sigx_app, &tmp); | - | ||||||||||||
75 | if (idx >= 0
| 0 | ||||||||||||
76 | t = sk_nid_triple_value(sigx_app, idx); | - | ||||||||||||
77 | rv = &t; | - | ||||||||||||
78 | } never executed: end of block | 0 | ||||||||||||
79 | } never executed: end of block | 0 | ||||||||||||
80 | - | |||||||||||||
81 | if (rv ==
| 0-65 | ||||||||||||
82 | ((void *)0)
| 0-65 | ||||||||||||
83 | ) { | - | ||||||||||||
84 | rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref, (sizeof(sigoid_srt_xref)/sizeof((sigoid_srt_xref)[0]))); | - | ||||||||||||
85 | } executed 65 times by 1 test: end of block Executed by:
| 65 | ||||||||||||
86 | - | |||||||||||||
87 | if (rv ==
| 0-65 | ||||||||||||
88 | ((void *)0)
| 0-65 | ||||||||||||
89 | ) | - | ||||||||||||
90 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
91 | if (psignid
| 0-65 | ||||||||||||
92 | * executed 65 times by 1 test: psignid = (*rv)->sign_id;*psignid = (*rv)->sign_id; Executed by:
executed 65 times by 1 test: *psignid = (*rv)->sign_id; Executed by:
| 65 | ||||||||||||
93 | return executed 65 times by 1 test: 1;return 1; Executed by:
executed 65 times by 1 test: return 1; Executed by:
| 65 | ||||||||||||
94 | } | - | ||||||||||||
95 | - | |||||||||||||
96 | int OBJ_add_sigid(int signid, int dig_id, int pkey_id) | - | ||||||||||||
97 | { | - | ||||||||||||
98 | nid_triple *ntr; | - | ||||||||||||
99 | if (sig_app ==
| 0 | ||||||||||||
100 | ((void *)0)
| 0 | ||||||||||||
101 | ) | - | ||||||||||||
102 | sig_app = sk_nid_triple_new(sig_sk_cmp); never executed: sig_app = sk_nid_triple_new(sig_sk_cmp); | 0 | ||||||||||||
103 | if (sig_app ==
| 0 | ||||||||||||
104 | ((void *)0)
| 0 | ||||||||||||
105 | ) | - | ||||||||||||
106 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
107 | if (sigx_app ==
| 0 | ||||||||||||
108 | ((void *)0)
| 0 | ||||||||||||
109 | ) | - | ||||||||||||
110 | sigx_app = sk_nid_triple_new(sigx_cmp); never executed: sigx_app = sk_nid_triple_new(sigx_cmp); | 0 | ||||||||||||
111 | if (sigx_app ==
| 0 | ||||||||||||
112 | ((void *)0)
| 0 | ||||||||||||
113 | ) | - | ||||||||||||
114 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
115 | if ((
| 0 | ||||||||||||
116 | ((void *)0)
| 0 | ||||||||||||
117 | ) { | - | ||||||||||||
118 | ERR_put_error(8,(107),((1|64)),__FILE__,107); | - | ||||||||||||
119 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
120 | } | - | ||||||||||||
121 | ntr->sign_id = signid; | - | ||||||||||||
122 | ntr->hash_id = dig_id; | - | ||||||||||||
123 | ntr->pkey_id = pkey_id; | - | ||||||||||||
124 | - | |||||||||||||
125 | if (!sk_nid_triple_push(sig_app, ntr)
| 0 | ||||||||||||
126 | CRYPTO_free(ntr, __FILE__, 115); | - | ||||||||||||
127 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
128 | } | - | ||||||||||||
129 | - | |||||||||||||
130 | if (!sk_nid_triple_push(sigx_app, ntr)
| 0 | ||||||||||||
131 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
132 | - | |||||||||||||
133 | sk_nid_triple_sort(sig_app); | - | ||||||||||||
134 | sk_nid_triple_sort(sigx_app); | - | ||||||||||||
135 | - | |||||||||||||
136 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||
137 | } | - | ||||||||||||
138 | - | |||||||||||||
139 | static void sid_free(nid_triple *tt) | - | ||||||||||||
140 | { | - | ||||||||||||
141 | CRYPTO_free(tt, __FILE__, 130); | - | ||||||||||||
142 | } never executed: end of block | 0 | ||||||||||||
143 | - | |||||||||||||
144 | void OBJ_sigid_free(void) | - | ||||||||||||
145 | { | - | ||||||||||||
146 | sk_nid_triple_pop_free(sig_app, sid_free); | - | ||||||||||||
147 | sig_app = | - | ||||||||||||
148 | ((void *)0) | - | ||||||||||||
149 | ; | - | ||||||||||||
150 | sk_nid_triple_free(sigx_app); | - | ||||||||||||
151 | sigx_app = | - | ||||||||||||
152 | ((void *)0) | - | ||||||||||||
153 | ; | - | ||||||||||||
154 | } executed 2076 times by 12 tests: end of block Executed by:
| 2076 | ||||||||||||
Switch to Source code | Preprocessed file |