| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bio/bio_meth.c | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | CRYPTO_RWLOCK *bio_type_lock = | - | ||||||||||||
| 3 | ((void *)0) | - | ||||||||||||
| 4 | ; | - | ||||||||||||
| 5 | static CRYPTO_ONCE bio_type_init = | - | ||||||||||||
| 6 | 0 | - | ||||||||||||
| 7 | ; | - | ||||||||||||
| 8 | - | |||||||||||||
| 9 | static int do_bio_type_init(void); static int do_bio_type_init_ossl_ret_ = 0; static void do_bio_type_init_ossl_(void) { do_bio_type_init_ossl_ret_ = do_bio_type_init(); } never executed: static int do_bio_type_init(void) end of block | 0 | ||||||||||||
| 10 | { | - | ||||||||||||
| 11 | bio_type_lock = CRYPTO_THREAD_lock_new(); | - | ||||||||||||
| 12 | return never executed: bio_type_lock != return bio_type_lock != ((void *)0) ;never executed:  return bio_type_lock != ((void *)0) ; | 0 | ||||||||||||
| 13 | ((void *)0) never executed:  return bio_type_lock != ((void *)0) ; | 0 | ||||||||||||
| 14 | ; never executed:  return bio_type_lock != ((void *)0) ; | 0 | ||||||||||||
| 15 | } | - | ||||||||||||
| 16 | - | |||||||||||||
| 17 | int BIO_get_new_index(void) | - | ||||||||||||
| 18 | { | - | ||||||||||||
| 19 | static CRYPTO_REF_COUNT bio_count = 128; | - | ||||||||||||
| 20 | int newval; | - | ||||||||||||
| 21 | - | |||||||||||||
| 22 | if (!(CRYPTO_THREAD_run_once(&bio_type_init, do_bio_type_init_ossl_) 
 
 | 0 | ||||||||||||
| 23 | ERR_put_error(32,(102),((1|64)),__FILE__,28); | - | ||||||||||||
| 24 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||
| 25 | } | - | ||||||||||||
| 26 | if (!CRYPTO_UP_REF(&bio_count, &newval, bio_type_lock) 
 | 0 | ||||||||||||
| 27 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||
| 28 | return never executed: newval; return newval;never executed:  return newval; | 0 | ||||||||||||
| 29 | } | - | ||||||||||||
| 30 | - | |||||||||||||
| 31 | BIO_METHOD *BIO_meth_new(int type, const char *name) | - | ||||||||||||
| 32 | { | - | ||||||||||||
| 33 | BIO_METHOD *biom = CRYPTO_zalloc(sizeof(BIO_METHOD), __FILE__, 38); | - | ||||||||||||
| 34 | - | |||||||||||||
| 35 | if (biom == 
 | 0-1502 | ||||||||||||
| 36 | ((void *)0) 
 | 0-1502 | ||||||||||||
| 37 | - | |||||||||||||
| 38 | || ( 
 
 | 0-1502 | ||||||||||||
| 39 | ((void *)0) 
 | 0-1502 | ||||||||||||
| 40 | ) { | - | ||||||||||||
| 41 | CRYPTO_free(biom, __FILE__, 42); | - | ||||||||||||
| 42 | ERR_put_error(32,(146),((1|64)),__FILE__,43); | - | ||||||||||||
| 43 | return never executed:  return ((void *)0) ;never executed:  return ((void *)0) ; | 0 | ||||||||||||
| 44 | ((void *)0) never executed:  return ((void *)0) ; | 0 | ||||||||||||
| 45 | ; never executed:  return ((void *)0) ; | 0 | ||||||||||||
| 46 | } | - | ||||||||||||
| 47 | biom->type = type; | - | ||||||||||||
| 48 | return executed 1502 times by 12 tests: biom; return biom;Executed by: 
 executed 1502 times by 12 tests:  return biom;Executed by: 
 | 1502 | ||||||||||||
| 49 | } | - | ||||||||||||
| 50 | - | |||||||||||||
| 51 | void BIO_meth_free(BIO_METHOD *biom) | - | ||||||||||||
| 52 | { | - | ||||||||||||
| 53 | if (biom != 
 | 450-1346 | ||||||||||||
| 54 | ((void *)0) 
 | 450-1346 | ||||||||||||
| 55 | ) { | - | ||||||||||||
| 56 | CRYPTO_free(biom->name, __FILE__, 53); | - | ||||||||||||
| 57 | CRYPTO_free(biom, __FILE__, 54); | - | ||||||||||||
| 58 | } executed 1346 times by 1 test:  end of blockExecuted by: 
 | 1346 | ||||||||||||
| 59 | } executed 1796 times by 1 test:  end of blockExecuted by: 
 | 1796 | ||||||||||||
| 60 | - | |||||||||||||
| 61 | int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int) | - | ||||||||||||
| 62 | { | - | ||||||||||||
| 63 | return never executed: biom->bwrite_old; return biom->bwrite_old;never executed:  return biom->bwrite_old; | 0 | ||||||||||||
| 64 | } | - | ||||||||||||
| 65 | - | |||||||||||||
| 66 | int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t, | - | ||||||||||||
| 67 | size_t *) | - | ||||||||||||
| 68 | { | - | ||||||||||||
| 69 | return never executed: biom->bwrite; return biom->bwrite;never executed:  return biom->bwrite; | 0 | ||||||||||||
| 70 | } | - | ||||||||||||
| 71 | - | |||||||||||||
| 72 | - | |||||||||||||
| 73 | int bwrite_conv(BIO *bio, const char *data, size_t datal, size_t *written) | - | ||||||||||||
| 74 | { | - | ||||||||||||
| 75 | int ret; | - | ||||||||||||
| 76 | - | |||||||||||||
| 77 | if (datal > 0x7fffffff 
 | 0-13179310 | ||||||||||||
| 78 | datal = 0x7fffffff; never executed:  datal = 0x7fffffff; | 0 | ||||||||||||
| 79 | - | |||||||||||||
| 80 | ret = bio->method->bwrite_old(bio, data, (int)datal); | - | ||||||||||||
| 81 | - | |||||||||||||
| 82 | if (ret <= 0 
 | 1064-13178246 | ||||||||||||
| 83 | *written = 0; | - | ||||||||||||
| 84 | return executed 1064 times by 1 test: ret; return ret;Executed by: 
 executed 1064 times by 1 test:  return ret;Executed by: 
 | 1064 | ||||||||||||
| 85 | } | - | ||||||||||||
| 86 | - | |||||||||||||
| 87 | *written = (size_t)ret; | - | ||||||||||||
| 88 | - | |||||||||||||
| 89 | return executed 13178246 times by 12 tests: 1; return 1;Executed by: 
 executed 13178246 times by 12 tests:  return 1;Executed by: 
 | 13178246 | ||||||||||||
| 90 | } | - | ||||||||||||
| 91 | - | |||||||||||||
| 92 | int BIO_meth_set_write(BIO_METHOD *biom, | - | ||||||||||||
| 93 | int (*bwrite) (BIO *, const char *, int)) | - | ||||||||||||
| 94 | { | - | ||||||||||||
| 95 | biom->bwrite_old = bwrite; | - | ||||||||||||
| 96 | biom->bwrite = bwrite_conv; | - | ||||||||||||
| 97 | return executed 7 times by 1 test: 1; return 1;Executed by: 
 executed 7 times by 1 test:  return 1;Executed by: 
 | 7 | ||||||||||||
| 98 | } | - | ||||||||||||
| 99 | - | |||||||||||||
| 100 | int BIO_meth_set_write_ex(BIO_METHOD *biom, | - | ||||||||||||
| 101 | int (*bwrite) (BIO *, const char *, size_t, size_t *)) | - | ||||||||||||
| 102 | { | - | ||||||||||||
| 103 | biom->bwrite_old = | - | ||||||||||||
| 104 | ((void *)0) | - | ||||||||||||
| 105 | ; | - | ||||||||||||
| 106 | biom->bwrite = bwrite; | - | ||||||||||||
| 107 | return executed 1495 times by 12 tests: 1; return 1;Executed by: 
 executed 1495 times by 12 tests:  return 1;Executed by: 
 | 1495 | ||||||||||||
| 108 | } | - | ||||||||||||
| 109 | - | |||||||||||||
| 110 | int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int) | - | ||||||||||||
| 111 | { | - | ||||||||||||
| 112 | return never executed: biom->bread_old; return biom->bread_old;never executed:  return biom->bread_old; | 0 | ||||||||||||
| 113 | } | - | ||||||||||||
| 114 | - | |||||||||||||
| 115 | int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *) | - | ||||||||||||
| 116 | { | - | ||||||||||||
| 117 | return never executed: biom->bread; return biom->bread;never executed:  return biom->bread; | 0 | ||||||||||||
| 118 | } | - | ||||||||||||
| 119 | - | |||||||||||||
| 120 | - | |||||||||||||
| 121 | int bread_conv(BIO *bio, char *data, size_t datal, size_t *readbytes) | - | ||||||||||||
| 122 | { | - | ||||||||||||
| 123 | int ret; | - | ||||||||||||
| 124 | - | |||||||||||||
| 125 | if (datal > 0x7fffffff 
 | 0-1082919 | ||||||||||||
| 126 | datal = 0x7fffffff; never executed:  datal = 0x7fffffff; | 0 | ||||||||||||
| 127 | - | |||||||||||||
| 128 | ret = bio->method->bread_old(bio, data, (int)datal); | - | ||||||||||||
| 129 | - | |||||||||||||
| 130 | if (ret <= 0 
 | 104291-978628 | ||||||||||||
| 131 | *readbytes = 0; | - | ||||||||||||
| 132 | return executed 104291 times by 1 test: ret; return ret;Executed by: 
 executed 104291 times by 1 test:  return ret;Executed by: 
 | 104291 | ||||||||||||
| 133 | } | - | ||||||||||||
| 134 | - | |||||||||||||
| 135 | *readbytes = (size_t)ret; | - | ||||||||||||
| 136 | - | |||||||||||||
| 137 | return executed 978628 times by 1 test: 1; return 1;Executed by: 
 executed 978628 times by 1 test:  return 1;Executed by: 
 | 978628 | ||||||||||||
| 138 | } | - | ||||||||||||
| 139 | - | |||||||||||||
| 140 | int BIO_meth_set_read(BIO_METHOD *biom, | - | ||||||||||||
| 141 | int (*bread) (BIO *, char *, int)) | - | ||||||||||||
| 142 | { | - | ||||||||||||
| 143 | biom->bread_old = bread; | - | ||||||||||||
| 144 | biom->bread = bread_conv; | - | ||||||||||||
| 145 | return executed 7 times by 1 test: 1; return 1;Executed by: 
 executed 7 times by 1 test:  return 1;Executed by: 
 | 7 | ||||||||||||
| 146 | } | - | ||||||||||||
| 147 | - | |||||||||||||
| 148 | int BIO_meth_set_read_ex(BIO_METHOD *biom, | - | ||||||||||||
| 149 | int (*bread) (BIO *, char *, size_t, size_t *)) | - | ||||||||||||
| 150 | { | - | ||||||||||||
| 151 | biom->bread_old = | - | ||||||||||||
| 152 | ((void *)0) | - | ||||||||||||
| 153 | ; | - | ||||||||||||
| 154 | biom->bread = bread; | - | ||||||||||||
| 155 | return executed 1495 times by 12 tests: 1; return 1;Executed by: 
 executed 1495 times by 12 tests:  return 1;Executed by: 
 | 1495 | ||||||||||||
| 156 | } | - | ||||||||||||
| 157 | - | |||||||||||||
| 158 | int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *) | - | ||||||||||||
| 159 | { | - | ||||||||||||
| 160 | return never executed: biom->bputs; return biom->bputs;never executed:  return biom->bputs; | 0 | ||||||||||||
| 161 | } | - | ||||||||||||
| 162 | - | |||||||||||||
| 163 | int BIO_meth_set_puts(BIO_METHOD *biom, | - | ||||||||||||
| 164 | int (*bputs) (BIO *, const char *)) | - | ||||||||||||
| 165 | { | - | ||||||||||||
| 166 | biom->bputs = bputs; | - | ||||||||||||
| 167 | return executed 1502 times by 12 tests: 1; return 1;Executed by: 
 executed 1502 times by 12 tests:  return 1;Executed by: 
 | 1502 | ||||||||||||
| 168 | } | - | ||||||||||||
| 169 | - | |||||||||||||
| 170 | int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int) | - | ||||||||||||
| 171 | { | - | ||||||||||||
| 172 | return never executed: biom->bgets; return biom->bgets;never executed:  return biom->bgets; | 0 | ||||||||||||
| 173 | } | - | ||||||||||||
| 174 | - | |||||||||||||
| 175 | int BIO_meth_set_gets(BIO_METHOD *biom, | - | ||||||||||||
| 176 | int (*bgets) (BIO *, char *, int)) | - | ||||||||||||
| 177 | { | - | ||||||||||||
| 178 | biom->bgets = bgets; | - | ||||||||||||
| 179 | return executed 1502 times by 12 tests: 1; return 1;Executed by: 
 executed 1502 times by 12 tests:  return 1;Executed by: 
 | 1502 | ||||||||||||
| 180 | } | - | ||||||||||||
| 181 | - | |||||||||||||
| 182 | long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *) | - | ||||||||||||
| 183 | { | - | ||||||||||||
| 184 | return never executed: biom->ctrl; return biom->ctrl;never executed:  return biom->ctrl; | 0 | ||||||||||||
| 185 | } | - | ||||||||||||
| 186 | - | |||||||||||||
| 187 | int BIO_meth_set_ctrl(BIO_METHOD *biom, | - | ||||||||||||
| 188 | long (*ctrl) (BIO *, int, long, void *)) | - | ||||||||||||
| 189 | { | - | ||||||||||||
| 190 | biom->ctrl = ctrl; | - | ||||||||||||
| 191 | return executed 1502 times by 12 tests: 1; return 1;Executed by: 
 executed 1502 times by 12 tests:  return 1;Executed by: 
 | 1502 | ||||||||||||
| 192 | } | - | ||||||||||||
| 193 | - | |||||||||||||
| 194 | int (*BIO_meth_get_create(const BIO_METHOD *biom)) (BIO *) | - | ||||||||||||
| 195 | { | - | ||||||||||||
| 196 | return never executed: biom->create; return biom->create;never executed:  return biom->create; | 0 | ||||||||||||
| 197 | } | - | ||||||||||||
| 198 | - | |||||||||||||
| 199 | int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)) | - | ||||||||||||
| 200 | { | - | ||||||||||||
| 201 | biom->create = create; | - | ||||||||||||
| 202 | return executed 1502 times by 12 tests: 1; return 1;Executed by: 
 executed 1502 times by 12 tests:  return 1;Executed by: 
 | 1502 | ||||||||||||
| 203 | } | - | ||||||||||||
| 204 | - | |||||||||||||
| 205 | int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *) | - | ||||||||||||
| 206 | { | - | ||||||||||||
| 207 | return never executed: biom->destroy; return biom->destroy;never executed:  return biom->destroy; | 0 | ||||||||||||
| 208 | } | - | ||||||||||||
| 209 | - | |||||||||||||
| 210 | int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)) | - | ||||||||||||
| 211 | { | - | ||||||||||||
| 212 | biom->destroy = destroy; | - | ||||||||||||
| 213 | return executed 1502 times by 12 tests: 1; return 1;Executed by: 
 executed 1502 times by 12 tests:  return 1;Executed by: 
 | 1502 | ||||||||||||
| 214 | } | - | ||||||||||||
| 215 | - | |||||||||||||
| 216 | long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) (BIO *, int, BIO_info_cb *) | - | ||||||||||||
| 217 | { | - | ||||||||||||
| 218 | return never executed: biom->callback_ctrl; return biom->callback_ctrl;never executed:  return biom->callback_ctrl; | 0 | ||||||||||||
| 219 | } | - | ||||||||||||
| 220 | - | |||||||||||||
| 221 | int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, | - | ||||||||||||
| 222 | long (*callback_ctrl) (BIO *, int, | - | ||||||||||||
| 223 | BIO_info_cb *)) | - | ||||||||||||
| 224 | { | - | ||||||||||||
| 225 | biom->callback_ctrl = callback_ctrl; | - | ||||||||||||
| 226 | return executed 1495 times by 12 tests: 1; return 1;Executed by: 
 executed 1495 times by 12 tests:  return 1;Executed by: 
 | 1495 | ||||||||||||
| 227 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |