Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/bio_asn1.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | typedef enum { | - | ||||||||||||
6 | ASN1_STATE_START, | - | ||||||||||||
7 | ASN1_STATE_PRE_COPY, | - | ||||||||||||
8 | ASN1_STATE_HEADER, | - | ||||||||||||
9 | ASN1_STATE_HEADER_COPY, | - | ||||||||||||
10 | ASN1_STATE_DATA_COPY, | - | ||||||||||||
11 | ASN1_STATE_POST_COPY, | - | ||||||||||||
12 | ASN1_STATE_DONE | - | ||||||||||||
13 | } asn1_bio_state_t; | - | ||||||||||||
14 | - | |||||||||||||
15 | typedef struct BIO_ASN1_EX_FUNCS_st { | - | ||||||||||||
16 | asn1_ps_func *ex_func; | - | ||||||||||||
17 | asn1_ps_func *ex_free_func; | - | ||||||||||||
18 | } BIO_ASN1_EX_FUNCS; | - | ||||||||||||
19 | - | |||||||||||||
20 | typedef struct BIO_ASN1_BUF_CTX_t { | - | ||||||||||||
21 | - | |||||||||||||
22 | asn1_bio_state_t state; | - | ||||||||||||
23 | - | |||||||||||||
24 | unsigned char *buf; | - | ||||||||||||
25 | - | |||||||||||||
26 | int bufsize; | - | ||||||||||||
27 | - | |||||||||||||
28 | int bufpos; | - | ||||||||||||
29 | - | |||||||||||||
30 | int buflen; | - | ||||||||||||
31 | - | |||||||||||||
32 | int copylen; | - | ||||||||||||
33 | - | |||||||||||||
34 | int asn1_class, asn1_tag; | - | ||||||||||||
35 | asn1_ps_func *prefix, *prefix_free, *suffix, *suffix_free; | - | ||||||||||||
36 | - | |||||||||||||
37 | unsigned char *ex_buf; | - | ||||||||||||
38 | int ex_len; | - | ||||||||||||
39 | int ex_pos; | - | ||||||||||||
40 | void *ex_arg; | - | ||||||||||||
41 | } BIO_ASN1_BUF_CTX; | - | ||||||||||||
42 | - | |||||||||||||
43 | static int asn1_bio_write(BIO *h, const char *buf, int num); | - | ||||||||||||
44 | static int asn1_bio_read(BIO *h, char *buf, int size); | - | ||||||||||||
45 | static int asn1_bio_puts(BIO *h, const char *str); | - | ||||||||||||
46 | static int asn1_bio_gets(BIO *h, char *str, int size); | - | ||||||||||||
47 | static long asn1_bio_ctrl(BIO *h, int cmd, long arg1, void *arg2); | - | ||||||||||||
48 | static int asn1_bio_new(BIO *h); | - | ||||||||||||
49 | static int asn1_bio_free(BIO *data); | - | ||||||||||||
50 | static long asn1_bio_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp); | - | ||||||||||||
51 | - | |||||||||||||
52 | static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size); | - | ||||||||||||
53 | static int asn1_bio_flush_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx, | - | ||||||||||||
54 | asn1_ps_func *cleanup, asn1_bio_state_t next); | - | ||||||||||||
55 | static int asn1_bio_setup_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx, | - | ||||||||||||
56 | asn1_ps_func *setup, | - | ||||||||||||
57 | asn1_bio_state_t ex_state, | - | ||||||||||||
58 | asn1_bio_state_t other_state); | - | ||||||||||||
59 | - | |||||||||||||
60 | static const BIO_METHOD methods_asn1 = { | - | ||||||||||||
61 | (22|0x0200), | - | ||||||||||||
62 | "asn1", | - | ||||||||||||
63 | - | |||||||||||||
64 | bwrite_conv, | - | ||||||||||||
65 | asn1_bio_write, | - | ||||||||||||
66 | - | |||||||||||||
67 | bread_conv, | - | ||||||||||||
68 | asn1_bio_read, | - | ||||||||||||
69 | asn1_bio_puts, | - | ||||||||||||
70 | asn1_bio_gets, | - | ||||||||||||
71 | asn1_bio_ctrl, | - | ||||||||||||
72 | asn1_bio_new, | - | ||||||||||||
73 | asn1_bio_free, | - | ||||||||||||
74 | asn1_bio_callback_ctrl, | - | ||||||||||||
75 | }; | - | ||||||||||||
76 | - | |||||||||||||
77 | const BIO_METHOD *BIO_f_asn1(void) | - | ||||||||||||
78 | { | - | ||||||||||||
79 | return executed 45 times by 1 test: &methods_asn1;return &methods_asn1; Executed by:
executed 45 times by 1 test: return &methods_asn1; Executed by:
| 45 | ||||||||||||
80 | } | - | ||||||||||||
81 | - | |||||||||||||
82 | static int asn1_bio_new(BIO *b) | - | ||||||||||||
83 | { | - | ||||||||||||
84 | BIO_ASN1_BUF_CTX *ctx = CRYPTO_zalloc(sizeof(*ctx), __FILE__, 103); | - | ||||||||||||
85 | - | |||||||||||||
86 | if (ctx ==
| 0-45 | ||||||||||||
87 | ((void *)0)
| 0-45 | ||||||||||||
88 | ) | - | ||||||||||||
89 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
90 | if (!asn1_bio_init(ctx, 20)
| 0-45 | ||||||||||||
91 | CRYPTO_free(ctx, __FILE__, 108); | - | ||||||||||||
92 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
93 | } | - | ||||||||||||
94 | BIO_set_data(b, ctx); | - | ||||||||||||
95 | BIO_set_init(b, 1); | - | ||||||||||||
96 | - | |||||||||||||
97 | return executed 45 times by 1 test: 1;return 1; Executed by:
executed 45 times by 1 test: return 1; Executed by:
| 45 | ||||||||||||
98 | } | - | ||||||||||||
99 | - | |||||||||||||
100 | static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size) | - | ||||||||||||
101 | { | - | ||||||||||||
102 | if ((
| 0-45 | ||||||||||||
103 | ((void *)0)
| 0-45 | ||||||||||||
104 | ) { | - | ||||||||||||
105 | ERR_put_error(13,(113),((1|64)),__FILE__,120); | - | ||||||||||||
106 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
107 | } | - | ||||||||||||
108 | ctx->bufsize = size; | - | ||||||||||||
109 | ctx->asn1_class = 0x00; | - | ||||||||||||
110 | ctx->asn1_tag = 4; | - | ||||||||||||
111 | ctx->state = ASN1_STATE_START; | - | ||||||||||||
112 | return executed 45 times by 1 test: 1;return 1; Executed by:
executed 45 times by 1 test: return 1; Executed by:
| 45 | ||||||||||||
113 | } | - | ||||||||||||
114 | - | |||||||||||||
115 | static int asn1_bio_free(BIO *b) | - | ||||||||||||
116 | { | - | ||||||||||||
117 | BIO_ASN1_BUF_CTX *ctx; | - | ||||||||||||
118 | - | |||||||||||||
119 | if (b ==
| 0-45 | ||||||||||||
120 | ((void *)0)
| 0-45 | ||||||||||||
121 | ) | - | ||||||||||||
122 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
123 | - | |||||||||||||
124 | ctx = BIO_get_data(b); | - | ||||||||||||
125 | if (ctx ==
| 0-45 | ||||||||||||
126 | ((void *)0)
| 0-45 | ||||||||||||
127 | ) | - | ||||||||||||
128 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
129 | - | |||||||||||||
130 | CRYPTO_free(ctx->buf, __FILE__, 141); | - | ||||||||||||
131 | CRYPTO_free(ctx, __FILE__, 142); | - | ||||||||||||
132 | BIO_set_data(b, | - | ||||||||||||
133 | ((void *)0) | - | ||||||||||||
134 | ); | - | ||||||||||||
135 | BIO_set_init(b, 0); | - | ||||||||||||
136 | - | |||||||||||||
137 | return executed 45 times by 1 test: 1;return 1; Executed by:
executed 45 times by 1 test: return 1; Executed by:
| 45 | ||||||||||||
138 | } | - | ||||||||||||
139 | - | |||||||||||||
140 | static int asn1_bio_write(BIO *b, const char *in, int inl) | - | ||||||||||||
141 | { | - | ||||||||||||
142 | BIO_ASN1_BUF_CTX *ctx; | - | ||||||||||||
143 | int wrmax, wrlen, ret; | - | ||||||||||||
144 | unsigned char *p; | - | ||||||||||||
145 | BIO *next; | - | ||||||||||||
146 | - | |||||||||||||
147 | ctx = BIO_get_data(b); | - | ||||||||||||
148 | next = BIO_next(b); | - | ||||||||||||
149 | if (in ==
| 0-72 | ||||||||||||
150 | ((void *)0)
| 0-72 | ||||||||||||
151 | || inl < 0
| 0-72 | ||||||||||||
152 | ((void *)0)
| 0-72 | ||||||||||||
153 | || next ==
| 0-72 | ||||||||||||
154 | ((void *)0)
| 0-72 | ||||||||||||
155 | ) | - | ||||||||||||
156 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
157 | - | |||||||||||||
158 | wrlen = 0; | - | ||||||||||||
159 | ret = -1; | - | ||||||||||||
160 | - | |||||||||||||
161 | for (;;) { | - | ||||||||||||
162 | switch (ctx->state) { | - | ||||||||||||
163 | - | |||||||||||||
164 | case executed 45 times by 1 test: ASN1_STATE_START:case ASN1_STATE_START: Executed by:
executed 45 times by 1 test: case ASN1_STATE_START: Executed by:
| 45 | ||||||||||||
165 | if (!asn1_bio_setup_ex(b, ctx, ctx->prefix,
| 0-45 | ||||||||||||
166 | ASN1_STATE_PRE_COPY, ASN1_STATE_HEADER)
| 0-45 | ||||||||||||
167 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
168 | break; executed 45 times by 1 test: break; Executed by:
| 45 | ||||||||||||
169 | - | |||||||||||||
170 | - | |||||||||||||
171 | case executed 45 times by 1 test: ASN1_STATE_PRE_COPY:case ASN1_STATE_PRE_COPY: Executed by:
executed 45 times by 1 test: case ASN1_STATE_PRE_COPY: Executed by:
| 45 | ||||||||||||
172 | - | |||||||||||||
173 | ret = asn1_bio_flush_ex(b, ctx, ctx->prefix_free, | - | ||||||||||||
174 | ASN1_STATE_HEADER); | - | ||||||||||||
175 | - | |||||||||||||
176 | if (ret <= 0
| 0-45 | ||||||||||||
177 | goto never executed: done;goto done; never executed: goto done; | 0 | ||||||||||||
178 | - | |||||||||||||
179 | break; executed 45 times by 1 test: break; Executed by:
| 45 | ||||||||||||
180 | - | |||||||||||||
181 | case executed 72 times by 1 test: ASN1_STATE_HEADER:case ASN1_STATE_HEADER: Executed by:
executed 72 times by 1 test: case ASN1_STATE_HEADER: Executed by:
| 72 | ||||||||||||
182 | ctx->buflen = ASN1_object_size(0, inl, ctx->asn1_tag) - inl; | - | ||||||||||||
183 | if (!((ctx->buflen <= ctx->bufsize) != 0)
| 0-72 | ||||||||||||
184 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
185 | p = ctx->buf; | - | ||||||||||||
186 | ASN1_put_object(&p, 0, inl, ctx->asn1_tag, ctx->asn1_class); | - | ||||||||||||
187 | ctx->copylen = inl; | - | ||||||||||||
188 | ctx->state = ASN1_STATE_HEADER_COPY; | - | ||||||||||||
189 | - | |||||||||||||
190 | break; executed 72 times by 1 test: break; Executed by:
| 72 | ||||||||||||
191 | - | |||||||||||||
192 | case executed 72 times by 1 test: ASN1_STATE_HEADER_COPY:case ASN1_STATE_HEADER_COPY: Executed by:
executed 72 times by 1 test: case ASN1_STATE_HEADER_COPY: Executed by:
| 72 | ||||||||||||
193 | ret = BIO_write(next, ctx->buf + ctx->bufpos, ctx->buflen); | - | ||||||||||||
194 | if (ret <= 0
| 0-72 | ||||||||||||
195 | goto never executed: done;goto done; never executed: goto done; | 0 | ||||||||||||
196 | - | |||||||||||||
197 | ctx->buflen -= ret; | - | ||||||||||||
198 | if (ctx->buflen
| 0-72 | ||||||||||||
199 | ctx->bufpos += ret; never executed: ctx->bufpos += ret; | 0 | ||||||||||||
200 | else { | - | ||||||||||||
201 | ctx->bufpos = 0; | - | ||||||||||||
202 | ctx->state = ASN1_STATE_DATA_COPY; | - | ||||||||||||
203 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||
204 | - | |||||||||||||
205 | break; executed 72 times by 1 test: break; Executed by:
| 72 | ||||||||||||
206 | - | |||||||||||||
207 | case executed 72 times by 1 test: ASN1_STATE_DATA_COPY:case ASN1_STATE_DATA_COPY: Executed by:
executed 72 times by 1 test: case ASN1_STATE_DATA_COPY: Executed by:
| 72 | ||||||||||||
208 | - | |||||||||||||
209 | if (inl > ctx->copylen
| 0-72 | ||||||||||||
210 | wrmax = ctx->copylen; never executed: wrmax = ctx->copylen; | 0 | ||||||||||||
211 | else | - | ||||||||||||
212 | wrmax = inl; executed 72 times by 1 test: wrmax = inl; Executed by:
| 72 | ||||||||||||
213 | ret = BIO_write(next, in, wrmax); | - | ||||||||||||
214 | if (ret <= 0
| 0-72 | ||||||||||||
215 | goto never executed: done;goto done; never executed: goto done; | 0 | ||||||||||||
216 | wrlen += ret; | - | ||||||||||||
217 | ctx->copylen -= ret; | - | ||||||||||||
218 | in += ret; | - | ||||||||||||
219 | inl -= ret; | - | ||||||||||||
220 | - | |||||||||||||
221 | if (ctx->copylen == 0
| 0-72 | ||||||||||||
222 | ctx->state = ASN1_STATE_HEADER; executed 72 times by 1 test: ctx->state = ASN1_STATE_HEADER; Executed by:
| 72 | ||||||||||||
223 | - | |||||||||||||
224 | if (inl == 0
| 0-72 | ||||||||||||
225 | goto executed 72 times by 1 test: done;goto done; Executed by:
executed 72 times by 1 test: goto done; Executed by:
| 72 | ||||||||||||
226 | - | |||||||||||||
227 | break; never executed: break; | 0 | ||||||||||||
228 | - | |||||||||||||
229 | case never executed: ASN1_STATE_POST_COPY:case ASN1_STATE_POST_COPY: never executed: case ASN1_STATE_POST_COPY: | 0 | ||||||||||||
230 | case never executed: ASN1_STATE_DONE:case ASN1_STATE_DONE: never executed: case ASN1_STATE_DONE: | 0 | ||||||||||||
231 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||
232 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
233 | - | |||||||||||||
234 | } | - | ||||||||||||
235 | - | |||||||||||||
236 | } executed 234 times by 1 test: end of block Executed by:
| 234 | ||||||||||||
237 | - | |||||||||||||
238 | done: code before this statement never executed: done: | 0 | ||||||||||||
239 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||
240 | BIO_copy_next_retry(b); | - | ||||||||||||
241 | - | |||||||||||||
242 | return executed 72 times by 1 test: (return (wrlen > 0) ? wrlen : ret; Executed by:
executed 72 times by 1 test: return (wrlen > 0) ? wrlen : ret; Executed by:
| 0-72 | ||||||||||||
243 | - | |||||||||||||
244 | } | - | ||||||||||||
245 | - | |||||||||||||
246 | static int asn1_bio_flush_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx, | - | ||||||||||||
247 | asn1_ps_func *cleanup, asn1_bio_state_t next) | - | ||||||||||||
248 | { | - | ||||||||||||
249 | int ret; | - | ||||||||||||
250 | - | |||||||||||||
251 | if (ctx->ex_len <= 0
| 0-90 | ||||||||||||
252 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||
253 | for (;;) { | - | ||||||||||||
254 | ret = BIO_write(BIO_next(b), ctx->ex_buf + ctx->ex_pos, ctx->ex_len); | - | ||||||||||||
255 | if (ret <= 0
| 0-90 | ||||||||||||
256 | break; never executed: break; | 0 | ||||||||||||
257 | ctx->ex_len -= ret; | - | ||||||||||||
258 | if (ctx->ex_len > 0
| 0-90 | ||||||||||||
259 | ctx->ex_pos += ret; never executed: ctx->ex_pos += ret; | 0 | ||||||||||||
260 | else { | - | ||||||||||||
261 | if (cleanup
| 0-90 | ||||||||||||
262 | cleanup(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg); executed 90 times by 1 test: cleanup(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg); Executed by:
| 90 | ||||||||||||
263 | ctx->state = next; | - | ||||||||||||
264 | ctx->ex_pos = 0; | - | ||||||||||||
265 | break; executed 90 times by 1 test: break; Executed by:
| 90 | ||||||||||||
266 | } | - | ||||||||||||
267 | } | - | ||||||||||||
268 | return executed 90 times by 1 test: ret;return ret; Executed by:
executed 90 times by 1 test: return ret; Executed by:
| 90 | ||||||||||||
269 | } | - | ||||||||||||
270 | - | |||||||||||||
271 | static int asn1_bio_setup_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx, | - | ||||||||||||
272 | asn1_ps_func *setup, | - | ||||||||||||
273 | asn1_bio_state_t ex_state, | - | ||||||||||||
274 | asn1_bio_state_t other_state) | - | ||||||||||||
275 | { | - | ||||||||||||
276 | if (setup
| 0-90 | ||||||||||||
277 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||
278 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
279 | } | - | ||||||||||||
280 | if (ctx->ex_len > 0
| 0-90 | ||||||||||||
281 | ctx->state = ex_state; executed 90 times by 1 test: ctx->state = ex_state; Executed by:
| 90 | ||||||||||||
282 | else | - | ||||||||||||
283 | ctx->state = other_state; never executed: ctx->state = other_state; | 0 | ||||||||||||
284 | return executed 90 times by 1 test: 1;return 1; Executed by:
executed 90 times by 1 test: return 1; Executed by:
| 90 | ||||||||||||
285 | } | - | ||||||||||||
286 | - | |||||||||||||
287 | static int asn1_bio_read(BIO *b, char *in, int inl) | - | ||||||||||||
288 | { | - | ||||||||||||
289 | BIO *next = BIO_next(b); | - | ||||||||||||
290 | if (next ==
| 0 | ||||||||||||
291 | ((void *)0)
| 0 | ||||||||||||
292 | ) | - | ||||||||||||
293 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
294 | return never executed: BIO_read(next, in, inl);return BIO_read(next, in, inl); never executed: return BIO_read(next, in, inl); | 0 | ||||||||||||
295 | } | - | ||||||||||||
296 | - | |||||||||||||
297 | static int asn1_bio_puts(BIO *b, const char *str) | - | ||||||||||||
298 | { | - | ||||||||||||
299 | return never executed: asn1_bio_write(b, str, strlen(str));return asn1_bio_write(b, str, strlen(str)); never executed: return asn1_bio_write(b, str, strlen(str)); | 0 | ||||||||||||
300 | } | - | ||||||||||||
301 | - | |||||||||||||
302 | static int asn1_bio_gets(BIO *b, char *str, int size) | - | ||||||||||||
303 | { | - | ||||||||||||
304 | BIO *next = BIO_next(b); | - | ||||||||||||
305 | if (next ==
| 0 | ||||||||||||
306 | ((void *)0)
| 0 | ||||||||||||
307 | ) | - | ||||||||||||
308 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
309 | return never executed: BIO_gets(next, str, size);return BIO_gets(next, str, size); never executed: return BIO_gets(next, str, size); | 0 | ||||||||||||
310 | } | - | ||||||||||||
311 | - | |||||||||||||
312 | static long asn1_bio_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) | - | ||||||||||||
313 | { | - | ||||||||||||
314 | BIO *next = BIO_next(b); | - | ||||||||||||
315 | if (next ==
| 0 | ||||||||||||
316 | ((void *)0)
| 0 | ||||||||||||
317 | ) | - | ||||||||||||
318 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
319 | return never executed: BIO_callback_ctrl(next, cmd, fp);return BIO_callback_ctrl(next, cmd, fp); never executed: return BIO_callback_ctrl(next, cmd, fp); | 0 | ||||||||||||
320 | } | - | ||||||||||||
321 | - | |||||||||||||
322 | static long asn1_bio_ctrl(BIO *b, int cmd, long arg1, void *arg2) | - | ||||||||||||
323 | { | - | ||||||||||||
324 | BIO_ASN1_BUF_CTX *ctx; | - | ||||||||||||
325 | BIO_ASN1_EX_FUNCS *ex_func; | - | ||||||||||||
326 | long ret = 1; | - | ||||||||||||
327 | BIO *next; | - | ||||||||||||
328 | - | |||||||||||||
329 | ctx = BIO_get_data(b); | - | ||||||||||||
330 | if (ctx ==
| 0-493 | ||||||||||||
331 | ((void *)0)
| 0-493 | ||||||||||||
332 | ) | - | ||||||||||||
333 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
334 | next = BIO_next(b); | - | ||||||||||||
335 | switch (cmd) { | - | ||||||||||||
336 | - | |||||||||||||
337 | case executed 45 times by 1 test: 149:case 149: Executed by:
executed 45 times by 1 test: case 149: Executed by:
| 45 | ||||||||||||
338 | ex_func = arg2; | - | ||||||||||||
339 | ctx->prefix = ex_func->ex_func; | - | ||||||||||||
340 | ctx->prefix_free = ex_func->ex_free_func; | - | ||||||||||||
341 | break; executed 45 times by 1 test: break; Executed by:
| 45 | ||||||||||||
342 | - | |||||||||||||
343 | case never executed: 150:case 150: never executed: case 150: | 0 | ||||||||||||
344 | ex_func = arg2; | - | ||||||||||||
345 | ex_func->ex_func = ctx->prefix; | - | ||||||||||||
346 | ex_func->ex_free_func = ctx->prefix_free; | - | ||||||||||||
347 | break; never executed: break; | 0 | ||||||||||||
348 | - | |||||||||||||
349 | case executed 45 times by 1 test: 151:case 151: Executed by:
executed 45 times by 1 test: case 151: Executed by:
| 45 | ||||||||||||
350 | ex_func = arg2; | - | ||||||||||||
351 | ctx->suffix = ex_func->ex_func; | - | ||||||||||||
352 | ctx->suffix_free = ex_func->ex_free_func; | - | ||||||||||||
353 | break; executed 45 times by 1 test: break; Executed by:
| 45 | ||||||||||||
354 | - | |||||||||||||
355 | case never executed: 152:case 152: never executed: case 152: | 0 | ||||||||||||
356 | ex_func = arg2; | - | ||||||||||||
357 | ex_func->ex_func = ctx->suffix; | - | ||||||||||||
358 | ex_func->ex_free_func = ctx->suffix_free; | - | ||||||||||||
359 | break; never executed: break; | 0 | ||||||||||||
360 | - | |||||||||||||
361 | case executed 45 times by 1 test: 153:case 153: Executed by:
executed 45 times by 1 test: case 153: Executed by:
| 45 | ||||||||||||
362 | ctx->ex_arg = arg2; | - | ||||||||||||
363 | break; executed 45 times by 1 test: break; Executed by:
| 45 | ||||||||||||
364 | - | |||||||||||||
365 | case never executed: 154:case 154: never executed: case 154: | 0 | ||||||||||||
366 | *(void **)arg2 = ctx->ex_arg; | - | ||||||||||||
367 | break; never executed: break; | 0 | ||||||||||||
368 | - | |||||||||||||
369 | case executed 90 times by 1 test: 11:case 11: Executed by:
executed 90 times by 1 test: case 11: Executed by:
| 90 | ||||||||||||
370 | if (next ==
| 0-90 | ||||||||||||
371 | ((void *)0)
| 0-90 | ||||||||||||
372 | ) | - | ||||||||||||
373 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
374 | - | |||||||||||||
375 | - | |||||||||||||
376 | if (ctx->state == ASN1_STATE_HEADER
| 45 | ||||||||||||
377 | if (!asn1_bio_setup_ex(b, ctx, ctx->suffix,
| 0-45 | ||||||||||||
378 | ASN1_STATE_POST_COPY, ASN1_STATE_DONE)
| 0-45 | ||||||||||||
379 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
380 | } executed 45 times by 1 test: end of block Executed by:
| 45 | ||||||||||||
381 | - | |||||||||||||
382 | if (ctx->state == ASN1_STATE_POST_COPY
| 45 | ||||||||||||
383 | ret = asn1_bio_flush_ex(b, ctx, ctx->suffix_free, | - | ||||||||||||
384 | ASN1_STATE_DONE); | - | ||||||||||||
385 | if (ret <= 0
| 0-45 | ||||||||||||
386 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
387 | } executed 45 times by 1 test: end of block Executed by:
| 45 | ||||||||||||
388 | - | |||||||||||||
389 | if (ctx->state == ASN1_STATE_DONE
| 0-90 | ||||||||||||
390 | return executed 90 times by 1 test: BIO_ctrl(next, cmd, arg1, arg2);return BIO_ctrl(next, cmd, arg1, arg2); Executed by:
executed 90 times by 1 test: return BIO_ctrl(next, cmd, arg1, arg2); Executed by:
| 90 | ||||||||||||
391 | else { | - | ||||||||||||
392 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||
393 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
394 | } | - | ||||||||||||
395 | - | |||||||||||||
396 | default executed 268 times by 1 test: :default: Executed by:
executed 268 times by 1 test: default: Executed by:
| 268 | ||||||||||||
397 | if (next ==
| 0-268 | ||||||||||||
398 | ((void *)0)
| 0-268 | ||||||||||||
399 | ) | - | ||||||||||||
400 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
401 | return executed 268 times by 1 test: BIO_ctrl(next, cmd, arg1, arg2);return BIO_ctrl(next, cmd, arg1, arg2); Executed by:
executed 268 times by 1 test: return BIO_ctrl(next, cmd, arg1, arg2); Executed by:
| 268 | ||||||||||||
402 | - | |||||||||||||
403 | } | - | ||||||||||||
404 | - | |||||||||||||
405 | return executed 135 times by 1 test: ret;return ret; Executed by:
executed 135 times by 1 test: return ret; Executed by:
| 135 | ||||||||||||
406 | } | - | ||||||||||||
407 | - | |||||||||||||
408 | static int asn1_bio_set_ex(BIO *b, int cmd, | - | ||||||||||||
409 | asn1_ps_func *ex_func, asn1_ps_func *ex_free_func) | - | ||||||||||||
410 | { | - | ||||||||||||
411 | BIO_ASN1_EX_FUNCS extmp; | - | ||||||||||||
412 | extmp.ex_func = ex_func; | - | ||||||||||||
413 | extmp.ex_free_func = ex_free_func; | - | ||||||||||||
414 | return executed 90 times by 1 test: BIO_ctrl(b, cmd, 0, &extmp);return BIO_ctrl(b, cmd, 0, &extmp); Executed by:
executed 90 times by 1 test: return BIO_ctrl(b, cmd, 0, &extmp); Executed by:
| 90 | ||||||||||||
415 | } | - | ||||||||||||
416 | - | |||||||||||||
417 | static int asn1_bio_get_ex(BIO *b, int cmd, | - | ||||||||||||
418 | asn1_ps_func **ex_func, | - | ||||||||||||
419 | asn1_ps_func **ex_free_func) | - | ||||||||||||
420 | { | - | ||||||||||||
421 | BIO_ASN1_EX_FUNCS extmp; | - | ||||||||||||
422 | int ret; | - | ||||||||||||
423 | ret = BIO_ctrl(b, cmd, 0, &extmp); | - | ||||||||||||
424 | if (ret > 0
| 0 | ||||||||||||
425 | *ex_func = extmp.ex_func; | - | ||||||||||||
426 | *ex_free_func = extmp.ex_free_func; | - | ||||||||||||
427 | } never executed: end of block | 0 | ||||||||||||
428 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
429 | } | - | ||||||||||||
430 | - | |||||||||||||
431 | int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, | - | ||||||||||||
432 | asn1_ps_func *prefix_free) | - | ||||||||||||
433 | { | - | ||||||||||||
434 | return executed 45 times by 1 test: asn1_bio_set_ex(b, 149, prefix, prefix_free);return asn1_bio_set_ex(b, 149, prefix, prefix_free); Executed by:
executed 45 times by 1 test: return asn1_bio_set_ex(b, 149, prefix, prefix_free); Executed by:
| 45 | ||||||||||||
435 | } | - | ||||||||||||
436 | - | |||||||||||||
437 | int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, | - | ||||||||||||
438 | asn1_ps_func **pprefix_free) | - | ||||||||||||
439 | { | - | ||||||||||||
440 | return never executed: asn1_bio_get_ex(b, 150, pprefix, pprefix_free);return asn1_bio_get_ex(b, 150, pprefix, pprefix_free); never executed: return asn1_bio_get_ex(b, 150, pprefix, pprefix_free); | 0 | ||||||||||||
441 | } | - | ||||||||||||
442 | - | |||||||||||||
443 | int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, | - | ||||||||||||
444 | asn1_ps_func *suffix_free) | - | ||||||||||||
445 | { | - | ||||||||||||
446 | return executed 45 times by 1 test: asn1_bio_set_ex(b, 151, suffix, suffix_free);return asn1_bio_set_ex(b, 151, suffix, suffix_free); Executed by:
executed 45 times by 1 test: return asn1_bio_set_ex(b, 151, suffix, suffix_free); Executed by:
| 45 | ||||||||||||
447 | } | - | ||||||||||||
448 | - | |||||||||||||
449 | int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, | - | ||||||||||||
450 | asn1_ps_func **psuffix_free) | - | ||||||||||||
451 | { | - | ||||||||||||
452 | return never executed: asn1_bio_get_ex(b, 152, psuffix, psuffix_free);return asn1_bio_get_ex(b, 152, psuffix, psuffix_free); never executed: return asn1_bio_get_ex(b, 152, psuffix, psuffix_free); | 0 | ||||||||||||
453 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |