Cleared Coverity finding STREAM_FORMAT_STATE
parent
e560bb6ccb
commit
2ff035512f
17
validat3.cpp
17
validat3.cpp
|
|
@ -61,10 +61,8 @@ bool HashModuleTest(HashTransformation &md, const HashTestTuple *testSet, unsign
|
||||||
bool pass=true, fail;
|
bool pass=true, fail;
|
||||||
SecByteBlock digest(md.DigestSize());
|
SecByteBlock digest(md.DigestSize());
|
||||||
|
|
||||||
// Coverity finding (http://stackoverflow.com/a/30968371 does not squash the finding)
|
// Coverity finding, also see http://stackoverflow.com/a/34509163/608639.
|
||||||
std::ostringstream out;
|
StreamState ss(cout);
|
||||||
out.copyfmt(cout);
|
|
||||||
|
|
||||||
for (unsigned int i=0; i<testSetSize; i++)
|
for (unsigned int i=0; i<testSetSize; i++)
|
||||||
{
|
{
|
||||||
unsigned j;
|
unsigned j;
|
||||||
|
|
@ -75,16 +73,15 @@ bool HashModuleTest(HashTransformation &md, const HashTestTuple *testSet, unsign
|
||||||
fail = memcmp(digest, testSet[i].output, md.DigestSize()) != 0;
|
fail = memcmp(digest, testSet[i].output, md.DigestSize()) != 0;
|
||||||
pass = pass && !fail;
|
pass = pass && !fail;
|
||||||
|
|
||||||
out << (fail ? "FAILED " : "passed ");
|
cout << (fail ? "FAILED " : "passed ");
|
||||||
for (j=0; j<md.DigestSize(); j++)
|
for (j=0; j<md.DigestSize(); j++)
|
||||||
out << setw(2) << setfill('0') << hex << (int)digest[j];
|
cout << setw(2) << setfill('0') << hex << (int)digest[j];
|
||||||
out << " \"" << (char *)testSet[i].input << '\"';
|
cout << " \"" << (char *)testSet[i].input << '\"';
|
||||||
if (testSet[i].repeatTimes != 1)
|
if (testSet[i].repeatTimes != 1)
|
||||||
out << " repeated " << dec << testSet[i].repeatTimes << " times";
|
cout << " repeated " << dec << testSet[i].repeatTimes << " times";
|
||||||
out << endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << out.str();
|
|
||||||
return pass;
|
return pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue