| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/rand/drbg_lib.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | static RAND_DRBG *master_drbg; | - | ||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | static CRYPTO_THREAD_LOCAL public_drbg; | - | ||||||||||||
| 10 | - | |||||||||||||
| 11 | - | |||||||||||||
| 12 | - | |||||||||||||
| 13 | - | |||||||||||||
| 14 | - | |||||||||||||
| 15 | - | |||||||||||||
| 16 | - | |||||||||||||
| 17 | static CRYPTO_THREAD_LOCAL private_drbg; | - | ||||||||||||
| 18 | - | |||||||||||||
| 19 | - | |||||||||||||
| 20 | - | |||||||||||||
| 21 | - | |||||||||||||
| 22 | static const char ossl_pers_string[] = "OpenSSL NIST SP 800-90A DRBG"; | - | ||||||||||||
| 23 | - | |||||||||||||
| 24 | static CRYPTO_ONCE rand_drbg_init = | - | ||||||||||||
| 25 | 0 | - | ||||||||||||
| 26 | ; | - | ||||||||||||
| 27 | - | |||||||||||||
| 28 | - | |||||||||||||
| 29 | - | |||||||||||||
| 30 | static int rand_drbg_type = 906; | - | ||||||||||||
| 31 | static unsigned int rand_drbg_flags = 0; | - | ||||||||||||
| 32 | - | |||||||||||||
| 33 | static unsigned int master_reseed_interval = (1 << 8); | - | ||||||||||||
| 34 | static unsigned int slave_reseed_interval = (1 << 16); | - | ||||||||||||
| 35 | - | |||||||||||||
| 36 | static time_t master_reseed_time_interval = (60*60); | - | ||||||||||||
| 37 | static time_t slave_reseed_time_interval = (7*60); | - | ||||||||||||
| 38 | - | |||||||||||||
| 39 | - | |||||||||||||
| 40 | static const unsigned int rand_drbg_used_flags = | - | ||||||||||||
| 41 | 0x1; | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | static RAND_DRBG *drbg_setup(RAND_DRBG *parent); | - | ||||||||||||
| 44 | - | |||||||||||||
| 45 | static RAND_DRBG *rand_drbg_new(int secure, | - | ||||||||||||
| 46 | int type, | - | ||||||||||||
| 47 | unsigned int flags, | - | ||||||||||||
| 48 | RAND_DRBG *parent); | - | ||||||||||||
| 49 | int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags) | - | ||||||||||||
| 50 | { | - | ||||||||||||
| 51 | int ret = 1; | - | ||||||||||||
| 52 | - | |||||||||||||
| 53 | if (type == 0
| 0-14791 | ||||||||||||
| 54 | type = rand_drbg_type; | - | ||||||||||||
| 55 | flags = rand_drbg_flags; | - | ||||||||||||
| 56 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||
| 57 | - | |||||||||||||
| 58 | drbg->state = DRBG_UNINITIALISED; | - | ||||||||||||
| 59 | drbg->flags = flags; | - | ||||||||||||
| 60 | drbg->type = type; | - | ||||||||||||
| 61 | - | |||||||||||||
| 62 | switch (type) { | - | ||||||||||||
| 63 | default never executed: :default:never executed: default: | 0 | ||||||||||||
| 64 | ERR_put_error(36,(104),(120),__FILE__,118); | - | ||||||||||||
| 65 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 66 | case never executed: 0:case 0:never executed: case 0: | 0 | ||||||||||||
| 67 | - | |||||||||||||
| 68 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 69 | case executed 4332 times by 1 test: 904:case 904:Executed by:
executed 4332 times by 1 test: case 904:Executed by:
| 4332 | ||||||||||||
| 70 | case executed 4332 times by 1 test: 905:case 905:Executed by:
executed 4332 times by 1 test: case 905:Executed by:
| 4332 | ||||||||||||
| 71 | case executed 6133 times by 2 tests: 906:case 906:Executed by:
executed 6133 times by 2 tests: case 906:Executed by:
| 6133 | ||||||||||||
| 72 | ret = drbg_ctr_init(drbg); | - | ||||||||||||
| 73 | break; executed 14797 times by 2 tests: break;Executed by:
| 14797 | ||||||||||||
| 74 | } | - | ||||||||||||
| 75 | - | |||||||||||||
| 76 | if (ret == 0
| 0-14797 | ||||||||||||
| 77 | ERR_put_error(36,(104),(107),__FILE__,131); never executed: ERR_put_error(36,(104),(107),__FILE__,131); | 0 | ||||||||||||
| 78 | return executed 14797 times by 2 tests: ret;return ret;Executed by:
executed 14797 times by 2 tests: return ret;Executed by:
| 14797 | ||||||||||||
| 79 | } | - | ||||||||||||
| 80 | - | |||||||||||||
| 81 | - | |||||||||||||
| 82 | - | |||||||||||||
| 83 | - | |||||||||||||
| 84 | - | |||||||||||||
| 85 | - | |||||||||||||
| 86 | int RAND_DRBG_set_defaults(int type, unsigned int flags) | - | ||||||||||||
| 87 | { | - | ||||||||||||
| 88 | int ret = 1; | - | ||||||||||||
| 89 | - | |||||||||||||
| 90 | switch (type) { | - | ||||||||||||
| 91 | default never executed: :default:never executed: default: | 0 | ||||||||||||
| 92 | ERR_put_error(36,(121),(120),__FILE__,146); | - | ||||||||||||
| 93 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 94 | case never executed: 904:case 904:never executed: case 904: | 0 | ||||||||||||
| 95 | case never executed: 905:case 905:never executed: case 905: | 0 | ||||||||||||
| 96 | case never executed: 906:case 906:never executed: case 906: | 0 | ||||||||||||
| 97 | break; never executed: break; | 0 | ||||||||||||
| 98 | } | - | ||||||||||||
| 99 | - | |||||||||||||
| 100 | if ((
| 0 | ||||||||||||
| 101 | ERR_put_error(36,(121),(132),__FILE__,155); | - | ||||||||||||
| 102 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 103 | } | - | ||||||||||||
| 104 | - | |||||||||||||
| 105 | rand_drbg_type = type; | - | ||||||||||||
| 106 | rand_drbg_flags = flags; | - | ||||||||||||
| 107 | - | |||||||||||||
| 108 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||
| 109 | } | - | ||||||||||||
| 110 | static RAND_DRBG *rand_drbg_new(int secure, | - | ||||||||||||
| 111 | int type, | - | ||||||||||||
| 112 | unsigned int flags, | - | ||||||||||||
| 113 | RAND_DRBG *parent) | - | ||||||||||||
| 114 | { | - | ||||||||||||
| 115 | RAND_DRBG *drbg = secure
| 1787-4332 | ||||||||||||
| 116 | CRYPTO_secure_zalloc(sizeof(*drbg), __FILE__, 179) : CRYPTO_zalloc(sizeof(*drbg), __FILE__, 179); | - | ||||||||||||
| 117 | - | |||||||||||||
| 118 | if (drbg ==
| 0-6119 | ||||||||||||
| 119 | ((void *)0)
| 0-6119 | ||||||||||||
| 120 | ) { | - | ||||||||||||
| 121 | ERR_put_error(36,(109),((1|64)),__FILE__,182); | - | ||||||||||||
| 122 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 123 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 124 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 125 | } | - | ||||||||||||
| 126 | - | |||||||||||||
| 127 | drbg->secure = secure
| 0-4332 | ||||||||||||
| 128 | drbg->fork_count = rand_fork_count; | - | ||||||||||||
| 129 | drbg->parent = parent; | - | ||||||||||||
| 130 | - | |||||||||||||
| 131 | if (parent ==
| 1008-5111 | ||||||||||||
| 132 | ((void *)0)
| 1008-5111 | ||||||||||||
| 133 | ) { | - | ||||||||||||
| 134 | drbg->get_entropy = rand_drbg_get_entropy; | - | ||||||||||||
| 135 | drbg->cleanup_entropy = rand_drbg_cleanup_entropy; | - | ||||||||||||
| 136 | - | |||||||||||||
| 137 | drbg->get_nonce = rand_drbg_get_nonce; | - | ||||||||||||
| 138 | drbg->cleanup_nonce = rand_drbg_cleanup_nonce; | - | ||||||||||||
| 139 | - | |||||||||||||
| 140 | - | |||||||||||||
| 141 | drbg->reseed_interval = master_reseed_interval; | - | ||||||||||||
| 142 | drbg->reseed_time_interval = master_reseed_time_interval; | - | ||||||||||||
| 143 | } executed 5111 times by 2 tests: else {end of blockExecuted by:
| 5111 | ||||||||||||
| 144 | drbg->get_entropy = rand_drbg_get_entropy; | - | ||||||||||||
| 145 | drbg->cleanup_entropy = rand_drbg_cleanup_entropy; | - | ||||||||||||
| 146 | - | |||||||||||||
| 147 | - | |||||||||||||
| 148 | - | |||||||||||||
| 149 | - | |||||||||||||
| 150 | - | |||||||||||||
| 151 | drbg->reseed_interval = slave_reseed_interval; | - | ||||||||||||
| 152 | drbg->reseed_time_interval = slave_reseed_time_interval; | - | ||||||||||||
| 153 | } executed 1008 times by 2 tests: end of blockExecuted by:
| 1008 | ||||||||||||
| 154 | - | |||||||||||||
| 155 | if (RAND_DRBG_set(drbg, type, flags) == 0
| 0-6119 | ||||||||||||
| 156 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 157 | - | |||||||||||||
| 158 | if (parent !=
| 1008-5111 | ||||||||||||
| 159 | ((void *)0)
| 1008-5111 | ||||||||||||
| 160 | ) { | - | ||||||||||||
| 161 | rand_drbg_lock(parent); | - | ||||||||||||
| 162 | if (drbg->strength > parent->strength
| 0-1008 | ||||||||||||
| 163 | - | |||||||||||||
| 164 | - | |||||||||||||
| 165 | - | |||||||||||||
| 166 | - | |||||||||||||
| 167 | rand_drbg_unlock(parent); | - | ||||||||||||
| 168 | ERR_put_error(36,(109),(131),__FILE__,223); | - | ||||||||||||
| 169 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 170 | } | - | ||||||||||||
| 171 | rand_drbg_unlock(parent); | - | ||||||||||||
| 172 | } executed 1008 times by 2 tests: end of blockExecuted by:
| 1008 | ||||||||||||
| 173 | - | |||||||||||||
| 174 | return executed 6119 times by 2 tests: drbg;return drbg;Executed by:
executed 6119 times by 2 tests: return drbg;Executed by:
| 6119 | ||||||||||||
| 175 | - | |||||||||||||
| 176 | err: | - | ||||||||||||
| 177 | if (drbg->secure
| 0 | ||||||||||||
| 178 | CRYPTO_secure_free(drbg, __FILE__, 233); never executed: CRYPTO_secure_free(drbg, __FILE__, 233); | 0 | ||||||||||||
| 179 | else | - | ||||||||||||
| 180 | CRYPTO_free(drbg, __FILE__, 235); never executed: CRYPTO_free(drbg, __FILE__, 235); | 0 | ||||||||||||
| 181 | - | |||||||||||||
| 182 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 183 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 184 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 185 | } | - | ||||||||||||
| 186 | - | |||||||||||||
| 187 | RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent) | - | ||||||||||||
| 188 | { | - | ||||||||||||
| 189 | return executed 4332 times by 1 test: rand_drbg_new(0, type, flags, parent);return rand_drbg_new(0, type, flags, parent);Executed by:
executed 4332 times by 1 test: return rand_drbg_new(0, type, flags, parent);Executed by:
| 4332 | ||||||||||||
| 190 | } | - | ||||||||||||
| 191 | - | |||||||||||||
| 192 | RAND_DRBG *RAND_DRBG_secure_new(int type, unsigned int flags, RAND_DRBG *parent) | - | ||||||||||||
| 193 | { | - | ||||||||||||
| 194 | return executed 1787 times by 2 tests: rand_drbg_new(1, type, flags, parent);return rand_drbg_new(1, type, flags, parent);Executed by:
executed 1787 times by 2 tests: return rand_drbg_new(1, type, flags, parent);Executed by:
| 1787 | ||||||||||||
| 195 | } | - | ||||||||||||
| 196 | - | |||||||||||||
| 197 | - | |||||||||||||
| 198 | - | |||||||||||||
| 199 | - | |||||||||||||
| 200 | void RAND_DRBG_free(RAND_DRBG *drbg) | - | ||||||||||||
| 201 | { | - | ||||||||||||
| 202 | if (drbg ==
| 556-6119 | ||||||||||||
| 203 | ((void *)0)
| 556-6119 | ||||||||||||
| 204 | ) | - | ||||||||||||
| 205 | return; executed 556 times by 2 tests: return;Executed by:
| 556 | ||||||||||||
| 206 | - | |||||||||||||
| 207 | if (drbg->meth !=
| 0-6119 | ||||||||||||
| 208 | ((void *)0)
| 0-6119 | ||||||||||||
| 209 | ) | - | ||||||||||||
| 210 | drbg->meth->uninstantiate(drbg); executed 6119 times by 2 tests: drbg->meth->uninstantiate(drbg);Executed by:
| 6119 | ||||||||||||
| 211 | CRYPTO_THREAD_lock_free(drbg->lock); | - | ||||||||||||
| 212 | CRYPTO_free_ex_data(15, drbg, &drbg->ex_data); | - | ||||||||||||
| 213 | - | |||||||||||||
| 214 | if (drbg->secure
| 0-6119 | ||||||||||||
| 215 | CRYPTO_secure_clear_free(drbg, sizeof(*drbg), __FILE__, 264); never executed: CRYPTO_secure_clear_free(drbg, sizeof(*drbg), __FILE__, 264); | 0 | ||||||||||||
| 216 | else | - | ||||||||||||
| 217 | CRYPTO_clear_free(drbg, sizeof(*drbg), __FILE__, 266); executed 6119 times by 2 tests: CRYPTO_clear_free(drbg, sizeof(*drbg), __FILE__, 266);Executed by:
| 6119 | ||||||||||||
| 218 | } | - | ||||||||||||
| 219 | int RAND_DRBG_instantiate(RAND_DRBG *drbg, | - | ||||||||||||
| 220 | const unsigned char *pers, size_t perslen) | - | ||||||||||||
| 221 | { | - | ||||||||||||
| 222 | unsigned char *nonce = | - | ||||||||||||
| 223 | ((void *)0) | - | ||||||||||||
| 224 | , *entropy = | - | ||||||||||||
| 225 | ((void *)0) | - | ||||||||||||
| 226 | ; | - | ||||||||||||
| 227 | size_t noncelen = 0, entropylen = 0; | - | ||||||||||||
| 228 | size_t min_entropy = drbg->strength; | - | ||||||||||||
| 229 | size_t min_entropylen = drbg->min_entropylen; | - | ||||||||||||
| 230 | size_t max_entropylen = drbg->max_entropylen; | - | ||||||||||||
| 231 | - | |||||||||||||
| 232 | if (perslen > drbg->max_perslen
| 6-6134 | ||||||||||||
| 233 | ERR_put_error(36,(108),(116),__FILE__,288) | - | ||||||||||||
| 234 | ; | - | ||||||||||||
| 235 | goto executed 6 times by 1 test: end;goto end;Executed by:
executed 6 times by 1 test: goto end;Executed by:
| 6 | ||||||||||||
| 236 | } | - | ||||||||||||
| 237 | - | |||||||||||||
| 238 | if (drbg->meth ==
| 0-6134 | ||||||||||||
| 239 | ((void *)0)
| 0-6134 | ||||||||||||
| 240 | ) { | - | ||||||||||||
| 241 | ERR_put_error(36,(108),(128),__FILE__,294) | - | ||||||||||||
| 242 | ; | - | ||||||||||||
| 243 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 244 | } | - | ||||||||||||
| 245 | - | |||||||||||||
| 246 | if (drbg->state != DRBG_UNINITIALISED
| 1-6133 | ||||||||||||
| 247 | ERR_put_error(36,(108),(drbg->state == DRBG_ERROR ? 114 : 103),__FILE__,301) | - | ||||||||||||
| 248 | - | |||||||||||||
| 249 | ; | - | ||||||||||||
| 250 | goto executed 1 time by 1 test: end;goto end;Executed by:
executed 1 time by 1 test: goto end;Executed by:
| 1 | ||||||||||||
| 251 | } | - | ||||||||||||
| 252 | - | |||||||||||||
| 253 | drbg->state = DRBG_ERROR; | - | ||||||||||||
| 254 | - | |||||||||||||
| 255 | - | |||||||||||||
| 256 | - | |||||||||||||
| 257 | - | |||||||||||||
| 258 | - | |||||||||||||
| 259 | - | |||||||||||||
| 260 | - | |||||||||||||
| 261 | if (drbg->min_noncelen > 0
| 1012-3964 | ||||||||||||
| 262 | ((void *)0)
| 1012-2952 | ||||||||||||
| 263 | ) { | - | ||||||||||||
| 264 | min_entropy += drbg->strength / 2; | - | ||||||||||||
| 265 | min_entropylen += drbg->min_noncelen; | - | ||||||||||||
| 266 | max_entropylen += drbg->max_noncelen; | - | ||||||||||||
| 267 | } executed 1012 times by 2 tests: end of blockExecuted by:
| 1012 | ||||||||||||
| 268 | - | |||||||||||||
| 269 | if (drbg->get_entropy !=
| 0-6133 | ||||||||||||
| 270 | ((void *)0)
| 0-6133 | ||||||||||||
| 271 | ) | - | ||||||||||||
| 272 | entropylen = drbg->get_entropy(drbg, &entropy, min_entropy, executed 6133 times by 2 tests: entropylen = drbg->get_entropy(drbg, &entropy, min_entropy, min_entropylen, max_entropylen, 0);Executed by:
| 6133 | ||||||||||||
| 273 | min_entropylen, max_entropylen, 0); executed 6133 times by 2 tests: entropylen = drbg->get_entropy(drbg, &entropy, min_entropy, min_entropylen, max_entropylen, 0);Executed by:
| 6133 | ||||||||||||
| 274 | if (entropylen < min_entropylen
| 8-6125 | ||||||||||||
| 275 | || entropylen > max_entropylen
| 0-6125 | ||||||||||||
| 276 | ERR_put_error(36,(108),(110),__FILE__,324); | - | ||||||||||||
| 277 | goto executed 8 times by 1 test: end;goto end;Executed by:
executed 8 times by 1 test: goto end;Executed by:
| 8 | ||||||||||||
| 278 | } | - | ||||||||||||
| 279 | - | |||||||||||||
| 280 | if (drbg->min_noncelen > 0
| 1012-3959 | ||||||||||||
| 281 | ((void *)0)
| 1012-2947 | ||||||||||||
| 282 | ) { | - | ||||||||||||
| 283 | noncelen = drbg->get_nonce(drbg, &nonce, drbg->strength / 2, | - | ||||||||||||
| 284 | drbg->min_noncelen, drbg->max_noncelen); | - | ||||||||||||
| 285 | if (noncelen < drbg->min_noncelen
| 0-2947 | ||||||||||||
| 286 | ERR_put_error(36,(108),(111),__FILE__,332); | - | ||||||||||||
| 287 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 288 | } | - | ||||||||||||
| 289 | } executed 2947 times by 2 tests: end of blockExecuted by:
| 2947 | ||||||||||||
| 290 | - | |||||||||||||
| 291 | if (!drbg->meth->instantiate(drbg, entropy, entropylen,
| 0-6125 | ||||||||||||
| 292 | nonce, noncelen, pers, perslen)
| 0-6125 | ||||||||||||
| 293 | ERR_put_error(36,(108),(108),__FILE__,339); | - | ||||||||||||
| 294 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 295 | } | - | ||||||||||||
| 296 | - | |||||||||||||
| 297 | drbg->state = DRBG_READY; | - | ||||||||||||
| 298 | drbg->generate_counter = 0; | - | ||||||||||||
| 299 | drbg->reseed_time = time( | - | ||||||||||||
| 300 | ((void *)0) | - | ||||||||||||
| 301 | ); | - | ||||||||||||
| 302 | if (drbg->reseed_counter > 0
| 1793-4332 | ||||||||||||
| 303 | if (drbg->parent ==
| 781-1012 | ||||||||||||
| 304 | ((void *)0)
| 781-1012 | ||||||||||||
| 305 | ) | - | ||||||||||||
| 306 | drbg->reseed_counter++; executed 781 times by 2 tests: drbg->reseed_counter++;Executed by:
| 781 | ||||||||||||
| 307 | else | - | ||||||||||||
| 308 | drbg->reseed_counter = drbg->parent->reseed_counter; executed 1012 times by 2 tests: drbg->reseed_counter = drbg->parent->reseed_counter;Executed by:
| 1012 | ||||||||||||
| 309 | } | - | ||||||||||||
| 310 | - | |||||||||||||
| 311 | end: code before this statement executed 6125 times by 2 tests: end:Executed by:
| 6125 | ||||||||||||
| 312 | if (entropy !=
| 9-6131 | ||||||||||||
| 313 | ((void *)0)
| 9-6131 | ||||||||||||
| 314 | && drbg->cleanup_entropy !=
| 1793-4338 | ||||||||||||
| 315 | ((void *)0)
| 1793-4338 | ||||||||||||
| 316 | ) | - | ||||||||||||
| 317 | drbg->cleanup_entropy(drbg, entropy, entropylen); executed 1793 times by 2 tests: drbg->cleanup_entropy(drbg, entropy, entropylen);Executed by:
| 1793 | ||||||||||||
| 318 | if (nonce !=
| 2947-3193 | ||||||||||||
| 319 | ((void *)0)
| 2947-3193 | ||||||||||||
| 320 | && drbg->cleanup_nonce!=
| 781-2166 | ||||||||||||
| 321 | ((void *)0)
| 781-2166 | ||||||||||||
| 322 | ) | - | ||||||||||||
| 323 | drbg->cleanup_nonce(drbg, nonce, noncelen); executed 781 times by 2 tests: drbg->cleanup_nonce(drbg, nonce, noncelen);Executed by:
| 781 | ||||||||||||
| 324 | if (drbg->pool !=
| 0-6140 | ||||||||||||
| 325 | ((void *)0)
| 0-6140 | ||||||||||||
| 326 | ) { | - | ||||||||||||
| 327 | if (drbg->state == DRBG_READY
| 0 | ||||||||||||
| 328 | ERR_put_error(36,(108),(127),__FILE__,361) | - | ||||||||||||
| 329 | ; | - | ||||||||||||
| 330 | drbg->state = DRBG_ERROR; | - | ||||||||||||
| 331 | } never executed: end of block | 0 | ||||||||||||
| 332 | rand_pool_free(drbg->pool); | - | ||||||||||||
| 333 | drbg->pool = | - | ||||||||||||
| 334 | ((void *)0) | - | ||||||||||||
| 335 | ; | - | ||||||||||||
| 336 | } never executed: end of block | 0 | ||||||||||||
| 337 | if (drbg->state == DRBG_READY
| 14-6126 | ||||||||||||
| 338 | return executed 6126 times by 2 tests: 1;return 1;Executed by:
executed 6126 times by 2 tests: return 1;Executed by:
| 6126 | ||||||||||||
| 339 | return executed 14 times by 1 test: 0;return 0;Executed by:
executed 14 times by 1 test: return 0;Executed by:
| 14 | ||||||||||||
| 340 | } | - | ||||||||||||
| 341 | int RAND_DRBG_uninstantiate(RAND_DRBG *drbg) | - | ||||||||||||
| 342 | { | - | ||||||||||||
| 343 | if (drbg->meth ==
| 0-8666 | ||||||||||||
| 344 | ((void *)0)
| 0-8666 | ||||||||||||
| 345 | ) { | - | ||||||||||||
| 346 | ERR_put_error(36,(118),(128),__FILE__,383) | - | ||||||||||||
| 347 | ; | - | ||||||||||||
| 348 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 349 | } | - | ||||||||||||
| 350 | - | |||||||||||||
| 351 | - | |||||||||||||
| 352 | - | |||||||||||||
| 353 | - | |||||||||||||
| 354 | - | |||||||||||||
| 355 | drbg->meth->uninstantiate(drbg); | - | ||||||||||||
| 356 | return executed 8666 times by 1 test: RAND_DRBG_set(drbg, drbg->type, drbg->flags);return RAND_DRBG_set(drbg, drbg->type, drbg->flags);Executed by:
executed 8666 times by 1 test: return RAND_DRBG_set(drbg, drbg->type, drbg->flags);Executed by:
| 8666 | ||||||||||||
| 357 | } | - | ||||||||||||
| 358 | int RAND_DRBG_reseed(RAND_DRBG *drbg, | - | ||||||||||||
| 359 | const unsigned char *adin, size_t adinlen, | - | ||||||||||||
| 360 | int prediction_resistance) | - | ||||||||||||
| 361 | { | - | ||||||||||||
| 362 | unsigned char *entropy = | - | ||||||||||||
| 363 | ((void *)0) | - | ||||||||||||
| 364 | ; | - | ||||||||||||
| 365 | size_t entropylen = 0; | - | ||||||||||||
| 366 | - | |||||||||||||
| 367 | if (drbg->state == DRBG_ERROR
| 0-4402 | ||||||||||||
| 368 | ERR_put_error(36,(110),(114),__FILE__,410); | - | ||||||||||||
| 369 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 370 | } | - | ||||||||||||
| 371 | if (drbg->state == DRBG_UNINITIALISED
| 0-4402 | ||||||||||||
| 372 | ERR_put_error(36,(110),(115),__FILE__,414); | - | ||||||||||||
| 373 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 374 | } | - | ||||||||||||
| 375 | - | |||||||||||||
| 376 | if (adin ==
| 20-4382 | ||||||||||||
| 377 | ((void *)0)
| 20-4382 | ||||||||||||
| 378 | ) { | - | ||||||||||||
| 379 | adinlen = 0; | - | ||||||||||||
| 380 | } executed 20 times by 1 test: else if (adinlen > drbg->max_adinlenend of blockExecuted by:
| 0-4382 | ||||||||||||
| 381 | ERR_put_error(36,(110),(102),__FILE__,421); | - | ||||||||||||
| 382 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 383 | } | - | ||||||||||||
| 384 | - | |||||||||||||
| 385 | drbg->state = DRBG_ERROR; | - | ||||||||||||
| 386 | if (drbg->get_entropy !=
| 0-4403 | ||||||||||||
| 387 | ((void *)0)
| 0-4403 | ||||||||||||
| 388 | ) | - | ||||||||||||
| 389 | entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength, executed 4403 times by 1 test: entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength, drbg->min_entropylen, drbg->max_entropylen, prediction_resistance);Executed by:
| 4403 | ||||||||||||
| 390 | drbg->min_entropylen, executed 4403 times by 1 test: entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength, drbg->min_entropylen, drbg->max_entropylen, prediction_resistance);Executed by:
| 4403 | ||||||||||||
| 391 | drbg->max_entropylen, executed 4403 times by 1 test: entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength, drbg->min_entropylen, drbg->max_entropylen, prediction_resistance);Executed by:
| 4403 | ||||||||||||
| 392 | prediction_resistance); executed 4403 times by 1 test: entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength, drbg->min_entropylen, drbg->max_entropylen, prediction_resistance);Executed by:
| 4403 | ||||||||||||
| 393 | if (entropylen < drbg->min_entropylen
| 3-4400 | ||||||||||||
| 394 | || entropylen > drbg->max_entropylen
| 0-4400 | ||||||||||||
| 395 | ERR_put_error(36,(110),(110),__FILE__,433); | - | ||||||||||||
| 396 | goto executed 3 times by 1 test: end;goto end;Executed by:
executed 3 times by 1 test: goto end;Executed by:
| 3 | ||||||||||||
| 397 | } | - | ||||||||||||
| 398 | - | |||||||||||||
| 399 | if (!drbg->meth->reseed(drbg, entropy, entropylen, adin, adinlen)
| 0-4400 | ||||||||||||
| 400 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 401 | - | |||||||||||||
| 402 | drbg->state = DRBG_READY; | - | ||||||||||||
| 403 | drbg->generate_counter = 0; | - | ||||||||||||
| 404 | drbg->reseed_time = time( | - | ||||||||||||
| 405 | ((void *)0) | - | ||||||||||||
| 406 | ); | - | ||||||||||||
| 407 | if (drbg->reseed_counter > 0
| 62-4338 | ||||||||||||
| 408 | if (drbg->parent ==
| 19-43 | ||||||||||||
| 409 | ((void *)0)
| 19-43 | ||||||||||||
| 410 | ) | - | ||||||||||||
| 411 | drbg->reseed_counter++; executed 19 times by 1 test: drbg->reseed_counter++;Executed by:
| 19 | ||||||||||||
| 412 | else | - | ||||||||||||
| 413 | drbg->reseed_counter = drbg->parent->reseed_counter; executed 43 times by 1 test: drbg->reseed_counter = drbg->parent->reseed_counter;Executed by:
| 43 | ||||||||||||
| 414 | } | - | ||||||||||||
| 415 | - | |||||||||||||
| 416 | end: code before this statement executed 4400 times by 1 test: end:Executed by:
| 4400 | ||||||||||||
| 417 | if (entropy !=
| 3-4400 | ||||||||||||
| 418 | ((void *)0)
| 3-4400 | ||||||||||||
| 419 | && drbg->cleanup_entropy !=
| 62-4338 | ||||||||||||
| 420 | ((void *)0)
| 62-4338 | ||||||||||||
| 421 | ) | - | ||||||||||||
| 422 | drbg->cleanup_entropy(drbg, entropy, entropylen); executed 62 times by 1 test: drbg->cleanup_entropy(drbg, entropy, entropylen);Executed by:
| 62 | ||||||||||||
| 423 | if (drbg->state == DRBG_READY
| 3-4400 | ||||||||||||
| 424 | return executed 4400 times by 1 test: 1;return 1;Executed by:
executed 4400 times by 1 test: return 1;Executed by:
| 4400 | ||||||||||||
| 425 | return executed 3 times by 1 test: 0;return 0;Executed by:
executed 3 times by 1 test: return 0;Executed by:
| 3 | ||||||||||||
| 426 | } | - | ||||||||||||
| 427 | int rand_drbg_restart(RAND_DRBG *drbg, | - | ||||||||||||
| 428 | const unsigned char *buffer, size_t len, size_t entropy) | - | ||||||||||||
| 429 | { | - | ||||||||||||
| 430 | int reseeded = 0; | - | ||||||||||||
| 431 | const unsigned char *adin = | - | ||||||||||||
| 432 | ((void *)0) | - | ||||||||||||
| 433 | ; | - | ||||||||||||
| 434 | size_t adinlen = 0; | - | ||||||||||||
| 435 | - | |||||||||||||
| 436 | if (drbg->pool !=
| 0-28 | ||||||||||||
| 437 | ((void *)0)
| 0-28 | ||||||||||||
| 438 | ) { | - | ||||||||||||
| 439 | ERR_put_error(36,(102),((4|64)),__FILE__,483); | - | ||||||||||||
| 440 | rand_pool_free(drbg->pool); | - | ||||||||||||
| 441 | drbg->pool = | - | ||||||||||||
| 442 | ((void *)0) | - | ||||||||||||
| 443 | ; | - | ||||||||||||
| 444 | } never executed: end of block | 0 | ||||||||||||
| 445 | - | |||||||||||||
| 446 | if (buffer !=
| 7-21 | ||||||||||||
| 447 | ((void *)0)
| 7-21 | ||||||||||||
| 448 | ) { | - | ||||||||||||
| 449 | if (entropy > 0
| 0-21 | ||||||||||||
| 450 | if (drbg->max_entropylen < len
| 0-21 | ||||||||||||
| 451 | ERR_put_error(36,(102),(106),__FILE__,492) | - | ||||||||||||
| 452 | ; | - | ||||||||||||
| 453 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 454 | } | - | ||||||||||||
| 455 | - | |||||||||||||
| 456 | if (entropy > 8 * len
| 0-21 | ||||||||||||
| 457 | ERR_put_error(36,(102),(124),__FILE__,497); | - | ||||||||||||
| 458 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 459 | } | - | ||||||||||||
| 460 | - | |||||||||||||
| 461 | - | |||||||||||||
| 462 | drbg->pool = rand_pool_new(entropy, len, len); | - | ||||||||||||
| 463 | if (drbg->pool ==
| 0-21 | ||||||||||||
| 464 | ((void *)0)
| 0-21 | ||||||||||||
| 465 | ) | - | ||||||||||||
| 466 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 467 | - | |||||||||||||
| 468 | rand_pool_add(drbg->pool, buffer, len, entropy); | - | ||||||||||||
| 469 | } executed 21 times by 1 test: else {end of blockExecuted by:
| 21 | ||||||||||||
| 470 | if (drbg->max_adinlen < len
| 0 | ||||||||||||
| 471 | ERR_put_error(36,(102),(102),__FILE__,510) | - | ||||||||||||
| 472 | ; | - | ||||||||||||
| 473 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 474 | } | - | ||||||||||||
| 475 | adin = buffer; | - | ||||||||||||
| 476 | adinlen = len; | - | ||||||||||||
| 477 | } never executed: end of block | 0 | ||||||||||||
| 478 | } | - | ||||||||||||
| 479 | - | |||||||||||||
| 480 | - | |||||||||||||
| 481 | if (drbg->state == DRBG_ERROR
| 4-24 | ||||||||||||
| 482 | RAND_DRBG_uninstantiate(drbg); executed 4 times by 1 test: RAND_DRBG_uninstantiate(drbg);Executed by:
| 4 | ||||||||||||
| 483 | - | |||||||||||||
| 484 | - | |||||||||||||
| 485 | if (drbg->state == DRBG_UNINITIALISED
| 8-20 | ||||||||||||
| 486 | - | |||||||||||||
| 487 | RAND_DRBG_instantiate(drbg, | - | ||||||||||||
| 488 | (const unsigned char *) ossl_pers_string, | - | ||||||||||||
| 489 | sizeof(ossl_pers_string) - 1); | - | ||||||||||||
| 490 | - | |||||||||||||
| 491 | reseeded = (drbg->state == DRBG_READY); | - | ||||||||||||
| 492 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||
| 493 | - | |||||||||||||
| 494 | - | |||||||||||||
| 495 | if (drbg->state == DRBG_READY
| 2-26 | ||||||||||||
| 496 | if (adin !=
| 0-26 | ||||||||||||
| 497 | ((void *)0)
| 0-26 | ||||||||||||
| 498 | ) { | - | ||||||||||||
| 499 | drbg->meth->reseed(drbg, adin, adinlen, | - | ||||||||||||
| 500 | ((void *)0) | - | ||||||||||||
| 501 | , 0); | - | ||||||||||||
| 502 | } never executed: else if (reseeded == 0end of block
| 0-20 | ||||||||||||
| 503 | - | |||||||||||||
| 504 | RAND_DRBG_reseed(drbg, | - | ||||||||||||
| 505 | ((void *)0) | - | ||||||||||||
| 506 | , 0, 0); | - | ||||||||||||
| 507 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||||||||
| 508 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||
| 509 | - | |||||||||||||
| 510 | - | |||||||||||||
| 511 | if (drbg->pool !=
| 1-27 | ||||||||||||
| 512 | ((void *)0)
| 1-27 | ||||||||||||
| 513 | ) { | - | ||||||||||||
| 514 | drbg->state = DRBG_ERROR; | - | ||||||||||||
| 515 | ERR_put_error(36,(102),((4|64)),__FILE__,553); | - | ||||||||||||
| 516 | rand_pool_free(drbg->pool); | - | ||||||||||||
| 517 | drbg->pool = | - | ||||||||||||
| 518 | ((void *)0) | - | ||||||||||||
| 519 | ; | - | ||||||||||||
| 520 | return executed 1 time by 1 test: 0;return 0;Executed by:
executed 1 time by 1 test: return 0;Executed by:
| 1 | ||||||||||||
| 521 | } | - | ||||||||||||
| 522 | - | |||||||||||||
| 523 | return executed 27 times by 1 test: drbg->state == DRBG_READY;return drbg->state == DRBG_READY;Executed by:
executed 27 times by 1 test: return drbg->state == DRBG_READY;Executed by:
| 27 | ||||||||||||
| 524 | } | - | ||||||||||||
| 525 | int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, | - | ||||||||||||
| 526 | int prediction_resistance, | - | ||||||||||||
| 527 | const unsigned char *adin, size_t adinlen) | - | ||||||||||||
| 528 | { | - | ||||||||||||
| 529 | int reseed_required = 0; | - | ||||||||||||
| 530 | - | |||||||||||||
| 531 | if (drbg->state != DRBG_READY
| 7-1038601 | ||||||||||||
| 532 | - | |||||||||||||
| 533 | rand_drbg_restart(drbg, | - | ||||||||||||
| 534 | ((void *)0) | - | ||||||||||||
| 535 | , 0, 0); | - | ||||||||||||
| 536 | - | |||||||||||||
| 537 | if (drbg->state == DRBG_ERROR
| 2-5 | ||||||||||||
| 538 | ERR_put_error(36,(107),(114),__FILE__,583); | - | ||||||||||||
| 539 | return executed 2 times by 1 test: 0;return 0;Executed by:
executed 2 times by 1 test: return 0;Executed by:
| 2 | ||||||||||||
| 540 | } | - | ||||||||||||
| 541 | if (drbg->state == DRBG_UNINITIALISED
| 0-5 | ||||||||||||
| 542 | ERR_put_error(36,(107),(115),__FILE__,587); | - | ||||||||||||
| 543 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 544 | } | - | ||||||||||||
| 545 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||
| 546 | - | |||||||||||||
| 547 | if (outlen > drbg->max_request
| 0-1036308 | ||||||||||||
| 548 | ERR_put_error(36,(107),(117),__FILE__,593); | - | ||||||||||||
| 549 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 550 | } | - | ||||||||||||
| 551 | if (adinlen > drbg->max_adinlen
| 0-1044845 | ||||||||||||
| 552 | ERR_put_error(36,(107),(102),__FILE__,597); | - | ||||||||||||
| 553 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 554 | } | - | ||||||||||||
| 555 | - | |||||||||||||
| 556 | if (drbg->fork_count != rand_fork_count
| 0-1049337 | ||||||||||||
| 557 | drbg->fork_count = rand_fork_count; | - | ||||||||||||
| 558 | reseed_required = 1; | - | ||||||||||||
| 559 | } never executed: end of block | 0 | ||||||||||||
| 560 | - | |||||||||||||
| 561 | if (drbg->reseed_interval > 0
| 0-1056824 | ||||||||||||
| 562 | if (drbg->generate_counter >= drbg->reseed_interval
| 3-1071657 | ||||||||||||
| 563 | reseed_required = 1; executed 3 times by 1 test: reseed_required = 1;Executed by:
| 3 | ||||||||||||
| 564 | } executed 1064277 times by 2 tests: end of blockExecuted by:
| 1064277 | ||||||||||||
| 565 | if (drbg->reseed_time_interval > 0
| 0-1063945 | ||||||||||||
| 566 | time_t now = time( | - | ||||||||||||
| 567 | ((void *)0) | - | ||||||||||||
| 568 | ); | - | ||||||||||||
| 569 | if (now < drbg->reseed_time
| 0-1067482 | ||||||||||||
| 570 | || now - drbg->reseed_time >= drbg->reseed_time_interval
| 34-1067256 | ||||||||||||
| 571 | reseed_required = 1; executed 34 times by 1 test: reseed_required = 1;Executed by:
| 34 | ||||||||||||
| 572 | } executed 1069303 times by 2 tests: end of blockExecuted by:
| 1069303 | ||||||||||||
| 573 | if (drbg->reseed_counter > 0
| 1055-1061309 | ||||||||||||
| 574 | ((void *)0)
| 1055-1057850 | ||||||||||||
| 575 | ) { | - | ||||||||||||
| 576 | if (drbg->reseed_counter != drbg->parent->reseed_counter
| 8-1061390 | ||||||||||||
| 577 | reseed_required = 1; executed 8 times by 1 test: reseed_required = 1;Executed by:
| 8 | ||||||||||||
| 578 | } executed 1061020 times by 2 tests: end of blockExecuted by:
| 1061020 | ||||||||||||
| 579 | - | |||||||||||||
| 580 | if (reseed_required
| 45-1070847 | ||||||||||||
| 581 | if (!RAND_DRBG_reseed(drbg, adin, adinlen, prediction_resistance)
| 2-2935 | ||||||||||||
| 582 | ERR_put_error(36,(107),(118),__FILE__,623); | - | ||||||||||||
| 583 | return executed 2 times by 1 test: 0;return 0;Executed by:
executed 2 times by 1 test: return 0;Executed by:
| 2 | ||||||||||||
| 584 | } | - | ||||||||||||
| 585 | adin = | - | ||||||||||||
| 586 | ((void *)0) | - | ||||||||||||
| 587 | ; | - | ||||||||||||
| 588 | adinlen = 0; | - | ||||||||||||
| 589 | } executed 2935 times by 1 test: end of blockExecuted by:
| 2935 | ||||||||||||
| 590 | - | |||||||||||||
| 591 | if (!drbg->meth->generate(drbg, out, outlen, adin, adinlen)
| 0-1034268 | ||||||||||||
| 592 | drbg->state = DRBG_ERROR; | - | ||||||||||||
| 593 | ERR_put_error(36,(107),(112),__FILE__,632); | - | ||||||||||||
| 594 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 595 | } | - | ||||||||||||
| 596 | - | |||||||||||||
| 597 | drbg->generate_counter++; | - | ||||||||||||
| 598 | - | |||||||||||||
| 599 | return executed 1033938 times by 2 tests: 1;return 1;Executed by:
executed 1033938 times by 2 tests: return 1;Executed by:
| 1033938 | ||||||||||||
| 600 | } | - | ||||||||||||
| 601 | int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen) | - | ||||||||||||
| 602 | { | - | ||||||||||||
| 603 | unsigned char *additional = | - | ||||||||||||
| 604 | ((void *)0) | - | ||||||||||||
| 605 | ; | - | ||||||||||||
| 606 | size_t additional_len; | - | ||||||||||||
| 607 | size_t chunk; | - | ||||||||||||
| 608 | size_t ret; | - | ||||||||||||
| 609 | - | |||||||||||||
| 610 | additional_len = rand_drbg_get_additional_data(&additional, drbg->max_adinlen); | - | ||||||||||||
| 611 | - | |||||||||||||
| 612 | for ( ; outlen > 0
| 1032809-1043108 | ||||||||||||
| 613 | chunk = outlen; | - | ||||||||||||
| 614 | if (chunk > drbg->max_request
| 0-1041917 | ||||||||||||
| 615 | chunk = drbg->max_request; never executed: chunk = drbg->max_request; | 0 | ||||||||||||
| 616 | ret = RAND_DRBG_generate(drbg, out, chunk, 0, additional, additional_len); | - | ||||||||||||
| 617 | if (!ret
| 2-1025801 | ||||||||||||
| 618 | goto executed 2 times by 1 test: err;goto err;Executed by:
executed 2 times by 1 test: goto err;Executed by:
| 2 | ||||||||||||
| 619 | } executed 1034540 times by 2 tests: end of blockExecuted by:
| 1034540 | ||||||||||||
| 620 | ret = 1; | - | ||||||||||||
| 621 | - | |||||||||||||
| 622 | err: code before this statement executed 1031170 times by 2 tests: err:Executed by:
| 1031170 | ||||||||||||
| 623 | if (additional_len != 0
| 0-1035520 | ||||||||||||
| 624 | CRYPTO_secure_clear_free(additional, additional_len, __FILE__, 670); executed 1039376 times by 2 tests: CRYPTO_secure_clear_free(additional, additional_len, __FILE__, 670);Executed by:
| 1039376 | ||||||||||||
| 625 | - | |||||||||||||
| 626 | return executed 1060959 times by 2 tests: ret;return ret;Executed by:
executed 1060959 times by 2 tests: return ret;Executed by:
| 1060959 | ||||||||||||
| 627 | } | - | ||||||||||||
| 628 | int RAND_DRBG_set_callbacks(RAND_DRBG *drbg, | - | ||||||||||||
| 629 | RAND_DRBG_get_entropy_fn get_entropy, | - | ||||||||||||
| 630 | RAND_DRBG_cleanup_entropy_fn cleanup_entropy, | - | ||||||||||||
| 631 | RAND_DRBG_get_nonce_fn get_nonce, | - | ||||||||||||
| 632 | RAND_DRBG_cleanup_nonce_fn cleanup_nonce) | - | ||||||||||||
| 633 | { | - | ||||||||||||
| 634 | if (drbg->state != DRBG_UNINITIALISED
| 0-4338 | ||||||||||||
| 635 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 636 | drbg->get_entropy = get_entropy; | - | ||||||||||||
| 637 | drbg->cleanup_entropy = cleanup_entropy; | - | ||||||||||||
| 638 | drbg->get_nonce = get_nonce; | - | ||||||||||||
| 639 | drbg->cleanup_nonce = cleanup_nonce; | - | ||||||||||||
| 640 | return executed 4338 times by 1 test: 1;return 1;Executed by:
executed 4338 times by 1 test: return 1;Executed by:
| 4338 | ||||||||||||
| 641 | } | - | ||||||||||||
| 642 | int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg, unsigned int interval) | - | ||||||||||||
| 643 | { | - | ||||||||||||
| 644 | if (interval > (1 << 24)
| 0 | ||||||||||||
| 645 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 646 | drbg->reseed_interval = interval; | - | ||||||||||||
| 647 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 648 | } | - | ||||||||||||
| 649 | int RAND_DRBG_set_reseed_time_interval(RAND_DRBG *drbg, time_t interval) | - | ||||||||||||
| 650 | { | - | ||||||||||||
| 651 | if (interval > (1 << 20)
| 0-8 | ||||||||||||
| 652 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 653 | drbg->reseed_time_interval = interval; | - | ||||||||||||
| 654 | return executed 8 times by 1 test: 1;return 1;Executed by:
executed 8 times by 1 test: return 1;Executed by:
| 8 | ||||||||||||
| 655 | } | - | ||||||||||||
| 656 | int RAND_DRBG_set_reseed_defaults( | - | ||||||||||||
| 657 | unsigned int _master_reseed_interval, | - | ||||||||||||
| 658 | unsigned int _slave_reseed_interval, | - | ||||||||||||
| 659 | time_t _master_reseed_time_interval, | - | ||||||||||||
| 660 | time_t _slave_reseed_time_interval | - | ||||||||||||
| 661 | ) | - | ||||||||||||
| 662 | { | - | ||||||||||||
| 663 | if (_master_reseed_interval > (1 << 24)
| 0 | ||||||||||||
| 664 | || _slave_reseed_interval > (1 << 24)
| 0 | ||||||||||||
| 665 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 666 | - | |||||||||||||
| 667 | if (_master_reseed_time_interval > (1 << 20)
| 0 | ||||||||||||
| 668 | || _slave_reseed_time_interval > (1 << 20)
| 0 | ||||||||||||
| 669 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 670 | - | |||||||||||||
| 671 | master_reseed_interval = _master_reseed_interval; | - | ||||||||||||
| 672 | slave_reseed_interval = _slave_reseed_interval; | - | ||||||||||||
| 673 | - | |||||||||||||
| 674 | master_reseed_time_interval = _master_reseed_time_interval; | - | ||||||||||||
| 675 | slave_reseed_time_interval = _slave_reseed_time_interval; | - | ||||||||||||
| 676 | - | |||||||||||||
| 677 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 678 | } | - | ||||||||||||
| 679 | - | |||||||||||||
| 680 | - | |||||||||||||
| 681 | - | |||||||||||||
| 682 | - | |||||||||||||
| 683 | - | |||||||||||||
| 684 | - | |||||||||||||
| 685 | - | |||||||||||||
| 686 | int rand_drbg_lock(RAND_DRBG *drbg) | - | ||||||||||||
| 687 | { | - | ||||||||||||
| 688 | if (drbg->lock !=
| 0-2085 | ||||||||||||
| 689 | ((void *)0)
| 0-2085 | ||||||||||||
| 690 | ) | - | ||||||||||||
| 691 | return executed 2085 times by 2 tests: CRYPTO_THREAD_write_lock(drbg->lock);return CRYPTO_THREAD_write_lock(drbg->lock);Executed by:
executed 2085 times by 2 tests: return CRYPTO_THREAD_write_lock(drbg->lock);Executed by:
| 2085 | ||||||||||||
| 692 | - | |||||||||||||
| 693 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 694 | } | - | ||||||||||||
| 695 | - | |||||||||||||
| 696 | - | |||||||||||||
| 697 | - | |||||||||||||
| 698 | - | |||||||||||||
| 699 | - | |||||||||||||
| 700 | - | |||||||||||||
| 701 | - | |||||||||||||
| 702 | int rand_drbg_unlock(RAND_DRBG *drbg) | - | ||||||||||||
| 703 | { | - | ||||||||||||
| 704 | if (drbg->lock !=
| 0-2086 | ||||||||||||
| 705 | ((void *)0)
| 0-2086 | ||||||||||||
| 706 | ) | - | ||||||||||||
| 707 | return executed 2086 times by 2 tests: CRYPTO_THREAD_unlock(drbg->lock);return CRYPTO_THREAD_unlock(drbg->lock);Executed by:
executed 2086 times by 2 tests: return CRYPTO_THREAD_unlock(drbg->lock);Executed by:
| 2086 | ||||||||||||
| 708 | - | |||||||||||||
| 709 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 710 | } | - | ||||||||||||
| 711 | int rand_drbg_enable_locking(RAND_DRBG *drbg) | - | ||||||||||||
| 712 | { | - | ||||||||||||
| 713 | if (drbg->state != DRBG_UNINITIALISED
| 0-779 | ||||||||||||
| 714 | ERR_put_error(36,(119),(129),__FILE__,806) | - | ||||||||||||
| 715 | ; | - | ||||||||||||
| 716 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 717 | } | - | ||||||||||||
| 718 | - | |||||||||||||
| 719 | if (drbg->lock ==
| 0-779 | ||||||||||||
| 720 | ((void *)0)
| 0-779 | ||||||||||||
| 721 | ) { | - | ||||||||||||
| 722 | if (drbg->parent !=
| 0-779 | ||||||||||||
| 723 | ((void *)0)
| 0-779 | ||||||||||||
| 724 | && drbg->parent->lock ==
| 0 | ||||||||||||
| 725 | ((void *)0)
| 0 | ||||||||||||
| 726 | ) { | - | ||||||||||||
| 727 | ERR_put_error(36,(119),(130),__FILE__,813) | - | ||||||||||||
| 728 | ; | - | ||||||||||||
| 729 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 730 | } | - | ||||||||||||
| 731 | - | |||||||||||||
| 732 | drbg->lock = CRYPTO_THREAD_lock_new(); | - | ||||||||||||
| 733 | if (drbg->lock ==
| 0-779 | ||||||||||||
| 734 | ((void *)0)
| 0-779 | ||||||||||||
| 735 | ) { | - | ||||||||||||
| 736 | ERR_put_error(36,(119),(126),__FILE__,820) | - | ||||||||||||
| 737 | ; | - | ||||||||||||
| 738 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 739 | } | - | ||||||||||||
| 740 | } executed 779 times by 2 tests: end of blockExecuted by:
| 779 | ||||||||||||
| 741 | - | |||||||||||||
| 742 | return executed 779 times by 2 tests: 1;return 1;Executed by:
executed 779 times by 2 tests: return 1;Executed by:
| 779 | ||||||||||||
| 743 | } | - | ||||||||||||
| 744 | - | |||||||||||||
| 745 | - | |||||||||||||
| 746 | - | |||||||||||||
| 747 | - | |||||||||||||
| 748 | int RAND_DRBG_set_ex_data(RAND_DRBG *drbg, int idx, void *arg) | - | ||||||||||||
| 749 | { | - | ||||||||||||
| 750 | return executed 4341 times by 1 test: CRYPTO_set_ex_data(&drbg->ex_data, idx, arg);return CRYPTO_set_ex_data(&drbg->ex_data, idx, arg);Executed by:
executed 4341 times by 1 test: return CRYPTO_set_ex_data(&drbg->ex_data, idx, arg);Executed by:
| 4341 | ||||||||||||
| 751 | } | - | ||||||||||||
| 752 | - | |||||||||||||
| 753 | void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) | - | ||||||||||||
| 754 | { | - | ||||||||||||
| 755 | return executed 10860 times by 1 test: CRYPTO_get_ex_data(&drbg->ex_data, idx);return CRYPTO_get_ex_data(&drbg->ex_data, idx);Executed by:
executed 10860 times by 1 test: return CRYPTO_get_ex_data(&drbg->ex_data, idx);Executed by:
| 10860 | ||||||||||||
| 756 | } | - | ||||||||||||
| 757 | static RAND_DRBG *drbg_setup(RAND_DRBG *parent) | - | ||||||||||||
| 758 | { | - | ||||||||||||
| 759 | RAND_DRBG *drbg; | - | ||||||||||||
| 760 | - | |||||||||||||
| 761 | drbg = RAND_DRBG_secure_new(rand_drbg_type, rand_drbg_flags, parent); | - | ||||||||||||
| 762 | if (drbg ==
| 0-1787 | ||||||||||||
| 763 | ((void *)0)
| 0-1787 | ||||||||||||
| 764 | ) | - | ||||||||||||
| 765 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 766 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 767 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 768 | - | |||||||||||||
| 769 | - | |||||||||||||
| 770 | if (parent ==
| 779-1008 | ||||||||||||
| 771 | ((void *)0)
| 779-1008 | ||||||||||||
| 772 | && rand_drbg_enable_locking(drbg) == 0
| 0-779 | ||||||||||||
| 773 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 774 | - | |||||||||||||
| 775 | - | |||||||||||||
| 776 | drbg->reseed_counter = 1; | - | ||||||||||||
| 777 | - | |||||||||||||
| 778 | - | |||||||||||||
| 779 | - | |||||||||||||
| 780 | - | |||||||||||||
| 781 | - | |||||||||||||
| 782 | - | |||||||||||||
| 783 | - | |||||||||||||
| 784 | (void)RAND_DRBG_instantiate(drbg, | - | ||||||||||||
| 785 | (const unsigned char *) ossl_pers_string, | - | ||||||||||||
| 786 | sizeof(ossl_pers_string) - 1); | - | ||||||||||||
| 787 | return executed 1787 times by 2 tests: drbg;return drbg;Executed by:
executed 1787 times by 2 tests: return drbg;Executed by:
| 1787 | ||||||||||||
| 788 | - | |||||||||||||
| 789 | err: | - | ||||||||||||
| 790 | RAND_DRBG_free(drbg); | - | ||||||||||||
| 791 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 792 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 793 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 794 | } | - | ||||||||||||
| 795 | - | |||||||||||||
| 796 | - | |||||||||||||
| 797 | - | |||||||||||||
| 798 | - | |||||||||||||
| 799 | - | |||||||||||||
| 800 | static int do_rand_drbg_init(void); static int do_rand_drbg_init_ossl_ret_ = 0; static void do_rand_drbg_init_ossl_(void) { do_rand_drbg_init_ossl_ret_ = do_rand_drbg_init(); } executed 779 times by 2 tests: static int do_rand_drbg_init(void)end of blockExecuted by:
| 779 | ||||||||||||
| 801 | { | - | ||||||||||||
| 802 | - | |||||||||||||
| 803 | - | |||||||||||||
| 804 | - | |||||||||||||
| 805 | - | |||||||||||||
| 806 | if (!OPENSSL_init_crypto(0,
| 0-779 | ||||||||||||
| 807 | ((void *)0)
| 0-779 | ||||||||||||
| 808 | )
| 0-779 | ||||||||||||
| 809 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 810 | - | |||||||||||||
| 811 | if (!CRYPTO_THREAD_init_local(&private_drbg,
| 0-779 | ||||||||||||
| 812 | ((void *)0)
| 0-779 | ||||||||||||
| 813 | )
| 0-779 | ||||||||||||
| 814 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 815 | - | |||||||||||||
| 816 | if (!CRYPTO_THREAD_init_local(&public_drbg,
| 0-779 | ||||||||||||
| 817 | ((void *)0)
| 0-779 | ||||||||||||
| 818 | )
| 0-779 | ||||||||||||
| 819 | goto never executed: err1;goto err1;never executed: goto err1; | 0 | ||||||||||||
| 820 | - | |||||||||||||
| 821 | master_drbg = drbg_setup( | - | ||||||||||||
| 822 | ((void *)0) | - | ||||||||||||
| 823 | ); | - | ||||||||||||
| 824 | if (master_drbg ==
| 0-779 | ||||||||||||
| 825 | ((void *)0)
| 0-779 | ||||||||||||
| 826 | ) | - | ||||||||||||
| 827 | goto never executed: err2;goto err2;never executed: goto err2; | 0 | ||||||||||||
| 828 | - | |||||||||||||
| 829 | return executed 779 times by 2 tests: 1;return 1;Executed by:
executed 779 times by 2 tests: return 1;Executed by:
| 779 | ||||||||||||
| 830 | - | |||||||||||||
| 831 | err2: | - | ||||||||||||
| 832 | CRYPTO_THREAD_cleanup_local(&public_drbg); | - | ||||||||||||
| 833 | err1: code before this statement never executed: err1: | 0 | ||||||||||||
| 834 | CRYPTO_THREAD_cleanup_local(&private_drbg); | - | ||||||||||||
| 835 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 836 | } | - | ||||||||||||
| 837 | - | |||||||||||||
| 838 | - | |||||||||||||
| 839 | void rand_drbg_cleanup_int(void) | - | ||||||||||||
| 840 | { | - | ||||||||||||
| 841 | if (master_drbg !=
| 779-1297 | ||||||||||||
| 842 | ((void *)0)
| 779-1297 | ||||||||||||
| 843 | ) { | - | ||||||||||||
| 844 | RAND_DRBG_free(master_drbg); | - | ||||||||||||
| 845 | master_drbg = | - | ||||||||||||
| 846 | ((void *)0) | - | ||||||||||||
| 847 | ; | - | ||||||||||||
| 848 | - | |||||||||||||
| 849 | CRYPTO_THREAD_cleanup_local(&private_drbg); | - | ||||||||||||
| 850 | CRYPTO_THREAD_cleanup_local(&public_drbg); | - | ||||||||||||
| 851 | } executed 779 times by 2 tests: end of blockExecuted by:
| 779 | ||||||||||||
| 852 | } executed 2076 times by 12 tests: end of blockExecuted by:
| 2076 | ||||||||||||
| 853 | - | |||||||||||||
| 854 | void drbg_delete_thread_state(void) | - | ||||||||||||
| 855 | { | - | ||||||||||||
| 856 | RAND_DRBG *drbg; | - | ||||||||||||
| 857 | - | |||||||||||||
| 858 | drbg = CRYPTO_THREAD_get_local(&public_drbg); | - | ||||||||||||
| 859 | CRYPTO_THREAD_set_local(&public_drbg, | - | ||||||||||||
| 860 | ((void *)0) | - | ||||||||||||
| 861 | ); | - | ||||||||||||
| 862 | RAND_DRBG_free(drbg); | - | ||||||||||||
| 863 | - | |||||||||||||
| 864 | drbg = CRYPTO_THREAD_get_local(&private_drbg); | - | ||||||||||||
| 865 | CRYPTO_THREAD_set_local(&private_drbg, | - | ||||||||||||
| 866 | ((void *)0) | - | ||||||||||||
| 867 | ); | - | ||||||||||||
| 868 | RAND_DRBG_free(drbg); | - | ||||||||||||
| 869 | } executed 782 times by 2 tests: end of blockExecuted by:
| 782 | ||||||||||||
| 870 | - | |||||||||||||
| 871 | - | |||||||||||||
| 872 | static int drbg_bytes(unsigned char *out, int count) | - | ||||||||||||
| 873 | { | - | ||||||||||||
| 874 | int ret; | - | ||||||||||||
| 875 | RAND_DRBG *drbg = RAND_DRBG_get0_public(); | - | ||||||||||||
| 876 | - | |||||||||||||
| 877 | if (drbg ==
| 0-564240 | ||||||||||||
| 878 | ((void *)0)
| 0-564240 | ||||||||||||
| 879 | ) | - | ||||||||||||
| 880 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 881 | - | |||||||||||||
| 882 | ret = RAND_DRBG_bytes(drbg, out, count); | - | ||||||||||||
| 883 | - | |||||||||||||
| 884 | return executed 564990 times by 1 test: ret;return ret;Executed by:
executed 564990 times by 1 test: return ret;Executed by:
| 564990 | ||||||||||||
| 885 | } | - | ||||||||||||
| 886 | - | |||||||||||||
| 887 | - | |||||||||||||
| 888 | static int drbg_add(const void *buf, int num, double randomness) | - | ||||||||||||
| 889 | { | - | ||||||||||||
| 890 | int ret = 0; | - | ||||||||||||
| 891 | RAND_DRBG *drbg = RAND_DRBG_get0_master(); | - | ||||||||||||
| 892 | - | |||||||||||||
| 893 | if (drbg ==
| 0-21 | ||||||||||||
| 894 | ((void *)0)
| 0-21 | ||||||||||||
| 895 | ) | - | ||||||||||||
| 896 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 897 | - | |||||||||||||
| 898 | if (num < 0
| 0-21 | ||||||||||||
| 899 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 900 | - | |||||||||||||
| 901 | if (randomness > (double)drbg->max_entropylen
| 0-21 | ||||||||||||
| 902 | - | |||||||||||||
| 903 | - | |||||||||||||
| 904 | - | |||||||||||||
| 905 | - | |||||||||||||
| 906 | - | |||||||||||||
| 907 | - | |||||||||||||
| 908 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 909 | } | - | ||||||||||||
| 910 | - | |||||||||||||
| 911 | rand_drbg_lock(drbg); | - | ||||||||||||
| 912 | ret = rand_drbg_restart(drbg, buf, | - | ||||||||||||
| 913 | (size_t)(unsigned int)num, | - | ||||||||||||
| 914 | (size_t)(8*randomness)); | - | ||||||||||||
| 915 | rand_drbg_unlock(drbg); | - | ||||||||||||
| 916 | - | |||||||||||||
| 917 | return executed 21 times by 1 test: ret;return ret;Executed by:
executed 21 times by 1 test: return ret;Executed by:
| 21 | ||||||||||||
| 918 | } | - | ||||||||||||
| 919 | - | |||||||||||||
| 920 | - | |||||||||||||
| 921 | static int drbg_seed(const void *buf, int num) | - | ||||||||||||
| 922 | { | - | ||||||||||||
| 923 | return never executed: drbg_add(buf, num, num);return drbg_add(buf, num, num);never executed: return drbg_add(buf, num, num); | 0 | ||||||||||||
| 924 | } | - | ||||||||||||
| 925 | - | |||||||||||||
| 926 | - | |||||||||||||
| 927 | static int drbg_status(void) | - | ||||||||||||
| 928 | { | - | ||||||||||||
| 929 | int ret; | - | ||||||||||||
| 930 | RAND_DRBG *drbg = RAND_DRBG_get0_master(); | - | ||||||||||||
| 931 | - | |||||||||||||
| 932 | if (drbg ==
| 0 | ||||||||||||
| 933 | ((void *)0)
| 0 | ||||||||||||
| 934 | ) | - | ||||||||||||
| 935 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 936 | - | |||||||||||||
| 937 | rand_drbg_lock(drbg); | - | ||||||||||||
| 938 | ret = drbg->state == DRBG_READY
| 0 | ||||||||||||
| 939 | rand_drbg_unlock(drbg); | - | ||||||||||||
| 940 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||
| 941 | } | - | ||||||||||||
| 942 | - | |||||||||||||
| 943 | - | |||||||||||||
| 944 | - | |||||||||||||
| 945 | - | |||||||||||||
| 946 | - | |||||||||||||
| 947 | - | |||||||||||||
| 948 | RAND_DRBG *RAND_DRBG_get0_master(void) | - | ||||||||||||
| 949 | { | - | ||||||||||||
| 950 | if (!(CRYPTO_THREAD_run_once(&rand_drbg_init, do_rand_drbg_init_ossl_)
| 0-23 | ||||||||||||
| 951 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 952 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 953 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 954 | - | |||||||||||||
| 955 | return executed 23 times by 1 test: master_drbg;return master_drbg;Executed by:
executed 23 times by 1 test: return master_drbg;Executed by:
| 23 | ||||||||||||
| 956 | } | - | ||||||||||||
| 957 | - | |||||||||||||
| 958 | - | |||||||||||||
| 959 | - | |||||||||||||
| 960 | - | |||||||||||||
| 961 | - | |||||||||||||
| 962 | RAND_DRBG *RAND_DRBG_get0_public(void) | - | ||||||||||||
| 963 | { | - | ||||||||||||
| 964 | RAND_DRBG *drbg; | - | ||||||||||||
| 965 | - | |||||||||||||
| 966 | if (!(CRYPTO_THREAD_run_once(&rand_drbg_init, do_rand_drbg_init_ossl_)
| 0-565554 | ||||||||||||
| 967 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 968 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 969 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 970 | - | |||||||||||||
| 971 | drbg = CRYPTO_THREAD_get_local(&public_drbg); | - | ||||||||||||
| 972 | if (drbg ==
| 550-565216 | ||||||||||||
| 973 | ((void *)0)
| 550-565216 | ||||||||||||
| 974 | ) { | - | ||||||||||||
| 975 | if (!ossl_init_thread_start(0x04)
| 0-550 | ||||||||||||
| 976 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 977 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 978 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 979 | drbg = drbg_setup(master_drbg); | - | ||||||||||||
| 980 | CRYPTO_THREAD_set_local(&public_drbg, drbg); | - | ||||||||||||
| 981 | } executed 550 times by 1 test: end of blockExecuted by:
| 550 | ||||||||||||
| 982 | return executed 564027 times by 1 test: drbg;return drbg;Executed by:
executed 564027 times by 1 test: return drbg;Executed by:
| 564027 | ||||||||||||
| 983 | } | - | ||||||||||||
| 984 | - | |||||||||||||
| 985 | - | |||||||||||||
| 986 | - | |||||||||||||
| 987 | - | |||||||||||||
| 988 | - | |||||||||||||
| 989 | RAND_DRBG *RAND_DRBG_get0_private(void) | - | ||||||||||||
| 990 | { | - | ||||||||||||
| 991 | RAND_DRBG *drbg; | - | ||||||||||||
| 992 | - | |||||||||||||
| 993 | if (!(CRYPTO_THREAD_run_once(&rand_drbg_init, do_rand_drbg_init_ossl_)
| 0-498118 | ||||||||||||
| 994 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 995 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 996 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 997 | - | |||||||||||||
| 998 | drbg = CRYPTO_THREAD_get_local(&private_drbg); | - | ||||||||||||
| 999 | if (drbg ==
| 458-498110 | ||||||||||||
| 1000 | ((void *)0)
| 458-498110 | ||||||||||||
| 1001 | ) { | - | ||||||||||||
| 1002 | if (!ossl_init_thread_start(0x04)
| 0-458 | ||||||||||||
| 1003 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 1004 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 1005 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 1006 | drbg = drbg_setup(master_drbg); | - | ||||||||||||
| 1007 | CRYPTO_THREAD_set_local(&private_drbg, drbg); | - | ||||||||||||
| 1008 | } executed 458 times by 2 tests: end of blockExecuted by:
| 458 | ||||||||||||
| 1009 | return executed 498444 times by 2 tests: drbg;return drbg;Executed by:
executed 498444 times by 2 tests: return drbg;Executed by:
| 498444 | ||||||||||||
| 1010 | } | - | ||||||||||||
| 1011 | - | |||||||||||||
| 1012 | RAND_METHOD rand_meth = { | - | ||||||||||||
| 1013 | drbg_seed, | - | ||||||||||||
| 1014 | drbg_bytes, | - | ||||||||||||
| 1015 | - | |||||||||||||
| 1016 | ((void *)0) | - | ||||||||||||
| 1017 | , | - | ||||||||||||
| 1018 | drbg_add, | - | ||||||||||||
| 1019 | drbg_bytes, | - | ||||||||||||
| 1020 | drbg_status | - | ||||||||||||
| 1021 | }; | - | ||||||||||||
| 1022 | - | |||||||||||||
| 1023 | RAND_METHOD *RAND_OpenSSL(void) | - | ||||||||||||
| 1024 | { | - | ||||||||||||
| 1025 | return executed 566075 times by 2 tests: &rand_meth;return &rand_meth;Executed by:
executed 566075 times by 2 tests: return &rand_meth;Executed by:
| 566075 | ||||||||||||
| 1026 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |