| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bio/bss_mem.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | static int mem_write(BIO *h, const char *buf, int num); | - | ||||||||||||||||||||||||
| 4 | static int mem_read(BIO *h, char *buf, int size); | - | ||||||||||||||||||||||||
| 5 | static int mem_puts(BIO *h, const char *str); | - | ||||||||||||||||||||||||
| 6 | static int mem_gets(BIO *h, char *str, int size); | - | ||||||||||||||||||||||||
| 7 | static long mem_ctrl(BIO *h, int cmd, long arg1, void *arg2); | - | ||||||||||||||||||||||||
| 8 | static int mem_new(BIO *h); | - | ||||||||||||||||||||||||
| 9 | static int secmem_new(BIO *h); | - | ||||||||||||||||||||||||
| 10 | static int mem_free(BIO *data); | - | ||||||||||||||||||||||||
| 11 | static int mem_buf_free(BIO *data, int free_all); | - | ||||||||||||||||||||||||
| 12 | static int mem_buf_sync(BIO *h); | - | ||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | static const BIO_METHOD mem_method = { | - | ||||||||||||||||||||||||
| 15 | ( 1|0x0400), | - | ||||||||||||||||||||||||
| 16 | "memory buffer", | - | ||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||
| 18 | bwrite_conv, | - | ||||||||||||||||||||||||
| 19 | mem_write, | - | ||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||
| 21 | bread_conv, | - | ||||||||||||||||||||||||
| 22 | mem_read, | - | ||||||||||||||||||||||||
| 23 | mem_puts, | - | ||||||||||||||||||||||||
| 24 | mem_gets, | - | ||||||||||||||||||||||||
| 25 | mem_ctrl, | - | ||||||||||||||||||||||||
| 26 | mem_new, | - | ||||||||||||||||||||||||
| 27 | mem_free, | - | ||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||
| 29 | ((void *)0) | - | ||||||||||||||||||||||||
| 30 | , | - | ||||||||||||||||||||||||
| 31 | }; | - | ||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | static const BIO_METHOD secmem_method = { | - | ||||||||||||||||||||||||
| 34 | ( 1|0x0400), | - | ||||||||||||||||||||||||
| 35 | "secure memory buffer", | - | ||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||
| 37 | bwrite_conv, | - | ||||||||||||||||||||||||
| 38 | mem_write, | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | bread_conv, | - | ||||||||||||||||||||||||
| 41 | mem_read, | - | ||||||||||||||||||||||||
| 42 | mem_puts, | - | ||||||||||||||||||||||||
| 43 | mem_gets, | - | ||||||||||||||||||||||||
| 44 | mem_ctrl, | - | ||||||||||||||||||||||||
| 45 | secmem_new, | - | ||||||||||||||||||||||||
| 46 | mem_free, | - | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | ((void *)0) | - | ||||||||||||||||||||||||
| 49 | , | - | ||||||||||||||||||||||||
| 50 | }; | - | ||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||
| 53 | typedef struct bio_buf_mem_st { | - | ||||||||||||||||||||||||
| 54 | struct buf_mem_st *buf; | - | ||||||||||||||||||||||||
| 55 | struct buf_mem_st *readp; | - | ||||||||||||||||||||||||
| 56 | } BIO_BUF_MEM; | - | ||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | const BIO_METHOD *BIO_s_mem(void) | - | ||||||||||||||||||||||||
| 64 | { | - | ||||||||||||||||||||||||
| 65 | return executed 81666 times by 1 test: &mem_method;return &mem_method;Executed by:
executed 81666 times by 1 test: return &mem_method;Executed by:
| 81666 | ||||||||||||||||||||||||
| 66 | } | - | ||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||
| 68 | const BIO_METHOD *BIO_s_secmem(void) | - | ||||||||||||||||||||||||
| 69 | { | - | ||||||||||||||||||||||||
| 70 | return executed 7726 times by 1 test: (&secmem_method);return(&secmem_method);Executed by:
executed 7726 times by 1 test: return(&secmem_method);Executed by:
| 7726 | ||||||||||||||||||||||||
| 71 | } | - | ||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||
| 73 | BIO *BIO_new_mem_buf(const void *buf, int len) | - | ||||||||||||||||||||||||
| 74 | { | - | ||||||||||||||||||||||||
| 75 | BIO *ret; | - | ||||||||||||||||||||||||
| 76 | BUF_MEM *b; | - | ||||||||||||||||||||||||
| 77 | BIO_BUF_MEM *bb; | - | ||||||||||||||||||||||||
| 78 | size_t sz; | - | ||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | if (buf ==
| 0-37022 | ||||||||||||||||||||||||
| 81 | ((void *)0)
| 0-37022 | ||||||||||||||||||||||||
| 82 | ) { | - | ||||||||||||||||||||||||
| 83 | ERR_put_error(32,(126),(115),__FILE__,89); | - | ||||||||||||||||||||||||
| 84 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 85 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 86 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 87 | } | - | ||||||||||||||||||||||||
| 88 | sz = (
| 0-37022 | ||||||||||||||||||||||||
| 89 | if ((
| 0-37022 | ||||||||||||||||||||||||
| 90 | ((void *)0)
| 0-37022 | ||||||||||||||||||||||||
| 91 | ) | - | ||||||||||||||||||||||||
| 92 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 93 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 94 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 95 | bb = (BIO_BUF_MEM *)ret->ptr; | - | ||||||||||||||||||||||||
| 96 | b = bb->buf; | - | ||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | b->data = (void *)buf; | - | ||||||||||||||||||||||||
| 99 | b->length = sz; | - | ||||||||||||||||||||||||
| 100 | b->max = sz; | - | ||||||||||||||||||||||||
| 101 | *bb->readp = *bb->buf; | - | ||||||||||||||||||||||||
| 102 | ret->flags |= 0x200; | - | ||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | ret->num = 0; | - | ||||||||||||||||||||||||
| 105 | return executed 37022 times by 1 test: ret;return ret;Executed by:
executed 37022 times by 1 test: return ret;Executed by:
| 37022 | ||||||||||||||||||||||||
| 106 | } | - | ||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||
| 108 | static int mem_init(BIO *bi, unsigned long flags) | - | ||||||||||||||||||||||||
| 109 | { | - | ||||||||||||||||||||||||
| 110 | BIO_BUF_MEM *bb = CRYPTO_zalloc(sizeof(*bb), __FILE__, 110); | - | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | if (bb ==
| 0-111695 | ||||||||||||||||||||||||
| 113 | ((void *)0)
| 0-111695 | ||||||||||||||||||||||||
| 114 | ) | - | ||||||||||||||||||||||||
| 115 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 116 | if ((
| 0-111695 | ||||||||||||||||||||||||
| 117 | ((void *)0)
| 0-111695 | ||||||||||||||||||||||||
| 118 | ) { | - | ||||||||||||||||||||||||
| 119 | CRYPTO_free(bb, __FILE__, 115); | - | ||||||||||||||||||||||||
| 120 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 121 | } | - | ||||||||||||||||||||||||
| 122 | if ((
| 0-111695 | ||||||||||||||||||||||||
| 123 | ((void *)0)
| 0-111695 | ||||||||||||||||||||||||
| 124 | ) { | - | ||||||||||||||||||||||||
| 125 | BUF_MEM_free(bb->buf); | - | ||||||||||||||||||||||||
| 126 | CRYPTO_free(bb, __FILE__, 120); | - | ||||||||||||||||||||||||
| 127 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 128 | } | - | ||||||||||||||||||||||||
| 129 | *bb->readp = *bb->buf; | - | ||||||||||||||||||||||||
| 130 | bi->shutdown = 1; | - | ||||||||||||||||||||||||
| 131 | bi->init = 1; | - | ||||||||||||||||||||||||
| 132 | bi->num = -1; | - | ||||||||||||||||||||||||
| 133 | bi->ptr = (char *)bb; | - | ||||||||||||||||||||||||
| 134 | return executed 111695 times by 1 test: 1;return 1;Executed by:
executed 111695 times by 1 test: return 1;Executed by:
| 111695 | ||||||||||||||||||||||||
| 135 | } | - | ||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | static int mem_new(BIO *bi) | - | ||||||||||||||||||||||||
| 138 | { | - | ||||||||||||||||||||||||
| 139 | return executed 96243 times by 1 test: mem_init(bi, 0L);return mem_init(bi, 0L);Executed by:
executed 96243 times by 1 test: return mem_init(bi, 0L);Executed by:
| 96243 | ||||||||||||||||||||||||
| 140 | } | - | ||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | static int secmem_new(BIO *bi) | - | ||||||||||||||||||||||||
| 143 | { | - | ||||||||||||||||||||||||
| 144 | return executed 15452 times by 1 test: mem_init(bi, 0x01);return mem_init(bi, 0x01);Executed by:
executed 15452 times by 1 test: return mem_init(bi, 0x01);Executed by:
| 15452 | ||||||||||||||||||||||||
| 145 | } | - | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | static int mem_free(BIO *a) | - | ||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||
| 149 | return executed 111695 times by 1 test: mem_buf_free(a, 1);return mem_buf_free(a, 1);Executed by:
executed 111695 times by 1 test: return mem_buf_free(a, 1);Executed by:
| 111695 | ||||||||||||||||||||||||
| 150 | } | - | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | static int mem_buf_free(BIO *a, int free_all) | - | ||||||||||||||||||||||||
| 153 | { | - | ||||||||||||||||||||||||
| 154 | if (a ==
| 0-111695 | ||||||||||||||||||||||||
| 155 | ((void *)0)
| 0-111695 | ||||||||||||||||||||||||
| 156 | ) | - | ||||||||||||||||||||||||
| 157 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||
| 159 | if (a->shutdown
| 0-111695 | ||||||||||||||||||||||||
| 160 | ((void *)0)
| 0-111695 | ||||||||||||||||||||||||
| 161 | ) { | - | ||||||||||||||||||||||||
| 162 | BIO_BUF_MEM *bb = (BIO_BUF_MEM *)a->ptr; | - | ||||||||||||||||||||||||
| 163 | BUF_MEM *b = bb->buf; | - | ||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||
| 165 | if (a->flags & 0x200
| 37039-74656 | ||||||||||||||||||||||||
| 166 | b->data = executed 37039 times by 1 test: b->data = ((void *)0) ;Executed by:
| 37039 | ||||||||||||||||||||||||
| 167 | ((void *)0) executed 37039 times by 1 test: b->data = ((void *)0) ;Executed by:
| 37039 | ||||||||||||||||||||||||
| 168 | ; executed 37039 times by 1 test: b->data = ((void *)0) ;Executed by:
| 37039 | ||||||||||||||||||||||||
| 169 | BUF_MEM_free(b); | - | ||||||||||||||||||||||||
| 170 | if (free_all
| 0-111695 | ||||||||||||||||||||||||
| 171 | CRYPTO_free(bb->readp, __FILE__, 159); | - | ||||||||||||||||||||||||
| 172 | CRYPTO_free(bb, __FILE__, 160); | - | ||||||||||||||||||||||||
| 173 | } executed 111695 times by 1 test: end of blockExecuted by:
| 111695 | ||||||||||||||||||||||||
| 174 | a->ptr = | - | ||||||||||||||||||||||||
| 175 | ((void *)0) | - | ||||||||||||||||||||||||
| 176 | ; | - | ||||||||||||||||||||||||
| 177 | } executed 111695 times by 1 test: end of blockExecuted by:
| 111695 | ||||||||||||||||||||||||
| 178 | return executed 111695 times by 1 test: 1;return 1;Executed by:
executed 111695 times by 1 test: return 1;Executed by:
| 111695 | ||||||||||||||||||||||||
| 179 | } | - | ||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||
| 182 | - | |||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | static int mem_buf_sync(BIO *b) | - | ||||||||||||||||||||||||
| 185 | { | - | ||||||||||||||||||||||||
| 186 | if (b !=
| 0-346472 | ||||||||||||||||||||||||
| 187 | ((void *)0)
| 0-346472 | ||||||||||||||||||||||||
| 188 | && b->init != 0
| 0-346472 | ||||||||||||||||||||||||
| 189 | ((void *)0)
| 0-346472 | ||||||||||||||||||||||||
| 190 | ) { | - | ||||||||||||||||||||||||
| 191 | BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)b->ptr; | - | ||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||
| 193 | if (bbm->readp->data != bbm->buf->data
| 7781-338691 | ||||||||||||||||||||||||
| 194 | memmove(bbm->buf->data, bbm->readp->data, bbm->readp->length); | - | ||||||||||||||||||||||||
| 195 | bbm->buf->length = bbm->readp->length; | - | ||||||||||||||||||||||||
| 196 | bbm->readp->data = bbm->buf->data; | - | ||||||||||||||||||||||||
| 197 | } executed 7781 times by 1 test: end of blockExecuted by:
| 7781 | ||||||||||||||||||||||||
| 198 | } executed 346472 times by 1 test: end of blockExecuted by:
| 346472 | ||||||||||||||||||||||||
| 199 | return executed 346472 times by 1 test: 0;return 0;Executed by:
executed 346472 times by 1 test: return 0;Executed by:
| 346472 | ||||||||||||||||||||||||
| 200 | } | - | ||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||
| 202 | static int mem_read(BIO *b, char *out, int outl) | - | ||||||||||||||||||||||||
| 203 | { | - | ||||||||||||||||||||||||
| 204 | int ret = -1; | - | ||||||||||||||||||||||||
| 205 | BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)b->ptr; | - | ||||||||||||||||||||||||
| 206 | BUF_MEM *bm = bbm->readp; | - | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
| 209 | ret = (outl >= 0
| 0-929320 | ||||||||||||||||||||||||
| 210 | if ((
| 0-929320 | ||||||||||||||||||||||||
| 211 | ((void *)0)
| 0-929320 | ||||||||||||||||||||||||
| 212 | )
| 0-929320 | ||||||||||||||||||||||||
| 213 | memcpy(out, bm->data, ret); | - | ||||||||||||||||||||||||
| 214 | bm->length -= ret; | - | ||||||||||||||||||||||||
| 215 | bm->data += ret; | - | ||||||||||||||||||||||||
| 216 | } executed 862038 times by 1 test: else if (bm->length == 0end of blockExecuted by:
| 0-862038 | ||||||||||||||||||||||||
| 217 | ret = b->num; | - | ||||||||||||||||||||||||
| 218 | if (ret != 0
| 30279-37003 | ||||||||||||||||||||||||
| 219 | BIO_set_flags(b, (0x01|0x08)); executed 30279 times by 1 test: BIO_set_flags(b, (0x01|0x08));Executed by:
| 30279 | ||||||||||||||||||||||||
| 220 | } executed 67282 times by 1 test: end of blockExecuted by:
| 67282 | ||||||||||||||||||||||||
| 221 | return executed 929320 times by 1 test: ret;return ret;Executed by:
executed 929320 times by 1 test: return ret;Executed by:
| 929320 | ||||||||||||||||||||||||
| 222 | } | - | ||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | static int mem_write(BIO *b, const char *in, int inl) | - | ||||||||||||||||||||||||
| 225 | { | - | ||||||||||||||||||||||||
| 226 | int ret = -1; | - | ||||||||||||||||||||||||
| 227 | int blen; | - | ||||||||||||||||||||||||
| 228 | BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)b->ptr; | - | ||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||
| 230 | if (in ==
| 0-328234 | ||||||||||||||||||||||||
| 231 | ((void *)0)
| 0-328234 | ||||||||||||||||||||||||
| 232 | ) { | - | ||||||||||||||||||||||||
| 233 | ERR_put_error(32,(117),(115),__FILE__,211); | - | ||||||||||||||||||||||||
| 234 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 235 | } | - | ||||||||||||||||||||||||
| 236 | if (b->flags & 0x200
| 0-328234 | ||||||||||||||||||||||||
| 237 | ERR_put_error(32,(117),(126),__FILE__,215); | - | ||||||||||||||||||||||||
| 238 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||
| 240 | BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
| 241 | if (inl == 0
| 0-328234 | ||||||||||||||||||||||||
| 242 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 243 | blen = bbm->readp->length; | - | ||||||||||||||||||||||||
| 244 | mem_buf_sync(b); | - | ||||||||||||||||||||||||
| 245 | if (BUF_MEM_grow_clean(bbm->buf, blen + inl) == 0
| 0-328234 | ||||||||||||||||||||||||
| 246 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||||||||
| 247 | memcpy(bbm->buf->data + blen, in, inl); | - | ||||||||||||||||||||||||
| 248 | *bbm->readp = *bbm->buf; | - | ||||||||||||||||||||||||
| 249 | ret = inl; | - | ||||||||||||||||||||||||
| 250 | end: code before this statement executed 328234 times by 1 test: end:Executed by:
| 328234 | ||||||||||||||||||||||||
| 251 | return executed 328234 times by 1 test: ret;return ret;Executed by:
executed 328234 times by 1 test: return ret;Executed by:
| 328234 | ||||||||||||||||||||||||
| 252 | } | - | ||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||
| 254 | static long mem_ctrl(BIO *b, int cmd, long num, void *ptr) | - | ||||||||||||||||||||||||
| 255 | { | - | ||||||||||||||||||||||||
| 256 | long ret = 1; | - | ||||||||||||||||||||||||
| 257 | char **pptr; | - | ||||||||||||||||||||||||
| 258 | BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)b->ptr; | - | ||||||||||||||||||||||||
| 259 | BUF_MEM *bm; | - | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | switch (cmd) { | - | ||||||||||||||||||||||||
| 262 | case executed 1974 times by 1 test: 1:case 1:Executed by:
executed 1974 times by 1 test: case 1:Executed by:
| 1974 | ||||||||||||||||||||||||
| 263 | bm = bbm->buf; | - | ||||||||||||||||||||||||
| 264 | if (bm->data !=
| 6-1968 | ||||||||||||||||||||||||
| 265 | ((void *)0)
| 6-1968 | ||||||||||||||||||||||||
| 266 | ) { | - | ||||||||||||||||||||||||
| 267 | - | |||||||||||||||||||||||||
| 268 | if ((
| 0-1968 | ||||||||||||||||||||||||
| 269 | bm->length = bm->max; | - | ||||||||||||||||||||||||
| 270 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 271 | memset(bm->data, 0, bm->max); | - | ||||||||||||||||||||||||
| 272 | bm->length = 0; | - | ||||||||||||||||||||||||
| 273 | } executed 1968 times by 1 test: end of blockExecuted by:
| 1968 | ||||||||||||||||||||||||
| 274 | *bbm->readp = *bbm->buf; | - | ||||||||||||||||||||||||
| 275 | } executed 1968 times by 1 test: end of blockExecuted by:
| 1968 | ||||||||||||||||||||||||
| 276 | break; executed 1974 times by 1 test: break;Executed by:
| 1974 | ||||||||||||||||||||||||
| 277 | case never executed: 2:case 2:never executed: case 2: | 0 | ||||||||||||||||||||||||
| 278 | bm = bbm->readp; | - | ||||||||||||||||||||||||
| 279 | ret = (long)(bm->length == 0); | - | ||||||||||||||||||||||||
| 280 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 281 | case executed 927 times by 1 test: 130:case 130:Executed by:
executed 927 times by 1 test: case 130:Executed by:
| 927 | ||||||||||||||||||||||||
| 282 | b->num = (int)num; | - | ||||||||||||||||||||||||
| 283 | break; executed 927 times by 1 test: break;Executed by:
| 927 | ||||||||||||||||||||||||
| 284 | case executed 23655 times by 1 test: 3:case 3:Executed by:
executed 23655 times by 1 test: case 3:Executed by:
| 23655 | ||||||||||||||||||||||||
| 285 | bm = bbm->readp; | - | ||||||||||||||||||||||||
| 286 | ret = (long)bm->length; | - | ||||||||||||||||||||||||
| 287 | if (ptr !=
| 5424-18231 | ||||||||||||||||||||||||
| 288 | ((void *)0)
| 5424-18231 | ||||||||||||||||||||||||
| 289 | ) { | - | ||||||||||||||||||||||||
| 290 | pptr = (char **)ptr; | - | ||||||||||||||||||||||||
| 291 | *pptr = (char *)&(bm->data[0]); | - | ||||||||||||||||||||||||
| 292 | } executed 5424 times by 1 test: end of blockExecuted by:
| 5424 | ||||||||||||||||||||||||
| 293 | break; executed 23655 times by 1 test: break;Executed by:
| 23655 | ||||||||||||||||||||||||
| 294 | case never executed: 114:case 114:never executed: case 114: | 0 | ||||||||||||||||||||||||
| 295 | mem_buf_free(b, 0); | - | ||||||||||||||||||||||||
| 296 | b->shutdown = (int)num; | - | ||||||||||||||||||||||||
| 297 | bbm->buf = ptr; | - | ||||||||||||||||||||||||
| 298 | *bbm->readp = *bbm->buf; | - | ||||||||||||||||||||||||
| 299 | b->ptr = bbm; | - | ||||||||||||||||||||||||
| 300 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 301 | case executed 18238 times by 1 test: 115:case 115:Executed by:
executed 18238 times by 1 test: case 115:Executed by:
| 18238 | ||||||||||||||||||||||||
| 302 | if (ptr !=
| 0-18238 | ||||||||||||||||||||||||
| 303 | ((void *)0)
| 0-18238 | ||||||||||||||||||||||||
| 304 | ) { | - | ||||||||||||||||||||||||
| 305 | mem_buf_sync(b); | - | ||||||||||||||||||||||||
| 306 | bm = bbm->readp; | - | ||||||||||||||||||||||||
| 307 | pptr = (char **)ptr; | - | ||||||||||||||||||||||||
| 308 | *pptr = (char *)bm; | - | ||||||||||||||||||||||||
| 309 | } executed 18238 times by 1 test: end of blockExecuted by:
| 18238 | ||||||||||||||||||||||||
| 310 | break; executed 18238 times by 1 test: break;Executed by:
| 18238 | ||||||||||||||||||||||||
| 311 | case never executed: 8:case 8:never executed: case 8: | 0 | ||||||||||||||||||||||||
| 312 | ret = (long)b->shutdown; | - | ||||||||||||||||||||||||
| 313 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 314 | case executed 9057 times by 1 test: 9:case 9:Executed by:
executed 9057 times by 1 test: case 9:Executed by:
| 9057 | ||||||||||||||||||||||||
| 315 | b->shutdown = (int)num; | - | ||||||||||||||||||||||||
| 316 | break; executed 9057 times by 1 test: break;Executed by:
| 9057 | ||||||||||||||||||||||||
| 317 | case executed 483 times by 1 test: 13:case 13:Executed by:
executed 483 times by 1 test: case 13:Executed by:
| 483 | ||||||||||||||||||||||||
| 318 | ret = 0L; | - | ||||||||||||||||||||||||
| 319 | break; executed 483 times by 1 test: break;Executed by:
| 483 | ||||||||||||||||||||||||
| 320 | case executed 1564 times by 1 test: 10:case 10:Executed by:
executed 1564 times by 1 test: case 10:Executed by:
| 1564 | ||||||||||||||||||||||||
| 321 | bm = bbm->readp; | - | ||||||||||||||||||||||||
| 322 | ret = (long)bm->length; | - | ||||||||||||||||||||||||
| 323 | break; executed 1564 times by 1 test: break;Executed by:
| 1564 | ||||||||||||||||||||||||
| 324 | case never executed: 12:case 12:never executed: case 12: | 0 | ||||||||||||||||||||||||
| 325 | case executed 17065 times by 1 test: 11:case 11:Executed by:
executed 17065 times by 1 test: case 11:Executed by:
| 17065 | ||||||||||||||||||||||||
| 326 | ret = 1; | - | ||||||||||||||||||||||||
| 327 | break; executed 17065 times by 1 test: break;Executed by:
| 17065 | ||||||||||||||||||||||||
| 328 | case executed 45670 times by 1 test: 6:case 6:Executed by:
executed 45670 times by 1 test: case 6:Executed by:
| 45670 | ||||||||||||||||||||||||
| 329 | case executed 8620 times by 1 test: 7:case 7:Executed by:
executed 8620 times by 1 test: case 7:Executed by:
| 8620 | ||||||||||||||||||||||||
| 330 | default executed 7648 times by 1 test: :default:Executed by:
executed 7648 times by 1 test: default:Executed by:
| 7648 | ||||||||||||||||||||||||
| 331 | ret = 0; | - | ||||||||||||||||||||||||
| 332 | break; executed 61938 times by 1 test: break;Executed by:
| 61938 | ||||||||||||||||||||||||
| 333 | } | - | ||||||||||||||||||||||||
| 334 | return executed 134901 times by 1 test: ret;return ret;Executed by:
executed 134901 times by 1 test: return ret;Executed by:
| 134901 | ||||||||||||||||||||||||
| 335 | } | - | ||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||
| 337 | static int mem_gets(BIO *bp, char *buf, int size) | - | ||||||||||||||||||||||||
| 338 | { | - | ||||||||||||||||||||||||
| 339 | int i, j; | - | ||||||||||||||||||||||||
| 340 | int ret = -1; | - | ||||||||||||||||||||||||
| 341 | char *p; | - | ||||||||||||||||||||||||
| 342 | BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)bp->ptr; | - | ||||||||||||||||||||||||
| 343 | BUF_MEM *bm = bbm->readp; | - | ||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||
| 345 | BIO_clear_flags(bp, ((0x01|0x02|0x04)|0x08)); | - | ||||||||||||||||||||||||
| 346 | j = bm->length; | - | ||||||||||||||||||||||||
| 347 | if ((
| 57017-73714 | ||||||||||||||||||||||||
| 348 | j = size - 1; executed 73714 times by 1 test: j = size - 1;Executed by:
| 73714 | ||||||||||||||||||||||||
| 349 | if (j <= 0
| 591-130140 | ||||||||||||||||||||||||
| 350 | *buf = '\0'; | - | ||||||||||||||||||||||||
| 351 | return executed 591 times by 1 test: 0;return 0;Executed by:
executed 591 times by 1 test: return 0;Executed by:
| 591 | ||||||||||||||||||||||||
| 352 | } | - | ||||||||||||||||||||||||
| 353 | p = bm->data; | - | ||||||||||||||||||||||||
| 354 | for (i = 0; i < j
| 402-5014074 | ||||||||||||||||||||||||
| 355 | if (p[i] == '\n'
| 129738-4884336 | ||||||||||||||||||||||||
| 356 | i++; | - | ||||||||||||||||||||||||
| 357 | break; executed 129738 times by 1 test: break;Executed by:
| 129738 | ||||||||||||||||||||||||
| 358 | } | - | ||||||||||||||||||||||||
| 359 | } executed 4884336 times by 1 test: end of blockExecuted by:
| 4884336 | ||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | i = mem_read(bp, buf, i); | - | ||||||||||||||||||||||||
| 367 | if (i > 0
| 0-130140 | ||||||||||||||||||||||||
| 368 | buf[i] = '\0'; executed 130140 times by 1 test: buf[i] = '\0';Executed by:
| 130140 | ||||||||||||||||||||||||
| 369 | ret = i; | - | ||||||||||||||||||||||||
| 370 | return executed 130140 times by 1 test: ret;return ret;Executed by:
executed 130140 times by 1 test: return ret;Executed by:
| 130140 | ||||||||||||||||||||||||
| 371 | } | - | ||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||
| 373 | static int mem_puts(BIO *bp, const char *str) | - | ||||||||||||||||||||||||
| 374 | { | - | ||||||||||||||||||||||||
| 375 | int n, ret; | - | ||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | n = strlen(str); | - | ||||||||||||||||||||||||
| 378 | ret = mem_write(bp, str, n); | - | ||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||
| 380 | return executed 263329 times by 1 test: ret;return ret;Executed by:
executed 263329 times by 1 test: return ret;Executed by:
| 263329 | ||||||||||||||||||||||||
| 381 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |