Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ct/ct_oct.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | int o2i_SCT_signature(SCT *sct, const unsigned char **in, size_t len) | - | ||||||||||||
5 | { | - | ||||||||||||
6 | size_t siglen; | - | ||||||||||||
7 | size_t len_remaining = len; | - | ||||||||||||
8 | const unsigned char *p; | - | ||||||||||||
9 | - | |||||||||||||
10 | if (sct->version != SCT_VERSION_V1
| 0-3007 | ||||||||||||
11 | ERR_put_error(50,(112),(103),__FILE__,31); | - | ||||||||||||
12 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
13 | } | - | ||||||||||||
14 | - | |||||||||||||
15 | - | |||||||||||||
16 | - | |||||||||||||
17 | - | |||||||||||||
18 | - | |||||||||||||
19 | - | |||||||||||||
20 | - | |||||||||||||
21 | if (len <= 4
| 475-2532 | ||||||||||||
22 | ERR_put_error(50,(112),(107),__FILE__,42); | - | ||||||||||||
23 | return executed 475 times by 1 test: -1;return -1; Executed by:
executed 475 times by 1 test: return -1; Executed by:
| 475 | ||||||||||||
24 | } | - | ||||||||||||
25 | - | |||||||||||||
26 | p = *in; | - | ||||||||||||
27 | - | |||||||||||||
28 | sct->hash_alg = *p++; | - | ||||||||||||
29 | sct->sig_alg = *p++; | - | ||||||||||||
30 | if (SCT_get_signature_nid(sct) == 0
| 97-2435 | ||||||||||||
31 | ERR_put_error(50,(112),(107),__FILE__,51); | - | ||||||||||||
32 | return executed 97 times by 1 test: -1;return -1; Executed by:
executed 97 times by 1 test: return -1; Executed by:
| 97 | ||||||||||||
33 | } | - | ||||||||||||
34 | - | |||||||||||||
35 | ((siglen=(((unsigned int)((p)[0]))<< 8)| (((unsigned int)((p)[1])) )),p+=2); | - | ||||||||||||
36 | len_remaining -= (p - *in); | - | ||||||||||||
37 | if (siglen > len_remaining
| 73-2362 | ||||||||||||
38 | ERR_put_error(50,(112),(107),__FILE__,58); | - | ||||||||||||
39 | return executed 73 times by 1 test: -1;return -1; Executed by:
executed 73 times by 1 test: return -1; Executed by:
| 73 | ||||||||||||
40 | } | - | ||||||||||||
41 | - | |||||||||||||
42 | if (SCT_set1_signature(sct, p, siglen) != 1
| 0-2362 | ||||||||||||
43 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
44 | len_remaining -= siglen; | - | ||||||||||||
45 | *in = p + siglen; | - | ||||||||||||
46 | - | |||||||||||||
47 | return executed 2362 times by 1 test: len - len_remaining;return len - len_remaining; Executed by:
executed 2362 times by 1 test: return len - len_remaining; Executed by:
| 2362 | ||||||||||||
48 | } | - | ||||||||||||
49 | - | |||||||||||||
50 | SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len) | - | ||||||||||||
51 | { | - | ||||||||||||
52 | SCT *sct = | - | ||||||||||||
53 | ((void *)0) | - | ||||||||||||
54 | ; | - | ||||||||||||
55 | const unsigned char *p; | - | ||||||||||||
56 | - | |||||||||||||
57 | if (len == 0
| 0-14202 | ||||||||||||
58 | ERR_put_error(50,(110),(104),__FILE__,76); | - | ||||||||||||
59 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
60 | } | - | ||||||||||||
61 | - | |||||||||||||
62 | if ((
| 0-14202 | ||||||||||||
63 | ((void *)0)
| 0-14202 | ||||||||||||
64 | ) | - | ||||||||||||
65 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
66 | - | |||||||||||||
67 | p = *in; | - | ||||||||||||
68 | - | |||||||||||||
69 | sct->version = *p; | - | ||||||||||||
70 | if (sct->version == SCT_VERSION_V1
| 3365-10837 | ||||||||||||
71 | int sig_len; | - | ||||||||||||
72 | size_t len2; | - | ||||||||||||
73 | if (len < 43
| 267-3098 | ||||||||||||
74 | ERR_put_error(50,(110),(104),__FILE__,99); | - | ||||||||||||
75 | goto executed 267 times by 1 test: err;goto err; Executed by:
executed 267 times by 1 test: goto err; Executed by:
| 267 | ||||||||||||
76 | } | - | ||||||||||||
77 | len -= 43; | - | ||||||||||||
78 | p++; | - | ||||||||||||
79 | sct->log_id = CRYPTO_memdup((p), 32, __FILE__, 104); | - | ||||||||||||
80 | if (sct->log_id ==
| 0-3098 | ||||||||||||
81 | ((void *)0)
| 0-3098 | ||||||||||||
82 | ) | - | ||||||||||||
83 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
84 | sct->log_id_len = 32; | - | ||||||||||||
85 | p += 32; | - | ||||||||||||
86 | - | |||||||||||||
87 | (sct->timestamp =((uint64_t)(*((p)++)))<<56, sct->timestamp|=((uint64_t)(*((p)++)))<<48, sct->timestamp|=((uint64_t)(*((p)++)))<<40, sct->timestamp|=((uint64_t)(*((p)++)))<<32, sct->timestamp|=((uint64_t)(*((p)++)))<<24, sct->timestamp|=((uint64_t)(*((p)++)))<<16, sct->timestamp|=((uint64_t)(*((p)++)))<< 8, sct->timestamp|=((uint64_t)(*((p)++)))); | - | ||||||||||||
88 | - | |||||||||||||
89 | ((len2=(((unsigned int)((p)[0]))<< 8)| (((unsigned int)((p)[1])) )),p+=2); | - | ||||||||||||
90 | if (len < len2
| 92-3006 | ||||||||||||
91 | ERR_put_error(50,(110),(104),__FILE__,114); | - | ||||||||||||
92 | goto executed 92 times by 1 test: err;goto err; Executed by:
executed 92 times by 1 test: goto err; Executed by:
| 92 | ||||||||||||
93 | } | - | ||||||||||||
94 | if (len2 > 0
| 597-2409 | ||||||||||||
95 | sct->ext = CRYPTO_memdup((p), len2, __FILE__, 118); | - | ||||||||||||
96 | if (sct->ext ==
| 0-597 | ||||||||||||
97 | ((void *)0)
| 0-597 | ||||||||||||
98 | ) | - | ||||||||||||
99 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
100 | } executed 597 times by 1 test: end of block Executed by:
| 597 | ||||||||||||
101 | sct->ext_len = len2; | - | ||||||||||||
102 | p += len2; | - | ||||||||||||
103 | len -= len2; | - | ||||||||||||
104 | - | |||||||||||||
105 | sig_len = o2i_SCT_signature(sct, &p, len); | - | ||||||||||||
106 | if (sig_len <= 0
| 645-2361 | ||||||||||||
107 | ERR_put_error(50,(110),(104),__FILE__,128); | - | ||||||||||||
108 | goto executed 645 times by 1 test: err;goto err; Executed by:
executed 645 times by 1 test: goto err; Executed by:
| 645 | ||||||||||||
109 | } | - | ||||||||||||
110 | len -= sig_len; | - | ||||||||||||
111 | *in = p + len; | - | ||||||||||||
112 | } executed 2361 times by 1 test: else {end of block Executed by:
| 2361 | ||||||||||||
113 | - | |||||||||||||
114 | sct->sct = CRYPTO_memdup((p), len, __FILE__, 135); | - | ||||||||||||
115 | if (sct->sct ==
| 0-10837 | ||||||||||||
116 | ((void *)0)
| 0-10837 | ||||||||||||
117 | ) | - | ||||||||||||
118 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
119 | sct->sct_len = len; | - | ||||||||||||
120 | *in = p + len; | - | ||||||||||||
121 | } executed 10837 times by 1 test: end of block Executed by:
| 10837 | ||||||||||||
122 | - | |||||||||||||
123 | if (psct !=
| 0-13198 | ||||||||||||
124 | ((void *)0)
| 0-13198 | ||||||||||||
125 | ) { | - | ||||||||||||
126 | SCT_free(*psct); | - | ||||||||||||
127 | *psct = sct; | - | ||||||||||||
128 | } never executed: end of block | 0 | ||||||||||||
129 | - | |||||||||||||
130 | return executed 13198 times by 1 test: sct;return sct; Executed by:
executed 13198 times by 1 test: return sct; Executed by:
| 13198 | ||||||||||||
131 | err: | - | ||||||||||||
132 | SCT_free(sct); | - | ||||||||||||
133 | return executed 1004 times by 1 test: return ((void *)0) ; Executed by:
executed 1004 times by 1 test: return ((void *)0) ; Executed by:
| 1004 | ||||||||||||
134 | ((void *)0) executed 1004 times by 1 test: return ((void *)0) ; Executed by:
| 1004 | ||||||||||||
135 | ; executed 1004 times by 1 test: return ((void *)0) ; Executed by:
| 1004 | ||||||||||||
136 | } | - | ||||||||||||
137 | - | |||||||||||||
138 | int i2o_SCT_signature(const SCT *sct, unsigned char **out) | - | ||||||||||||
139 | { | - | ||||||||||||
140 | size_t len; | - | ||||||||||||
141 | unsigned char *p = | - | ||||||||||||
142 | ((void *)0) | - | ||||||||||||
143 | , *pstart = | - | ||||||||||||
144 | ((void *)0) | - | ||||||||||||
145 | ; | - | ||||||||||||
146 | - | |||||||||||||
147 | if (!SCT_signature_is_complete(sct)
| 0-549 | ||||||||||||
148 | ERR_put_error(50,(109),(107),__FILE__,159); | - | ||||||||||||
149 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
150 | } | - | ||||||||||||
151 | - | |||||||||||||
152 | if (sct->version != SCT_VERSION_V1
| 0-549 | ||||||||||||
153 | ERR_put_error(50,(109),(103),__FILE__,164); | - | ||||||||||||
154 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
155 | } | - | ||||||||||||
156 | - | |||||||||||||
157 | - | |||||||||||||
158 | - | |||||||||||||
159 | - | |||||||||||||
160 | - | |||||||||||||
161 | - | |||||||||||||
162 | len = 4 + sct->sig_len; | - | ||||||||||||
163 | - | |||||||||||||
164 | if (out !=
| 0-549 | ||||||||||||
165 | ((void *)0)
| 0-549 | ||||||||||||
166 | ) { | - | ||||||||||||
167 | if (*
| 0-549 | ||||||||||||
168 | ((void *)0)
| 0-549 | ||||||||||||
169 | ) { | - | ||||||||||||
170 | p = *out; | - | ||||||||||||
171 | *out += len; | - | ||||||||||||
172 | } executed 549 times by 1 test: else {end of block Executed by:
| 549 | ||||||||||||
173 | pstart = p = CRYPTO_malloc(len, __FILE__, 180); | - | ||||||||||||
174 | if (p ==
| 0 | ||||||||||||
175 | ((void *)0)
| 0 | ||||||||||||
176 | ) { | - | ||||||||||||
177 | ERR_put_error(50,(109),((1|64)),__FILE__,182); | - | ||||||||||||
178 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
179 | } | - | ||||||||||||
180 | *out = p; | - | ||||||||||||
181 | } never executed: end of block | 0 | ||||||||||||
182 | - | |||||||||||||
183 | *p++ = sct->hash_alg; | - | ||||||||||||
184 | *p++ = sct->sig_alg; | - | ||||||||||||
185 | ((p[0]=(unsigned char)(((sct->sig_len)>> 8)&0xff), p[1]=(unsigned char)(((sct->sig_len) )&0xff)),p+=2); | - | ||||||||||||
186 | memcpy(p, sct->sig, sct->sig_len); | - | ||||||||||||
187 | } executed 549 times by 1 test: end of block Executed by:
| 549 | ||||||||||||
188 | - | |||||||||||||
189 | return executed 549 times by 1 test: len;return len; Executed by:
executed 549 times by 1 test: return len; Executed by:
| 549 | ||||||||||||
190 | err: | - | ||||||||||||
191 | CRYPTO_free(pstart, __FILE__, 196); | - | ||||||||||||
192 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
193 | } | - | ||||||||||||
194 | - | |||||||||||||
195 | int i2o_SCT(const SCT *sct, unsigned char **out) | - | ||||||||||||
196 | { | - | ||||||||||||
197 | size_t len; | - | ||||||||||||
198 | unsigned char *p = | - | ||||||||||||
199 | ((void *)0) | - | ||||||||||||
200 | , *pstart = | - | ||||||||||||
201 | ((void *)0) | - | ||||||||||||
202 | ; | - | ||||||||||||
203 | - | |||||||||||||
204 | if (!SCT_is_complete(sct)
| 20-9985 | ||||||||||||
205 | ERR_put_error(50,(107),(106),__FILE__,206); | - | ||||||||||||
206 | goto executed 20 times by 1 test: err;goto err; Executed by:
executed 20 times by 1 test: goto err; Executed by:
| 20 | ||||||||||||
207 | } | - | ||||||||||||
208 | - | |||||||||||||
209 | - | |||||||||||||
210 | - | |||||||||||||
211 | - | |||||||||||||
212 | - | |||||||||||||
213 | - | |||||||||||||
214 | if (sct->version == SCT_VERSION_V1
| 1125-8860 | ||||||||||||
215 | len = 43 + sct->ext_len + 4 + sct->sig_len; executed 1125 times by 1 test: len = 43 + sct->ext_len + 4 + sct->sig_len; Executed by:
| 1125 | ||||||||||||
216 | else | - | ||||||||||||
217 | len = sct->sct_len; executed 8860 times by 1 test: len = sct->sct_len; Executed by:
| 8860 | ||||||||||||
218 | - | |||||||||||||
219 | if (out ==
| 4950-5035 | ||||||||||||
220 | ((void *)0)
| 4950-5035 | ||||||||||||
221 | ) | - | ||||||||||||
222 | return executed 5035 times by 1 test: len;return len; Executed by:
executed 5035 times by 1 test: return len; Executed by:
| 5035 | ||||||||||||
223 | - | |||||||||||||
224 | if (*
| 0-4950 | ||||||||||||
225 | ((void *)0)
| 0-4950 | ||||||||||||
226 | ) { | - | ||||||||||||
227 | p = *out; | - | ||||||||||||
228 | *out += len; | - | ||||||||||||
229 | } executed 4950 times by 1 test: else {end of block Executed by:
| 4950 | ||||||||||||
230 | pstart = p = CRYPTO_malloc(len, __FILE__, 227); | - | ||||||||||||
231 | if (p ==
| 0 | ||||||||||||
232 | ((void *)0)
| 0 | ||||||||||||
233 | ) { | - | ||||||||||||
234 | ERR_put_error(50,(107),((1|64)),__FILE__,229); | - | ||||||||||||
235 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
236 | } | - | ||||||||||||
237 | *out = p; | - | ||||||||||||
238 | } never executed: end of block | 0 | ||||||||||||
239 | - | |||||||||||||
240 | if (sct->version == SCT_VERSION_V1
| 549-4401 | ||||||||||||
241 | *p++ = sct->version; | - | ||||||||||||
242 | memcpy(p, sct->log_id, 32); | - | ||||||||||||
243 | p += 32; | - | ||||||||||||
244 | (*((p)++)=(unsigned char)(((sct->timestamp)>>56)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>>48)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>>40)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>>32)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>>24)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>>16)&0xff), *((p)++)=(unsigned char)(((sct->timestamp)>> 8)&0xff), *((p)++)=(unsigned char)(((sct->timestamp) )&0xff)); | - | ||||||||||||
245 | ((p[0]=(unsigned char)(((sct->ext_len)>> 8)&0xff), p[1]=(unsigned char)(((sct->ext_len) )&0xff)),p+=2); | - | ||||||||||||
246 | if (sct->ext_len > 0
| 89-460 | ||||||||||||
247 | memcpy(p, sct->ext, sct->ext_len); | - | ||||||||||||
248 | p += sct->ext_len; | - | ||||||||||||
249 | } executed 89 times by 1 test: end of block Executed by:
| 89 | ||||||||||||
250 | if (i2o_SCT_signature(sct, &p) <= 0
| 0-549 | ||||||||||||
251 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
252 | } executed 549 times by 1 test: else {end of block Executed by:
| 549 | ||||||||||||
253 | memcpy(p, sct->sct, len); | - | ||||||||||||
254 | } executed 4401 times by 1 test: end of block Executed by:
| 4401 | ||||||||||||
255 | - | |||||||||||||
256 | return executed 4950 times by 1 test: len;return len; Executed by:
executed 4950 times by 1 test: return len; Executed by:
| 4950 | ||||||||||||
257 | err: | - | ||||||||||||
258 | CRYPTO_free(pstart, __FILE__, 253); | - | ||||||||||||
259 | return executed 20 times by 1 test: -1;return -1; Executed by:
executed 20 times by 1 test: return -1; Executed by:
| 20 | ||||||||||||
260 | } | - | ||||||||||||
261 | - | |||||||||||||
262 | struct stack_st_SCT *o2i_SCT_LIST(struct stack_st_SCT **a, const unsigned char **pp, | - | ||||||||||||
263 | size_t len) | - | ||||||||||||
264 | { | - | ||||||||||||
265 | struct stack_st_SCT *sk = | - | ||||||||||||
266 | ((void *)0) | - | ||||||||||||
267 | ; | - | ||||||||||||
268 | size_t list_len, sct_len; | - | ||||||||||||
269 | - | |||||||||||||
270 | if (len < 2
| 0-5121 | ||||||||||||
271 | ERR_put_error(50,(111),(105),__FILE__,264); | - | ||||||||||||
272 | return executed 410 times by 1 test: return ((void *)0) ; Executed by:
executed 410 times by 1 test: return ((void *)0) ; Executed by:
| 410 | ||||||||||||
273 | ((void *)0) executed 410 times by 1 test: return ((void *)0) ; Executed by:
| 410 | ||||||||||||
274 | ; executed 410 times by 1 test: return ((void *)0) ; Executed by:
| 410 | ||||||||||||
275 | } | - | ||||||||||||
276 | - | |||||||||||||
277 | ((list_len=(((unsigned int)((*pp)[0]))<< 8)| (((unsigned int)((*pp)[1])) )),*pp+=2); | - | ||||||||||||
278 | if (list_len != len - 2
| 428-4693 | ||||||||||||
279 | ERR_put_error(50,(111),(105),__FILE__,270); | - | ||||||||||||
280 | return executed 428 times by 1 test: return ((void *)0) ; Executed by:
executed 428 times by 1 test: return ((void *)0) ; Executed by:
| 428 | ||||||||||||
281 | ((void *)0) executed 428 times by 1 test: return ((void *)0) ; Executed by:
| 428 | ||||||||||||
282 | ; executed 428 times by 1 test: return ((void *)0) ; Executed by:
| 428 | ||||||||||||
283 | } | - | ||||||||||||
284 | - | |||||||||||||
285 | if (a ==
| 1-4692 | ||||||||||||
286 | ((void *)0)
| 1-4692 | ||||||||||||
287 | || *
| 0-1 | ||||||||||||
288 | ((void *)0)
| 0-1 | ||||||||||||
289 | ) { | - | ||||||||||||
290 | sk = sk_SCT_new_null(); | - | ||||||||||||
291 | if (sk ==
| 0-4693 | ||||||||||||
292 | ((void *)0)
| 0-4693 | ||||||||||||
293 | ) | - | ||||||||||||
294 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||
295 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
296 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
297 | } executed 4693 times by 1 test: else {end of block Executed by:
| 4693 | ||||||||||||
298 | SCT *sct; | - | ||||||||||||
299 | - | |||||||||||||
300 | - | |||||||||||||
301 | sk = *a; | - | ||||||||||||
302 | while ((
| 0 | ||||||||||||
303 | ((void *)0)
| 0 | ||||||||||||
304 | ) | - | ||||||||||||
305 | SCT_free(sct); never executed: SCT_free(sct); | 0 | ||||||||||||
306 | } never executed: end of block | 0 | ||||||||||||
307 | - | |||||||||||||
308 | while (list_len > 0
| 2741-15150 | ||||||||||||
309 | SCT *sct; | - | ||||||||||||
310 | - | |||||||||||||
311 | if (list_len < 2
| 395-14755 | ||||||||||||
312 | ERR_put_error(50,(111),(105),__FILE__,291); | - | ||||||||||||
313 | goto executed 395 times by 1 test: err;goto err; Executed by:
executed 395 times by 1 test: goto err; Executed by:
| 395 | ||||||||||||
314 | } | - | ||||||||||||
315 | ((sct_len=(((unsigned int)((*pp)[0]))<< 8)| (((unsigned int)((*pp)[1])) )),*pp+=2); | - | ||||||||||||
316 | list_len -= 2; | - | ||||||||||||
317 | - | |||||||||||||
318 | if (sct_len == 0
| 134-14621 | ||||||||||||
319 | ERR_put_error(50,(111),(105),__FILE__,298); | - | ||||||||||||
320 | goto executed 553 times by 1 test: err;goto err; Executed by:
executed 553 times by 1 test: goto err; Executed by:
| 553 | ||||||||||||
321 | } | - | ||||||||||||
322 | list_len -= sct_len; | - | ||||||||||||
323 | - | |||||||||||||
324 | if ((
| 1004-13198 | ||||||||||||
325 | ((void *)0)
| 1004-13198 | ||||||||||||
326 | , pp, sct_len)) ==
| 1004-13198 | ||||||||||||
327 | ((void *)0)
| 1004-13198 | ||||||||||||
328 | ) | - | ||||||||||||
329 | goto executed 1004 times by 1 test: err;goto err; Executed by:
executed 1004 times by 1 test: goto err; Executed by:
| 1004 | ||||||||||||
330 | if (!sk_SCT_push(sk, sct)
| 0-13198 | ||||||||||||
331 | SCT_free(sct); | - | ||||||||||||
332 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
333 | } | - | ||||||||||||
334 | } executed 13198 times by 1 test: end of block Executed by:
| 13198 | ||||||||||||
335 | - | |||||||||||||
336 | if (a !=
| 1-2740 | ||||||||||||
337 | ((void *)0)
| 1-2740 | ||||||||||||
338 | && *
| 0-1 | ||||||||||||
339 | ((void *)0)
| 0-1 | ||||||||||||
340 | ) | - | ||||||||||||
341 | * executed 1 time by 1 test: a = sk;*a = sk; Executed by:
executed 1 time by 1 test: *a = sk; Executed by:
| 1 | ||||||||||||
342 | return executed 2741 times by 1 test: sk;return sk; Executed by:
executed 2741 times by 1 test: return sk; Executed by:
| 2741 | ||||||||||||
343 | - | |||||||||||||
344 | err: | - | ||||||||||||
345 | if (a ==
| 0-1952 | ||||||||||||
346 | ((void *)0)
| 0-1952 | ||||||||||||
347 | || *
| 0 | ||||||||||||
348 | ((void *)0)
| 0 | ||||||||||||
349 | ) | - | ||||||||||||
350 | SCT_LIST_free(sk); executed 1952 times by 1 test: SCT_LIST_free(sk); Executed by:
| 1952 | ||||||||||||
351 | return executed 1952 times by 1 test: return ((void *)0) ; Executed by:
executed 1952 times by 1 test: return ((void *)0) ; Executed by:
| 1952 | ||||||||||||
352 | ((void *)0) executed 1952 times by 1 test: return ((void *)0) ; Executed by:
| 1952 | ||||||||||||
353 | ; executed 1952 times by 1 test: return ((void *)0) ; Executed by:
| 1952 | ||||||||||||
354 | } | - | ||||||||||||
355 | - | |||||||||||||
356 | int i2o_SCT_LIST(const struct stack_st_SCT *a, unsigned char **pp) | - | ||||||||||||
357 | { | - | ||||||||||||
358 | int len, sct_len, i, is_pp_new = 0; | - | ||||||||||||
359 | size_t len2; | - | ||||||||||||
360 | unsigned char *p = | - | ||||||||||||
361 | ((void *)0) | - | ||||||||||||
362 | , *p2; | - | ||||||||||||
363 | - | |||||||||||||
364 | if (pp !=
| 104 | ||||||||||||
365 | ((void *)0)
| 104 | ||||||||||||
366 | ) { | - | ||||||||||||
367 | if (*
| 0-104 | ||||||||||||
368 | ((void *)0)
| 0-104 | ||||||||||||
369 | ) { | - | ||||||||||||
370 | if ((
| 20-84 | ||||||||||||
371 | ((void *)0)
| 20-84 | ||||||||||||
372 | )) == -1
| 20-84 | ||||||||||||
373 | ERR_put_error(50,(108),(105),__FILE__,330); | - | ||||||||||||
374 | return executed 20 times by 1 test: -1;return -1; Executed by:
executed 20 times by 1 test: return -1; Executed by:
| 20 | ||||||||||||
375 | } | - | ||||||||||||
376 | if ((*
| 0-84 | ||||||||||||
377 | ((void *)0)
| 0-84 | ||||||||||||
378 | ) { | - | ||||||||||||
379 | ERR_put_error(50,(108),((1|64)),__FILE__,334); | - | ||||||||||||
380 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
381 | } | - | ||||||||||||
382 | is_pp_new = 1; | - | ||||||||||||
383 | } executed 84 times by 1 test: end of block Executed by:
| 84 | ||||||||||||
384 | p = *pp + 2; | - | ||||||||||||
385 | } executed 84 times by 1 test: end of block Executed by:
| 84 | ||||||||||||
386 | - | |||||||||||||
387 | len2 = 2; | - | ||||||||||||
388 | for (i = 0; i < sk_SCT_num(a)
| 168-10005 | ||||||||||||
389 | if (pp !=
| 4950-5055 | ||||||||||||
390 | ((void *)0)
| 4950-5055 | ||||||||||||
391 | ) { | - | ||||||||||||
392 | p2 = p; | - | ||||||||||||
393 | p += 2; | - | ||||||||||||
394 | if ((
| 0-4950 | ||||||||||||
395 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
396 | ((p2[0]=(unsigned char)(((sct_len)>> 8)&0xff), p2[1]=(unsigned char)(((sct_len) )&0xff)),p2+=2); | - | ||||||||||||
397 | } executed 4950 times by 1 test: else {end of block Executed by:
| 4950 | ||||||||||||
398 | if ((
| 20-5035 | ||||||||||||
399 | ((void *)0)
| 20-5035 | ||||||||||||
400 | )) == -1
| 20-5035 | ||||||||||||
401 | goto executed 20 times by 1 test: err;goto err; Executed by:
executed 20 times by 1 test: goto err; Executed by:
| 20 | ||||||||||||
402 | } executed 5035 times by 1 test: end of block Executed by:
| 5035 | ||||||||||||
403 | len2 += 2 + sct_len; | - | ||||||||||||
404 | } executed 9985 times by 1 test: end of block Executed by:
| 9985 | ||||||||||||
405 | - | |||||||||||||
406 | if (len2 > 65535
| 0-168 | ||||||||||||
407 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
408 | - | |||||||||||||
409 | if (pp !=
| 84 | ||||||||||||
410 | ((void *)0)
| 84 | ||||||||||||
411 | ) { | - | ||||||||||||
412 | p = *pp; | - | ||||||||||||
413 | ((p[0]=(unsigned char)(((len2 - 2)>> 8)&0xff), p[1]=(unsigned char)(((len2 - 2) )&0xff)),p+=2); | - | ||||||||||||
414 | if (!is_pp_new
| 0-84 | ||||||||||||
415 | * never executed: pp += len2;*pp += len2; never executed: *pp += len2; | 0 | ||||||||||||
416 | } executed 84 times by 1 test: end of block Executed by:
| 84 | ||||||||||||
417 | return executed 168 times by 1 test: len2;return len2; Executed by:
executed 168 times by 1 test: return len2; Executed by:
| 168 | ||||||||||||
418 | - | |||||||||||||
419 | err: | - | ||||||||||||
420 | if (is_pp_new
| 0-20 | ||||||||||||
421 | CRYPTO_free(*pp, __FILE__, 370); | - | ||||||||||||
422 | *pp = | - | ||||||||||||
423 | ((void *)0) | - | ||||||||||||
424 | ; | - | ||||||||||||
425 | } never executed: end of block | 0 | ||||||||||||
426 | return executed 20 times by 1 test: -1;return -1; Executed by:
executed 20 times by 1 test: return -1; Executed by:
| 20 | ||||||||||||
427 | } | - | ||||||||||||
428 | - | |||||||||||||
429 | struct stack_st_SCT *d2i_SCT_LIST(struct stack_st_SCT **a, const unsigned char **pp, | - | ||||||||||||
430 | long len) | - | ||||||||||||
431 | { | - | ||||||||||||
432 | ASN1_OCTET_STRING *oct = | - | ||||||||||||
433 | ((void *)0) | - | ||||||||||||
434 | ; | - | ||||||||||||
435 | struct stack_st_SCT *sk = | - | ||||||||||||
436 | ((void *)0) | - | ||||||||||||
437 | ; | - | ||||||||||||
438 | const unsigned char *p; | - | ||||||||||||
439 | - | |||||||||||||
440 | p = *pp; | - | ||||||||||||
441 | if (d2i_ASN1_OCTET_STRING(&oct, &p, len) ==
| 959-5528 | ||||||||||||
442 | ((void *)0)
| 959-5528 | ||||||||||||
443 | ) | - | ||||||||||||
444 | return executed 959 times by 1 test: return ((void *)0) ; Executed by:
executed 959 times by 1 test: return ((void *)0) ; Executed by:
| 959 | ||||||||||||
445 | ((void *)0) executed 959 times by 1 test: return ((void *)0) ; Executed by:
| 959 | ||||||||||||
446 | ; executed 959 times by 1 test: return ((void *)0) ; Executed by:
| 959 | ||||||||||||
447 | - | |||||||||||||
448 | p = oct->data; | - | ||||||||||||
449 | if ((
| 2739-2789 | ||||||||||||
450 | ((void *)0)
| 2739-2789 | ||||||||||||
451 | ) | - | ||||||||||||
452 | * executed 2739 times by 1 test: pp += len;*pp += len; Executed by:
executed 2739 times by 1 test: *pp += len; Executed by:
| 2739 | ||||||||||||
453 | - | |||||||||||||
454 | ASN1_OCTET_STRING_free(oct); | - | ||||||||||||
455 | return executed 5528 times by 1 test: sk;return sk; Executed by:
executed 5528 times by 1 test: return sk; Executed by:
| 5528 | ||||||||||||
456 | } | - | ||||||||||||
457 | - | |||||||||||||
458 | int i2d_SCT_LIST(const struct stack_st_SCT *a, unsigned char **out) | - | ||||||||||||
459 | { | - | ||||||||||||
460 | ASN1_OCTET_STRING oct; | - | ||||||||||||
461 | int len; | - | ||||||||||||
462 | - | |||||||||||||
463 | oct.data = | - | ||||||||||||
464 | ((void *)0) | - | ||||||||||||
465 | ; | - | ||||||||||||
466 | if ((
| 20-83 | ||||||||||||
467 | return executed 20 times by 1 test: -1;return -1; Executed by:
executed 20 times by 1 test: return -1; Executed by:
| 20 | ||||||||||||
468 | - | |||||||||||||
469 | len = i2d_ASN1_OCTET_STRING(&oct, out); | - | ||||||||||||
470 | CRYPTO_free(oct.data, __FILE__, 405); | - | ||||||||||||
471 | return executed 83 times by 1 test: len;return len; Executed by:
executed 83 times by 1 test: return len; Executed by:
| 83 | ||||||||||||
472 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |