Update comment. Whitespace cleanup
parent
c1f025343a
commit
2efe26a418
10
rdrand.cpp
10
rdrand.cpp
|
|
@ -137,7 +137,7 @@
|
|||
# endif
|
||||
# if defined(__has_include)
|
||||
# if __has_include(<x86intrin.h>)
|
||||
# include <x86intrin.h> // rdseed for Clang (immintrin.h); rdseed for Clang (rdseedintrin.h)
|
||||
# include <x86intrin.h> // rdrand for Clang (immintrin.h); rdseed for Clang (rdseedintrin.h)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
|
@ -169,12 +169,12 @@ extern "C" int NASM_RRA_GenerateBlock(byte*, size_t, unsigned int);
|
|||
#if NASM_RDSEED_ASM_AVAILABLE
|
||||
extern "C" int NASM_RSA_GenerateBlock(byte*, size_t, unsigned int);
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
|
||||
#if ALL_RDRAND_INTRIN_AVAILABLE
|
||||
static int ALL_RRI_GenerateBlock(byte *output, size_t size, unsigned int safety)
|
||||
{
|
||||
|
|
@ -226,7 +226,7 @@ static int ALL_RRI_GenerateBlock(byte *output, size_t size, unsigned int safety)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if CRYPTOPP_BOOL_X64 || CRYTPOPP_BOOL_X32
|
||||
*((volatile word64*)&val) = 0;
|
||||
#else
|
||||
|
|
@ -407,7 +407,7 @@ static int ALL_RSI_GenerateBlock(byte *output, size_t size, unsigned int safety)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32
|
||||
*((volatile word64*)&val) = 0;
|
||||
#else
|
||||
|
|
|
|||
16
rdrand.h
16
rdrand.h
|
|
@ -37,7 +37,7 @@ class RDRAND : public RandomNumberGenerator
|
|||
{
|
||||
public:
|
||||
std::string AlgorithmName() const {return "RDRAND";}
|
||||
|
||||
|
||||
//! \brief Construct a RDRAND generator
|
||||
//! \param retries the number of retries for failed calls to the hardware
|
||||
//! \details RDRAND() constructs a generator with a maximum number of retires
|
||||
|
|
@ -46,16 +46,16 @@ public:
|
|||
//! to fulfill requests at about 6 to 8 times the rate of RDRAND. The default
|
||||
//! retries reflects the difference.
|
||||
RDRAND(unsigned int retries = 12) : m_retries(retries) {}
|
||||
|
||||
|
||||
virtual ~RDRAND() {}
|
||||
|
||||
|
||||
//! \brief Retrieve the number of retries used by the generator
|
||||
//! \returns the number of times GenerateBlock() will attempt to recover from a failed generation
|
||||
unsigned int GetRetries() const
|
||||
{
|
||||
return m_retries;
|
||||
}
|
||||
|
||||
|
||||
//! \brief Set the number of retries used by the generator
|
||||
//! \param retries number of times GenerateBlock() will attempt to recover from a failed generation
|
||||
void SetRetries(unsigned int retries)
|
||||
|
|
@ -119,7 +119,7 @@ class RDSEED : public RandomNumberGenerator
|
|||
{
|
||||
public:
|
||||
std::string AlgorithmName() const {return "RDSEED";}
|
||||
|
||||
|
||||
//! \brief Construct a RDSEED generator
|
||||
//! \param retries the number of retries for failed calls to the hardware
|
||||
//! \details RDSEED() constructs a generator with a maximum number of retires
|
||||
|
|
@ -128,16 +128,16 @@ public:
|
|||
//! to fulfill requests at about 6 to 8 times the rate of RDRAND. The default
|
||||
//! retries reflects the difference.
|
||||
RDSEED(unsigned int retries = 64) : m_retries(retries) {}
|
||||
|
||||
|
||||
virtual ~RDSEED() {}
|
||||
|
||||
|
||||
//! \brief Retrieve the number of retries used by the generator
|
||||
//! \returns the number of times GenerateBlock() will attempt to recover from a failed generation
|
||||
unsigned int GetRetries() const
|
||||
{
|
||||
return m_retries;
|
||||
}
|
||||
|
||||
|
||||
//! \brief Set the number of retries used by the generator
|
||||
//! \param retries number of times GenerateBlock() will attempt to recover from a failed generation
|
||||
void SetRetries(unsigned int retries)
|
||||
|
|
|
|||
Loading…
Reference in New Issue