diff options
author | watcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-11-26 14:19:43 +0000 |
---|---|---|
committer | watcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-11-26 14:19:43 +0000 |
commit | 7aff1e4cb053394db57c2814d5fe1e6493e0cc75 (patch) | |
tree | c8585e44049b37e4da152495c954242204c2c38d /cryptopp/crypto/randpool.cpp | |
parent | 6f3d69266933ef120d229e0daf2da164b77214d0 (diff) |
Project folders rename part 2
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@214 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'cryptopp/crypto/randpool.cpp')
-rw-r--r-- | cryptopp/crypto/randpool.cpp | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/cryptopp/crypto/randpool.cpp b/cryptopp/crypto/randpool.cpp deleted file mode 100644 index 2a38f5d..0000000 --- a/cryptopp/crypto/randpool.cpp +++ /dev/null @@ -1,61 +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"
-#include "hrtimer.h"
-#include <time.h>
-
-NAMESPACE_BEGIN(CryptoPP)
-
-RandomPool::RandomPool()
- : m_pCipher(new AES::Encryption), m_keySet(false)
-{
-}
-
-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);
-
- Timer timer;
- TimerWord tw = timer.GetCurrentTimerValue();
- CRYPTOPP_COMPILE_ASSERT(sizeof(tw) <= 16);
- *(TimerWord *)m_seed.data() += tw;
-
- time_t t = time(NULL);
- CRYPTOPP_COMPILE_ASSERT(sizeof(t) <= 8);
- *(time_t *)(m_seed.data()+8) += t;
-
- 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
|