Add additional self tests

And whitespace check-in
pull/769/head
Jeffrey Walton 2018-12-25 09:28:27 -05:00
parent 2c3ca1c01e
commit 7226abd433
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 77 additions and 60 deletions

View File

@ -365,6 +365,15 @@ bool TestX25519()
const unsigned int AGREE_COUNT = 64;
bool pass = true;
try {
x25519 x1(FileSource(DataDir("TestData/x25519.dat").c_str(), true).Ref());
x25519 x2(FileSource(DataDir("TestData/x25519v0.dat").c_str(), true).Ref());
x25519 x3(FileSource(DataDir("TestData/x25519v1.dat").c_str(), true).Ref());
}
catch (BERDecodeErr&) {
pass = false;
}
SecByteBlock priv1(32), priv2(32), pub1(32), pub2(32), share1(32), share2(32);
for (unsigned int i=0; i<AGREE_COUNT; ++i)
{
@ -414,8 +423,16 @@ bool TestEd25519()
std::cout << "\nTesting ed25519 Signatures...\n\n";
bool pass = true;
try {
ed25519::Signer s1(FileSource(DataDir("TestData/ed25519.dat").c_str(), true).Ref());
ed25519::Signer s2(FileSource(DataDir("TestData/ed25519v0.dat").c_str(), true).Ref());
ed25519::Signer s3(FileSource(DataDir("TestData/ed25519v1.dat").c_str(), true).Ref());
}
catch (BERDecodeErr&) {
pass = false;
}
#if defined(NO_OS_DEPENDENCE)
std::cout << "\nNo operating system provided random number generator, skipping test." << std::endl;
return pass;
#else
const unsigned int SIGN_COUNT = 64, MSG_SIZE=128;