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