From 73caca5eea99506599530d3085aab3edcf3dc57d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 15 Jan 2005 02:36:07 +0000 Subject: [PATCH] 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. --- stepmania/src/CryptManager.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/stepmania/src/CryptManager.cpp b/stepmania/src/CryptManager.cpp index ff9ec48272..8afaa629fa 100644 --- a/stepmania/src/CryptManager.cpp +++ b/stepmania/src/CryptManager.cpp @@ -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 ) {