commit
50c276bda7
25
seckey.h
25
seckey.h
|
|
@ -80,16 +80,16 @@ protected:
|
||||||
//! \throws InvalidRounds if the number of rounds are invalid
|
//! \throws InvalidRounds if the number of rounds are invalid
|
||||||
inline void ThrowIfInvalidRounds(int rounds, const Algorithm *alg)
|
inline void ThrowIfInvalidRounds(int rounds, const Algorithm *alg)
|
||||||
{
|
{
|
||||||
#if defined(__BORLANDC__)
|
if (M == INT_MAX) // Coverity and result_independent_of_operands
|
||||||
if (rounds < MIN_ROUNDS || rounds > MAX_ROUNDS)
|
{
|
||||||
throw InvalidRounds(alg ? alg->AlgorithmName() : std::string("VariableRounds"), rounds);
|
if (rounds < MIN_ROUNDS)
|
||||||
#elif (M==INT_MAX) // Coverity and result_independent_of_operands
|
throw InvalidRounds(alg ? alg->AlgorithmName() : std::string("VariableRounds"), rounds);
|
||||||
if (rounds < MIN_ROUNDS)
|
}
|
||||||
throw InvalidRounds(alg ? alg->AlgorithmName() : "VariableRounds", rounds);
|
else
|
||||||
#else
|
{
|
||||||
if (rounds < MIN_ROUNDS || rounds > MAX_ROUNDS)
|
if (rounds < MIN_ROUNDS || rounds > MAX_ROUNDS)
|
||||||
throw InvalidRounds(alg ? alg->AlgorithmName() : "VariableRounds", rounds);
|
throw InvalidRounds(alg ? alg->AlgorithmName() : std::string("VariableRounds"), rounds);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \brief Validates the number of rounds for an algorithm
|
//! \brief Validates the number of rounds for an algorithm
|
||||||
|
|
@ -194,12 +194,9 @@ public:
|
||||||
//! \details keylength is provided in bytes, not bits.
|
//! \details keylength is provided in bytes, not bits.
|
||||||
static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t keylength)
|
static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t keylength)
|
||||||
{
|
{
|
||||||
#if MIN_KEYLENGTH > 0
|
|
||||||
if (keylength < (size_t)MIN_KEYLENGTH)
|
if (keylength < (size_t)MIN_KEYLENGTH)
|
||||||
return MIN_KEYLENGTH;
|
return MIN_KEYLENGTH;
|
||||||
else
|
else if (keylength > (size_t)MAX_KEYLENGTH)
|
||||||
#endif
|
|
||||||
if (keylength > (size_t)MAX_KEYLENGTH)
|
|
||||||
return (size_t)MAX_KEYLENGTH;
|
return (size_t)MAX_KEYLENGTH;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue