Abstract interface to a source of entropy
Definition at line 25 of file entropy_src.h.
std::unique_ptr< Entropy_Source > Botan::Entropy_Source::create |
( |
std::string_view | type | ) |
|
|
static |
Return a new entropy source of a particular type, or null Each entropy source may require substantial resources (eg, a file handle or socket instance), so try to share them among multiple RNGs, or just use the preconfigured global list accessed by Entropy_Sources::global_sources()
Definition at line 88 of file entropy_srcs.cpp.
88 {
89#if defined(BOTAN_HAS_SYSTEM_RNG)
90 if(
name ==
"system_rng") {
91 return std::make_unique<System_RNG_EntropySource>();
92 }
93#endif
94
95#if defined(BOTAN_HAS_PROCESSOR_RNG)
98 return std::make_unique<Processor_RNG_EntropySource>();
99 }
100 }
101#endif
102
103#if defined(BOTAN_HAS_ENTROPY_SRC_RDSEED)
104 if(
name ==
"rdseed") {
105 return std::make_unique<Intel_Rdseed>();
106 }
107#endif
108
109#if defined(BOTAN_HAS_ENTROPY_SRC_GETENTROPY)
110 if(
name ==
"getentropy") {
111 return std::make_unique<Getentropy>();
112 }
113#endif
114
115#if defined(BOTAN_HAS_ENTROPY_SRC_WIN32)
116 if(
name ==
"system_stats") {
117 return std::make_unique<Win32_EntropySource>();
118 }
119#endif
120
122 return nullptr;
123}
virtual std::string name() const =0
References Botan::Processor_RNG::available(), BOTAN_UNUSED, and name().
Referenced by Botan::Entropy_Sources::Entropy_Sources().