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