Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/x_int64.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | static int uint64_new(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||||||||
3 | { | - | ||||||||||||||||||
4 | if ((*
| 0-208 | ||||||||||||||||||
5 | ((void *)0)
| 0-208 | ||||||||||||||||||
6 | ) { | - | ||||||||||||||||||
7 | ERR_put_error(13,(141),((1|64)),__FILE__,32); | - | ||||||||||||||||||
8 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
9 | } | - | ||||||||||||||||||
10 | return executed 208 times by 1 test: 1;return 1; Executed by:
executed 208 times by 1 test: return 1; Executed by:
| 208 | ||||||||||||||||||
11 | } | - | ||||||||||||||||||
12 | - | |||||||||||||||||||
13 | static void uint64_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||||||||
14 | { | - | ||||||||||||||||||
15 | CRYPTO_free(*pval, __FILE__, 40); | - | ||||||||||||||||||
16 | *pval = | - | ||||||||||||||||||
17 | ((void *)0) | - | ||||||||||||||||||
18 | ; | - | ||||||||||||||||||
19 | } executed 13292 times by 1 test: end of block Executed by:
| 13292 | ||||||||||||||||||
20 | - | |||||||||||||||||||
21 | static void uint64_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||||||||
22 | { | - | ||||||||||||||||||
23 | **(uint64_t **)pval = 0; | - | ||||||||||||||||||
24 | } executed 43142 times by 1 test: end of block Executed by:
| 43142 | ||||||||||||||||||
25 | - | |||||||||||||||||||
26 | static int uint64_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, | - | ||||||||||||||||||
27 | const ASN1_ITEM *it) | - | ||||||||||||||||||
28 | { | - | ||||||||||||||||||
29 | uint64_t utmp; | - | ||||||||||||||||||
30 | int neg = 0; | - | ||||||||||||||||||
31 | - | |||||||||||||||||||
32 | char *cp = (char *)*pval; | - | ||||||||||||||||||
33 | - | |||||||||||||||||||
34 | - | |||||||||||||||||||
35 | memcpy(&utmp, cp, sizeof(utmp)); | - | ||||||||||||||||||
36 | - | |||||||||||||||||||
37 | if ((
| 455-62577 | ||||||||||||||||||
38 | && utmp == 0
| 16576-46001 | ||||||||||||||||||
39 | return executed 16576 times by 1 test: -1;return -1; Executed by:
executed 16576 times by 1 test: return -1; Executed by:
| 16576 | ||||||||||||||||||
40 | if ((
| 9423-37033 | ||||||||||||||||||
41 | && (
| 128-36905 | ||||||||||||||||||
42 | - | |||||||||||||||||||
43 | utmp = 0 - utmp; | - | ||||||||||||||||||
44 | neg = 1; | - | ||||||||||||||||||
45 | } executed 128 times by 1 test: end of block Executed by:
| 128 | ||||||||||||||||||
46 | - | |||||||||||||||||||
47 | return executed 46456 times by 1 test: i2c_uint64_int(cont, utmp, neg);return i2c_uint64_int(cont, utmp, neg); Executed by:
executed 46456 times by 1 test: return i2c_uint64_int(cont, utmp, neg); Executed by:
| 46456 | ||||||||||||||||||
48 | } | - | ||||||||||||||||||
49 | - | |||||||||||||||||||
50 | static int uint64_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, | - | ||||||||||||||||||
51 | int utype, char *free_cont, const ASN1_ITEM *it) | - | ||||||||||||||||||
52 | { | - | ||||||||||||||||||
53 | uint64_t utmp = 0; | - | ||||||||||||||||||
54 | char *cp; | - | ||||||||||||||||||
55 | int neg = 0; | - | ||||||||||||||||||
56 | - | |||||||||||||||||||
57 | if (*
| 104-5157 | ||||||||||||||||||
58 | ((void *)0)
| 104-5157 | ||||||||||||||||||
59 | && !uint64_new(pval, it)
| 0-104 | ||||||||||||||||||
60 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
61 | - | |||||||||||||||||||
62 | cp = (char *)*pval; | - | ||||||||||||||||||
63 | - | |||||||||||||||||||
64 | - | |||||||||||||||||||
65 | - | |||||||||||||||||||
66 | - | |||||||||||||||||||
67 | - | |||||||||||||||||||
68 | - | |||||||||||||||||||
69 | - | |||||||||||||||||||
70 | if (len == 0
| 7-5254 | ||||||||||||||||||
71 | goto executed 7 times by 1 test: long_compat;goto long_compat; Executed by:
executed 7 times by 1 test: goto long_compat; Executed by:
| 7 | ||||||||||||||||||
72 | - | |||||||||||||||||||
73 | if (!c2i_uint64_int(&utmp, &neg, &cont, len)
| 69-5185 | ||||||||||||||||||
74 | return executed 69 times by 1 test: 0;return 0; Executed by:
executed 69 times by 1 test: return 0; Executed by:
| 69 | ||||||||||||||||||
75 | if ((
| 22-4051 | ||||||||||||||||||
76 | ERR_put_error(13,(112),(226),__FILE__,97); | - | ||||||||||||||||||
77 | return executed 22 times by 1 test: 0;return 0; Executed by:
executed 22 times by 1 test: return 0; Executed by:
| 22 | ||||||||||||||||||
78 | } | - | ||||||||||||||||||
79 | if ((
| 1112-4051 | ||||||||||||||||||
80 | && !neg
| 5-4015 | ||||||||||||||||||
81 | (9223372036854775807L)
| 5-4010 | ||||||||||||||||||
82 | ) { | - | ||||||||||||||||||
83 | ERR_put_error(13,(112),(223),__FILE__,102); | - | ||||||||||||||||||
84 | return executed 5 times by 1 test: 0;return 0; Executed by:
executed 5 times by 1 test: return 0; Executed by:
| 5 | ||||||||||||||||||
85 | } | - | ||||||||||||||||||
86 | if (neg
| 36-5122 | ||||||||||||||||||
87 | - | |||||||||||||||||||
88 | utmp = 0 - utmp; executed 36 times by 1 test: utmp = 0 - utmp; Executed by:
| 36 | ||||||||||||||||||
89 | - | |||||||||||||||||||
90 | long_compat: code before this statement executed 5158 times by 1 test: long_compat: Executed by:
| 5158 | ||||||||||||||||||
91 | memcpy(cp, &utmp, sizeof(utmp)); | - | ||||||||||||||||||
92 | return executed 5165 times by 1 test: 1;return 1; Executed by:
executed 5165 times by 1 test: return 1; Executed by:
| 5165 | ||||||||||||||||||
93 | } | - | ||||||||||||||||||
94 | - | |||||||||||||||||||
95 | static int uint64_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, | - | ||||||||||||||||||
96 | int indent, const ASN1_PCTX *pctx) | - | ||||||||||||||||||
97 | { | - | ||||||||||||||||||
98 | if ((
| 18-28 | ||||||||||||||||||
99 | return executed 28 times by 1 test: BIO_printf(out, "%jd\n", **(int64_t **)pval);return BIO_printf(out, "%jd\n", **(int64_t **)pval); Executed by:
executed 28 times by 1 test: return BIO_printf(out, "%jd\n", **(int64_t **)pval); Executed by:
| 28 | ||||||||||||||||||
100 | return executed 18 times by 1 test: BIO_printf(out, "%ju\n", **(uint64_t **)pval);return BIO_printf(out, "%ju\n", **(uint64_t **)pval); Executed by:
executed 18 times by 1 test: return BIO_printf(out, "%ju\n", **(uint64_t **)pval); Executed by:
| 18 | ||||||||||||||||||
101 | } | - | ||||||||||||||||||
102 | - | |||||||||||||||||||
103 | - | |||||||||||||||||||
104 | - | |||||||||||||||||||
105 | static int uint32_new(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||||||||
106 | { | - | ||||||||||||||||||
107 | if ((*
| 0 | ||||||||||||||||||
108 | ((void *)0)
| 0 | ||||||||||||||||||
109 | ) { | - | ||||||||||||||||||
110 | ERR_put_error(13,(139),((1|64)),__FILE__,127); | - | ||||||||||||||||||
111 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
112 | } | - | ||||||||||||||||||
113 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||
114 | } | - | ||||||||||||||||||
115 | - | |||||||||||||||||||
116 | static void uint32_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||||||||
117 | { | - | ||||||||||||||||||
118 | CRYPTO_free(*pval, __FILE__, 135); | - | ||||||||||||||||||
119 | *pval = | - | ||||||||||||||||||
120 | ((void *)0) | - | ||||||||||||||||||
121 | ; | - | ||||||||||||||||||
122 | } executed 13292 times by 1 test: end of block Executed by:
| 13292 | ||||||||||||||||||
123 | - | |||||||||||||||||||
124 | static void uint32_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||||||||
125 | { | - | ||||||||||||||||||
126 | **(uint32_t **)pval = 0; | - | ||||||||||||||||||
127 | } executed 130589 times by 1 test: end of block Executed by:
| 130589 | ||||||||||||||||||
128 | - | |||||||||||||||||||
129 | static int uint32_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, | - | ||||||||||||||||||
130 | const ASN1_ITEM *it) | - | ||||||||||||||||||
131 | { | - | ||||||||||||||||||
132 | uint32_t utmp; | - | ||||||||||||||||||
133 | int neg = 0; | - | ||||||||||||||||||
134 | - | |||||||||||||||||||
135 | char *cp = (char *)*pval; | - | ||||||||||||||||||
136 | - | |||||||||||||||||||
137 | - | |||||||||||||||||||
138 | memcpy(&utmp, cp, sizeof(utmp)); | - | ||||||||||||||||||
139 | - | |||||||||||||||||||
140 | if ((
| 48258-72454 | ||||||||||||||||||
141 | && utmp == 0
| 10010-38248 | ||||||||||||||||||
142 | return executed 38248 times by 1 test: -1;return -1; Executed by:
executed 38248 times by 1 test: return -1; Executed by:
| 38248 | ||||||||||||||||||
143 | if ((
| 24391-58073 | ||||||||||||||||||
144 | && (
| 6464-51609 | ||||||||||||||||||
145 | - | |||||||||||||||||||
146 | utmp = 0 - utmp; | - | ||||||||||||||||||
147 | neg = 1; | - | ||||||||||||||||||
148 | } executed 6464 times by 1 test: end of block Executed by:
| 6464 | ||||||||||||||||||
149 | - | |||||||||||||||||||
150 | return executed 82464 times by 1 test: i2c_uint64_int(cont, (uint64_t)utmp, neg);return i2c_uint64_int(cont, (uint64_t)utmp, neg); Executed by:
executed 82464 times by 1 test: return i2c_uint64_int(cont, (uint64_t)utmp, neg); Executed by:
| 82464 | ||||||||||||||||||
151 | } | - | ||||||||||||||||||
152 | static int uint32_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, | - | ||||||||||||||||||
153 | int utype, char *free_cont, const ASN1_ITEM *it) | - | ||||||||||||||||||
154 | { | - | ||||||||||||||||||
155 | uint64_t utmp = 0; | - | ||||||||||||||||||
156 | uint32_t utmp2 = 0; | - | ||||||||||||||||||
157 | char *cp; | - | ||||||||||||||||||
158 | int neg = 0; | - | ||||||||||||||||||
159 | - | |||||||||||||||||||
160 | if (*
| 104-37729 | ||||||||||||||||||
161 | ((void *)0)
| 104-37729 | ||||||||||||||||||
162 | && !uint64_new(pval, it)
| 0-104 | ||||||||||||||||||
163 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
164 | - | |||||||||||||||||||
165 | cp = (char *)*pval; | - | ||||||||||||||||||
166 | - | |||||||||||||||||||
167 | - | |||||||||||||||||||
168 | - | |||||||||||||||||||
169 | - | |||||||||||||||||||
170 | - | |||||||||||||||||||
171 | - | |||||||||||||||||||
172 | - | |||||||||||||||||||
173 | if (len == 0
| 249-37584 | ||||||||||||||||||
174 | goto executed 249 times by 1 test: long_compat;goto long_compat; Executed by:
executed 249 times by 1 test: goto long_compat; Executed by:
| 249 | ||||||||||||||||||
175 | - | |||||||||||||||||||
176 | if (!c2i_uint64_int(&utmp, &neg, &cont, len)
| 401-37183 | ||||||||||||||||||
177 | return executed 401 times by 1 test: 0;return 0; Executed by:
executed 401 times by 1 test: return 0; Executed by:
| 401 | ||||||||||||||||||
178 | if ((
| 325-32888 | ||||||||||||||||||
179 | ERR_put_error(13,(105),(226),__FILE__,200); | - | ||||||||||||||||||
180 | return executed 325 times by 1 test: 0;return 0; Executed by:
executed 325 times by 1 test: return 0; Executed by:
| 325 | ||||||||||||||||||
181 | } | - | ||||||||||||||||||
182 | if (neg
| 6266-30592 | ||||||||||||||||||
183 | if (utmp > ((uint32_t)
| 70-6196 | ||||||||||||||||||
184 | (2147483647)
| 70-6196 | ||||||||||||||||||
185 | + 1)
| 70-6196 | ||||||||||||||||||
186 | ERR_put_error(13,(105),(224),__FILE__,205); | - | ||||||||||||||||||
187 | return executed 70 times by 1 test: 0;return 0; Executed by:
executed 70 times by 1 test: return 0; Executed by:
| 70 | ||||||||||||||||||
188 | } | - | ||||||||||||||||||
189 | utmp = 0 - utmp; | - | ||||||||||||||||||
190 | } executed 6196 times by 1 test: else {end of block Executed by:
| 6196 | ||||||||||||||||||
191 | if (((
| 94-26622 | ||||||||||||||||||
192 | (2147483647)
| 94-26528 | ||||||||||||||||||
193 | ) | - | ||||||||||||||||||
194 | || ((
| 20-26528 | ||||||||||||||||||
195 | (4294967295U)
| 20-3950 | ||||||||||||||||||
196 | )) { | - | ||||||||||||||||||
197 | ERR_put_error(13,(105),(223),__FILE__,212); | - | ||||||||||||||||||
198 | return executed 114 times by 1 test: 0;return 0; Executed by:
executed 114 times by 1 test: return 0; Executed by:
| 114 | ||||||||||||||||||
199 | } | - | ||||||||||||||||||
200 | } executed 30478 times by 1 test: end of block Executed by:
| 30478 | ||||||||||||||||||
201 | - | |||||||||||||||||||
202 | long_compat: code before this statement executed 36674 times by 1 test: long_compat: Executed by:
| 36674 | ||||||||||||||||||
203 | utmp2 = (uint32_t)utmp; | - | ||||||||||||||||||
204 | memcpy(cp, &utmp2, sizeof(utmp2)); | - | ||||||||||||||||||
205 | return executed 36923 times by 1 test: 1;return 1; Executed by:
executed 36923 times by 1 test: return 1; Executed by:
| 36923 | ||||||||||||||||||
206 | } | - | ||||||||||||||||||
207 | - | |||||||||||||||||||
208 | static int uint32_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, | - | ||||||||||||||||||
209 | int indent, const ASN1_PCTX *pctx) | - | ||||||||||||||||||
210 | { | - | ||||||||||||||||||
211 | if ((
| 12-978 | ||||||||||||||||||
212 | return executed 978 times by 1 test: BIO_printf(out, "%d\n", **(int32_t **)pval);return BIO_printf(out, "%d\n", **(int32_t **)pval); Executed by:
executed 978 times by 1 test: return BIO_printf(out, "%d\n", **(int32_t **)pval); Executed by:
| 978 | ||||||||||||||||||
213 | return executed 12 times by 1 test: BIO_printf(out, "%u\n", **(uint32_t **)pval);return BIO_printf(out, "%u\n", **(uint32_t **)pval); Executed by:
executed 12 times by 1 test: return BIO_printf(out, "%u\n", **(uint32_t **)pval); Executed by:
| 12 | ||||||||||||||||||
214 | } | - | ||||||||||||||||||
215 | - | |||||||||||||||||||
216 | - | |||||||||||||||||||
217 | - | |||||||||||||||||||
218 | - | |||||||||||||||||||
219 | static ASN1_PRIMITIVE_FUNCS uint32_pf = { | - | ||||||||||||||||||
220 | - | |||||||||||||||||||
221 | ((void *)0) | - | ||||||||||||||||||
222 | , 0, | - | ||||||||||||||||||
223 | uint32_new, | - | ||||||||||||||||||
224 | uint32_free, | - | ||||||||||||||||||
225 | uint32_clear, | - | ||||||||||||||||||
226 | uint32_c2i, | - | ||||||||||||||||||
227 | uint32_i2c, | - | ||||||||||||||||||
228 | uint32_print | - | ||||||||||||||||||
229 | }; | - | ||||||||||||||||||
230 | - | |||||||||||||||||||
231 | static ASN1_PRIMITIVE_FUNCS uint64_pf = { | - | ||||||||||||||||||
232 | - | |||||||||||||||||||
233 | ((void *)0) | - | ||||||||||||||||||
234 | , 0, | - | ||||||||||||||||||
235 | uint64_new, | - | ||||||||||||||||||
236 | uint64_free, | - | ||||||||||||||||||
237 | uint64_clear, | - | ||||||||||||||||||
238 | uint64_c2i, | - | ||||||||||||||||||
239 | uint64_i2c, | - | ||||||||||||||||||
240 | uint64_print | - | ||||||||||||||||||
241 | }; | - | ||||||||||||||||||
242 | - | |||||||||||||||||||
243 | const ASN1_ITEM INT32_it = { | - | ||||||||||||||||||
244 | 0x0, 2, | - | ||||||||||||||||||
245 | ((void *)0) | - | ||||||||||||||||||
246 | , 0, &uint32_pf, | - | ||||||||||||||||||
247 | (1<<1), "INT32" | - | ||||||||||||||||||
248 | }; | - | ||||||||||||||||||
249 | - | |||||||||||||||||||
250 | const ASN1_ITEM UINT32_it = { | - | ||||||||||||||||||
251 | 0x0, 2, | - | ||||||||||||||||||
252 | ((void *)0) | - | ||||||||||||||||||
253 | , 0, &uint32_pf, 0, "UINT32" | - | ||||||||||||||||||
254 | }; | - | ||||||||||||||||||
255 | - | |||||||||||||||||||
256 | const ASN1_ITEM INT64_it = { | - | ||||||||||||||||||
257 | 0x0, 2, | - | ||||||||||||||||||
258 | ((void *)0) | - | ||||||||||||||||||
259 | , 0, &uint64_pf, | - | ||||||||||||||||||
260 | (1<<1), "INT64" | - | ||||||||||||||||||
261 | }; | - | ||||||||||||||||||
262 | - | |||||||||||||||||||
263 | const ASN1_ITEM UINT64_it = { | - | ||||||||||||||||||
264 | 0x0, 2, | - | ||||||||||||||||||
265 | ((void *)0) | - | ||||||||||||||||||
266 | , 0, &uint64_pf, 0, "UINT64" | - | ||||||||||||||||||
267 | }; | - | ||||||||||||||||||
268 | - | |||||||||||||||||||
269 | const ASN1_ITEM ZINT32_it = { | - | ||||||||||||||||||
270 | 0x0, 2, | - | ||||||||||||||||||
271 | ((void *)0) | - | ||||||||||||||||||
272 | , 0, &uint32_pf, | - | ||||||||||||||||||
273 | (1<<0)|(1<<1), "ZINT32" | - | ||||||||||||||||||
274 | }; | - | ||||||||||||||||||
275 | - | |||||||||||||||||||
276 | const ASN1_ITEM ZUINT32_it = { | - | ||||||||||||||||||
277 | 0x0, 2, | - | ||||||||||||||||||
278 | ((void *)0) | - | ||||||||||||||||||
279 | , 0, &uint32_pf, | - | ||||||||||||||||||
280 | (1<<0), "ZUINT32" | - | ||||||||||||||||||
281 | }; | - | ||||||||||||||||||
282 | - | |||||||||||||||||||
283 | const ASN1_ITEM ZINT64_it = { | - | ||||||||||||||||||
284 | 0x0, 2, | - | ||||||||||||||||||
285 | ((void *)0) | - | ||||||||||||||||||
286 | , 0, &uint64_pf, | - | ||||||||||||||||||
287 | (1<<0)|(1<<1), "ZINT64" | - | ||||||||||||||||||
288 | }; | - | ||||||||||||||||||
289 | - | |||||||||||||||||||
290 | const ASN1_ITEM ZUINT64_it = { | - | ||||||||||||||||||
291 | 0x0, 2, | - | ||||||||||||||||||
292 | ((void *)0) | - | ||||||||||||||||||
293 | , 0, &uint64_pf, | - | ||||||||||||||||||
294 | (1<<0), "ZUINT64" | - | ||||||||||||||||||
295 | }; | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |