summaryrefslogtreecommitdiff
path: root/validat1.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-03-07 03:57:23 -0500
committerJeffrey Walton <noloader@gmail.com>2017-03-07 03:57:23 -0500
commit14d92f9eba81191e3537ac14ff21d84ef7405e9c (patch)
tree1172fe3ce930b17822242c9a3f6c3fe28a17842f /validat1.cpp
parent1e5d6ee8d4f1dd2dd7d89bc6e2dd5391fd853908 (diff)
downloadcryptopp-git-14d92f9eba81191e3537ac14ff21d84ef7405e9c.tar.gz
Improve performance of RDRAND and RDSEED (Issue 387)
Diffstat (limited to 'validat1.cpp')
-rw-r--r--validat1.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/validat1.cpp b/validat1.cpp
index 8a220879..e4e7c456 100644
--- a/validat1.cpp
+++ b/validat1.cpp
@@ -679,7 +679,6 @@ bool TestRDRAND()
// Squash code coverage warnings on unused functions
(void)rdrand.AlgorithmName();
(void)rdrand.CanIncorporateEntropy();
- rdrand.SetRetries(rdrand.GetRetries());
rdrand.IncorporateEntropy(NULLPTR, 0);
if (!(entropy && compress && discard))
@@ -694,7 +693,7 @@ bool TestRDSEED()
{
// Testing on 5th generation i5 shows RDSEED needs about 128 retries for 10K bytes
// on 64-bit/amd64 VM, and it needs more for an 32-bit/i686 VM.
- RDSEED rdseed(256);
+ RDSEED rdseed;
bool entropy = true, compress = true, discard = true;
static const unsigned int SIZE = 10000;
@@ -758,7 +757,6 @@ bool TestRDSEED()
// Squash code coverage warnings on unused functions
(void)rdseed.AlgorithmName();
(void)rdseed.CanIncorporateEntropy();
- rdseed.SetRetries(rdseed.GetRetries());
rdseed.IncorporateEntropy(NULLPTR, 0);
if (!(entropy && compress && discard))
@@ -1410,8 +1408,9 @@ bool TestModeIV(SymmetricCipher &e, SymmetricCipher &d)
SecByteBlock lastIV, iv(e.IVSize());
StreamTransformationFilter filter(e, new StreamTransformationFilter(d));
- // vector_ptr<byte> due to Enterprise Analysis finding on the stack based array.
- vector_ptr<byte> plaintext(20480);
+ // Enterprise Analysis finding on the stack based array
+ const int BUF_SIZE=20480U;
+ AlignedSecByteBlock plaintext(BUF_SIZE);
for (unsigned int i=1; i<20480; i*=2)
{