| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bio/bf_buff.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | static int buffer_write(BIO *h, const char *buf, int num); | - | ||||||||||||||||||||||||
| 4 | static int buffer_read(BIO *h, char *buf, int size); | - | ||||||||||||||||||||||||
| 5 | static int buffer_puts(BIO *h, const char *str); | - | ||||||||||||||||||||||||
| 6 | static int buffer_gets(BIO *h, char *str, int size); | - | ||||||||||||||||||||||||
| 7 | static long buffer_ctrl(BIO *h, int cmd, long arg1, void *arg2); | - | ||||||||||||||||||||||||
| 8 | static int buffer_new(BIO *h); | - | ||||||||||||||||||||||||
| 9 | static int buffer_free(BIO *data); | - | ||||||||||||||||||||||||
| 10 | static long buffer_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp); | - | ||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | static const BIO_METHOD methods_buffer = { | - | ||||||||||||||||||||||||
| 14 | ( 9|0x0200), | - | ||||||||||||||||||||||||
| 15 | "buffer", | - | ||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | bwrite_conv, | - | ||||||||||||||||||||||||
| 18 | buffer_write, | - | ||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||
| 20 | bread_conv, | - | ||||||||||||||||||||||||
| 21 | buffer_read, | - | ||||||||||||||||||||||||
| 22 | buffer_puts, | - | ||||||||||||||||||||||||
| 23 | buffer_gets, | - | ||||||||||||||||||||||||
| 24 | buffer_ctrl, | - | ||||||||||||||||||||||||
| 25 | buffer_new, | - | ||||||||||||||||||||||||
| 26 | buffer_free, | - | ||||||||||||||||||||||||
| 27 | buffer_callback_ctrl, | - | ||||||||||||||||||||||||
| 28 | }; | - | ||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||
| 30 | const BIO_METHOD *BIO_f_buffer(void) | - | ||||||||||||||||||||||||
| 31 | { | - | ||||||||||||||||||||||||
| 32 | return executed 9513 times by 1 test: &methods_buffer;return &methods_buffer;Executed by:
executed 9513 times by 1 test: return &methods_buffer;Executed by:
| 9513 | ||||||||||||||||||||||||
| 33 | } | - | ||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | static int buffer_new(BIO *bi) | - | ||||||||||||||||||||||||
| 36 | { | - | ||||||||||||||||||||||||
| 37 | BIO_F_BUFFER_CTX *ctx = CRYPTO_zalloc(sizeof(*ctx), __FILE__, 49); | - | ||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||
| 39 | if (ctx ==
| 0-9513 | ||||||||||||||||||||||||
| 40 | ((void *)0)
| 0-9513 | ||||||||||||||||||||||||
| 41 | ) | - | ||||||||||||||||||||||||
| 42 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 43 | ctx->ibuf_size = 4096; | - | ||||||||||||||||||||||||
| 44 | ctx->ibuf = CRYPTO_malloc(4096, __FILE__, 54); | - | ||||||||||||||||||||||||
| 45 | if (ctx->ibuf ==
| 0-9513 | ||||||||||||||||||||||||
| 46 | ((void *)0)
| 0-9513 | ||||||||||||||||||||||||
| 47 | ) { | - | ||||||||||||||||||||||||
| 48 | CRYPTO_free(ctx, __FILE__, 56); | - | ||||||||||||||||||||||||
| 49 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 50 | } | - | ||||||||||||||||||||||||
| 51 | ctx->obuf_size = 4096; | - | ||||||||||||||||||||||||
| 52 | ctx->obuf = CRYPTO_malloc(4096, __FILE__, 60); | - | ||||||||||||||||||||||||
| 53 | if (ctx->obuf ==
| 0-9513 | ||||||||||||||||||||||||
| 54 | ((void *)0)
| 0-9513 | ||||||||||||||||||||||||
| 55 | ) { | - | ||||||||||||||||||||||||
| 56 | CRYPTO_free(ctx->ibuf, __FILE__, 62); | - | ||||||||||||||||||||||||
| 57 | CRYPTO_free(ctx, __FILE__, 63); | - | ||||||||||||||||||||||||
| 58 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 59 | } | - | ||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | bi->init = 1; | - | ||||||||||||||||||||||||
| 62 | bi->ptr = (char *)ctx; | - | ||||||||||||||||||||||||
| 63 | bi->flags = 0; | - | ||||||||||||||||||||||||
| 64 | return executed 9513 times by 1 test: 1;return 1;Executed by:
executed 9513 times by 1 test: return 1;Executed by:
| 9513 | ||||||||||||||||||||||||
| 65 | } | - | ||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | static int buffer_free(BIO *a) | - | ||||||||||||||||||||||||
| 68 | { | - | ||||||||||||||||||||||||
| 69 | BIO_F_BUFFER_CTX *b; | - | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | if (a ==
| 0-9513 | ||||||||||||||||||||||||
| 72 | ((void *)0)
| 0-9513 | ||||||||||||||||||||||||
| 73 | ) | - | ||||||||||||||||||||||||
| 74 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 75 | b = (BIO_F_BUFFER_CTX *)a->ptr; | - | ||||||||||||||||||||||||
| 76 | CRYPTO_free(b->ibuf, __FILE__, 80); | - | ||||||||||||||||||||||||
| 77 | CRYPTO_free(b->obuf, __FILE__, 81); | - | ||||||||||||||||||||||||
| 78 | CRYPTO_free(a->ptr, __FILE__, 82); | - | ||||||||||||||||||||||||
| 79 | a->ptr = | - | ||||||||||||||||||||||||
| 80 | ((void *)0) | - | ||||||||||||||||||||||||
| 81 | ; | - | ||||||||||||||||||||||||
| 82 | a->init = 0; | - | ||||||||||||||||||||||||
| 83 | a->flags = 0; | - | ||||||||||||||||||||||||
| 84 | return executed 9513 times by 1 test: 1;return 1;Executed by:
executed 9513 times by 1 test: return 1;Executed by:
| 9513 | ||||||||||||||||||||||||
| 85 | } | - | ||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | static int buffer_read(BIO *b, char *out, int outl) | - | ||||||||||||||||||||||||
| 88 | { | - | ||||||||||||||||||||||||
| 89 | int i, num = 0; | - | ||||||||||||||||||||||||
| 90 | BIO_F_BUFFER_CTX *ctx; | - | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | if (out ==
| 0 | ||||||||||||||||||||||||
| 93 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 94 | ) | - | ||||||||||||||||||||||||
| 95 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 96 | ctx = (BIO_F_BUFFER_CTX *)b->ptr; | - | ||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | if ((
| 0 | ||||||||||||||||||||||||
| 99 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 100 | )
| 0 | ||||||||||||||||||||||||
| 101 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 102 | )
| 0 | ||||||||||||||||||||||||
| 103 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 104 | num = 0; | - | ||||||||||||||||||||||||
| 105 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 | start: code before this statement never executed: start: | 0 | ||||||||||||||||||||||||
| 108 | i = ctx->ibuf_len; | - | ||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | if (i != 0
| 0 | ||||||||||||||||||||||||
| 111 | if (i > outl
| 0 | ||||||||||||||||||||||||
| 112 | i = outl; never executed: i = outl; | 0 | ||||||||||||||||||||||||
| 113 | memcpy(out, &(ctx->ibuf[ctx->ibuf_off]), i); | - | ||||||||||||||||||||||||
| 114 | ctx->ibuf_off += i; | - | ||||||||||||||||||||||||
| 115 | ctx->ibuf_len -= i; | - | ||||||||||||||||||||||||
| 116 | num += i; | - | ||||||||||||||||||||||||
| 117 | if (outl == i
| 0 | ||||||||||||||||||||||||
| 118 | return never executed: num;return num;never executed: return num; | 0 | ||||||||||||||||||||||||
| 119 | outl -= i; | - | ||||||||||||||||||||||||
| 120 | out += i; | - | ||||||||||||||||||||||||
| 121 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | if (outl > ctx->ibuf_size
| 0 | ||||||||||||||||||||||||
| 130 | for (;;) { | - | ||||||||||||||||||||||||
| 131 | i = BIO_read(b->next_bio, out, outl); | - | ||||||||||||||||||||||||
| 132 | if (i <= 0
| 0 | ||||||||||||||||||||||||
| 133 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||
| 134 | if (i < 0
| 0 | ||||||||||||||||||||||||
| 135 | return never executed: ((return ((num > 0) ? num : i);
never executed: return ((num > 0) ? num : i); | 0 | ||||||||||||||||||||||||
| 136 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 137 | return never executed: num;return num;never executed: return num; | 0 | ||||||||||||||||||||||||
| 138 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 139 | num += i; | - | ||||||||||||||||||||||||
| 140 | if (outl == i
| 0 | ||||||||||||||||||||||||
| 141 | return never executed: num;return num;never executed: return num; | 0 | ||||||||||||||||||||||||
| 142 | out += i; | - | ||||||||||||||||||||||||
| 143 | outl -= i; | - | ||||||||||||||||||||||||
| 144 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 145 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||
| 149 | i = BIO_read(b->next_bio, ctx->ibuf, ctx->ibuf_size); | - | ||||||||||||||||||||||||
| 150 | if (i <= 0
| 0 | ||||||||||||||||||||||||
| 151 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||
| 152 | if (i < 0
| 0 | ||||||||||||||||||||||||
| 153 | return never executed: ((return ((num > 0) ? num : i);
never executed: return ((num > 0) ? num : i); | 0 | ||||||||||||||||||||||||
| 154 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 155 | return never executed: num;return num;never executed: return num; | 0 | ||||||||||||||||||||||||
| 156 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 157 | ctx->ibuf_off = 0; | - | ||||||||||||||||||||||||
| 158 | ctx->ibuf_len = i; | - | ||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | goto never executed: start;goto start;never executed: goto start; | 0 | ||||||||||||||||||||||||
| 162 | } | - | ||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | static int buffer_write(BIO *b, const char *in, int inl) | - | ||||||||||||||||||||||||
| 165 | { | - | ||||||||||||||||||||||||
| 166 | int i, num = 0; | - | ||||||||||||||||||||||||
| 167 | BIO_F_BUFFER_CTX *ctx; | - | ||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||
| 169 | if ((
| 0-32043 | ||||||||||||||||||||||||
| 170 | ((void *)0)
| 0-32043 | ||||||||||||||||||||||||
| 171 | )
| 0-32043 | ||||||||||||||||||||||||
| 172 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 173 | ctx = (BIO_F_BUFFER_CTX *)b->ptr; | - | ||||||||||||||||||||||||
| 174 | if ((
| 0-32043 | ||||||||||||||||||||||||
| 175 | ((void *)0)
| 0-32043 | ||||||||||||||||||||||||
| 176 | )
| 0-32043 | ||||||||||||||||||||||||
| 177 | ((void *)0)
| 0-32043 | ||||||||||||||||||||||||
| 178 | )
| 0-32043 | ||||||||||||||||||||||||
| 179 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
| 182 | start: code before this statement executed 32043 times by 1 test: start:Executed by:
| 32043 | ||||||||||||||||||||||||
| 183 | i = ctx->obuf_size - (ctx->obuf_len + ctx->obuf_off); | - | ||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||
| 185 | if (i >= inl
| 6-32037 | ||||||||||||||||||||||||
| 186 | memcpy(&(ctx->obuf[ctx->obuf_off + ctx->obuf_len]), in, inl); | - | ||||||||||||||||||||||||
| 187 | ctx->obuf_len += inl; | - | ||||||||||||||||||||||||
| 188 | return executed 32037 times by 1 test: (num + inl);return (num + inl);Executed by:
executed 32037 times by 1 test: return (num + inl);Executed by:
| 32037 | ||||||||||||||||||||||||
| 189 | } | - | ||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||
| 192 | if (ctx->obuf_len != 0
| 2-4 | ||||||||||||||||||||||||
| 193 | if (i > 0
| 0-2 | ||||||||||||||||||||||||
| 194 | memcpy(&(ctx->obuf[ctx->obuf_off + ctx->obuf_len]), in, i); | - | ||||||||||||||||||||||||
| 195 | in += i; | - | ||||||||||||||||||||||||
| 196 | inl -= i; | - | ||||||||||||||||||||||||
| 197 | num += i; | - | ||||||||||||||||||||||||
| 198 | ctx->obuf_len += i; | - | ||||||||||||||||||||||||
| 199 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||
| 201 | for (;;) { | - | ||||||||||||||||||||||||
| 202 | i = BIO_write(b->next_bio, &(ctx->obuf[ctx->obuf_off]), | - | ||||||||||||||||||||||||
| 203 | ctx->obuf_len); | - | ||||||||||||||||||||||||
| 204 | if (i <= 0
| 0-2 | ||||||||||||||||||||||||
| 205 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||
| 207 | if (i < 0
| 0 | ||||||||||||||||||||||||
| 208 | return never executed: ((return ((num > 0) ? num : i);
never executed: return ((num > 0) ? num : i); | 0 | ||||||||||||||||||||||||
| 209 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 210 | return never executed: num;return num;never executed: return num; | 0 | ||||||||||||||||||||||||
| 211 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 212 | ctx->obuf_off += i; | - | ||||||||||||||||||||||||
| 213 | ctx->obuf_len -= i; | - | ||||||||||||||||||||||||
| 214 | if (ctx->obuf_len == 0
| 0-2 | ||||||||||||||||||||||||
| 215 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||||||||
| 216 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 217 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||
| 222 | ctx->obuf_off = 0; | - | ||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||
| 225 | while (inl >= ctx->obuf_size
| 0-6 | ||||||||||||||||||||||||
| 226 | i = BIO_write(b->next_bio, in, inl); | - | ||||||||||||||||||||||||
| 227 | if (i <= 0
| 0-6 | ||||||||||||||||||||||||
| 228 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||
| 229 | if (i < 0
| 0 | ||||||||||||||||||||||||
| 230 | return never executed: ((return ((num > 0) ? num : i);
never executed: return ((num > 0) ? num : i); | 0 | ||||||||||||||||||||||||
| 231 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 232 | return never executed: num;return num;never executed: return num; | 0 | ||||||||||||||||||||||||
| 233 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 234 | num += i; | - | ||||||||||||||||||||||||
| 235 | in += i; | - | ||||||||||||||||||||||||
| 236 | inl -= i; | - | ||||||||||||||||||||||||
| 237 | if (inl == 0
| 0-6 | ||||||||||||||||||||||||
| 238 | return executed 6 times by 1 test: num;return num;Executed by:
executed 6 times by 1 test: return num;Executed by:
| 6 | ||||||||||||||||||||||||
| 239 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | goto never executed: start;goto start;never executed: goto start; | 0 | ||||||||||||||||||||||||
| 245 | } | - | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) | - | ||||||||||||||||||||||||
| 248 | { | - | ||||||||||||||||||||||||
| 249 | BIO *dbio; | - | ||||||||||||||||||||||||
| 250 | BIO_F_BUFFER_CTX *ctx; | - | ||||||||||||||||||||||||
| 251 | long ret = 1; | - | ||||||||||||||||||||||||
| 252 | char *p1, *p2; | - | ||||||||||||||||||||||||
| 253 | int r, i, *ip; | - | ||||||||||||||||||||||||
| 254 | int ibs, obs; | - | ||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||
| 256 | ctx = (BIO_F_BUFFER_CTX *)b->ptr; | - | ||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | switch (cmd) { | - | ||||||||||||||||||||||||
| 259 | case never executed: 1:case 1:never executed: case 1: | 0 | ||||||||||||||||||||||||
| 260 | ctx->ibuf_off = 0; | - | ||||||||||||||||||||||||
| 261 | ctx->ibuf_len = 0; | - | ||||||||||||||||||||||||
| 262 | ctx->obuf_off = 0; | - | ||||||||||||||||||||||||
| 263 | ctx->obuf_len = 0; | - | ||||||||||||||||||||||||
| 264 | if (b->next_bio ==
| 0 | ||||||||||||||||||||||||
| 265 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 266 | ) | - | ||||||||||||||||||||||||
| 267 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 268 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); | - | ||||||||||||||||||||||||
| 269 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 270 | case never executed: 2:case 2:never executed: case 2: | 0 | ||||||||||||||||||||||||
| 271 | if (ctx->ibuf_len > 0
| 0 | ||||||||||||||||||||||||
| 272 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 273 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); | - | ||||||||||||||||||||||||
| 274 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 275 | case never executed: 3:case 3:never executed: case 3: | 0 | ||||||||||||||||||||||||
| 276 | ret = (long)ctx->obuf_len; | - | ||||||||||||||||||||||||
| 277 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 278 | case never executed: 116:case 116:never executed: case 116: | 0 | ||||||||||||||||||||||||
| 279 | ret = 0; | - | ||||||||||||||||||||||||
| 280 | p1 = ctx->ibuf; | - | ||||||||||||||||||||||||
| 281 | for (i = 0; i < ctx->ibuf_len
| 0 | ||||||||||||||||||||||||
| 282 | if (p1[ctx->ibuf_off + i] == '\n'
| 0 | ||||||||||||||||||||||||
| 283 | ret++; never executed: ret++; | 0 | ||||||||||||||||||||||||
| 284 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 285 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 286 | case executed 3009 times by 1 test: 13:case 13:Executed by:
executed 3009 times by 1 test: case 13:Executed by:
| 3009 | ||||||||||||||||||||||||
| 287 | ret = (long)ctx->obuf_len; | - | ||||||||||||||||||||||||
| 288 | if (ret == 0
| 825-2184 | ||||||||||||||||||||||||
| 289 | if (b->next_bio ==
| 0-825 | ||||||||||||||||||||||||
| 290 | ((void *)0)
| 0-825 | ||||||||||||||||||||||||
| 291 | ) | - | ||||||||||||||||||||||||
| 292 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 293 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); | - | ||||||||||||||||||||||||
| 294 | } executed 825 times by 1 test: end of blockExecuted by:
| 825 | ||||||||||||||||||||||||
| 295 | break; executed 3009 times by 1 test: break;Executed by:
| 3009 | ||||||||||||||||||||||||
| 296 | case never executed: 10:case 10:never executed: case 10: | 0 | ||||||||||||||||||||||||
| 297 | ret = (long)ctx->ibuf_len; | - | ||||||||||||||||||||||||
| 298 | if (ret == 0
| 0 | ||||||||||||||||||||||||
| 299 | if (b->next_bio ==
| 0 | ||||||||||||||||||||||||
| 300 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 301 | ) | - | ||||||||||||||||||||||||
| 302 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 303 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); | - | ||||||||||||||||||||||||
| 304 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 305 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 306 | case never executed: 122:case 122:never executed: case 122: | 0 | ||||||||||||||||||||||||
| 307 | if (num > ctx->ibuf_size
| 0 | ||||||||||||||||||||||||
| 308 | p1 = CRYPTO_malloc((int)num, __FILE__, 292); | - | ||||||||||||||||||||||||
| 309 | if (p1 ==
| 0 | ||||||||||||||||||||||||
| 310 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 311 | ) | - | ||||||||||||||||||||||||
| 312 | goto never executed: malloc_error;goto malloc_error;never executed: goto malloc_error; | 0 | ||||||||||||||||||||||||
| 313 | CRYPTO_free(ctx->ibuf, __FILE__, 295); | - | ||||||||||||||||||||||||
| 314 | ctx->ibuf = p1; | - | ||||||||||||||||||||||||
| 315 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 316 | ctx->ibuf_off = 0; | - | ||||||||||||||||||||||||
| 317 | ctx->ibuf_len = (int)num; | - | ||||||||||||||||||||||||
| 318 | memcpy(ctx->ibuf, ptr, (int)num); | - | ||||||||||||||||||||||||
| 319 | ret = 1; | - | ||||||||||||||||||||||||
| 320 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 321 | case executed 9434 times by 1 test: 117:case 117:Executed by:
executed 9434 times by 1 test: case 117:Executed by:
| 9434 | ||||||||||||||||||||||||
| 322 | if (ptr !=
| 0-9434 | ||||||||||||||||||||||||
| 323 | ((void *)0)
| 0-9434 | ||||||||||||||||||||||||
| 324 | ) { | - | ||||||||||||||||||||||||
| 325 | ip = (int *)ptr; | - | ||||||||||||||||||||||||
| 326 | if (*
| 191-9243 | ||||||||||||||||||||||||
| 327 | ibs = (int)num; | - | ||||||||||||||||||||||||
| 328 | obs = ctx->obuf_size; | - | ||||||||||||||||||||||||
| 329 | } executed 9243 times by 1 test: else {end of blockExecuted by:
| 9243 | ||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||
| 331 | ibs = ctx->ibuf_size; | - | ||||||||||||||||||||||||
| 332 | obs = (int)num; | - | ||||||||||||||||||||||||
| 333 | } executed 191 times by 1 test: end of blockExecuted by:
| 191 | ||||||||||||||||||||||||
| 334 | } else { | - | ||||||||||||||||||||||||
| 335 | ibs = (int)num; | - | ||||||||||||||||||||||||
| 336 | obs = (int)num; | - | ||||||||||||||||||||||||
| 337 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 338 | p1 = ctx->ibuf; | - | ||||||||||||||||||||||||
| 339 | p2 = ctx->obuf; | - | ||||||||||||||||||||||||
| 340 | if ((
| 0-9434 | ||||||||||||||||||||||||
| 341 | p1 = CRYPTO_malloc((int)num, __FILE__, 321); | - | ||||||||||||||||||||||||
| 342 | if (p1 ==
| 0 | ||||||||||||||||||||||||
| 343 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 344 | ) | - | ||||||||||||||||||||||||
| 345 | goto never executed: malloc_error;goto malloc_error;never executed: goto malloc_error; | 0 | ||||||||||||||||||||||||
| 346 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 347 | if ((
| 0-9243 | ||||||||||||||||||||||||
| 348 | p2 = CRYPTO_malloc((int)num, __FILE__, 326); | - | ||||||||||||||||||||||||
| 349 | if (p2 ==
| 0-191 | ||||||||||||||||||||||||
| 350 | ((void *)0)
| 0-191 | ||||||||||||||||||||||||
| 351 | ) { | - | ||||||||||||||||||||||||
| 352 | if (p1 != ctx->ibuf
| 0 | ||||||||||||||||||||||||
| 353 | CRYPTO_free(p1, __FILE__, 329); never executed: CRYPTO_free(p1, __FILE__, 329); | 0 | ||||||||||||||||||||||||
| 354 | goto never executed: malloc_error;goto malloc_error;never executed: goto malloc_error; | 0 | ||||||||||||||||||||||||
| 355 | } | - | ||||||||||||||||||||||||
| 356 | } executed 191 times by 1 test: end of blockExecuted by:
| 191 | ||||||||||||||||||||||||
| 357 | if (ctx->ibuf != p1
| 0-9434 | ||||||||||||||||||||||||
| 358 | CRYPTO_free(ctx->ibuf, __FILE__, 334); | - | ||||||||||||||||||||||||
| 359 | ctx->ibuf = p1; | - | ||||||||||||||||||||||||
| 360 | ctx->ibuf_off = 0; | - | ||||||||||||||||||||||||
| 361 | ctx->ibuf_len = 0; | - | ||||||||||||||||||||||||
| 362 | ctx->ibuf_size = ibs; | - | ||||||||||||||||||||||||
| 363 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 364 | if (ctx->obuf != p2
| 191-9243 | ||||||||||||||||||||||||
| 365 | CRYPTO_free(ctx->obuf, __FILE__, 341); | - | ||||||||||||||||||||||||
| 366 | ctx->obuf = p2; | - | ||||||||||||||||||||||||
| 367 | ctx->obuf_off = 0; | - | ||||||||||||||||||||||||
| 368 | ctx->obuf_len = 0; | - | ||||||||||||||||||||||||
| 369 | ctx->obuf_size = obs; | - | ||||||||||||||||||||||||
| 370 | } executed 191 times by 1 test: end of blockExecuted by:
| 191 | ||||||||||||||||||||||||
| 371 | break; executed 9434 times by 1 test: break;Executed by:
| 9434 | ||||||||||||||||||||||||
| 372 | case executed 191 times by 1 test: 101:case 101:Executed by:
executed 191 times by 1 test: case 101:Executed by:
| 191 | ||||||||||||||||||||||||
| 373 | if (b->next_bio ==
| 0-191 | ||||||||||||||||||||||||
| 374 | ((void *)0)
| 0-191 | ||||||||||||||||||||||||
| 375 | ) | - | ||||||||||||||||||||||||
| 376 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 377 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
| 378 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); | - | ||||||||||||||||||||||||
| 379 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||
| 380 | break; executed 191 times by 1 test: break;Executed by:
| 191 | ||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||
| 382 | case executed 17364 times by 1 test: 11:case 11:Executed by:
executed 17364 times by 1 test: case 11:Executed by:
| 17364 | ||||||||||||||||||||||||
| 383 | if (b->next_bio ==
| 0-17364 | ||||||||||||||||||||||||
| 384 | ((void *)0)
| 0-17364 | ||||||||||||||||||||||||
| 385 | ) | - | ||||||||||||||||||||||||
| 386 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 387 | if (ctx->obuf_len <= 0
| 0-17364 | ||||||||||||||||||||||||
| 388 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); | - | ||||||||||||||||||||||||
| 389 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 390 | } | - | ||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||
| 392 | for (;;) { | - | ||||||||||||||||||||||||
| 393 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
| 394 | if (ctx->obuf_len > 0
| 16748-17667 | ||||||||||||||||||||||||
| 395 | r = BIO_write(b->next_bio, | - | ||||||||||||||||||||||||
| 396 | &(ctx->obuf[ctx->obuf_off]), ctx->obuf_len); | - | ||||||||||||||||||||||||
| 397 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||
| 398 | if (r <= 0
| 616-17051 | ||||||||||||||||||||||||
| 399 | return executed 616 times by 1 test: (long)r;return (long)r;Executed by:
executed 616 times by 1 test: return (long)r;Executed by:
| 616 | ||||||||||||||||||||||||
| 400 | ctx->obuf_off += r; | - | ||||||||||||||||||||||||
| 401 | ctx->obuf_len -= r; | - | ||||||||||||||||||||||||
| 402 | } executed 17051 times by 1 test: else {end of blockExecuted by:
| 17051 | ||||||||||||||||||||||||
| 403 | ctx->obuf_len = 0; | - | ||||||||||||||||||||||||
| 404 | ctx->obuf_off = 0; | - | ||||||||||||||||||||||||
| 405 | break; executed 16748 times by 1 test: break;Executed by:
| 16748 | ||||||||||||||||||||||||
| 406 | } | - | ||||||||||||||||||||||||
| 407 | } | - | ||||||||||||||||||||||||
| 408 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); | - | ||||||||||||||||||||||||
| 409 | break; executed 16748 times by 1 test: break;Executed by:
| 16748 | ||||||||||||||||||||||||
| 410 | case never executed: 12:case 12:never executed: case 12: | 0 | ||||||||||||||||||||||||
| 411 | dbio = (BIO *)ptr; | - | ||||||||||||||||||||||||
| 412 | if (!BIO_int_ctrl(dbio,117,ctx->ibuf_size,0)
| 0 | ||||||||||||||||||||||||
| 413 | !BIO_int_ctrl(dbio,117,ctx->obuf_size,1)
| 0 | ||||||||||||||||||||||||
| 414 | ret = 0; never executed: ret = 0; | 0 | ||||||||||||||||||||||||
| 415 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 416 | case never executed: 29:case 29:never executed: case 29: | 0 | ||||||||||||||||||||||||
| 417 | - | |||||||||||||||||||||||||
| 418 | { | - | ||||||||||||||||||||||||
| 419 | char fake_buf[1]; | - | ||||||||||||||||||||||||
| 420 | (void)buffer_read(b, fake_buf, 0); | - | ||||||||||||||||||||||||
| 421 | } | - | ||||||||||||||||||||||||
| 422 | if (num > ctx->ibuf_len
| 0 | ||||||||||||||||||||||||
| 423 | num = ctx->ibuf_len; never executed: num = ctx->ibuf_len; | 0 | ||||||||||||||||||||||||
| 424 | memcpy(ptr, &(ctx->ibuf[ctx->ibuf_off]), num); | - | ||||||||||||||||||||||||
| 425 | ret = num; | - | ||||||||||||||||||||||||
| 426 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 427 | default executed 18845 times by 1 test: :default:Executed by:
executed 18845 times by 1 test: default:Executed by:
| 18845 | ||||||||||||||||||||||||
| 428 | if (b->next_bio ==
| 4-18841 | ||||||||||||||||||||||||
| 429 | ((void *)0)
| 4-18841 | ||||||||||||||||||||||||
| 430 | ) | - | ||||||||||||||||||||||||
| 431 | return executed 4 times by 1 test: 0;return 0;Executed by:
executed 4 times by 1 test: return 0;Executed by:
| 4 | ||||||||||||||||||||||||
| 432 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); | - | ||||||||||||||||||||||||
| 433 | break; executed 18841 times by 1 test: break;Executed by:
| 18841 | ||||||||||||||||||||||||
| 434 | } | - | ||||||||||||||||||||||||
| 435 | return executed 48223 times by 1 test: ret;return ret;Executed by:
executed 48223 times by 1 test: return ret;Executed by:
| 48223 | ||||||||||||||||||||||||
| 436 | malloc_error: | - | ||||||||||||||||||||||||
| 437 | ERR_put_error(32,(114),((1|64)),__FILE__,407); | - | ||||||||||||||||||||||||
| 438 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 439 | } | - | ||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||
| 441 | static long buffer_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) | - | ||||||||||||||||||||||||
| 442 | { | - | ||||||||||||||||||||||||
| 443 | long ret = 1; | - | ||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | if (b->next_bio ==
| 0 | ||||||||||||||||||||||||
| 446 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 447 | ) | - | ||||||||||||||||||||||||
| 448 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 449 | switch (cmd) { | - | ||||||||||||||||||||||||
| 450 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 451 | ret = BIO_callback_ctrl(b->next_bio, cmd, fp); | - | ||||||||||||||||||||||||
| 452 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 453 | } | - | ||||||||||||||||||||||||
| 454 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||
| 455 | } | - | ||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 | static int buffer_gets(BIO *b, char *buf, int size) | - | ||||||||||||||||||||||||
| 458 | { | - | ||||||||||||||||||||||||
| 459 | BIO_F_BUFFER_CTX *ctx; | - | ||||||||||||||||||||||||
| 460 | int num = 0, i, flag; | - | ||||||||||||||||||||||||
| 461 | char *p; | - | ||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | ctx = (BIO_F_BUFFER_CTX *)b->ptr; | - | ||||||||||||||||||||||||
| 464 | size--; | - | ||||||||||||||||||||||||
| 465 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||
| 467 | for (;;) { | - | ||||||||||||||||||||||||
| 468 | if (ctx->ibuf_len > 0
| 113-350 | ||||||||||||||||||||||||
| 469 | p = &(ctx->ibuf[ctx->ibuf_off]); | - | ||||||||||||||||||||||||
| 470 | flag = 0; | - | ||||||||||||||||||||||||
| 471 | for (i = 0; (
| 0-443 | ||||||||||||||||||||||||
| 472 | *(buf++) = p[i]; | - | ||||||||||||||||||||||||
| 473 | if (p[i] == '\n'
| 0-443 | ||||||||||||||||||||||||
| 474 | flag = 1; | - | ||||||||||||||||||||||||
| 475 | i++; | - | ||||||||||||||||||||||||
| 476 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 477 | } | - | ||||||||||||||||||||||||
| 478 | } executed 443 times by 1 test: end of blockExecuted by:
| 443 | ||||||||||||||||||||||||
| 479 | num += i; | - | ||||||||||||||||||||||||
| 480 | size -= i; | - | ||||||||||||||||||||||||
| 481 | ctx->ibuf_len -= i; | - | ||||||||||||||||||||||||
| 482 | ctx->ibuf_off += i; | - | ||||||||||||||||||||||||
| 483 | if (flag
| 0-113 | ||||||||||||||||||||||||
| 484 | *buf = '\0'; | - | ||||||||||||||||||||||||
| 485 | return never executed: num;return num;never executed: return num; | 0 | ||||||||||||||||||||||||
| 486 | } | - | ||||||||||||||||||||||||
| 487 | } executed 113 times by 1 test: else {end of blockExecuted by:
| 113 | ||||||||||||||||||||||||
| 488 | - | |||||||||||||||||||||||||
| 489 | i = BIO_read(b->next_bio, ctx->ibuf, ctx->ibuf_size); | - | ||||||||||||||||||||||||
| 490 | if (i <= 0
| 113-237 | ||||||||||||||||||||||||
| 491 | BIO_copy_next_retry(b); | - | ||||||||||||||||||||||||
| 492 | *buf = '\0'; | - | ||||||||||||||||||||||||
| 493 | if (i < 0
| 4-233 | ||||||||||||||||||||||||
| 494 | return executed 4 times by 1 test: ((return ((num > 0) ? num : i);Executed by:
executed 4 times by 1 test: return ((num > 0) ? num : i);Executed by:
| 0-4 | ||||||||||||||||||||||||
| 495 | if (i == 0
| 0-233 | ||||||||||||||||||||||||
| 496 | return executed 233 times by 1 test: num;return num;Executed by:
executed 233 times by 1 test: return num;Executed by:
| 233 | ||||||||||||||||||||||||
| 497 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 498 | ctx->ibuf_len = i; | - | ||||||||||||||||||||||||
| 499 | ctx->ibuf_off = 0; | - | ||||||||||||||||||||||||
| 500 | } executed 113 times by 1 test: end of blockExecuted by:
| 113 | ||||||||||||||||||||||||
| 501 | } | - | ||||||||||||||||||||||||
| 502 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | static int buffer_puts(BIO *b, const char *str) | - | ||||||||||||||||||||||||
| 505 | { | - | ||||||||||||||||||||||||
| 506 | return never executed: buffer_write(b, str, strlen(str));return buffer_write(b, str, strlen(str));never executed: return buffer_write(b, str, strlen(str)); | 0 | ||||||||||||||||||||||||
| 507 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |