Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/a_object.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | int | - | ||||||||||||||||||||||||
5 | i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp) | - | ||||||||||||||||||||||||
6 | { | - | ||||||||||||||||||||||||
7 | unsigned char *p; | - | ||||||||||||||||||||||||
8 | int objsize; | - | ||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||
10 | if ((
| 0 | ||||||||||||||||||||||||
11 | ((void *)0)
| 0 | ||||||||||||||||||||||||
12 | )
| 0 | ||||||||||||||||||||||||
13 | ((void *)0)
| 0 | ||||||||||||||||||||||||
14 | )
| 0 | ||||||||||||||||||||||||
15 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||
17 | objsize = ASN1_object_size(0, a->length, 6); | - | ||||||||||||||||||||||||
18 | if (pp ==
| 0 | ||||||||||||||||||||||||
19 | ((void *)0)
| 0 | ||||||||||||||||||||||||
20 | ) | - | ||||||||||||||||||||||||
21 | return never executed: objsize;return objsize; never executed: return objsize; | 0 | ||||||||||||||||||||||||
22 | - | |||||||||||||||||||||||||
23 | p = *pp; | - | ||||||||||||||||||||||||
24 | ASN1_put_object(&p, 0, a->length, 6, 0x00); | - | ||||||||||||||||||||||||
25 | memcpy(p, a->data, a->length); | - | ||||||||||||||||||||||||
26 | p += a->length; | - | ||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||
28 | *pp = p; | - | ||||||||||||||||||||||||
29 | return never executed: (objsize);return (objsize); never executed: return (objsize); | 0 | ||||||||||||||||||||||||
30 | } | - | ||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||
32 | int | - | ||||||||||||||||||||||||
33 | a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) | - | ||||||||||||||||||||||||
34 | { | - | ||||||||||||||||||||||||
35 | int i, first, len = 0, c, use_bn; | - | ||||||||||||||||||||||||
36 | char ftmp[24], *tmp = ftmp; | - | ||||||||||||||||||||||||
37 | int tmpsize = sizeof ftmp; | - | ||||||||||||||||||||||||
38 | const char *p; | - | ||||||||||||||||||||||||
39 | unsigned long l; | - | ||||||||||||||||||||||||
40 | BIGNUM *bl = | - | ||||||||||||||||||||||||
41 | ((void *)0) | - | ||||||||||||||||||||||||
42 | ; | - | ||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||
44 | if (num == 0
| 0-6 | ||||||||||||||||||||||||
45 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
46 | else if (num == -1
| 0-6 | ||||||||||||||||||||||||
47 | num = strlen(buf); executed 6 times by 1 test: num = strlen(buf); Executed by:
| 6 | ||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||
49 | p = buf; | - | ||||||||||||||||||||||||
50 | c = *(p++); | - | ||||||||||||||||||||||||
51 | num--; | - | ||||||||||||||||||||||||
52 | if ((
| 0-6 | ||||||||||||||||||||||||
53 | first= c-'0'; | - | ||||||||||||||||||||||||
54 | } executed 6 times by 1 test: else {end of block Executed by:
| 6 | ||||||||||||||||||||||||
55 | ERR_put_error(13,(0xfff),(122),__FILE__,112); | - | ||||||||||||||||||||||||
56 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
57 | } | - | ||||||||||||||||||||||||
58 | - | |||||||||||||||||||||||||
59 | if (num <= 0
| 0-6 | ||||||||||||||||||||||||
60 | ERR_put_error(13,(0xfff),(138),__FILE__,117); | - | ||||||||||||||||||||||||
61 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
62 | } | - | ||||||||||||||||||||||||
63 | c = *(p++); | - | ||||||||||||||||||||||||
64 | num--; | - | ||||||||||||||||||||||||
65 | for (;;) { | - | ||||||||||||||||||||||||
66 | if (num <= 0
| 6-12 | ||||||||||||||||||||||||
67 | break; executed 6 times by 1 test: break; Executed by:
| 6 | ||||||||||||||||||||||||
68 | if ((
| 0-12 | ||||||||||||||||||||||||
69 | ERR_put_error(13,(0xfff),(131),__FILE__,126); | - | ||||||||||||||||||||||||
70 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
71 | } | - | ||||||||||||||||||||||||
72 | l = 0; | - | ||||||||||||||||||||||||
73 | use_bn = 0; | - | ||||||||||||||||||||||||
74 | for (;;) { | - | ||||||||||||||||||||||||
75 | if (num <= 0
| 6-42 | ||||||||||||||||||||||||
76 | break; executed 6 times by 1 test: break; Executed by:
| 6 | ||||||||||||||||||||||||
77 | num--; | - | ||||||||||||||||||||||||
78 | c = *(p++); | - | ||||||||||||||||||||||||
79 | if ((
| 0-42 | ||||||||||||||||||||||||
80 | break; executed 6 times by 1 test: break; Executed by:
| 6 | ||||||||||||||||||||||||
81 | if ((
| 0-36 | ||||||||||||||||||||||||
82 | ERR_put_error(13,(0xfff),(130),__FILE__,139); | - | ||||||||||||||||||||||||
83 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
84 | } | - | ||||||||||||||||||||||||
85 | if (!use_bn
| 0-36 | ||||||||||||||||||||||||
86 | (0x7fffffffffffffffL * 2UL + 1UL)
| 0-36 | ||||||||||||||||||||||||
87 | - 80) / 10L)
| 0-36 | ||||||||||||||||||||||||
88 | use_bn = 1; | - | ||||||||||||||||||||||||
89 | if (!bl
| 0 | ||||||||||||||||||||||||
90 | bl = BN_new(); never executed: bl = BN_new(); | 0 | ||||||||||||||||||||||||
91 | if (!bl
| 0 | ||||||||||||||||||||||||
92 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
93 | } never executed: end of block | 0 | ||||||||||||||||||||||||
94 | if (use_bn
| 0-36 | ||||||||||||||||||||||||
95 | if (!BN_mul_word(bl, 10L)
| 0 | ||||||||||||||||||||||||
96 | !BN_add_word(bl, c-'0')
| 0 | ||||||||||||||||||||||||
97 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
98 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
99 | l = l * 10L + (long)(c - '0'); executed 36 times by 1 test: l = l * 10L + (long)(c - '0'); Executed by:
| 36 | ||||||||||||||||||||||||
100 | } | - | ||||||||||||||||||||||||
101 | if (len == 0
| 6 | ||||||||||||||||||||||||
102 | if ((
| 0-6 | ||||||||||||||||||||||||
103 | ERR_put_error(13,(0xfff),(147),__FILE__,158); | - | ||||||||||||||||||||||||
104 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
105 | } | - | ||||||||||||||||||||||||
106 | if (use_bn
| 0-6 | ||||||||||||||||||||||||
107 | if (!BN_add_word(bl, first * 40)
| 0 | ||||||||||||||||||||||||
108 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
109 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
110 | l += (long)first * 40; executed 6 times by 1 test: l += (long)first * 40; Executed by:
| 6 | ||||||||||||||||||||||||
111 | } | - | ||||||||||||||||||||||||
112 | i = 0; | - | ||||||||||||||||||||||||
113 | if (use_bn
| 0-12 | ||||||||||||||||||||||||
114 | int blsize; | - | ||||||||||||||||||||||||
115 | blsize = BN_num_bits(bl); | - | ||||||||||||||||||||||||
116 | blsize = (blsize + 6) / 7; | - | ||||||||||||||||||||||||
117 | if (blsize > tmpsize
| 0 | ||||||||||||||||||||||||
118 | if (tmp != ftmp
| 0 | ||||||||||||||||||||||||
119 | free(tmp); never executed: free(tmp); | 0 | ||||||||||||||||||||||||
120 | tmpsize = blsize + 32; | - | ||||||||||||||||||||||||
121 | tmp = malloc(tmpsize); | - | ||||||||||||||||||||||||
122 | if (!tmp
| 0 | ||||||||||||||||||||||||
123 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
124 | } never executed: end of block | 0 | ||||||||||||||||||||||||
125 | while (blsize--
| 0 | ||||||||||||||||||||||||
126 | tmp[i++] = (unsigned char)BN_div_word(bl, 0x80L); never executed: tmp[i++] = (unsigned char)BN_div_word(bl, 0x80L); | 0 | ||||||||||||||||||||||||
127 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
128 | - | |||||||||||||||||||||||||
129 | for (;;) { | - | ||||||||||||||||||||||||
130 | tmp[i++] = (unsigned char)l & 0x7f; | - | ||||||||||||||||||||||||
131 | l >>= 7L; | - | ||||||||||||||||||||||||
132 | if (l == 0L
| 12 | ||||||||||||||||||||||||
133 | break; executed 12 times by 1 test: break; Executed by:
| 12 | ||||||||||||||||||||||||
134 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||
135 | - | |||||||||||||||||||||||||
136 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||
137 | if (out !=
| 6 | ||||||||||||||||||||||||
138 | ((void *)0)
| 6 | ||||||||||||||||||||||||
139 | ) { | - | ||||||||||||||||||||||||
140 | if (len + i > olen
| 0-6 | ||||||||||||||||||||||||
141 | ERR_put_error(13,(0xfff),(107),__FILE__,194); | - | ||||||||||||||||||||||||
142 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
143 | } | - | ||||||||||||||||||||||||
144 | while (--
| 6 | ||||||||||||||||||||||||
145 | out[len++] = tmp[i]|0x80; executed 6 times by 1 test: out[len++] = tmp[i]|0x80; Executed by:
| 6 | ||||||||||||||||||||||||
146 | out[len++] = tmp[0]; | - | ||||||||||||||||||||||||
147 | } executed 6 times by 1 test: elseend of block Executed by:
| 6 | ||||||||||||||||||||||||
148 | len += i; executed 6 times by 1 test: len += i; Executed by:
| 6 | ||||||||||||||||||||||||
149 | } | - | ||||||||||||||||||||||||
150 | if (tmp != ftmp
| 0-6 | ||||||||||||||||||||||||
151 | free(tmp); never executed: free(tmp); | 0 | ||||||||||||||||||||||||
152 | BN_free(bl); | - | ||||||||||||||||||||||||
153 | return executed 6 times by 1 test: (len);return (len); Executed by:
executed 6 times by 1 test: return (len); Executed by:
| 6 | ||||||||||||||||||||||||
154 | - | |||||||||||||||||||||||||
155 | err: | - | ||||||||||||||||||||||||
156 | if (tmp != ftmp
| 0 | ||||||||||||||||||||||||
157 | free(tmp); never executed: free(tmp); | 0 | ||||||||||||||||||||||||
158 | BN_free(bl); | - | ||||||||||||||||||||||||
159 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
160 | } | - | ||||||||||||||||||||||||
161 | - | |||||||||||||||||||||||||
162 | int | - | ||||||||||||||||||||||||
163 | i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a) | - | ||||||||||||||||||||||||
164 | { | - | ||||||||||||||||||||||||
165 | return executed 12 times by 1 test: OBJ_obj2txt(buf, buf_len, a, 0);return OBJ_obj2txt(buf, buf_len, a, 0); Executed by:
executed 12 times by 1 test: return OBJ_obj2txt(buf, buf_len, a, 0); Executed by:
| 12 | ||||||||||||||||||||||||
166 | } | - | ||||||||||||||||||||||||
167 | - | |||||||||||||||||||||||||
168 | int | - | ||||||||||||||||||||||||
169 | i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a) | - | ||||||||||||||||||||||||
170 | { | - | ||||||||||||||||||||||||
171 | char *tmp = | - | ||||||||||||||||||||||||
172 | ((void *)0) | - | ||||||||||||||||||||||||
173 | ; | - | ||||||||||||||||||||||||
174 | size_t tlen = 256; | - | ||||||||||||||||||||||||
175 | int i = -1; | - | ||||||||||||||||||||||||
176 | - | |||||||||||||||||||||||||
177 | if ((
| 0-12 | ||||||||||||||||||||||||
178 | ((void *)0)
| 0-12 | ||||||||||||||||||||||||
179 | )
| 0-12 | ||||||||||||||||||||||||
180 | ((void *)0)
| 0-12 | ||||||||||||||||||||||||
181 | )
| 0-12 | ||||||||||||||||||||||||
182 | return never executed: (BIO_write(bp, "NULL", 4));return(BIO_write(bp, "NULL", 4)); never executed: return(BIO_write(bp, "NULL", 4)); | 0 | ||||||||||||||||||||||||
183 | if ((
| 0-12 | ||||||||||||||||||||||||
184 | ((void *)0)
| 0-12 | ||||||||||||||||||||||||
185 | ) | - | ||||||||||||||||||||||||
186 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
187 | i = i2t_ASN1_OBJECT(tmp, tlen, a); | - | ||||||||||||||||||||||||
188 | if (i > (int)(tlen - 1)
| 0-12 | ||||||||||||||||||||||||
189 | freezero(tmp, tlen); | - | ||||||||||||||||||||||||
190 | if ((
| 0 | ||||||||||||||||||||||||
191 | ((void *)0)
| 0 | ||||||||||||||||||||||||
192 | ) | - | ||||||||||||||||||||||||
193 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
194 | tlen = i + 1; | - | ||||||||||||||||||||||||
195 | i = i2t_ASN1_OBJECT(tmp, tlen, a); | - | ||||||||||||||||||||||||
196 | } never executed: end of block | 0 | ||||||||||||||||||||||||
197 | if (i <= 0
| 0-12 | ||||||||||||||||||||||||
198 | i = BIO_write(bp, "<INVALID>", 9); never executed: i = BIO_write(bp, "<INVALID>", 9); | 0 | ||||||||||||||||||||||||
199 | else | - | ||||||||||||||||||||||||
200 | i = BIO_write(bp, tmp, i); executed 12 times by 1 test: i = BIO_write(bp, tmp, i); Executed by:
| 12 | ||||||||||||||||||||||||
201 | freezero(tmp, tlen); | - | ||||||||||||||||||||||||
202 | return executed 12 times by 1 test: (i);return (i); Executed by:
executed 12 times by 1 test: return (i); Executed by:
| 12 | ||||||||||||||||||||||||
203 | } | - | ||||||||||||||||||||||||
204 | - | |||||||||||||||||||||||||
205 | ASN1_OBJECT * | - | ||||||||||||||||||||||||
206 | d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, long length) | - | ||||||||||||||||||||||||
207 | { | - | ||||||||||||||||||||||||
208 | const unsigned char *p; | - | ||||||||||||||||||||||||
209 | long len; | - | ||||||||||||||||||||||||
210 | int tag, xclass; | - | ||||||||||||||||||||||||
211 | int inf, i; | - | ||||||||||||||||||||||||
212 | ASN1_OBJECT *ret = | - | ||||||||||||||||||||||||
213 | ((void *)0) | - | ||||||||||||||||||||||||
214 | ; | - | ||||||||||||||||||||||||
215 | - | |||||||||||||||||||||||||
216 | p = *pp; | - | ||||||||||||||||||||||||
217 | inf = ASN1_get_object(&p, &len, &tag, &xclass, length); | - | ||||||||||||||||||||||||
218 | if (inf & 0x80
| 0 | ||||||||||||||||||||||||
219 | i = 102; | - | ||||||||||||||||||||||||
220 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
221 | } | - | ||||||||||||||||||||||||
222 | - | |||||||||||||||||||||||||
223 | if (tag != 6
| 0 | ||||||||||||||||||||||||
224 | i = 116; | - | ||||||||||||||||||||||||
225 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
226 | } | - | ||||||||||||||||||||||||
227 | ret = c2i_ASN1_OBJECT(a, &p, len); | - | ||||||||||||||||||||||||
228 | if (ret
| 0 | ||||||||||||||||||||||||
229 | * never executed: pp = p;*pp = p; never executed: *pp = p; | 0 | ||||||||||||||||||||||||
230 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||
232 | err: | - | ||||||||||||||||||||||||
233 | ERR_put_error(13,(0xfff),(i),__FILE__,274); | - | ||||||||||||||||||||||||
234 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
235 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
236 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
237 | } | - | ||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||
239 | ASN1_OBJECT * | - | ||||||||||||||||||||||||
240 | c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, long len) | - | ||||||||||||||||||||||||
241 | { | - | ||||||||||||||||||||||||
242 | ASN1_OBJECT *ret; | - | ||||||||||||||||||||||||
243 | const unsigned char *p; | - | ||||||||||||||||||||||||
244 | unsigned char *data; | - | ||||||||||||||||||||||||
245 | int i, length; | - | ||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||
248 | - | |||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||
251 | - | |||||||||||||||||||||||||
252 | - | |||||||||||||||||||||||||
253 | if (len <= 0
| 0-3252 | ||||||||||||||||||||||||
254 | ((void *)0)
| 0-3252 | ||||||||||||||||||||||||
255 | || (
| 0-3252 | ||||||||||||||||||||||||
256 | ((void *)0)
| 0-3252 | ||||||||||||||||||||||||
257 | || | - | ||||||||||||||||||||||||
258 | p[len - 1] & 0x80
| 0-3252 | ||||||||||||||||||||||||
259 | ERR_put_error(13,(0xfff),(216),__FILE__,294); | - | ||||||||||||||||||||||||
260 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
261 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
262 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
263 | } | - | ||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||
266 | length = (int)len; | - | ||||||||||||||||||||||||
267 | for (i = 0; i < length
| 3252-14622 | ||||||||||||||||||||||||
268 | if (*
| 0-14622 | ||||||||||||||||||||||||
269 | ERR_put_error(13,(0xfff),(216),__FILE__,302); | - | ||||||||||||||||||||||||
270 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
271 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
272 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
273 | } | - | ||||||||||||||||||||||||
274 | } executed 14622 times by 8 tests: end of block Executed by:
| 14622 | ||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||
277 | - | |||||||||||||||||||||||||
278 | if ((
| 0-3252 | ||||||||||||||||||||||||
279 | ((void *)0)
| 0-3252 | ||||||||||||||||||||||||
280 | )
| 0-3252 | ||||||||||||||||||||||||
281 | ((void *)0)
| 2-3250 | ||||||||||||||||||||||||
282 | )
| 2-3250 | ||||||||||||||||||||||||
283 | !((*a)->flags & 0x01)
| 0-3250 | ||||||||||||||||||||||||
284 | if ((
| 0-3252 | ||||||||||||||||||||||||
285 | ((void *)0)
| 0-3252 | ||||||||||||||||||||||||
286 | ) | - | ||||||||||||||||||||||||
287 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
288 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
289 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
290 | } executed 3252 times by 8 tests: elseend of block Executed by:
| 3252 | ||||||||||||||||||||||||
291 | ret = *a; never executed: ret = *a; | 0 | ||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||
293 | p = *pp; | - | ||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||
295 | - | |||||||||||||||||||||||||
296 | data = (unsigned char *)ret->data; | - | ||||||||||||||||||||||||
297 | freezero(data, ret->length); | - | ||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||
299 | data = malloc(length); | - | ||||||||||||||||||||||||
300 | if (data ==
| 0-3252 | ||||||||||||||||||||||||
301 | ((void *)0)
| 0-3252 | ||||||||||||||||||||||||
302 | ) { | - | ||||||||||||||||||||||||
303 | ERR_put_error(13,(0xfff),((1|64)),__FILE__,324); | - | ||||||||||||||||||||||||
304 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
305 | } | - | ||||||||||||||||||||||||
306 | - | |||||||||||||||||||||||||
307 | memcpy(data, p, length); | - | ||||||||||||||||||||||||
308 | - | |||||||||||||||||||||||||
309 | - | |||||||||||||||||||||||||
310 | ret->data = data; | - | ||||||||||||||||||||||||
311 | ret->length = length; | - | ||||||||||||||||||||||||
312 | ret->sn = | - | ||||||||||||||||||||||||
313 | ((void *)0) | - | ||||||||||||||||||||||||
314 | ; | - | ||||||||||||||||||||||||
315 | ret->ln = | - | ||||||||||||||||||||||||
316 | ((void *)0) | - | ||||||||||||||||||||||||
317 | ; | - | ||||||||||||||||||||||||
318 | ret->flags |= 0x08; | - | ||||||||||||||||||||||||
319 | p += length; | - | ||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||
321 | if (a !=
| 0-3252 | ||||||||||||||||||||||||
322 | ((void *)0)
| 0-3252 | ||||||||||||||||||||||||
323 | ) | - | ||||||||||||||||||||||||
324 | * executed 3252 times by 8 tests: a = ret;*a = ret; Executed by:
executed 3252 times by 8 tests: *a = ret; Executed by:
| 3252 | ||||||||||||||||||||||||
325 | *pp = p; | - | ||||||||||||||||||||||||
326 | return executed 3252 times by 8 tests: (ret);return (ret); Executed by:
executed 3252 times by 8 tests: return (ret); Executed by:
| 3252 | ||||||||||||||||||||||||
327 | - | |||||||||||||||||||||||||
328 | err: | - | ||||||||||||||||||||||||
329 | if (a ==
| 0 | ||||||||||||||||||||||||
330 | ((void *)0)
| 0 | ||||||||||||||||||||||||
331 | || ret != *a
| 0 | ||||||||||||||||||||||||
332 | ASN1_OBJECT_free(ret); never executed: ASN1_OBJECT_free(ret); | 0 | ||||||||||||||||||||||||
333 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
334 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
335 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
336 | } | - | ||||||||||||||||||||||||
337 | - | |||||||||||||||||||||||||
338 | ASN1_OBJECT * | - | ||||||||||||||||||||||||
339 | ASN1_OBJECT_new(void) | - | ||||||||||||||||||||||||
340 | { | - | ||||||||||||||||||||||||
341 | ASN1_OBJECT *ret; | - | ||||||||||||||||||||||||
342 | - | |||||||||||||||||||||||||
343 | ret = malloc(sizeof(ASN1_OBJECT)); | - | ||||||||||||||||||||||||
344 | if (ret ==
| 0-5096 | ||||||||||||||||||||||||
345 | ((void *)0)
| 0-5096 | ||||||||||||||||||||||||
346 | ) { | - | ||||||||||||||||||||||||
347 | ERR_put_error(13,(0xfff),((1|64)),__FILE__,356); | - | ||||||||||||||||||||||||
348 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
349 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
350 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
351 | } | - | ||||||||||||||||||||||||
352 | ret->length = 0; | - | ||||||||||||||||||||||||
353 | ret->data = | - | ||||||||||||||||||||||||
354 | ((void *)0) | - | ||||||||||||||||||||||||
355 | ; | - | ||||||||||||||||||||||||
356 | ret->nid = 0; | - | ||||||||||||||||||||||||
357 | ret->sn = | - | ||||||||||||||||||||||||
358 | ((void *)0) | - | ||||||||||||||||||||||||
359 | ; | - | ||||||||||||||||||||||||
360 | ret->ln = | - | ||||||||||||||||||||||||
361 | ((void *)0) | - | ||||||||||||||||||||||||
362 | ; | - | ||||||||||||||||||||||||
363 | ret->flags = 0x01; | - | ||||||||||||||||||||||||
364 | return executed 5096 times by 8 tests: (ret);return (ret); Executed by:
executed 5096 times by 8 tests: return (ret); Executed by:
| 5096 | ||||||||||||||||||||||||
365 | } | - | ||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||
367 | void | - | ||||||||||||||||||||||||
368 | ASN1_OBJECT_free(ASN1_OBJECT *a) | - | ||||||||||||||||||||||||
369 | { | - | ||||||||||||||||||||||||
370 | if (a ==
| 1-5338 | ||||||||||||||||||||||||
371 | ((void *)0)
| 1-5338 | ||||||||||||||||||||||||
372 | ) | - | ||||||||||||||||||||||||
373 | return; executed 1 time by 1 test: return; Executed by:
| 1 | ||||||||||||||||||||||||
374 | if (a->flags & 0x04
| 1844-3494 | ||||||||||||||||||||||||
375 | free((void *)a->sn); | - | ||||||||||||||||||||||||
376 | free((void *)a->ln); | - | ||||||||||||||||||||||||
377 | a->sn = a->ln = | - | ||||||||||||||||||||||||
378 | ((void *)0) | - | ||||||||||||||||||||||||
379 | ; | - | ||||||||||||||||||||||||
380 | } executed 1844 times by 8 tests: end of block Executed by:
| 1844 | ||||||||||||||||||||||||
381 | if (a->flags & 0x08
| 342-4996 | ||||||||||||||||||||||||
382 | freezero((void *)a->data, a->length); | - | ||||||||||||||||||||||||
383 | a->data = | - | ||||||||||||||||||||||||
384 | ((void *)0) | - | ||||||||||||||||||||||||
385 | ; | - | ||||||||||||||||||||||||
386 | a->length = 0; | - | ||||||||||||||||||||||||
387 | } executed 4996 times by 8 tests: end of block Executed by:
| 4996 | ||||||||||||||||||||||||
388 | if (a->flags & 0x01
| 342-4996 | ||||||||||||||||||||||||
389 | free(a); executed 4996 times by 8 tests: free(a); Executed by:
| 4996 | ||||||||||||||||||||||||
390 | } executed 5338 times by 9 tests: end of block Executed by:
| 5338 | ||||||||||||||||||||||||
391 | - | |||||||||||||||||||||||||
392 | ASN1_OBJECT * | - | ||||||||||||||||||||||||
393 | ASN1_OBJECT_create(int nid, unsigned char *data, int len, | - | ||||||||||||||||||||||||
394 | const char *sn, const char *ln) | - | ||||||||||||||||||||||||
395 | { | - | ||||||||||||||||||||||||
396 | ASN1_OBJECT o; | - | ||||||||||||||||||||||||
397 | - | |||||||||||||||||||||||||
398 | o.sn = sn; | - | ||||||||||||||||||||||||
399 | o.ln = ln; | - | ||||||||||||||||||||||||
400 | o.data = data; | - | ||||||||||||||||||||||||
401 | o.nid = nid; | - | ||||||||||||||||||||||||
402 | o.length = len; | - | ||||||||||||||||||||||||
403 | o.flags = 0x01 | 0x04 | | - | ||||||||||||||||||||||||
404 | 0x08; | - | ||||||||||||||||||||||||
405 | return executed 3 times by 1 test: (OBJ_dup(&o));return (OBJ_dup(&o)); Executed by:
executed 3 times by 1 test: return (OBJ_dup(&o)); Executed by:
| 3 | ||||||||||||||||||||||||
406 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |