Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/tasn_utl.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||
3 | { | - | ||||||||||||
4 | int *sel = (void *)(((char *) *pval) + it->utype); | - | ||||||||||||
5 | return executed 325287 times by 1 test: *sel;return *sel; Executed by:
executed 325287 times by 1 test: return *sel; Executed by:
| 325287 | ||||||||||||
6 | } | - | ||||||||||||
7 | - | |||||||||||||
8 | - | |||||||||||||
9 | - | |||||||||||||
10 | - | |||||||||||||
11 | - | |||||||||||||
12 | int asn1_set_choice_selector(ASN1_VALUE **pval, int value, | - | ||||||||||||
13 | const ASN1_ITEM *it) | - | ||||||||||||
14 | { | - | ||||||||||||
15 | int *sel, ret; | - | ||||||||||||
16 | sel = (void *)(((char *) *pval) + it->utype); | - | ||||||||||||
17 | ret = *sel; | - | ||||||||||||
18 | *sel = value; | - | ||||||||||||
19 | return executed 349929 times by 1 test: ret;return ret; Executed by:
executed 349929 times by 1 test: return ret; Executed by:
| 349929 | ||||||||||||
20 | } | - | ||||||||||||
21 | int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it) | - | ||||||||||||
22 | { | - | ||||||||||||
23 | const ASN1_AUX *aux; | - | ||||||||||||
24 | CRYPTO_REF_COUNT *lck; | - | ||||||||||||
25 | CRYPTO_RWLOCK **lock; | - | ||||||||||||
26 | int ret = -1; | - | ||||||||||||
27 | - | |||||||||||||
28 | if ((
| 101854-3271981 | ||||||||||||
29 | && (
| 0-101854 | ||||||||||||
30 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
31 | aux = it->funcs; | - | ||||||||||||
32 | if (!aux
| 196943-2688219 | ||||||||||||
33 | return executed 3176892 times by 2 tests: 0;return 0; Executed by:
executed 3176892 times by 2 tests: return 0; Executed by:
| 3176892 | ||||||||||||
34 | lck = (void *)(((char *) *pval) + aux->ref_offset); | - | ||||||||||||
35 | lock = (void *)(((char *) *pval) + aux->ref_lock); | - | ||||||||||||
36 | - | |||||||||||||
37 | switch (op) { | - | ||||||||||||
38 | case executed 80831 times by 1 test: 0:case 0: Executed by:
executed 80831 times by 1 test: case 0: Executed by:
| 80831 | ||||||||||||
39 | *lck = ret = 1; | - | ||||||||||||
40 | *lock = CRYPTO_THREAD_lock_new(); | - | ||||||||||||
41 | if (*lock
| 0-80831 | ||||||||||||
42 | ((void *)0)
| 0-80831 | ||||||||||||
43 | ) { | - | ||||||||||||
44 | ERR_put_error(13,(233),((1|64)),__FILE__,79); | - | ||||||||||||
45 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
46 | } | - | ||||||||||||
47 | break; executed 80831 times by 1 test: break; Executed by:
| 80831 | ||||||||||||
48 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||
49 | if (!CRYPTO_UP_REF(lck, &ret, *lock)
| 0 | ||||||||||||
50 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
51 | break; never executed: break; | 0 | ||||||||||||
52 | case executed 116112 times by 1 test: -1:case -1: Executed by:
executed 116112 times by 1 test: case -1: Executed by:
| 116112 | ||||||||||||
53 | if (!CRYPTO_DOWN_REF(lck, &ret, *lock)
| 0-116112 | ||||||||||||
54 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
55 | - | |||||||||||||
56 | - | |||||||||||||
57 | - | |||||||||||||
58 | ; | - | ||||||||||||
59 | if (ret == 0
| 35281-80831 | ||||||||||||
60 | CRYPTO_THREAD_lock_free(*lock); | - | ||||||||||||
61 | *lock = | - | ||||||||||||
62 | ((void *)0) | - | ||||||||||||
63 | ; | - | ||||||||||||
64 | } executed 80831 times by 1 test: end of block Executed by:
| 80831 | ||||||||||||
65 | break; executed 116112 times by 1 test: break; Executed by:
| 116112 | ||||||||||||
66 | } | - | ||||||||||||
67 | - | |||||||||||||
68 | return executed 196943 times by 1 test: ret;return ret; Executed by:
executed 196943 times by 1 test: return ret; Executed by:
| 196943 | ||||||||||||
69 | } | - | ||||||||||||
70 | - | |||||||||||||
71 | static ASN1_ENCODING *asn1_get_enc_ptr(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||
72 | { | - | ||||||||||||
73 | const ASN1_AUX *aux; | - | ||||||||||||
74 | if (!pval
| 0-5472365 | ||||||||||||
75 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
76 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
77 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
78 | aux = it->funcs; | - | ||||||||||||
79 | if (!aux
| 412587-4301377 | ||||||||||||
80 | return executed 5059778 times by 2 tests: return ((void *)0) ; Executed by:
executed 5059778 times by 2 tests: return ((void *)0) ; Executed by:
| 5059778 | ||||||||||||
81 | ((void *)0) executed 5059778 times by 2 tests: return ((void *)0) ; Executed by:
| 5059778 | ||||||||||||
82 | ; executed 5059778 times by 2 tests: return ((void *)0) ; Executed by:
| 5059778 | ||||||||||||
83 | return executed 412587 times by 1 test: (void *)(((char *) *pval) + aux->enc_offset);return (void *)(((char *) *pval) + aux->enc_offset); Executed by:
executed 412587 times by 1 test: return (void *)(((char *) *pval) + aux->enc_offset); Executed by:
| 412587 | ||||||||||||
84 | } | - | ||||||||||||
85 | - | |||||||||||||
86 | void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||
87 | { | - | ||||||||||||
88 | ASN1_ENCODING *enc; | - | ||||||||||||
89 | enc = asn1_get_enc_ptr(pval, it); | - | ||||||||||||
90 | if (enc
| 89717-1570271 | ||||||||||||
91 | enc->enc = | - | ||||||||||||
92 | ((void *)0) | - | ||||||||||||
93 | ; | - | ||||||||||||
94 | enc->len = 0; | - | ||||||||||||
95 | enc->modified = 1; | - | ||||||||||||
96 | } executed 89717 times by 1 test: end of block Executed by:
| 89717 | ||||||||||||
97 | } executed 1659988 times by 2 tests: end of block Executed by:
| 1659988 | ||||||||||||
98 | - | |||||||||||||
99 | void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||
100 | { | - | ||||||||||||
101 | ASN1_ENCODING *enc; | - | ||||||||||||
102 | enc = asn1_get_enc_ptr(pval, it); | - | ||||||||||||
103 | if (enc
| 89717-1561266 | ||||||||||||
104 | CRYPTO_free(enc->enc, __FILE__, 131); | - | ||||||||||||
105 | enc->enc = | - | ||||||||||||
106 | ((void *)0) | - | ||||||||||||
107 | ; | - | ||||||||||||
108 | enc->len = 0; | - | ||||||||||||
109 | enc->modified = 1; | - | ||||||||||||
110 | } executed 89717 times by 1 test: end of block Executed by:
| 89717 | ||||||||||||
111 | } executed 1650983 times by 2 tests: end of block Executed by:
| 1650983 | ||||||||||||
112 | - | |||||||||||||
113 | int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, | - | ||||||||||||
114 | const ASN1_ITEM *it) | - | ||||||||||||
115 | { | - | ||||||||||||
116 | ASN1_ENCODING *enc; | - | ||||||||||||
117 | enc = asn1_get_enc_ptr(pval, it); | - | ||||||||||||
118 | if (!enc
| 69204-882759 | ||||||||||||
119 | return executed 882759 times by 2 tests: 1;return 1; Executed by:
executed 882759 times by 2 tests: return 1; Executed by:
| 882759 | ||||||||||||
120 | - | |||||||||||||
121 | CRYPTO_free(enc->enc, __FILE__, 146); | - | ||||||||||||
122 | if ((
| 0-69204 | ||||||||||||
123 | ((void *)0)
| 0-69204 | ||||||||||||
124 | ) { | - | ||||||||||||
125 | ERR_put_error(13,(115),((1|64)),__FILE__,148); | - | ||||||||||||
126 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
127 | } | - | ||||||||||||
128 | memcpy(enc->enc, in, inlen); | - | ||||||||||||
129 | enc->len = inlen; | - | ||||||||||||
130 | enc->modified = 0; | - | ||||||||||||
131 | - | |||||||||||||
132 | return executed 69204 times by 1 test: 1;return 1; Executed by:
executed 69204 times by 1 test: return 1; Executed by:
| 69204 | ||||||||||||
133 | } | - | ||||||||||||
134 | - | |||||||||||||
135 | int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, | - | ||||||||||||
136 | const ASN1_ITEM *it) | - | ||||||||||||
137 | { | - | ||||||||||||
138 | ASN1_ENCODING *enc; | - | ||||||||||||
139 | enc = asn1_get_enc_ptr(pval, it); | - | ||||||||||||
140 | if (!enc
| 124-1045482 | ||||||||||||
141 | return executed 1045606 times by 2 tests: 0;return 0; Executed by:
executed 1045606 times by 2 tests: return 0; Executed by:
| 1045606 | ||||||||||||
142 | if (out
| 54587-109238 | ||||||||||||
143 | memcpy(*out, enc->enc, enc->len); | - | ||||||||||||
144 | *out += enc->len; | - | ||||||||||||
145 | } executed 54587 times by 1 test: end of block Executed by:
| 54587 | ||||||||||||
146 | if (len
| 0-163825 | ||||||||||||
147 | * executed 163825 times by 1 test: len = enc->len;*len = enc->len; Executed by:
executed 163825 times by 1 test: *len = enc->len; Executed by:
| 163825 | ||||||||||||
148 | return executed 163825 times by 1 test: 1;return 1; Executed by:
executed 163825 times by 1 test: return 1; Executed by:
| 163825 | ||||||||||||
149 | } | - | ||||||||||||
150 | - | |||||||||||||
151 | - | |||||||||||||
152 | ASN1_VALUE **asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) | - | ||||||||||||
153 | { | - | ||||||||||||
154 | ASN1_VALUE **pvaltmp; | - | ||||||||||||
155 | pvaltmp = (void *)(((char *) *pval) + tt->offset); | - | ||||||||||||
156 | - | |||||||||||||
157 | - | |||||||||||||
158 | - | |||||||||||||
159 | - | |||||||||||||
160 | return executed 17774150 times by 2 tests: pvaltmp;return pvaltmp; Executed by:
executed 17774150 times by 2 tests: return pvaltmp; Executed by:
| 17774150 | ||||||||||||
161 | } | - | ||||||||||||
162 | - | |||||||||||||
163 | - | |||||||||||||
164 | - | |||||||||||||
165 | - | |||||||||||||
166 | - | |||||||||||||
167 | - | |||||||||||||
168 | const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, | - | ||||||||||||
169 | int nullerr) | - | ||||||||||||
170 | { | - | ||||||||||||
171 | const ASN1_ADB *adb; | - | ||||||||||||
172 | const ASN1_ADB_TABLE *atbl; | - | ||||||||||||
173 | long selector; | - | ||||||||||||
174 | ASN1_VALUE **sfld; | - | ||||||||||||
175 | int i; | - | ||||||||||||
176 | if (!(tt->flags & (0x3<<8))
| 105640-11996246 | ||||||||||||
177 | return executed 11996246 times by 2 tests: tt;return tt; Executed by:
executed 11996246 times by 2 tests: return tt; Executed by:
| 11996246 | ||||||||||||
178 | - | |||||||||||||
179 | - | |||||||||||||
180 | adb = ((const ASN1_ADB *)(tt->item)); | - | ||||||||||||
181 | - | |||||||||||||
182 | - | |||||||||||||
183 | sfld = (void *)(((char *) *pval) + adb->offset); | - | ||||||||||||
184 | - | |||||||||||||
185 | - | |||||||||||||
186 | if (*
| 43058-62582 | ||||||||||||
187 | ((void *)0)
| 43058-62582 | ||||||||||||
188 | ) { | - | ||||||||||||
189 | if (!adb->null_tt
| 0-43058 | ||||||||||||
190 | goto executed 43058 times by 1 test: err;goto err; Executed by:
executed 43058 times by 1 test: goto err; Executed by:
| 43058 | ||||||||||||
191 | return never executed: adb->null_tt;return adb->null_tt; never executed: return adb->null_tt; | 0 | ||||||||||||
192 | } | - | ||||||||||||
193 | - | |||||||||||||
194 | - | |||||||||||||
195 | - | |||||||||||||
196 | - | |||||||||||||
197 | - | |||||||||||||
198 | if (tt->flags & (0x1<<8)
| 0-62582 | ||||||||||||
199 | selector = OBJ_obj2nid((ASN1_OBJECT *)*sfld); executed 62582 times by 1 test: selector = OBJ_obj2nid((ASN1_OBJECT *)*sfld); Executed by:
| 62582 | ||||||||||||
200 | else | - | ||||||||||||
201 | selector = ASN1_INTEGER_get((ASN1_INTEGER *)*sfld); never executed: selector = ASN1_INTEGER_get((ASN1_INTEGER *)*sfld); | 0 | ||||||||||||
202 | - | |||||||||||||
203 | - | |||||||||||||
204 | if (adb->adb_cb !=
| 0-62582 | ||||||||||||
205 | ((void *)0)
| 0-62582 | ||||||||||||
206 | && adb->adb_cb(&selector) == 0
| 0 | ||||||||||||
207 | ERR_put_error(13,(110),(164),__FILE__,226); | - | ||||||||||||
208 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
209 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
210 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
211 | } | - | ||||||||||||
212 | for (atbl = adb->tbl, i = 0; i < adb->tblcount
| 51098-283401 | ||||||||||||
213 | if (atbl->value == selector
| 11484-271917 | ||||||||||||
214 | return executed 11484 times by 1 test: &atbl->tt;return &atbl->tt; Executed by:
executed 11484 times by 1 test: return &atbl->tt; Executed by:
| 11484 | ||||||||||||
215 | - | |||||||||||||
216 | - | |||||||||||||
217 | - | |||||||||||||
218 | - | |||||||||||||
219 | if (!adb->default_tt
| 0-51098 | ||||||||||||
220 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
221 | return executed 51098 times by 1 test: adb->default_tt;return adb->default_tt; Executed by:
executed 51098 times by 1 test: return adb->default_tt; Executed by:
| 51098 | ||||||||||||
222 | - | |||||||||||||
223 | err: | - | ||||||||||||
224 | - | |||||||||||||
225 | if (nullerr
| 0-43058 | ||||||||||||
226 | ERR_put_error(13,(110),(164),__FILE__,251); never executed: ERR_put_error(13,(110),(164),__FILE__,251); | 0 | ||||||||||||
227 | return executed 43058 times by 1 test: return ((void *)0) ; Executed by:
executed 43058 times by 1 test: return ((void *)0) ; Executed by:
| 43058 | ||||||||||||
228 | ((void *)0) executed 43058 times by 1 test: return ((void *)0) ; Executed by:
| 43058 | ||||||||||||
229 | ; executed 43058 times by 1 test: return ((void *)0) ; Executed by:
| 43058 | ||||||||||||
230 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |