summaryrefslogtreecommitdiff
path: root/rdrand.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2015-11-29 14:43:12 -0500
committerJeffrey Walton <noloader@gmail.com>2015-11-29 14:43:12 -0500
commit8ba42323860a3978efa72bf0ef071b32407503e0 (patch)
tree6000e3d6c15c5a97e7b422b45de833baba7c6935 /rdrand.h
parented6c1de915d1ac0e528a2762d6a0e29b2aba5982 (diff)
downloadcryptopp-git-8ba42323860a3978efa72bf0ef071b32407503e0.tar.gz
Changed retry count for RDRAND and RDSEED. RDSEED appears to fail to fulfill requests at about 6 to 8 times the rate of RDRAND.
Diffstat (limited to 'rdrand.h')
-rw-r--r--rdrand.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/rdrand.h b/rdrand.h
index fc2b77b7..6f4901be 100644
--- a/rdrand.h
+++ b/rdrand.h
@@ -1,8 +1,7 @@
// rdrand.h - written and placed in public domain by Jeffrey Walton and Uri Blumenthal.
// Copyright assigned to Crypto++ project.
-//! \file
-//! \headerfile rdrand.h
+//! \file rdrand.h
//! \brief Classes for RDRAND and RDSEED
#ifndef CRYPTOPP_RDRAND_H
@@ -15,8 +14,8 @@
// indirectly uses CRYPTOPP_BOOL_{X86|X32|X64} (via CRYPTOPP_CPUID_AVAILABLE)
// to select an implementation or "throw NotImplemented". At runtime, the
// class uses the result of CPUID to determine if RDRAND or RDSEED are
-// available. A lazy throw strategy is used in case the CPU does not support
-// the instruction. I.e., the throw is deferred until GenerateBlock() is called.
+// available. If not available, a lazy throw strategy is used. I.e., the
+// throw is deferred until GenerateBlock() is called.
// Microsoft added RDRAND in August 2012, VS2012. GCC added RDRAND in December 2010, GCC 4.6.
// Clang added RDRAND in July 2012, Clang 3.2. Intel added RDRAND in September 2011, ICC 12.1.
@@ -43,7 +42,10 @@ public:
//! \param retries the number of retries for failed calls to the hardware
//! \details RDRAND() constructs a generator with a maximum number of retires
//! for failed generation attempts.
- RDRAND(unsigned int retries = 8) : m_retries(retries) {}
+ //! \details Empirical testing under a 6th generaton i7 (6200U) shows RDSEED fails
+ //! 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() {}
@@ -122,7 +124,10 @@ public:
//! \param retries the number of retries for failed calls to the hardware
//! \details RDSEED() constructs a generator with a maximum number of retires
//! for failed generation attempts.
- RDSEED(unsigned int retries = 8) : m_retries(retries) {}
+ //! \details Empirical testing under a 6th generaton i7 (6200U) shows RDSEED fails
+ //! 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() {}