/* * Get the private DRBG. * Returns pointer to the DRBG on success, NULL on failure. */ RAND_DRBG *RAND_DRBG_get0_private(void) { RAND_DRBG *drbg; if (!RUN_ONCE(&rand_drbg_init, do_rand_drbg_init)) return NULL; drbg = CRYPTO_THREAD_get_local(&private_drbg_thread_local_key); if (drbg == NULL) { ossl_init_thread_start(OPENSSL_INIT_THREAD_RAND); drbg = drbg_setup(drbg_master); CRYPTO_THREAD_set_local(&private_drbg_thread_local_key, drbg); } return drbg; }
/* * Get the public DRBG. * Returns pointer to the DRBG on success, NULL on failure. */ RAND_DRBG *RAND_DRBG_get0_public(void) { RAND_DRBG *drbg; if (!RUN_ONCE(&rand_drbg_init, do_rand_drbg_init)) return NULL; drbg = CRYPTO_THREAD_get_local(&public_drbg); if (drbg == NULL) { if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_RAND)) return NULL; drbg = drbg_setup(master_drbg); CRYPTO_THREAD_set_local(&public_drbg, drbg); } return drbg; }