Finally figured how how to clear than damn Coverity finding on STREAM_FORMAT_STATE
parent
9e4e210834
commit
51d674c7d8
22
validat1.cpp
22
validat1.cpp
|
|
@ -468,7 +468,7 @@ bool TestSecBlock()
|
|||
cout << "passed:";
|
||||
cout << " Append word32" << endl;
|
||||
|
||||
//********** Append **********//
|
||||
//********** Concatenate **********//
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -555,7 +555,7 @@ bool TestSecBlock()
|
|||
|
||||
a.Assign(str1, COUNTOF(str1));
|
||||
b.Assign(str1, COUNTOF(str1));
|
||||
temp &= (a == b);
|
||||
temp &= (a.operator==(b));
|
||||
|
||||
a.Assign(str3, COUNTOF(str3));
|
||||
b.Assign(str3, COUNTOF(str3));
|
||||
|
|
@ -592,7 +592,7 @@ bool TestSecBlock()
|
|||
|
||||
a.Assign(str1, COUNTOF(str1));
|
||||
b.Assign(str1, COUNTOF(str1));
|
||||
temp &= (a == b);
|
||||
temp &= (a.operator==(b));
|
||||
|
||||
a.Assign(str3, COUNTOF(str3));
|
||||
b.Assign(str3, COUNTOF(str3));
|
||||
|
|
@ -861,12 +861,10 @@ bool TestRDRAND()
|
|||
}
|
||||
else
|
||||
cout << "passed:";
|
||||
|
||||
const std::streamsize oldp = cout.precision(6);
|
||||
const std::ios::fmtflags oldf = cout.setf(std::ios::fixed, std::ios::floatfield);
|
||||
|
||||
StreamState ss(cout);
|
||||
cout << std::setiosflags(std::ios::fixed) << std::setprecision(6);
|
||||
cout << " Maurer Randomness Test returned value " << mv << endl;
|
||||
cout.precision(oldp);
|
||||
cout.setf(oldf, std::ios::floatfield);
|
||||
|
||||
if (meter.GetTotalBytes() < SIZE)
|
||||
{
|
||||
|
|
@ -934,12 +932,10 @@ bool TestRDSEED()
|
|||
}
|
||||
else
|
||||
cout << "passed:";
|
||||
|
||||
const std::streamsize oldp = cout.precision(6);
|
||||
const std::ios::fmtflags oldf = cout.setf(std::ios::fixed, std::ios::floatfield);
|
||||
|
||||
StreamState ss(cout);
|
||||
cout << std::setiosflags(std::ios::fixed) << std::setprecision(6);
|
||||
cout << " Maurer Randomness Test returned value " << mv << endl;
|
||||
cout.precision(oldp);
|
||||
cout.setf(oldf, std::ios::floatfield);
|
||||
|
||||
if (meter.GetTotalBytes() < SIZE)
|
||||
{
|
||||
|
|
|
|||
27
validate.h
27
validate.h
|
|
@ -2,6 +2,8 @@
|
|||
#define CRYPTOPP_VALIDATE_H
|
||||
|
||||
#include "cryptlib.h"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
bool ValidateAll(bool thorough);
|
||||
bool TestSettings();
|
||||
|
|
@ -87,12 +89,35 @@ bool TestSecBlock();
|
|||
bool TestPolynomialMod2();
|
||||
#endif
|
||||
|
||||
// Coverity findings
|
||||
// Coverity finding
|
||||
template <class T, bool NON_NEGATIVE>
|
||||
T StringToValue(const std::string& str);
|
||||
|
||||
// Coverity finding
|
||||
template<>
|
||||
int StringToValue<int, true>(const std::string& str);
|
||||
|
||||
// Coverity finding
|
||||
class StreamState
|
||||
{
|
||||
public:
|
||||
StreamState(std::ostream& out)
|
||||
: m_out(out), m_fmt(out.flags()), m_prec(out.precision())
|
||||
{
|
||||
}
|
||||
|
||||
~StreamState()
|
||||
{
|
||||
m_out.precision(m_prec);
|
||||
m_out.flags(m_fmt);
|
||||
}
|
||||
|
||||
private:
|
||||
std::ostream& m_out;
|
||||
std::ios_base::fmtflags m_fmt;
|
||||
std::streamsize m_prec;
|
||||
};
|
||||
|
||||
// Functions that need a RNG; uses AES inf CFB mode with Seed.
|
||||
CryptoPP::RandomNumberGenerator & GlobalRNG();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue