Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/bio_b64.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||||||||
3 | static int b64_write(BIO *h, const char *buf, int num); | - | ||||||||||||||||||||||||||||||||||||
4 | static int b64_read(BIO *h, char *buf, int size); | - | ||||||||||||||||||||||||||||||||||||
5 | static int b64_puts(BIO *h, const char *str); | - | ||||||||||||||||||||||||||||||||||||
6 | static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2); | - | ||||||||||||||||||||||||||||||||||||
7 | static int b64_new(BIO *h); | - | ||||||||||||||||||||||||||||||||||||
8 | static int b64_free(BIO *data); | - | ||||||||||||||||||||||||||||||||||||
9 | static long b64_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp); | - | ||||||||||||||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||||||||||||||
16 | typedef struct b64_struct { | - | ||||||||||||||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||||||||||||||
19 | - | |||||||||||||||||||||||||||||||||||||
20 | int buf_len; | - | ||||||||||||||||||||||||||||||||||||
21 | int buf_off; | - | ||||||||||||||||||||||||||||||||||||
22 | int tmp_len; | - | ||||||||||||||||||||||||||||||||||||
23 | int tmp_nl; | - | ||||||||||||||||||||||||||||||||||||
24 | int encode; | - | ||||||||||||||||||||||||||||||||||||
25 | int start; | - | ||||||||||||||||||||||||||||||||||||
26 | int cont; | - | ||||||||||||||||||||||||||||||||||||
27 | EVP_ENCODE_CTX *base64; | - | ||||||||||||||||||||||||||||||||||||
28 | char buf[((((1024)+2)/3*4)+((1024)/48+1)*2+80) + 10]; | - | ||||||||||||||||||||||||||||||||||||
29 | char tmp[1024]; | - | ||||||||||||||||||||||||||||||||||||
30 | } BIO_B64_CTX; | - | ||||||||||||||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||||||||||||||
32 | static const BIO_METHOD methods_b64 = { | - | ||||||||||||||||||||||||||||||||||||
33 | (11|0x0200), | - | ||||||||||||||||||||||||||||||||||||
34 | "base64 encoding", | - | ||||||||||||||||||||||||||||||||||||
35 | - | |||||||||||||||||||||||||||||||||||||
36 | bwrite_conv, | - | ||||||||||||||||||||||||||||||||||||
37 | b64_write, | - | ||||||||||||||||||||||||||||||||||||
38 | - | |||||||||||||||||||||||||||||||||||||
39 | bread_conv, | - | ||||||||||||||||||||||||||||||||||||
40 | b64_read, | - | ||||||||||||||||||||||||||||||||||||
41 | b64_puts, | - | ||||||||||||||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||||||||||||||
43 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
44 | , | - | ||||||||||||||||||||||||||||||||||||
45 | b64_ctrl, | - | ||||||||||||||||||||||||||||||||||||
46 | b64_new, | - | ||||||||||||||||||||||||||||||||||||
47 | b64_free, | - | ||||||||||||||||||||||||||||||||||||
48 | b64_callback_ctrl, | - | ||||||||||||||||||||||||||||||||||||
49 | }; | - | ||||||||||||||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||||||||||||||
52 | const BIO_METHOD *BIO_f_base64(void) | - | ||||||||||||||||||||||||||||||||||||
53 | { | - | ||||||||||||||||||||||||||||||||||||
54 | return executed 302 times by 1 test: &methods_b64;return &methods_b64; Executed by:
executed 302 times by 1 test: return &methods_b64; Executed by:
| 302 | ||||||||||||||||||||||||||||||||||||
55 | } | - | ||||||||||||||||||||||||||||||||||||
56 | - | |||||||||||||||||||||||||||||||||||||
57 | static int b64_new(BIO *bi) | - | ||||||||||||||||||||||||||||||||||||
58 | { | - | ||||||||||||||||||||||||||||||||||||
59 | BIO_B64_CTX *ctx; | - | ||||||||||||||||||||||||||||||||||||
60 | - | |||||||||||||||||||||||||||||||||||||
61 | if ((
| 0-302 | ||||||||||||||||||||||||||||||||||||
62 | ((void *)0)
| 0-302 | ||||||||||||||||||||||||||||||||||||
63 | ) { | - | ||||||||||||||||||||||||||||||||||||
64 | ERR_put_error(6,(198),((1|64)),__FILE__,74); | - | ||||||||||||||||||||||||||||||||||||
65 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
66 | } | - | ||||||||||||||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||||||||||||||
68 | ctx->cont = 1; | - | ||||||||||||||||||||||||||||||||||||
69 | ctx->start = 1; | - | ||||||||||||||||||||||||||||||||||||
70 | ctx->base64 = EVP_ENCODE_CTX_new(); | - | ||||||||||||||||||||||||||||||||||||
71 | if (ctx->base64 ==
| 0-302 | ||||||||||||||||||||||||||||||||||||
72 | ((void *)0)
| 0-302 | ||||||||||||||||||||||||||||||||||||
73 | ) { | - | ||||||||||||||||||||||||||||||||||||
74 | CRYPTO_free(ctx, __FILE__, 82); | - | ||||||||||||||||||||||||||||||||||||
75 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
76 | } | - | ||||||||||||||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||||||||||||||
78 | BIO_set_data(bi, ctx); | - | ||||||||||||||||||||||||||||||||||||
79 | BIO_set_init(bi, 1); | - | ||||||||||||||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||||||||||||||
81 | return executed 302 times by 1 test: 1;return 1; Executed by:
executed 302 times by 1 test: return 1; Executed by:
| 302 | ||||||||||||||||||||||||||||||||||||
82 | } | - | ||||||||||||||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||||||||||||||
84 | static int b64_free(BIO *a) | - | ||||||||||||||||||||||||||||||||||||
85 | { | - | ||||||||||||||||||||||||||||||||||||
86 | BIO_B64_CTX *ctx; | - | ||||||||||||||||||||||||||||||||||||
87 | if (a ==
| 0-302 | ||||||||||||||||||||||||||||||||||||
88 | ((void *)0)
| 0-302 | ||||||||||||||||||||||||||||||||||||
89 | ) | - | ||||||||||||||||||||||||||||||||||||
90 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||||||||||||||
92 | ctx = BIO_get_data(a); | - | ||||||||||||||||||||||||||||||||||||
93 | if (ctx ==
| 0-302 | ||||||||||||||||||||||||||||||||||||
94 | ((void *)0)
| 0-302 | ||||||||||||||||||||||||||||||||||||
95 | ) | - | ||||||||||||||||||||||||||||||||||||
96 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
97 | - | |||||||||||||||||||||||||||||||||||||
98 | EVP_ENCODE_CTX_free(ctx->base64); | - | ||||||||||||||||||||||||||||||||||||
99 | CRYPTO_free(ctx, __FILE__, 103); | - | ||||||||||||||||||||||||||||||||||||
100 | BIO_set_data(a, | - | ||||||||||||||||||||||||||||||||||||
101 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
102 | ); | - | ||||||||||||||||||||||||||||||||||||
103 | BIO_set_init(a, 0); | - | ||||||||||||||||||||||||||||||||||||
104 | - | |||||||||||||||||||||||||||||||||||||
105 | return executed 302 times by 1 test: 1;return 1; Executed by:
executed 302 times by 1 test: return 1; Executed by:
| 302 | ||||||||||||||||||||||||||||||||||||
106 | } | - | ||||||||||||||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||||||||||||||
108 | static int b64_read(BIO *b, char *out, int outl) | - | ||||||||||||||||||||||||||||||||||||
109 | { | - | ||||||||||||||||||||||||||||||||||||
110 | int ret = 0, i, ii, j, k, x, n, num, ret_code = 0; | - | ||||||||||||||||||||||||||||||||||||
111 | BIO_B64_CTX *ctx; | - | ||||||||||||||||||||||||||||||||||||
112 | unsigned char *p, *q; | - | ||||||||||||||||||||||||||||||||||||
113 | BIO *next; | - | ||||||||||||||||||||||||||||||||||||
114 | - | |||||||||||||||||||||||||||||||||||||
115 | if (out ==
| 0-2129 | ||||||||||||||||||||||||||||||||||||
116 | ((void *)0)
| 0-2129 | ||||||||||||||||||||||||||||||||||||
117 | ) | - | ||||||||||||||||||||||||||||||||||||
118 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
119 | ctx = (BIO_B64_CTX *)BIO_get_data(b); | - | ||||||||||||||||||||||||||||||||||||
120 | - | |||||||||||||||||||||||||||||||||||||
121 | next = BIO_next(b); | - | ||||||||||||||||||||||||||||||||||||
122 | if ((
| 0-2129 | ||||||||||||||||||||||||||||||||||||
123 | ((void *)0)
| 0-2129 | ||||||||||||||||||||||||||||||||||||
124 | )
| 0-2129 | ||||||||||||||||||||||||||||||||||||
125 | ((void *)0)
| 0-2129 | ||||||||||||||||||||||||||||||||||||
126 | )
| 0-2129 | ||||||||||||||||||||||||||||||||||||
127 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
128 | - | |||||||||||||||||||||||||||||||||||||
129 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||||||||||||||
130 | - | |||||||||||||||||||||||||||||||||||||
131 | if (ctx->encode != 2
| 174-1955 | ||||||||||||||||||||||||||||||||||||
132 | ctx->encode = 2; | - | ||||||||||||||||||||||||||||||||||||
133 | ctx->buf_len = 0; | - | ||||||||||||||||||||||||||||||||||||
134 | ctx->buf_off = 0; | - | ||||||||||||||||||||||||||||||||||||
135 | ctx->tmp_len = 0; | - | ||||||||||||||||||||||||||||||||||||
136 | EVP_DecodeInit(ctx->base64); | - | ||||||||||||||||||||||||||||||||||||
137 | } executed 174 times by 1 test: end of block Executed by:
| 174 | ||||||||||||||||||||||||||||||||||||
138 | - | |||||||||||||||||||||||||||||||||||||
139 | - | |||||||||||||||||||||||||||||||||||||
140 | if (ctx->buf_len > 0
| 383-1746 | ||||||||||||||||||||||||||||||||||||
141 | (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 137), 1)); | - | ||||||||||||||||||||||||||||||||||||
142 | i = ctx->buf_len - ctx->buf_off; | - | ||||||||||||||||||||||||||||||||||||
143 | if (i > outl
| 308-1438 | ||||||||||||||||||||||||||||||||||||
144 | i = outl; executed 1438 times by 1 test: i = outl; Executed by:
| 1438 | ||||||||||||||||||||||||||||||||||||
145 | (void)((ctx->buf_off + i < (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_off + i < (int)sizeof(ctx->buf)", __FILE__, 141), 1)); | - | ||||||||||||||||||||||||||||||||||||
146 | memcpy(out, &(ctx->buf[ctx->buf_off]), i); | - | ||||||||||||||||||||||||||||||||||||
147 | ret = i; | - | ||||||||||||||||||||||||||||||||||||
148 | out += i; | - | ||||||||||||||||||||||||||||||||||||
149 | outl -= i; | - | ||||||||||||||||||||||||||||||||||||
150 | ctx->buf_off += i; | - | ||||||||||||||||||||||||||||||||||||
151 | if (ctx->buf_len == ctx->buf_off
| 308-1438 | ||||||||||||||||||||||||||||||||||||
152 | ctx->buf_len = 0; | - | ||||||||||||||||||||||||||||||||||||
153 | ctx->buf_off = 0; | - | ||||||||||||||||||||||||||||||||||||
154 | } executed 308 times by 1 test: end of block Executed by:
| 308 | ||||||||||||||||||||||||||||||||||||
155 | } executed 1746 times by 1 test: end of block Executed by:
| 1746 | ||||||||||||||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||||||||||||||
157 | - | |||||||||||||||||||||||||||||||||||||
158 | - | |||||||||||||||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||||||||||||||
160 | - | |||||||||||||||||||||||||||||||||||||
161 | - | |||||||||||||||||||||||||||||||||||||
162 | ret_code = 0; | - | ||||||||||||||||||||||||||||||||||||
163 | while (outl > 0
| 961-1777 | ||||||||||||||||||||||||||||||||||||
164 | if (ctx->cont <= 0
| 282-679 | ||||||||||||||||||||||||||||||||||||
165 | break; executed 282 times by 1 test: break; Executed by:
| 282 | ||||||||||||||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||||||||||||||
167 | i = BIO_read(next, &(ctx->tmp[ctx->tmp_len]), | - | ||||||||||||||||||||||||||||||||||||
168 | 1024 - ctx->tmp_len); | - | ||||||||||||||||||||||||||||||||||||
169 | - | |||||||||||||||||||||||||||||||||||||
170 | if (i <= 0
| 211-468 | ||||||||||||||||||||||||||||||||||||
171 | ret_code = i; | - | ||||||||||||||||||||||||||||||||||||
172 | - | |||||||||||||||||||||||||||||||||||||
173 | - | |||||||||||||||||||||||||||||||||||||
174 | if (!BIO_test_flags(next, 0x08)
| 0-211 | ||||||||||||||||||||||||||||||||||||
175 | ctx->cont = i; | - | ||||||||||||||||||||||||||||||||||||
176 | - | |||||||||||||||||||||||||||||||||||||
177 | if (ctx->tmp_len == 0
| 70-141 | ||||||||||||||||||||||||||||||||||||
178 | break; executed 70 times by 1 test: break; Executed by:
| 70 | ||||||||||||||||||||||||||||||||||||
179 | - | |||||||||||||||||||||||||||||||||||||
180 | else | - | ||||||||||||||||||||||||||||||||||||
181 | i = 0; executed 141 times by 1 test: i = 0; Executed by:
| 141 | ||||||||||||||||||||||||||||||||||||
182 | } | - | ||||||||||||||||||||||||||||||||||||
183 | - | |||||||||||||||||||||||||||||||||||||
184 | else | - | ||||||||||||||||||||||||||||||||||||
185 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
186 | } | - | ||||||||||||||||||||||||||||||||||||
187 | i += ctx->tmp_len; | - | ||||||||||||||||||||||||||||||||||||
188 | ctx->tmp_len = i; | - | ||||||||||||||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||||||||||||||
190 | - | |||||||||||||||||||||||||||||||||||||
191 | - | |||||||||||||||||||||||||||||||||||||
192 | - | |||||||||||||||||||||||||||||||||||||
193 | - | |||||||||||||||||||||||||||||||||||||
194 | if (ctx->start
| 0-435 | ||||||||||||||||||||||||||||||||||||
195 | - | |||||||||||||||||||||||||||||||||||||
196 | ctx->tmp_len = 0; | - | ||||||||||||||||||||||||||||||||||||
197 | } never executed: else if (ctx->startend of block
| 0-435 | ||||||||||||||||||||||||||||||||||||
198 | q = p = (unsigned char *)ctx->tmp; | - | ||||||||||||||||||||||||||||||||||||
199 | num = 0; | - | ||||||||||||||||||||||||||||||||||||
200 | for (j = 0; j < i
| 0-11316 | ||||||||||||||||||||||||||||||||||||
201 | if (*(
| 174-11142 | ||||||||||||||||||||||||||||||||||||
202 | continue; executed 11142 times by 1 test: continue; Executed by:
| 11142 | ||||||||||||||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||||||||||||||
204 | - | |||||||||||||||||||||||||||||||||||||
205 | - | |||||||||||||||||||||||||||||||||||||
206 | - | |||||||||||||||||||||||||||||||||||||
207 | - | |||||||||||||||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||||||||||||||
209 | if (ctx->tmp_nl
| 0-174 | ||||||||||||||||||||||||||||||||||||
210 | p = q; | - | ||||||||||||||||||||||||||||||||||||
211 | ctx->tmp_nl = 0; | - | ||||||||||||||||||||||||||||||||||||
212 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||
213 | } | - | ||||||||||||||||||||||||||||||||||||
214 | - | |||||||||||||||||||||||||||||||||||||
215 | k = EVP_DecodeUpdate(ctx->base64, | - | ||||||||||||||||||||||||||||||||||||
216 | (unsigned char *)ctx->buf, | - | ||||||||||||||||||||||||||||||||||||
217 | &num, p, q - p); | - | ||||||||||||||||||||||||||||||||||||
218 | if ((
| 0-174 | ||||||||||||||||||||||||||||||||||||
219 | EVP_DecodeInit(ctx->base64); never executed: EVP_DecodeInit(ctx->base64); | 0 | ||||||||||||||||||||||||||||||||||||
220 | else { | - | ||||||||||||||||||||||||||||||||||||
221 | if (p != (unsigned char *)
| 0-174 | ||||||||||||||||||||||||||||||||||||
222 | &(ctx->tmp[0])
| 0-174 | ||||||||||||||||||||||||||||||||||||
223 | i -= (p - (unsigned char *) | - | ||||||||||||||||||||||||||||||||||||
224 | &(ctx->tmp[0])); | - | ||||||||||||||||||||||||||||||||||||
225 | for (x = 0; x < i
| 0 | ||||||||||||||||||||||||||||||||||||
226 | ctx->tmp[x] = p[x]; never executed: ctx->tmp[x] = p[x]; | 0 | ||||||||||||||||||||||||||||||||||||
227 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
228 | EVP_DecodeInit(ctx->base64); | - | ||||||||||||||||||||||||||||||||||||
229 | ctx->start = 0; | - | ||||||||||||||||||||||||||||||||||||
230 | break; executed 174 times by 1 test: break; Executed by:
| 174 | ||||||||||||||||||||||||||||||||||||
231 | } | - | ||||||||||||||||||||||||||||||||||||
232 | p = q; | - | ||||||||||||||||||||||||||||||||||||
233 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||||||||||||||
236 | if ((
| 0-174 | ||||||||||||||||||||||||||||||||||||
237 | - | |||||||||||||||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||||||||||||||
239 | - | |||||||||||||||||||||||||||||||||||||
240 | - | |||||||||||||||||||||||||||||||||||||
241 | if (p == (unsigned char *)&(ctx->tmp[0])
| 0 | ||||||||||||||||||||||||||||||||||||
242 | - | |||||||||||||||||||||||||||||||||||||
243 | if (i == 1024
| 0 | ||||||||||||||||||||||||||||||||||||
244 | ctx->tmp_nl = 1; | - | ||||||||||||||||||||||||||||||||||||
245 | ctx->tmp_len = 0; | - | ||||||||||||||||||||||||||||||||||||
246 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
247 | } never executed: else if (p != qend of block
| 0 | ||||||||||||||||||||||||||||||||||||
248 | n = q - p; | - | ||||||||||||||||||||||||||||||||||||
249 | for (ii = 0; ii < n
| 0 | ||||||||||||||||||||||||||||||||||||
250 | ctx->tmp[ii] = p[ii]; never executed: ctx->tmp[ii] = p[ii]; | 0 | ||||||||||||||||||||||||||||||||||||
251 | ctx->tmp_len = n; | - | ||||||||||||||||||||||||||||||||||||
252 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||||||||||||||
254 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||
255 | } else { | - | ||||||||||||||||||||||||||||||||||||
256 | ctx->tmp_len = 0; | - | ||||||||||||||||||||||||||||||||||||
257 | } executed 174 times by 1 test: end of block Executed by:
| 174 | ||||||||||||||||||||||||||||||||||||
258 | } else if ((
| 141-282 | ||||||||||||||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||||||||||||||
262 | - | |||||||||||||||||||||||||||||||||||||
263 | continue; executed 141 times by 1 test: continue; Executed by:
| 141 | ||||||||||||||||||||||||||||||||||||
264 | } | - | ||||||||||||||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||||||||||||||
266 | if (BIO_test_flags(b, ~(0x0)) & 0x100
| 0-468 | ||||||||||||||||||||||||||||||||||||
267 | int z, jj; | - | ||||||||||||||||||||||||||||||||||||
268 | - | |||||||||||||||||||||||||||||||||||||
269 | jj = i & ~3; | - | ||||||||||||||||||||||||||||||||||||
270 | z = EVP_DecodeBlock((unsigned char *)ctx->buf, | - | ||||||||||||||||||||||||||||||||||||
271 | (unsigned char *)ctx->tmp, jj); | - | ||||||||||||||||||||||||||||||||||||
272 | if (jj > 2
| 0 | ||||||||||||||||||||||||||||||||||||
273 | if (ctx->tmp[jj - 1] == '='
| 0 | ||||||||||||||||||||||||||||||||||||
274 | z--; | - | ||||||||||||||||||||||||||||||||||||
275 | if (ctx->tmp[jj - 2] == '='
| 0 | ||||||||||||||||||||||||||||||||||||
276 | z--; never executed: z--; | 0 | ||||||||||||||||||||||||||||||||||||
277 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
278 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
279 | - | |||||||||||||||||||||||||||||||||||||
280 | - | |||||||||||||||||||||||||||||||||||||
281 | - | |||||||||||||||||||||||||||||||||||||
282 | if (jj != i
| 0 | ||||||||||||||||||||||||||||||||||||
283 | memmove(ctx->tmp, &ctx->tmp[jj], i - jj); | - | ||||||||||||||||||||||||||||||||||||
284 | ctx->tmp_len = i - jj; | - | ||||||||||||||||||||||||||||||||||||
285 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
286 | ctx->buf_len = 0; | - | ||||||||||||||||||||||||||||||||||||
287 | if (z > 0
| 0 | ||||||||||||||||||||||||||||||||||||
288 | ctx->buf_len = z; | - | ||||||||||||||||||||||||||||||||||||
289 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
290 | i = z; | - | ||||||||||||||||||||||||||||||||||||
291 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
292 | i = EVP_DecodeUpdate(ctx->base64, | - | ||||||||||||||||||||||||||||||||||||
293 | (unsigned char *)ctx->buf, &ctx->buf_len, | - | ||||||||||||||||||||||||||||||||||||
294 | (unsigned char *)ctx->tmp, i); | - | ||||||||||||||||||||||||||||||||||||
295 | ctx->tmp_len = 0; | - | ||||||||||||||||||||||||||||||||||||
296 | } executed 468 times by 1 test: end of block Executed by:
| 468 | ||||||||||||||||||||||||||||||||||||
297 | - | |||||||||||||||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||||||||||||||
299 | - | |||||||||||||||||||||||||||||||||||||
300 | - | |||||||||||||||||||||||||||||||||||||
301 | - | |||||||||||||||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||||||||||||||
303 | ctx->cont = i; | - | ||||||||||||||||||||||||||||||||||||
304 | - | |||||||||||||||||||||||||||||||||||||
305 | ctx->buf_off = 0; | - | ||||||||||||||||||||||||||||||||||||
306 | if (i < 0
| 0-468 | ||||||||||||||||||||||||||||||||||||
307 | ret_code = 0; | - | ||||||||||||||||||||||||||||||||||||
308 | ctx->buf_len = 0; | - | ||||||||||||||||||||||||||||||||||||
309 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
310 | } | - | ||||||||||||||||||||||||||||||||||||
311 | - | |||||||||||||||||||||||||||||||||||||
312 | if (ctx->buf_len <= outl
| 160-308 | ||||||||||||||||||||||||||||||||||||
313 | i = ctx->buf_len; executed 160 times by 1 test: i = ctx->buf_len; Executed by:
| 160 | ||||||||||||||||||||||||||||||||||||
314 | else | - | ||||||||||||||||||||||||||||||||||||
315 | i = outl; executed 308 times by 1 test: i = outl; Executed by:
| 308 | ||||||||||||||||||||||||||||||||||||
316 | - | |||||||||||||||||||||||||||||||||||||
317 | memcpy(out, ctx->buf, i); | - | ||||||||||||||||||||||||||||||||||||
318 | ret += i; | - | ||||||||||||||||||||||||||||||||||||
319 | ctx->buf_off = i; | - | ||||||||||||||||||||||||||||||||||||
320 | if (ctx->buf_off == ctx->buf_len
| 160-308 | ||||||||||||||||||||||||||||||||||||
321 | ctx->buf_len = 0; | - | ||||||||||||||||||||||||||||||||||||
322 | ctx->buf_off = 0; | - | ||||||||||||||||||||||||||||||||||||
323 | } executed 160 times by 1 test: end of block Executed by:
| 160 | ||||||||||||||||||||||||||||||||||||
324 | outl -= i; | - | ||||||||||||||||||||||||||||||||||||
325 | out += i; | - | ||||||||||||||||||||||||||||||||||||
326 | } executed 468 times by 1 test: end of block Executed by:
| 468 | ||||||||||||||||||||||||||||||||||||
327 | - | |||||||||||||||||||||||||||||||||||||
328 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||||||||||||||
329 | return executed 2129 times by 1 test: ((return ((ret == 0) ? ret_code : ret); Executed by:
executed 2129 times by 1 test: return ((ret == 0) ? ret_code : ret); Executed by:
| 209-2129 | ||||||||||||||||||||||||||||||||||||
330 | } | - | ||||||||||||||||||||||||||||||||||||
331 | - | |||||||||||||||||||||||||||||||||||||
332 | static int b64_write(BIO *b, const char *in, int inl) | - | ||||||||||||||||||||||||||||||||||||
333 | { | - | ||||||||||||||||||||||||||||||||||||
334 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||
335 | int n; | - | ||||||||||||||||||||||||||||||||||||
336 | int i; | - | ||||||||||||||||||||||||||||||||||||
337 | BIO_B64_CTX *ctx; | - | ||||||||||||||||||||||||||||||||||||
338 | BIO *next; | - | ||||||||||||||||||||||||||||||||||||
339 | - | |||||||||||||||||||||||||||||||||||||
340 | ctx = (BIO_B64_CTX *)BIO_get_data(b); | - | ||||||||||||||||||||||||||||||||||||
341 | next = BIO_next(b); | - | ||||||||||||||||||||||||||||||||||||
342 | if ((
| 0-2209 | ||||||||||||||||||||||||||||||||||||
343 | ((void *)0)
| 0-2209 | ||||||||||||||||||||||||||||||||||||
344 | )
| 0-2209 | ||||||||||||||||||||||||||||||||||||
345 | ((void *)0)
| 0-2209 | ||||||||||||||||||||||||||||||||||||
346 | )
| 0-2209 | ||||||||||||||||||||||||||||||||||||
347 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||||||||||||||
349 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||||||||||||||
350 | - | |||||||||||||||||||||||||||||||||||||
351 | if (ctx->encode != 1
| 128-2081 | ||||||||||||||||||||||||||||||||||||
352 | ctx->encode = 1; | - | ||||||||||||||||||||||||||||||||||||
353 | ctx->buf_len = 0; | - | ||||||||||||||||||||||||||||||||||||
354 | ctx->buf_off = 0; | - | ||||||||||||||||||||||||||||||||||||
355 | ctx->tmp_len = 0; | - | ||||||||||||||||||||||||||||||||||||
356 | EVP_EncodeInit(ctx->base64); | - | ||||||||||||||||||||||||||||||||||||
357 | } executed 128 times by 1 test: end of block Executed by:
| 128 | ||||||||||||||||||||||||||||||||||||
358 | - | |||||||||||||||||||||||||||||||||||||
359 | (void)((ctx->buf_off < (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_off < (int)sizeof(ctx->buf)", __FILE__, 351), 1)); | - | ||||||||||||||||||||||||||||||||||||
360 | (void)((ctx->buf_len <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len <= (int)sizeof(ctx->buf)", __FILE__, 352), 1)); | - | ||||||||||||||||||||||||||||||||||||
361 | (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 353), 1)); | - | ||||||||||||||||||||||||||||||||||||
362 | n = ctx->buf_len - ctx->buf_off; | - | ||||||||||||||||||||||||||||||||||||
363 | while (n > 0
| 126-2209 | ||||||||||||||||||||||||||||||||||||
364 | i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n); | - | ||||||||||||||||||||||||||||||||||||
365 | if (i <= 0
| 0-126 | ||||||||||||||||||||||||||||||||||||
366 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||||||||||||||
367 | return never executed: i;return i; never executed: return i; | 0 | ||||||||||||||||||||||||||||||||||||
368 | } | - | ||||||||||||||||||||||||||||||||||||
369 | (void)((i <= n) ? 0 : (OPENSSL_die("assertion failed: " "i <= n", __FILE__, 361), 1)); | - | ||||||||||||||||||||||||||||||||||||
370 | ctx->buf_off += i; | - | ||||||||||||||||||||||||||||||||||||
371 | (void)((ctx->buf_off <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_off <= (int)sizeof(ctx->buf)", __FILE__, 363), 1)); | - | ||||||||||||||||||||||||||||||||||||
372 | (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 364), 1)); | - | ||||||||||||||||||||||||||||||||||||
373 | n -= i; | - | ||||||||||||||||||||||||||||||||||||
374 | } executed 126 times by 1 test: end of block Executed by:
| 126 | ||||||||||||||||||||||||||||||||||||
375 | - | |||||||||||||||||||||||||||||||||||||
376 | ctx->buf_off = 0; | - | ||||||||||||||||||||||||||||||||||||
377 | ctx->buf_len = 0; | - | ||||||||||||||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||||||||||||||
379 | if ((
| 126-2083 | ||||||||||||||||||||||||||||||||||||
380 | ((void *)0)
| 126-2083 | ||||||||||||||||||||||||||||||||||||
381 | )
| 0-2083 | ||||||||||||||||||||||||||||||||||||
382 | return executed 126 times by 1 test: 0;return 0; Executed by:
executed 126 times by 1 test: return 0; Executed by:
| 126 | ||||||||||||||||||||||||||||||||||||
383 | - | |||||||||||||||||||||||||||||||||||||
384 | while (inl > 0
| 2083-2148 | ||||||||||||||||||||||||||||||||||||
385 | n = (
| 65-2083 | ||||||||||||||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||||||||||||||
387 | if (BIO_test_flags(b, ~(0x0)) & 0x100
| 0-2148 | ||||||||||||||||||||||||||||||||||||
388 | if (ctx->tmp_len > 0
| 0 | ||||||||||||||||||||||||||||||||||||
389 | (void)((ctx->tmp_len <= 3) ? 0 : (OPENSSL_die("assertion failed: " "ctx->tmp_len <= 3", __FILE__, 379), 1)); | - | ||||||||||||||||||||||||||||||||||||
390 | n = 3 - ctx->tmp_len; | - | ||||||||||||||||||||||||||||||||||||
391 | - | |||||||||||||||||||||||||||||||||||||
392 | - | |||||||||||||||||||||||||||||||||||||
393 | - | |||||||||||||||||||||||||||||||||||||
394 | if (n > inl
| 0 | ||||||||||||||||||||||||||||||||||||
395 | n = inl; never executed: n = inl; | 0 | ||||||||||||||||||||||||||||||||||||
396 | memcpy(&(ctx->tmp[ctx->tmp_len]), in, n); | - | ||||||||||||||||||||||||||||||||||||
397 | ctx->tmp_len += n; | - | ||||||||||||||||||||||||||||||||||||
398 | ret += n; | - | ||||||||||||||||||||||||||||||||||||
399 | if (ctx->tmp_len < 3
| 0 | ||||||||||||||||||||||||||||||||||||
400 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
401 | ctx->buf_len = | - | ||||||||||||||||||||||||||||||||||||
402 | EVP_EncodeBlock((unsigned char *)ctx->buf, | - | ||||||||||||||||||||||||||||||||||||
403 | (unsigned char *)ctx->tmp, ctx->tmp_len); | - | ||||||||||||||||||||||||||||||||||||
404 | (void)((ctx->buf_len <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len <= (int)sizeof(ctx->buf)", __FILE__, 394), 1)); | - | ||||||||||||||||||||||||||||||||||||
405 | (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 395), 1)); | - | ||||||||||||||||||||||||||||||||||||
406 | - | |||||||||||||||||||||||||||||||||||||
407 | - | |||||||||||||||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||||||||||||||
409 | - | |||||||||||||||||||||||||||||||||||||
410 | ctx->tmp_len = 0; | - | ||||||||||||||||||||||||||||||||||||
411 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
412 | if (n < 3
| 0 | ||||||||||||||||||||||||||||||||||||
413 | memcpy(ctx->tmp, in, n); | - | ||||||||||||||||||||||||||||||||||||
414 | ctx->tmp_len = n; | - | ||||||||||||||||||||||||||||||||||||
415 | ret += n; | - | ||||||||||||||||||||||||||||||||||||
416 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
417 | } | - | ||||||||||||||||||||||||||||||||||||
418 | n -= n % 3; | - | ||||||||||||||||||||||||||||||||||||
419 | ctx->buf_len = | - | ||||||||||||||||||||||||||||||||||||
420 | EVP_EncodeBlock((unsigned char *)ctx->buf, | - | ||||||||||||||||||||||||||||||||||||
421 | (const unsigned char *)in, n); | - | ||||||||||||||||||||||||||||||||||||
422 | (void)((ctx->buf_len <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len <= (int)sizeof(ctx->buf)", __FILE__, 412), 1)); | - | ||||||||||||||||||||||||||||||||||||
423 | (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 413), 1)); | - | ||||||||||||||||||||||||||||||||||||
424 | ret += n; | - | ||||||||||||||||||||||||||||||||||||
425 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
426 | } else { | - | ||||||||||||||||||||||||||||||||||||
427 | if (!EVP_EncodeUpdate(ctx->base64,
| 0-2148 | ||||||||||||||||||||||||||||||||||||
428 | (unsigned char *)ctx->buf, &ctx->buf_len,
| 0-2148 | ||||||||||||||||||||||||||||||||||||
429 | (unsigned char *)in, n)
| 0-2148 | ||||||||||||||||||||||||||||||||||||
430 | return never executed: ((return ((ret == 0) ? -1 : ret);
never executed: return ((ret == 0) ? -1 : ret); | 0 | ||||||||||||||||||||||||||||||||||||
431 | (void)((ctx->buf_len <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len <= (int)sizeof(ctx->buf)", __FILE__, 421), 1)); | - | ||||||||||||||||||||||||||||||||||||
432 | (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 422), 1)); | - | ||||||||||||||||||||||||||||||||||||
433 | ret += n; | - | ||||||||||||||||||||||||||||||||||||
434 | } executed 2148 times by 1 test: end of block Executed by:
| 2148 | ||||||||||||||||||||||||||||||||||||
435 | inl -= n; | - | ||||||||||||||||||||||||||||||||||||
436 | in += n; | - | ||||||||||||||||||||||||||||||||||||
437 | - | |||||||||||||||||||||||||||||||||||||
438 | ctx->buf_off = 0; | - | ||||||||||||||||||||||||||||||||||||
439 | n = ctx->buf_len; | - | ||||||||||||||||||||||||||||||||||||
440 | while (n > 0
| 1776-2148 | ||||||||||||||||||||||||||||||||||||
441 | i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n); | - | ||||||||||||||||||||||||||||||||||||
442 | if (i <= 0
| 0-1776 | ||||||||||||||||||||||||||||||||||||
443 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||||||||||||||
444 | return never executed: ((return ((ret == 0) ? i : ret);
never executed: return ((ret == 0) ? i : ret); | 0 | ||||||||||||||||||||||||||||||||||||
445 | } | - | ||||||||||||||||||||||||||||||||||||
446 | (void)((i <= n) ? 0 : (OPENSSL_die("assertion failed: " "i <= n", __FILE__, 436), 1)); | - | ||||||||||||||||||||||||||||||||||||
447 | n -= i; | - | ||||||||||||||||||||||||||||||||||||
448 | ctx->buf_off += i; | - | ||||||||||||||||||||||||||||||||||||
449 | (void)((ctx->buf_off <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_off <= (int)sizeof(ctx->buf)", __FILE__, 439), 1)); | - | ||||||||||||||||||||||||||||||||||||
450 | (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 440), 1)); | - | ||||||||||||||||||||||||||||||||||||
451 | } executed 1776 times by 1 test: end of block Executed by:
| 1776 | ||||||||||||||||||||||||||||||||||||
452 | ctx->buf_len = 0; | - | ||||||||||||||||||||||||||||||||||||
453 | ctx->buf_off = 0; | - | ||||||||||||||||||||||||||||||||||||
454 | } executed 2148 times by 1 test: end of block Executed by:
| 2148 | ||||||||||||||||||||||||||||||||||||
455 | return executed 2083 times by 1 test: ret;return ret; Executed by:
executed 2083 times by 1 test: return ret; Executed by:
| 2083 | ||||||||||||||||||||||||||||||||||||
456 | } | - | ||||||||||||||||||||||||||||||||||||
457 | - | |||||||||||||||||||||||||||||||||||||
458 | static long b64_ctrl(BIO *b, int cmd, long num, void *ptr) | - | ||||||||||||||||||||||||||||||||||||
459 | { | - | ||||||||||||||||||||||||||||||||||||
460 | BIO_B64_CTX *ctx; | - | ||||||||||||||||||||||||||||||||||||
461 | long ret = 1; | - | ||||||||||||||||||||||||||||||||||||
462 | int i; | - | ||||||||||||||||||||||||||||||||||||
463 | BIO *next; | - | ||||||||||||||||||||||||||||||||||||
464 | - | |||||||||||||||||||||||||||||||||||||
465 | ctx = (BIO_B64_CTX *)BIO_get_data(b); | - | ||||||||||||||||||||||||||||||||||||
466 | next = BIO_next(b); | - | ||||||||||||||||||||||||||||||||||||
467 | if ((
| 0-878 | ||||||||||||||||||||||||||||||||||||
468 | ((void *)0)
| 0-878 | ||||||||||||||||||||||||||||||||||||
469 | )
| 0-878 | ||||||||||||||||||||||||||||||||||||
470 | ((void *)0)
| 0-878 | ||||||||||||||||||||||||||||||||||||
471 | )
| 0-878 | ||||||||||||||||||||||||||||||||||||
472 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
473 | - | |||||||||||||||||||||||||||||||||||||
474 | switch (cmd) { | - | ||||||||||||||||||||||||||||||||||||
475 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||||||||||||||||||||
476 | ctx->cont = 1; | - | ||||||||||||||||||||||||||||||||||||
477 | ctx->start = 1; | - | ||||||||||||||||||||||||||||||||||||
478 | ctx->encode = 0; | - | ||||||||||||||||||||||||||||||||||||
479 | ret = BIO_ctrl(next, cmd, num, ptr); | - | ||||||||||||||||||||||||||||||||||||
480 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
481 | case never executed: 2:case 2: never executed: case 2: | 0 | ||||||||||||||||||||||||||||||||||||
482 | if (ctx->cont <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
483 | ret = 1; never executed: ret = 1; | 0 | ||||||||||||||||||||||||||||||||||||
484 | else | - | ||||||||||||||||||||||||||||||||||||
485 | ret = BIO_ctrl(next, cmd, num, ptr); never executed: ret = BIO_ctrl(next, cmd, num, ptr); | 0 | ||||||||||||||||||||||||||||||||||||
486 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
487 | case never executed: 13:case 13: never executed: case 13: | 0 | ||||||||||||||||||||||||||||||||||||
488 | (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 474), 1)); | - | ||||||||||||||||||||||||||||||||||||
489 | ret = ctx->buf_len - ctx->buf_off; | - | ||||||||||||||||||||||||||||||||||||
490 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||
491 | && (
| 0 | ||||||||||||||||||||||||||||||||||||
492 | ret = 1; never executed: ret = 1; | 0 | ||||||||||||||||||||||||||||||||||||
493 | else if (ret <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
494 | ret = BIO_ctrl(next, cmd, num, ptr); never executed: ret = BIO_ctrl(next, cmd, num, ptr); | 0 | ||||||||||||||||||||||||||||||||||||
495 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
496 | case never executed: 10:case 10: never executed: case 10: | 0 | ||||||||||||||||||||||||||||||||||||
497 | (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 483), 1)); | - | ||||||||||||||||||||||||||||||||||||
498 | ret = ctx->buf_len - ctx->buf_off; | - | ||||||||||||||||||||||||||||||||||||
499 | if (ret <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
500 | ret = BIO_ctrl(next, cmd, num, ptr); never executed: ret = BIO_ctrl(next, cmd, num, ptr); | 0 | ||||||||||||||||||||||||||||||||||||
501 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
502 | case executed 226 times by 1 test: 11:case 11: Executed by:
executed 226 times by 1 test: case 11: Executed by:
| 226 | ||||||||||||||||||||||||||||||||||||
503 | - | |||||||||||||||||||||||||||||||||||||
504 | again: | - | ||||||||||||||||||||||||||||||||||||
505 | while (ctx->buf_len != ctx->buf_off
| 126-352 | ||||||||||||||||||||||||||||||||||||
506 | i = b64_write(b, | - | ||||||||||||||||||||||||||||||||||||
507 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
508 | , 0); | - | ||||||||||||||||||||||||||||||||||||
509 | if (i < 0
| 0-126 | ||||||||||||||||||||||||||||||||||||
510 | return never executed: i;return i; never executed: return i; | 0 | ||||||||||||||||||||||||||||||||||||
511 | } executed 126 times by 1 test: end of block Executed by:
| 126 | ||||||||||||||||||||||||||||||||||||
512 | if (BIO_test_flags(b, ~(0x0)) & 0x100
| 0-352 | ||||||||||||||||||||||||||||||||||||
513 | if (ctx->tmp_len != 0
| 0 | ||||||||||||||||||||||||||||||||||||
514 | ctx->buf_len = EVP_EncodeBlock((unsigned char *)ctx->buf, | - | ||||||||||||||||||||||||||||||||||||
515 | (unsigned char *)ctx->tmp, | - | ||||||||||||||||||||||||||||||||||||
516 | ctx->tmp_len); | - | ||||||||||||||||||||||||||||||||||||
517 | ctx->buf_off = 0; | - | ||||||||||||||||||||||||||||||||||||
518 | ctx->tmp_len = 0; | - | ||||||||||||||||||||||||||||||||||||
519 | goto never executed: again;goto again; never executed: goto again; | 0 | ||||||||||||||||||||||||||||||||||||
520 | } | - | ||||||||||||||||||||||||||||||||||||
521 | } never executed: else if (ctx->encode != 0end of block
| 0-352 | ||||||||||||||||||||||||||||||||||||
522 | && EVP_ENCODE_CTX_num(ctx->base64) != 0
| 126-226 | ||||||||||||||||||||||||||||||||||||
523 | ctx->buf_off = 0; | - | ||||||||||||||||||||||||||||||||||||
524 | EVP_EncodeFinal(ctx->base64, | - | ||||||||||||||||||||||||||||||||||||
525 | (unsigned char *)ctx->buf, &(ctx->buf_len)); | - | ||||||||||||||||||||||||||||||||||||
526 | - | |||||||||||||||||||||||||||||||||||||
527 | goto executed 126 times by 1 test: again;goto again; Executed by:
executed 126 times by 1 test: goto again; Executed by:
| 126 | ||||||||||||||||||||||||||||||||||||
528 | } | - | ||||||||||||||||||||||||||||||||||||
529 | - | |||||||||||||||||||||||||||||||||||||
530 | ret = BIO_ctrl(next, cmd, num, ptr); | - | ||||||||||||||||||||||||||||||||||||
531 | break; executed 226 times by 1 test: break; Executed by:
| 226 | ||||||||||||||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||||||||||||||
533 | case never executed: 101:case 101: never executed: case 101: | 0 | ||||||||||||||||||||||||||||||||||||
534 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||||||||||||||
535 | ret = BIO_ctrl(next, cmd, num, ptr); | - | ||||||||||||||||||||||||||||||||||||
536 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||||||||||||||
537 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
538 | - | |||||||||||||||||||||||||||||||||||||
539 | case never executed: 12:case 12: never executed: case 12: | 0 | ||||||||||||||||||||||||||||||||||||
540 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
541 | case never executed: 3:case 3: never executed: case 3: | 0 | ||||||||||||||||||||||||||||||||||||
542 | case never executed: 5:case 5: never executed: case 5: | 0 | ||||||||||||||||||||||||||||||||||||
543 | case never executed: 4:case 4: never executed: case 4: | 0 | ||||||||||||||||||||||||||||||||||||
544 | default executed 652 times by 1 test: :default: Executed by:
executed 652 times by 1 test: default: Executed by:
| 652 | ||||||||||||||||||||||||||||||||||||
545 | ret = BIO_ctrl(next, cmd, num, ptr); | - | ||||||||||||||||||||||||||||||||||||
546 | break; executed 652 times by 1 test: break; Executed by:
| 652 | ||||||||||||||||||||||||||||||||||||
547 | } | - | ||||||||||||||||||||||||||||||||||||
548 | return executed 878 times by 1 test: ret;return ret; Executed by:
executed 878 times by 1 test: return ret; Executed by:
| 878 | ||||||||||||||||||||||||||||||||||||
549 | } | - | ||||||||||||||||||||||||||||||||||||
550 | - | |||||||||||||||||||||||||||||||||||||
551 | static long b64_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) | - | ||||||||||||||||||||||||||||||||||||
552 | { | - | ||||||||||||||||||||||||||||||||||||
553 | long ret = 1; | - | ||||||||||||||||||||||||||||||||||||
554 | BIO *next = BIO_next(b); | - | ||||||||||||||||||||||||||||||||||||
555 | - | |||||||||||||||||||||||||||||||||||||
556 | if (next ==
| 0 | ||||||||||||||||||||||||||||||||||||
557 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
558 | ) | - | ||||||||||||||||||||||||||||||||||||
559 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
560 | switch (cmd) { | - | ||||||||||||||||||||||||||||||||||||
561 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
562 | ret = BIO_callback_ctrl(next, cmd, fp); | - | ||||||||||||||||||||||||||||||||||||
563 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
564 | } | - | ||||||||||||||||||||||||||||||||||||
565 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||
566 | } | - | ||||||||||||||||||||||||||||||||||||
567 | - | |||||||||||||||||||||||||||||||||||||
568 | static int b64_puts(BIO *b, const char *str) | - | ||||||||||||||||||||||||||||||||||||
569 | { | - | ||||||||||||||||||||||||||||||||||||
570 | return never executed: b64_write(b, str, strlen(str));return b64_write(b, str, strlen(str)); never executed: return b64_write(b, str, strlen(str)); | 0 | ||||||||||||||||||||||||||||||||||||
571 | } | - | ||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |