8 #include <botan/rdrand_rng.h>
9 #include <botan/loadstor.h>
10 #include <botan/cpuid.h>
12 #if !defined(BOTAN_USE_GCC_INLINE_ASM)
13 #include <immintrin.h>
20 if(!CPUID::has_rdrand())
21 throw Exception(
"Current CPU does not support RDRAND instruction");
45 for(
size_t i = 0; i != BOTAN_ENTROPY_RDRAND_RETRIES; ++i)
47 #if defined(BOTAN_USE_GCC_INLINE_ASM)
51 asm(
".byte 0x0F, 0xC7, 0xF0; adcl $0,%1" :
52 "=a" (r),
"=r" (cf) :
"0" (r),
"1" (cf) :
"cc");
54 int cf = _rdrand32_step(&r);
80 for(
size_t i = 0; i != out_len; ++i)
void randomize(uint8_t out[], size_t out_len) override
static uint32_t rdrand_status(bool &ok)
#define BOTAN_FUNC_ISA(isa)
uint8_t get_byte(size_t byte_num, T input)
void store_le(uint16_t in, uint8_t out[2])