Cut-in determinsitic signature verification during signing
parent
79c231edcb
commit
9cc0c47f7b
32
datatest.cpp
32
datatest.cpp
|
|
@ -290,9 +290,12 @@ void TestSignatureScheme(TestData &v)
|
||||||
// for DSA and ECDSA, and access to the seed or secret is not needed. If
|
// for DSA and ECDSA, and access to the seed or secret is not needed. If
|
||||||
// additional determinsitic signatures are added, then the test harness will
|
// additional determinsitic signatures are added, then the test harness will
|
||||||
// likely need to be extended.
|
// likely need to be extended.
|
||||||
SignerFilter f(GlobalRNG(), *signer, new HexEncoder(new FileSink(cout)));
|
string signature;
|
||||||
|
SignerFilter f(GlobalRNG(), *signer, new HexEncoder(new StringSink(signature)));
|
||||||
StringSource ss(GetDecodedDatum(v, "Message"), true, new Redirector(f));
|
StringSource ss(GetDecodedDatum(v, "Message"), true, new Redirector(f));
|
||||||
|
if (GetDecodedDatum(v, "Signature") != signature)
|
||||||
SignalTestFailure();
|
SignalTestFailure();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (test == "RandomSign")
|
else if (test == "RandomSign")
|
||||||
{
|
{
|
||||||
|
|
@ -644,11 +647,6 @@ bool GetField(std::istream &is, std::string &name, std::string &value)
|
||||||
name.resize(0); // GCC workaround: 2.95.3 doesn't have clear()
|
name.resize(0); // GCC workaround: 2.95.3 doesn't have clear()
|
||||||
is >> name;
|
is >> name;
|
||||||
|
|
||||||
#if defined(__COVERITY__)
|
|
||||||
// The datafile being read is in /usr/share, and it protected by filesystem ACLs
|
|
||||||
// __coverity_tainted_data_sanitize__(reinterpret_cast<void*>(&name));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -668,7 +666,7 @@ bool GetField(std::istream &is, std::string &name, std::string &value)
|
||||||
// VC60 workaround: getline bug
|
// VC60 workaround: getline bug
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
value.resize(0); // GCC workaround: 2.95.3 doesn't have clear()
|
value.resize(0); // GCC workaround: 2.95.3 doesn't have clear()
|
||||||
bool continueLine;
|
bool continueLine, space = false;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -676,6 +674,8 @@ bool GetField(std::istream &is, std::string &name, std::string &value)
|
||||||
{
|
{
|
||||||
is.get(buffer, sizeof(buffer));
|
is.get(buffer, sizeof(buffer));
|
||||||
value += buffer;
|
value += buffer;
|
||||||
|
if (buffer[0] == ' ')
|
||||||
|
space = true;
|
||||||
}
|
}
|
||||||
while (buffer[0] != 0);
|
while (buffer[0] != 0);
|
||||||
is.clear();
|
is.clear();
|
||||||
|
|
@ -698,6 +698,23 @@ bool GetField(std::istream &is, std::string &name, std::string &value)
|
||||||
}
|
}
|
||||||
while (continueLine);
|
while (continueLine);
|
||||||
|
|
||||||
|
// Strip intermediate spaces for some values.
|
||||||
|
if (space && (name == "Modulus" || name == "SubgroupOrder" || name == "SubgroupGenerator" ||
|
||||||
|
name == "PublicElement" || name == "PrivateExponent" || name == "Signature"))
|
||||||
|
{
|
||||||
|
string temp;
|
||||||
|
temp.reserve(value.size());
|
||||||
|
|
||||||
|
std::string::const_iterator it;
|
||||||
|
for(it = value.begin(); it != value.end(); it++)
|
||||||
|
{
|
||||||
|
if(*it != ' ')
|
||||||
|
temp.push_back(*it);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::swap(temp, value);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -829,3 +846,4 @@ bool RunTestDataFile(const char *filename, const NameValuePairs &overrideParamet
|
||||||
cout << "SOME TESTS FAILED!\n";
|
cout << "SOME TESTS FAILED!\n";
|
||||||
return failedTests == 0;
|
return failedTests == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue