--- embedaddon/strongswan/src/libstrongswan/plugins/botan/botan_rng.c 2020/06/03 09:46:44 1.1.1.1 +++ embedaddon/strongswan/src/libstrongswan/plugins/botan/botan_rng.c 2021/03/17 00:20:08 1.1.1.2 @@ -22,6 +22,7 @@ */ #include "botan_rng.h" +#include "botan_util.h" #include @@ -83,29 +84,12 @@ METHOD(rng_t, destroy, void, botan_random_t *botan_rng_create(rng_quality_t quality) { private_botan_random_t *this; - const char* rng_name; + const char *rng_name; - switch (quality) + rng_name = botan_map_rng_quality(quality); + if (!rng_name) { - case RNG_WEAK: - case RNG_STRONG: - /* some rng_t instances of this class (e.g. in the ike-sa-manager) - * may be called concurrently by different threads. the Botan RNGs - * are not reentrant, by default, so use the threadsafe version. - * because we build without threading support when running tests - * with leak-detective (lots of reports of frees of unknown memory) - * there is a fallback to the default */ -#ifdef BOTAN_TARGET_OS_HAS_THREADS - rng_name = "user-threadsafe"; -#else - rng_name = "user"; -#endif - break; - case RNG_TRUE: - rng_name = "system"; - break; - default: - return NULL; + return NULL; } INIT(this,