Botan  2.11.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::Intel_Rdseed Class Referencefinal

#include <rdseed.h>

Inheritance diagram for Botan::Intel_Rdseed:

Public Member Functions

std::string name () const override
 
size_t poll (RandomNumberGenerator &rng) override
 

Detailed Description

Entropy source using the rdseed instruction first introduced on Intel's Broadwell architecture.

Definition at line 19 of file rdseed.h.

Member Function Documentation

◆ name()

std::string Botan::Intel_Rdseed::name ( ) const
inlineoverride

Definition at line 22 of file rdseed.h.

22 { return "rdseed"; }

◆ poll()

size_t Botan::Intel_Rdseed::poll ( RandomNumberGenerator &  rng)
override

Definition at line 18 of file rdseed.cpp.

19  {
20  if(CPUID::has_rdseed())
21  {
22  for(size_t p = 0; p != BOTAN_ENTROPY_INTEL_RNG_POLLS; ++p)
23  {
24  for(size_t i = 0; i != BOTAN_ENTROPY_RDSEED_RETRIES; ++i)
25  {
26  uint32_t r = 0;
27 
28 #if defined(BOTAN_USE_GCC_INLINE_ASM)
29  int cf = 0;
30 
31  // Encoding of rdseed %eax
32  asm(".byte 0x0F, 0xC7, 0xF8; adcl $0,%1" :
33  "=a" (r), "=r" (cf) : "0" (r), "1" (cf) : "cc");
34 #else
35  int cf = _rdseed32_step(&r);
36 #endif
37  if(1 == cf)
38  {
39  rng.add_entropy_T(r);
40  break;
41  }
42  }
43  }
44  }
45 
46  return 0;
47  }
bool RandomNumberGenerator & rng
Definition: numthry.h:176
BigInt const BigInt & p
Definition: numthry.h:150
void const BigInt BigInt BigInt & r
Definition: divide.h:23

References Botan::p, Botan::r, and Botan::rng.


The documentation for this class was generated from the following files: