In rng.h add to the declaration of MaurerRandomnessTest
unsigned int Put2(const byte *inString, unsigned int length, int
messageEnd, bool blocking);
bool IsolatedFlush(bool hardFlush, bool blocking);
In rnh.cpp
unsigned int MaurerRandomnessTest::Put2(const byte *inString, unsigned
int length, int messageEnd, bool blocking)
{
return -1;
}
bool MaurerRandomnessTest::IsolatedFlush(bool hardFlush, bool blocking)
{
return false;
}
Then the function Maurer_Test should compile, it does using VC++.
void Maurer_Test(const char *rnd_file)
{
SecByteBlock rndBuf(20000);
ArraySink *rndArr;
// Read the random number file from cryptest.exe fips-rand
FileSource inFile(rnd_file, true, rndArr = new ArraySink(rndBuf,
20000));
MaurerRandomnessTest mrTest;
mrTest.Put(rndBuf, 20000);
cout << "Result of Maurer_Test is " << mrTest.GetTestValue() <<
endl;
}
Regards,
Peter.
James Bishop wrote:
>
> Good afternoon,
>
> I'm exploring the RNG facilities of Crypto++5.1 (on Linux 2.4.18, using
> the gcc 3.2 compiler).
>
> 1) Is any block cipher preferred for use with the AutoSeededX917RNG class?
>
> 2) I tried to use the MaurerRandomnessTest class to process the output
> of the /dev/random device supplied by the OS (alleged randomness is
> coming from the i810_rng driver), which is seeding the X917 rng.
>
> I ran cryptest.exe fips-rand to generate "a few" random files.
>
> Then I tried to write a filter to test for randomness. However,
> compilation fails at the declaration of the MaurerRandomnessTest object
> with the following error messages:
>
> /opt/gcc32/bin/g++ -NDEBUG --ffunction-sections -fdata-sections -o
> maurer_test -I./lib -L./lib maurer_test.cpp -Wl,--gcc-sections -lcryptopp
> maurer_test.cpp: In function `void Maurer_Test(const char*)':
> maurer_test.cpp:112: cannot declare variable `mrTest' to be of type `
> CryptoPP::MaurerRandomnessTest'
> maurer_test.cpp:112: because the following virtual functions are abstract:
> lib/cryptlib.h:715: virtual unsigned int
> CryptoPP::BufferedTransformation::Put2(const byte*, unsigned int,
> int, bool)
> lib/cryptlib.h:735: virtual bool
> CryptoPP::BufferedTransformation::IsolatedFlush(bool, bool)
> make: *** [maurer_test] Error 1
>
> The offending function (which doesn't yet perform the test) is:
>
> void Maurer_Test(const char *rnd_file)
> {
> SecByteBlock rndBuf(20000);
> ArraySink *rndArr;
>
> // Read the random number file from cryptest.exe fips-rand
>
> FileSource inFile(rnd_file, true, rndArr = new ArraySink(rndBuf, 20000);
> MaurerRandomnessTest mrTest;
> }
>
> How and where should I define the abstract virtual
> BufferedTransformation functions (Put2 and IsolatedFlush)? I tried
> defining simple "do-nothing" functions with the appropriate signature,
> but without success. I guess this is more a problem with my knowledge
> and understanding of C++.
>
> Also, as the MaurerRandomnessTest class inherits from the Sink class,
> can I simply insert it in the FileSource statement in some way, to pipe
> the file contents straight into it, instead of first reading the file
> into an array?
>
> Eventually, I would just like to produce a list of the random file names
> with the corresponding result of the Maurer test on the file's contents.
>
> Thanks in advance.
> --
>
> _____________________________________________
> James Bishop
> Institute for the Protection and Security of the Citizen (IPSC)
> European Commission - Joint Research Centre
> I - 21020 Ispra, Italy
> Tel.: +39 0332 786225
> Fax.: +39 0332 789757
> e-mail: [EMAIL PROTECTED]
--
//
// Peter L. Bell [EMAIL PROTECTED]
// +61 2 9805 2955
// Blessed are the Peacemakers, they shall be called Sons of God.
//