Botan
2.1.0
Crypto and TLS for C++11
|
Functions | |
void * | allocate_locked_pages (size_t length) |
void | free_locked_pages (void *ptr, size_t length) |
uint64_t BOTAN_DLL | get_high_resolution_clock () |
size_t | get_memory_locking_limit () |
uint32_t BOTAN_DLL | get_process_id () |
uint64_t BOTAN_DLL | get_processor_timestamp () |
uint64_t BOTAN_DLL | get_system_timestamp_ns () |
int BOTAN_DLL | run_cpu_instruction_probe (std::function< int()> probe_fn) |
void * Botan::OS::allocate_locked_pages | ( | size_t | length | ) |
Request so many bytes of page-aligned RAM locked into memory using mlock, VirtualLock, or similar. Returns null on failure. The memory returned is zeroed. Free it with free_locked_pages.
length | requested allocation in bytes |
Definition at line 257 of file os_utils.cpp.
References BOTAN_UNUSED.
void Botan::OS::free_locked_pages | ( | void * | ptr, |
size_t | length | ||
) |
Free memory allocated by allocate_locked_pages
ptr | a pointer returned by allocate_locked_pages |
length | length passed to allocate_locked_pages |
Definition at line 314 of file os_utils.cpp.
References Botan::secure_scrub_memory().
uint64_t Botan::OS::get_high_resolution_clock | ( | ) |
Definition at line 109 of file os_utils.cpp.
References get_processor_timestamp().
Referenced by Botan::Stateful_RNG::randomize_with_ts_input(), and Botan::RandomNumberGenerator::randomize_with_ts_input().
size_t Botan::OS::get_memory_locking_limit | ( | ) |
Definition at line 171 of file os_utils.cpp.
References Botan::CT::min().
uint32_t Botan::OS::get_process_id | ( | ) |
Definition at line 31 of file os_utils.cpp.
Referenced by Botan::Stateful_RNG::reseed_check().
uint64_t Botan::OS::get_processor_timestamp | ( | ) |
On Windows, calls QueryPerformanceCounter.
Under GCC or Clang on supported platforms the hardware cycle counter is queried. Currently supported processors are x86, PPC, Alpha, SPARC, IA-64, S/390x, and HP-PA. If no CPU cycle counter is available on this system, returns zero.
Definition at line 44 of file os_utils.cpp.
Referenced by get_high_resolution_clock().
uint64_t Botan::OS::get_system_timestamp_ns | ( | ) |
Definition at line 157 of file os_utils.cpp.
Referenced by Botan::Stateful_RNG::randomize_with_ts_input(), and Botan::RandomNumberGenerator::randomize_with_ts_input().
int Botan::OS::run_cpu_instruction_probe | ( | std::function< int()> | probe_fn | ) |
Run a probe instruction to test for support for a CPU instruction. Runs in system-specific env that catches illegal instructions; this function always fails if the OS doesn't provide this. Returns value of probe_fn, if it could run. If error occurs, returns negative number. This allows probe_fn to indicate errors of its own, if it wants. For example the instruction might not only be only available on some CPUs, but also buggy on some subset of these - the probe function can test to make sure the instruction works properly before indicating that the instruction is available.
If probe_fn throws an exception the result is undefined.
Return codes: -1 illegal instruction detected
Definition at line 346 of file os_utils.cpp.