| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ex_data.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | struct ex_callback_st { | - | ||||||||||||
| 7 | long argl; | - | ||||||||||||
| 8 | void *argp; | - | ||||||||||||
| 9 | CRYPTO_EX_new *new_func; | - | ||||||||||||
| 10 | CRYPTO_EX_free *free_func; | - | ||||||||||||
| 11 | CRYPTO_EX_dup *dup_func; | - | ||||||||||||
| 12 | }; | - | ||||||||||||
| 13 | - | |||||||||||||
| 14 | - | |||||||||||||
| 15 | - | |||||||||||||
| 16 | - | |||||||||||||
| 17 | - | |||||||||||||
| 18 | typedef struct ex_callbacks_st { | - | ||||||||||||
| 19 | struct stack_st_EX_CALLBACK *meth; | - | ||||||||||||
| 20 | } EX_CALLBACKS; | - | ||||||||||||
| 21 | - | |||||||||||||
| 22 | static EX_CALLBACKS ex_data[16]; | - | ||||||||||||
| 23 | - | |||||||||||||
| 24 | static CRYPTO_RWLOCK *ex_data_lock = | - | ||||||||||||
| 25 | ((void *)0) | - | ||||||||||||
| 26 | ; | - | ||||||||||||
| 27 | static CRYPTO_ONCE ex_data_init = | - | ||||||||||||
| 28 | 0 | - | ||||||||||||
| 29 | ; | - | ||||||||||||
| 30 | - | |||||||||||||
| 31 | static int do_ex_data_init(void); static int do_ex_data_init_ossl_ret_ = 0; static void do_ex_data_init_ossl_(void) { do_ex_data_init_ossl_ret_ = do_ex_data_init(); } executed 2072 times by 12 tests: static int do_ex_data_init(void)end of blockExecuted by:
| 2072 | ||||||||||||
| 32 | { | - | ||||||||||||
| 33 | if (!OPENSSL_init_crypto(0,
| 0-2072 | ||||||||||||
| 34 | ((void *)0)
| 0-2072 | ||||||||||||
| 35 | )
| 0-2072 | ||||||||||||
| 36 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 37 | ex_data_lock = CRYPTO_THREAD_lock_new(); | - | ||||||||||||
| 38 | return executed 2072 times by 12 tests: ex_data_lock != return ex_data_lock != ((void *)0) ;Executed by:
executed 2072 times by 12 tests: return ex_data_lock != ((void *)0) ;Executed by:
| 2072 | ||||||||||||
| 39 | ((void *)0) executed 2072 times by 12 tests: return ex_data_lock != ((void *)0) ;Executed by:
| 2072 | ||||||||||||
| 40 | ; executed 2072 times by 12 tests: return ex_data_lock != ((void *)0) ;Executed by:
| 2072 | ||||||||||||
| 41 | } | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | - | |||||||||||||
| 44 | - | |||||||||||||
| 45 | - | |||||||||||||
| 46 | - | |||||||||||||
| 47 | static EX_CALLBACKS *get_and_lock(int class_index) | - | ||||||||||||
| 48 | { | - | ||||||||||||
| 49 | EX_CALLBACKS *ip; | - | ||||||||||||
| 50 | - | |||||||||||||
| 51 | if (class_index < 0
| 0-771175 | ||||||||||||
| 52 | ERR_put_error(15,(113),((7)),__FILE__,55); | - | ||||||||||||
| 53 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 54 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 55 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 56 | } | - | ||||||||||||
| 57 | - | |||||||||||||
| 58 | if (!(CRYPTO_THREAD_run_once(&ex_data_init, do_ex_data_init_ossl_)
| 0-771175 | ||||||||||||
| 59 | ERR_put_error(15,(113),((1|64)),__FILE__,60); | - | ||||||||||||
| 60 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 61 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 62 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 63 | } | - | ||||||||||||
| 64 | - | |||||||||||||
| 65 | if (ex_data_lock ==
| 0-771175 | ||||||||||||
| 66 | ((void *)0)
| 0-771175 | ||||||||||||
| 67 | ) { | - | ||||||||||||
| 68 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 69 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 70 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 71 | } | - | ||||||||||||
| 72 | - | |||||||||||||
| 73 | ip = &ex_data[class_index]; | - | ||||||||||||
| 74 | CRYPTO_THREAD_write_lock(ex_data_lock); | - | ||||||||||||
| 75 | return executed 771175 times by 12 tests: ip;return ip;Executed by:
executed 771175 times by 12 tests: return ip;Executed by:
| 771175 | ||||||||||||
| 76 | } | - | ||||||||||||
| 77 | - | |||||||||||||
| 78 | static void cleanup_cb(EX_CALLBACK *funcs) | - | ||||||||||||
| 79 | { | - | ||||||||||||
| 80 | CRYPTO_free(funcs, __FILE__, 84); | - | ||||||||||||
| 81 | } executed 2122 times by 1 test: end of blockExecuted by:
| 2122 | ||||||||||||
| 82 | - | |||||||||||||
| 83 | - | |||||||||||||
| 84 | - | |||||||||||||
| 85 | - | |||||||||||||
| 86 | - | |||||||||||||
| 87 | - | |||||||||||||
| 88 | - | |||||||||||||
| 89 | void crypto_cleanup_all_ex_data_int(void) | - | ||||||||||||
| 90 | { | - | ||||||||||||
| 91 | int i; | - | ||||||||||||
| 92 | - | |||||||||||||
| 93 | for (i = 0; i < 16
| 2076-33216 | ||||||||||||
| 94 | EX_CALLBACKS *ip = &ex_data[i]; | - | ||||||||||||
| 95 | - | |||||||||||||
| 96 | sk_EX_CALLBACK_pop_free(ip->meth, cleanup_cb); | - | ||||||||||||
| 97 | ip->meth = | - | ||||||||||||
| 98 | ((void *)0) | - | ||||||||||||
| 99 | ; | - | ||||||||||||
| 100 | } executed 33216 times by 12 tests: end of blockExecuted by:
| 33216 | ||||||||||||
| 101 | - | |||||||||||||
| 102 | CRYPTO_THREAD_lock_free(ex_data_lock); | - | ||||||||||||
| 103 | ex_data_lock = | - | ||||||||||||
| 104 | ((void *)0) | - | ||||||||||||
| 105 | ; | - | ||||||||||||
| 106 | } executed 2076 times by 12 tests: end of blockExecuted by:
| 2076 | ||||||||||||
| 107 | - | |||||||||||||
| 108 | - | |||||||||||||
| 109 | - | |||||||||||||
| 110 | - | |||||||||||||
| 111 | - | |||||||||||||
| 112 | - | |||||||||||||
| 113 | static void dummy_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, | - | ||||||||||||
| 114 | long argl, void *argp) | - | ||||||||||||
| 115 | { | - | ||||||||||||
| 116 | } | - | ||||||||||||
| 117 | - | |||||||||||||
| 118 | static void dummy_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, | - | ||||||||||||
| 119 | long argl, void *argp) | - | ||||||||||||
| 120 | { | - | ||||||||||||
| 121 | } | - | ||||||||||||
| 122 | - | |||||||||||||
| 123 | static int dummy_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, | - | ||||||||||||
| 124 | void *from_d, int idx, | - | ||||||||||||
| 125 | long argl, void *argp) | - | ||||||||||||
| 126 | { | - | ||||||||||||
| 127 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 128 | } | - | ||||||||||||
| 129 | - | |||||||||||||
| 130 | int CRYPTO_free_ex_index(int class_index, int idx) | - | ||||||||||||
| 131 | { | - | ||||||||||||
| 132 | EX_CALLBACKS *ip = get_and_lock(class_index); | - | ||||||||||||
| 133 | EX_CALLBACK *a; | - | ||||||||||||
| 134 | int toret = 0; | - | ||||||||||||
| 135 | - | |||||||||||||
| 136 | if (ip ==
| 0-8 | ||||||||||||
| 137 | ((void *)0)
| 0-8 | ||||||||||||
| 138 | ) | - | ||||||||||||
| 139 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 140 | if (idx < 0
| 0-8 | ||||||||||||
| 141 | goto executed 8 times by 1 test: err;goto err;Executed by:
executed 8 times by 1 test: goto err;Executed by:
| 8 | ||||||||||||
| 142 | a = sk_EX_CALLBACK_value(ip->meth, idx); | - | ||||||||||||
| 143 | if (a ==
| 0 | ||||||||||||
| 144 | ((void *)0)
| 0 | ||||||||||||
| 145 | ) | - | ||||||||||||
| 146 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 147 | a->new_func = dummy_new; | - | ||||||||||||
| 148 | a->dup_func = dummy_dup; | - | ||||||||||||
| 149 | a->free_func = dummy_free; | - | ||||||||||||
| 150 | toret = 1; | - | ||||||||||||
| 151 | err: code before this statement never executed: err: | 0 | ||||||||||||
| 152 | CRYPTO_THREAD_unlock(ex_data_lock); | - | ||||||||||||
| 153 | return executed 8 times by 1 test: toret;return toret;Executed by:
executed 8 times by 1 test: return toret;Executed by:
| 8 | ||||||||||||
| 154 | } | - | ||||||||||||
| 155 | - | |||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | - | |||||||||||||
| 159 | int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, | - | ||||||||||||
| 160 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, | - | ||||||||||||
| 161 | CRYPTO_EX_free *free_func) | - | ||||||||||||
| 162 | { | - | ||||||||||||
| 163 | int toret = -1; | - | ||||||||||||
| 164 | EX_CALLBACK *a; | - | ||||||||||||
| 165 | EX_CALLBACKS *ip = get_and_lock(class_index); | - | ||||||||||||
| 166 | - | |||||||||||||
| 167 | if (ip ==
| 0-2122 | ||||||||||||
| 168 | ((void *)0)
| 0-2122 | ||||||||||||
| 169 | ) | - | ||||||||||||
| 170 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 171 | - | |||||||||||||
| 172 | if (ip->meth ==
| 937-1185 | ||||||||||||
| 173 | ((void *)0)
| 937-1185 | ||||||||||||
| 174 | ) { | - | ||||||||||||
| 175 | ip->meth = sk_EX_CALLBACK_new_null(); | - | ||||||||||||
| 176 | - | |||||||||||||
| 177 | - | |||||||||||||
| 178 | if (ip->meth ==
| 0-937 | ||||||||||||
| 179 | ((void *)0)
| 0-937 | ||||||||||||
| 180 | - | |||||||||||||
| 181 | || !sk_EX_CALLBACK_push(ip->meth,
| 0-937 | ||||||||||||
| 182 | ((void *)0)
| 0-937 | ||||||||||||
| 183 | )
| 0-937 | ||||||||||||
| 184 | ERR_put_error(15,(100),((1|64)),__FILE__,172); | - | ||||||||||||
| 185 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 186 | } | - | ||||||||||||
| 187 | } executed 937 times by 1 test: end of blockExecuted by:
| 937 | ||||||||||||
| 188 | - | |||||||||||||
| 189 | a = (EX_CALLBACK *)CRYPTO_malloc(sizeof(*a), __FILE__, 177); | - | ||||||||||||
| 190 | if (a ==
| 0-2122 | ||||||||||||
| 191 | ((void *)0)
| 0-2122 | ||||||||||||
| 192 | ) { | - | ||||||||||||
| 193 | ERR_put_error(15,(100),((1|64)),__FILE__,179); | - | ||||||||||||
| 194 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 195 | } | - | ||||||||||||
| 196 | a->argl = argl; | - | ||||||||||||
| 197 | a->argp = argp; | - | ||||||||||||
| 198 | a->new_func = new_func; | - | ||||||||||||
| 199 | a->dup_func = dup_func; | - | ||||||||||||
| 200 | a->free_func = free_func; | - | ||||||||||||
| 201 | - | |||||||||||||
| 202 | if (!sk_EX_CALLBACK_push(ip->meth,
| 0-2122 | ||||||||||||
| 203 | ((void *)0)
| 0-2122 | ||||||||||||
| 204 | )
| 0-2122 | ||||||||||||
| 205 | ERR_put_error(15,(100),((1|64)),__FILE__,189); | - | ||||||||||||
| 206 | CRYPTO_free(a, __FILE__, 190); | - | ||||||||||||
| 207 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 208 | } | - | ||||||||||||
| 209 | toret = sk_EX_CALLBACK_num(ip->meth) - 1; | - | ||||||||||||
| 210 | (void)sk_EX_CALLBACK_set(ip->meth, toret, a); | - | ||||||||||||
| 211 | - | |||||||||||||
| 212 | err: code before this statement executed 2122 times by 1 test: err:Executed by:
| 2122 | ||||||||||||
| 213 | CRYPTO_THREAD_unlock(ex_data_lock); | - | ||||||||||||
| 214 | return executed 2122 times by 1 test: toret;return toret;Executed by:
executed 2122 times by 1 test: return toret;Executed by:
| 2122 | ||||||||||||
| 215 | } | - | ||||||||||||
| 216 | int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) | - | ||||||||||||
| 217 | { | - | ||||||||||||
| 218 | int mx, i; | - | ||||||||||||
| 219 | void *ptr; | - | ||||||||||||
| 220 | EX_CALLBACK **storage = | - | ||||||||||||
| 221 | ((void *)0) | - | ||||||||||||
| 222 | ; | - | ||||||||||||
| 223 | EX_CALLBACK *stack[10]; | - | ||||||||||||
| 224 | EX_CALLBACKS *ip = get_and_lock(class_index); | - | ||||||||||||
| 225 | - | |||||||||||||
| 226 | if (ip ==
| 0-381421 | ||||||||||||
| 227 | ((void *)0)
| 0-381421 | ||||||||||||
| 228 | ) | - | ||||||||||||
| 229 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 230 | - | |||||||||||||
| 231 | ad->sk = | - | ||||||||||||
| 232 | ((void *)0) | - | ||||||||||||
| 233 | ; | - | ||||||||||||
| 234 | - | |||||||||||||
| 235 | mx = sk_EX_CALLBACK_num(ip->meth); | - | ||||||||||||
| 236 | if (mx > 0
| 7136-374285 | ||||||||||||
| 237 | if (mx < (int)(sizeof(stack)/sizeof((stack)[0]))
| 2038-5098 | ||||||||||||
| 238 | storage = stack; executed 5098 times by 1 test: storage = stack;Executed by:
| 5098 | ||||||||||||
| 239 | else | - | ||||||||||||
| 240 | storage = CRYPTO_malloc(sizeof(*storage) * mx, __FILE__, 226); executed 2038 times by 1 test: storage = CRYPTO_malloc(sizeof(*storage) * mx, __FILE__, 226);Executed by:
| 2038 | ||||||||||||
| 241 | if (storage !=
| 0-7136 | ||||||||||||
| 242 | ((void *)0)
| 0-7136 | ||||||||||||
| 243 | ) | - | ||||||||||||
| 244 | for (i = 0; i < mx
| 7136-499969 | ||||||||||||
| 245 | storage[i] = sk_EX_CALLBACK_value(ip->meth, i); executed 499969 times by 1 test: storage[i] = sk_EX_CALLBACK_value(ip->meth, i);Executed by:
| 499969 | ||||||||||||
| 246 | } executed 7136 times by 1 test: end of blockExecuted by:
| 7136 | ||||||||||||
| 247 | CRYPTO_THREAD_unlock(ex_data_lock); | - | ||||||||||||
| 248 | - | |||||||||||||
| 249 | if (mx > 0
| 0-374285 | ||||||||||||
| 250 | ((void *)0)
| 0-7136 | ||||||||||||
| 251 | ) { | - | ||||||||||||
| 252 | ERR_put_error(15,(112),((1|64)),__FILE__,234); | - | ||||||||||||
| 253 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 254 | } | - | ||||||||||||
| 255 | for (i = 0; i < mx
| 381421-499969 | ||||||||||||
| 256 | if (storage[i]
| 7-492833 | ||||||||||||
| 257 | ptr = CRYPTO_get_ex_data(ad, i); | - | ||||||||||||
| 258 | storage[i]->new_func(obj, ptr, ad, i, | - | ||||||||||||
| 259 | storage[i]->argl, storage[i]->argp); | - | ||||||||||||
| 260 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||
| 261 | } executed 499969 times by 1 test: end of blockExecuted by:
| 499969 | ||||||||||||
| 262 | if (storage != stack
| 5098-376323 | ||||||||||||
| 263 | CRYPTO_free(storage, __FILE__, 245); executed 376323 times by 12 tests: CRYPTO_free(storage, __FILE__, 245);Executed by:
| 376323 | ||||||||||||
| 264 | return executed 381421 times by 12 tests: 1;return 1;Executed by:
executed 381421 times by 12 tests: return 1;Executed by:
| 381421 | ||||||||||||
| 265 | } | - | ||||||||||||
| 266 | - | |||||||||||||
| 267 | - | |||||||||||||
| 268 | - | |||||||||||||
| 269 | - | |||||||||||||
| 270 | - | |||||||||||||
| 271 | int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, | - | ||||||||||||
| 272 | const CRYPTO_EX_DATA *from) | - | ||||||||||||
| 273 | { | - | ||||||||||||
| 274 | int mx, j, i; | - | ||||||||||||
| 275 | void *ptr; | - | ||||||||||||
| 276 | EX_CALLBACK *stack[10]; | - | ||||||||||||
| 277 | EX_CALLBACK **storage = | - | ||||||||||||
| 278 | ((void *)0) | - | ||||||||||||
| 279 | ; | - | ||||||||||||
| 280 | EX_CALLBACKS *ip; | - | ||||||||||||
| 281 | int toret = 0; | - | ||||||||||||
| 282 | - | |||||||||||||
| 283 | if (from->sk ==
| 1-2890 | ||||||||||||
| 284 | ((void *)0)
| 1-2890 | ||||||||||||
| 285 | ) | - | ||||||||||||
| 286 | - | |||||||||||||
| 287 | return executed 2890 times by 1 test: 1;return 1;Executed by:
executed 2890 times by 1 test: return 1;Executed by:
| 2890 | ||||||||||||
| 288 | if ((
| 0-1 | ||||||||||||
| 289 | ((void *)0)
| 0-1 | ||||||||||||
| 290 | ) | - | ||||||||||||
| 291 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 292 | - | |||||||||||||
| 293 | mx = sk_EX_CALLBACK_num(ip->meth); | - | ||||||||||||
| 294 | j = sk_void_num(from->sk); | - | ||||||||||||
| 295 | if (j < mx
| 0-1 | ||||||||||||
| 296 | mx = j; never executed: mx = j; | 0 | ||||||||||||
| 297 | if (mx > 0
| 0-1 | ||||||||||||
| 298 | if (mx < (int)(sizeof(stack)/sizeof((stack)[0]))
| 0-1 | ||||||||||||
| 299 | storage = stack; executed 1 time by 1 test: storage = stack;Executed by:
| 1 | ||||||||||||
| 300 | else | - | ||||||||||||
| 301 | storage = CRYPTO_malloc(sizeof(*storage) * mx, __FILE__, 277); never executed: storage = CRYPTO_malloc(sizeof(*storage) * mx, __FILE__, 277); | 0 | ||||||||||||
| 302 | if (storage !=
| 0-1 | ||||||||||||
| 303 | ((void *)0)
| 0-1 | ||||||||||||
| 304 | ) | - | ||||||||||||
| 305 | for (i = 0; i < mx
| 1-3 | ||||||||||||
| 306 | storage[i] = sk_EX_CALLBACK_value(ip->meth, i); executed 3 times by 1 test: storage[i] = sk_EX_CALLBACK_value(ip->meth, i);Executed by:
| 3 | ||||||||||||
| 307 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 308 | CRYPTO_THREAD_unlock(ex_data_lock); | - | ||||||||||||
| 309 | - | |||||||||||||
| 310 | if (mx == 0
| 0-1 | ||||||||||||
| 311 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 312 | if (storage ==
| 0-1 | ||||||||||||
| 313 | ((void *)0)
| 0-1 | ||||||||||||
| 314 | ) { | - | ||||||||||||
| 315 | ERR_put_error(15,(110),((1|64)),__FILE__,287); | - | ||||||||||||
| 316 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 317 | } | - | ||||||||||||
| 318 | - | |||||||||||||
| 319 | - | |||||||||||||
| 320 | - | |||||||||||||
| 321 | - | |||||||||||||
| 322 | - | |||||||||||||
| 323 | - | |||||||||||||
| 324 | - | |||||||||||||
| 325 | if (!CRYPTO_set_ex_data(to, mx - 1, CRYPTO_get_ex_data(to, mx - 1))
| 0-1 | ||||||||||||
| 326 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 327 | - | |||||||||||||
| 328 | for (i = 0; i < mx
| 1-3 | ||||||||||||
| 329 | ptr = CRYPTO_get_ex_data(from, i); | - | ||||||||||||
| 330 | if (storage[i]
| 0-2 | ||||||||||||
| 331 | if (!storage[i]->dup_func(to, from, &ptr, i,
| 0-2 | ||||||||||||
| 332 | storage[i]->argl, storage[i]->argp)
| 0-2 | ||||||||||||
| 333 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 334 | CRYPTO_set_ex_data(to, i, ptr); | - | ||||||||||||
| 335 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||
| 336 | toret = 1; | - | ||||||||||||
| 337 | err: code before this statement executed 1 time by 1 test: err:Executed by:
| 1 | ||||||||||||
| 338 | if (storage != stack
| 0-1 | ||||||||||||
| 339 | CRYPTO_free(storage, __FILE__, 311); never executed: CRYPTO_free(storage, __FILE__, 311); | 0 | ||||||||||||
| 340 | return executed 1 time by 1 test: toret;return toret;Executed by:
executed 1 time by 1 test: return toret;Executed by:
| 1 | ||||||||||||
| 341 | } | - | ||||||||||||
| 342 | - | |||||||||||||
| 343 | - | |||||||||||||
| 344 | - | |||||||||||||
| 345 | - | |||||||||||||
| 346 | - | |||||||||||||
| 347 | - | |||||||||||||
| 348 | void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) | - | ||||||||||||
| 349 | { | - | ||||||||||||
| 350 | int mx, i; | - | ||||||||||||
| 351 | EX_CALLBACKS *ip; | - | ||||||||||||
| 352 | void *ptr; | - | ||||||||||||
| 353 | EX_CALLBACK *f; | - | ||||||||||||
| 354 | EX_CALLBACK *stack[10]; | - | ||||||||||||
| 355 | EX_CALLBACK **storage = | - | ||||||||||||
| 356 | ((void *)0) | - | ||||||||||||
| 357 | ; | - | ||||||||||||
| 358 | - | |||||||||||||
| 359 | if ((
| 0-387623 | ||||||||||||
| 360 | ((void *)0)
| 0-387623 | ||||||||||||
| 361 | ) | - | ||||||||||||
| 362 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 363 | - | |||||||||||||
| 364 | mx = sk_EX_CALLBACK_num(ip->meth); | - | ||||||||||||
| 365 | if (mx > 0
| 12318-375305 | ||||||||||||
| 366 | if (mx < (int)(sizeof(stack)/sizeof((stack)[0]))
| 2072-10246 | ||||||||||||
| 367 | storage = stack; executed 10246 times by 1 test: storage = stack;Executed by:
| 10246 | ||||||||||||
| 368 | else | - | ||||||||||||
| 369 | storage = CRYPTO_malloc(sizeof(*storage) * mx, __FILE__, 337); executed 2072 times by 1 test: storage = CRYPTO_malloc(sizeof(*storage) * mx, __FILE__, 337);Executed by:
| 2072 | ||||||||||||
| 370 | if (storage !=
| 0-12318 | ||||||||||||
| 371 | ((void *)0)
| 0-12318 | ||||||||||||
| 372 | ) | - | ||||||||||||
| 373 | for (i = 0; i < mx
| 12318-512701 | ||||||||||||
| 374 | storage[i] = sk_EX_CALLBACK_value(ip->meth, i); executed 512701 times by 1 test: storage[i] = sk_EX_CALLBACK_value(ip->meth, i);Executed by:
| 512701 | ||||||||||||
| 375 | } executed 12318 times by 1 test: end of blockExecuted by:
| 12318 | ||||||||||||
| 376 | CRYPTO_THREAD_unlock(ex_data_lock); | - | ||||||||||||
| 377 | - | |||||||||||||
| 378 | for (i = 0; i < mx
| 387623-512701 | ||||||||||||
| 379 | if (storage !=
| 0-512701 | ||||||||||||
| 380 | ((void *)0)
| 0-512701 | ||||||||||||
| 381 | ) | - | ||||||||||||
| 382 | f = storage[i]; executed 512701 times by 1 test: f = storage[i];Executed by:
| 512701 | ||||||||||||
| 383 | else { | - | ||||||||||||
| 384 | CRYPTO_THREAD_write_lock(ex_data_lock); | - | ||||||||||||
| 385 | f = sk_EX_CALLBACK_value(ip->meth, i); | - | ||||||||||||
| 386 | CRYPTO_THREAD_unlock(ex_data_lock); | - | ||||||||||||
| 387 | } never executed: end of block | 0 | ||||||||||||
| 388 | if (f !=
| 12318-500383 | ||||||||||||
| 389 | ((void *)0)
| 12318-500383 | ||||||||||||
| 390 | && f->free_func !=
| 744-499639 | ||||||||||||
| 391 | ((void *)0)
| 744-499639 | ||||||||||||
| 392 | ) { | - | ||||||||||||
| 393 | ptr = CRYPTO_get_ex_data(ad, i); | - | ||||||||||||
| 394 | f->free_func(obj, ptr, ad, i, f->argl, f->argp); | - | ||||||||||||
| 395 | } executed 744 times by 1 test: end of blockExecuted by:
| 744 | ||||||||||||
| 396 | } executed 512701 times by 1 test: end of blockExecuted by:
| 512701 | ||||||||||||
| 397 | - | |||||||||||||
| 398 | if (storage != stack
| 10246-377377 | ||||||||||||
| 399 | CRYPTO_free(storage, __FILE__, 359); executed 377377 times by 12 tests: CRYPTO_free(storage, __FILE__, 359);Executed by:
| 377377 | ||||||||||||
| 400 | err: code before this statement executed 387623 times by 12 tests: err:Executed by:
| 387623 | ||||||||||||
| 401 | sk_void_free(ad->sk); | - | ||||||||||||
| 402 | ad->sk = | - | ||||||||||||
| 403 | ((void *)0) | - | ||||||||||||
| 404 | ; | - | ||||||||||||
| 405 | } executed 387623 times by 12 tests: end of blockExecuted by:
| 387623 | ||||||||||||
| 406 | - | |||||||||||||
| 407 | - | |||||||||||||
| 408 | - | |||||||||||||
| 409 | - | |||||||||||||
| 410 | - | |||||||||||||
| 411 | int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val) | - | ||||||||||||
| 412 | { | - | ||||||||||||
| 413 | int i; | - | ||||||||||||
| 414 | - | |||||||||||||
| 415 | if (ad->sk ==
| 14-9787 | ||||||||||||
| 416 | ((void *)0)
| 14-9787 | ||||||||||||
| 417 | ) { | - | ||||||||||||
| 418 | if ((
| 0-9787 | ||||||||||||
| 419 | ((void *)0)
| 0-9787 | ||||||||||||
| 420 | ) { | - | ||||||||||||
| 421 | ERR_put_error(15,(102),((1|64)),__FILE__,375); | - | ||||||||||||
| 422 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 423 | } | - | ||||||||||||
| 424 | } executed 9787 times by 1 test: end of blockExecuted by:
| 9787 | ||||||||||||
| 425 | - | |||||||||||||
| 426 | for (i = sk_void_num(ad->sk); i <= idx
| 9801-507639 | ||||||||||||
| 427 | if (!sk_void_push(ad->sk,
| 0-507639 | ||||||||||||
| 428 | ((void *)0)
| 0-507639 | ||||||||||||
| 429 | )
| 0-507639 | ||||||||||||
| 430 | ERR_put_error(15,(102),((1|64)),__FILE__,382); | - | ||||||||||||
| 431 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 432 | } | - | ||||||||||||
| 433 | } executed 507639 times by 1 test: end of blockExecuted by:
| 507639 | ||||||||||||
| 434 | sk_void_set(ad->sk, idx, val); | - | ||||||||||||
| 435 | return executed 9801 times by 1 test: 1;return 1;Executed by:
executed 9801 times by 1 test: return 1;Executed by:
| 9801 | ||||||||||||
| 436 | } | - | ||||||||||||
| 437 | - | |||||||||||||
| 438 | - | |||||||||||||
| 439 | - | |||||||||||||
| 440 | - | |||||||||||||
| 441 | - | |||||||||||||
| 442 | void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) | - | ||||||||||||
| 443 | { | - | ||||||||||||
| 444 | if (ad->sk ==
| 1112-16985 | ||||||||||||
| 445 | ((void *)0)
| 1112-16985 | ||||||||||||
| 446 | || idx >= sk_void_num(ad->sk)
| 0-16985 | ||||||||||||
| 447 | return executed 1112 times by 1 test: return ((void *)0) ;Executed by:
executed 1112 times by 1 test: return ((void *)0) ;Executed by:
| 1112 | ||||||||||||
| 448 | ((void *)0) executed 1112 times by 1 test: return ((void *)0) ;Executed by:
| 1112 | ||||||||||||
| 449 | ; executed 1112 times by 1 test: return ((void *)0) ;Executed by:
| 1112 | ||||||||||||
| 450 | return executed 16985 times by 1 test: sk_void_value(ad->sk, idx);return sk_void_value(ad->sk, idx);Executed by:
executed 16985 times by 1 test: return sk_void_value(ad->sk, idx);Executed by:
| 16985 | ||||||||||||
| 451 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |