summaryrefslogtreecommitdiff
path: root/embeddedcryptopp/randpool.cpp
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2013-08-22 16:39:52 -0400
committerMicah Anderson <micah@riseup.net>2013-08-22 16:57:38 -0400
commit6d35b188b668c5007409e63a15e8340ed34dcfb8 (patch)
treec9dd25f3675b3b6f9b29b0786057f8a4d377bc2b /embeddedcryptopp/randpool.cpp
parent86a1089dc6694f58d0f3356bdf9c8fe4061421f5 (diff)
parent5e60e0e3af85f22aa0afe8bf0ecf85619afacfeb (diff)
Merge tag 'upstream/0.6.0.12'
Upstream version 0.6.0.12
Diffstat (limited to 'embeddedcryptopp/randpool.cpp')
-rw-r--r--embeddedcryptopp/randpool.cpp52
1 files changed, 0 insertions, 52 deletions
diff --git a/embeddedcryptopp/randpool.cpp b/embeddedcryptopp/randpool.cpp
deleted file mode 100644
index 4e935fe..0000000
--- a/embeddedcryptopp/randpool.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// randpool.cpp - written and placed in the public domain by Wei Dai
-// RandomPool used to follow the design of randpool in PGP 2.6.x,
-// but as of version 5.5 it has been redesigned to reduce the risk
-// of reusing random numbers after state rollback (which may occur
-// when running in a virtual machine like VMware).
-
-#include "pch.h"
-
-#ifndef CRYPTOPP_IMPORTS
-
-#include "randpool.h"
-#include "aes.h"
-#include "sha.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-RandomPool::RandomPool()
- : m_pCipher(new AES::Encryption), m_keySet(false)
-{
- memset(m_key, 0, m_key.SizeInBytes());
- memset(m_seed, 0, m_seed.SizeInBytes());
-}
-
-void RandomPool::IncorporateEntropy(const byte *input, size_t length)
-{
- SHA256 hash;
- hash.Update(m_key, 32);
- hash.Update(input, length);
- hash.Final(m_key);
- m_keySet = false;
-}
-
-void RandomPool::GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size)
-{
- if (size > 0)
- {
- if (!m_keySet)
- m_pCipher->SetKey(m_key, 32);
-
- do
- {
- m_pCipher->ProcessBlock(m_seed);
- size_t len = UnsignedMin(16, size);
- target.ChannelPut(channel, m_seed, len);
- size -= len;
- } while (size > 0);
- }
-}
-
-NAMESPACE_END
-
-#endif