Use NonblockingRng instead of AutoSeededRandomPool. AutoSeededRandomPool allows adding entropy from various sources, but we only have one source (the OS's random number generation). If we really want to seed entropy from multiple sources, we can use the code in crypto/ from Putty, which does the same thing in a tiny fraction of the code.

This commit is contained in:
Glenn Maynard
2005-01-15 02:36:07 +00:00
parent 79e018f52f
commit 73caca5eea
+2 -9
View File
@@ -20,13 +20,6 @@ static const CString PUBLIC_KEY_PATH = "Data/public.rsa";
static const int KEY_LENGTH = 1024;
#define MAX_SIGNATURE_SIZE_BYTES 1024 // 1 KB
#ifndef OS_RNG_AVAILABLE
/* To ease porting, if there is no AutoSeededRandomPool, use an insecure, unseeded pool. */
#include "crypto51/randpool.h"
#include "crypto51/rng.h"
#define AutoSeededRandomPool RandomPool
#endif
CryptManager* CRYPTMAN = NULL; // global and accessable from anywhere in our program
CryptManager::CryptManager()
@@ -56,7 +49,7 @@ void CryptManager::GenerateRSAKey( unsigned int keyLength, CString privFilename,
try
{
AutoSeededRandomPool rng;
NonblockingRng rng;
RSASSA_PKCS1v15_SHA_Signer priv(rng, keyLength);
RageFileSink privFile(privFilename);
@@ -90,7 +83,7 @@ void CryptManager::SignFileToFile( CString sPath, CString sSignatureFile )
try {
RageFileSource privFile(sPrivFilename, true);
RSASSA_PKCS1v15_SHA_Signer priv(privFile);
AutoSeededRandomPool rng;
NonblockingRng rng;
RageFileSource f(sMessageFilename, true, new SignerFilter(rng, priv, new RageFileSink(sSignatureFile)));
} catch( const CryptoPP::Exception &s ) {