The Crypto++ library can now be compiled with C++Builder
Two macro were causing compiler problems with bcc32 [bcc32 Error] seckey.h(83): E2313 Constant expression required and [bcc32 Error] seckey.h(194): E2313 Constant expression requiredpull/107/head
parent
51ec011a60
commit
c4aaf081f9
2
misc.h
2
misc.h
|
|
@ -1,4 +1,4 @@
|
||||||
// misc.h - written and placed in the public domain by Wei Dai
|
// misc.h - written and placed in the public domain by Wei Dai
|
||||||
|
|
||||||
//! \file misc.h
|
//! \file misc.h
|
||||||
//! \brief Utility functions for the Crypto++ library.
|
//! \brief Utility functions for the Crypto++ library.
|
||||||
|
|
|
||||||
9
seckey.h
9
seckey.h
|
|
@ -80,12 +80,15 @@ 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 (M==INT_MAX) // Coverity and result_independent_of_operands
|
#if defined(__BORLANDC__)
|
||||||
|
if (rounds < MIN_ROUNDS || rounds > MAX_ROUNDS)
|
||||||
|
throw InvalidRounds(alg ? alg->AlgorithmName() : std::string("VariableRounds"), rounds);
|
||||||
|
#elif (M==INT_MAX) // Coverity and result_independent_of_operands
|
||||||
if (rounds < MIN_ROUNDS)
|
if (rounds < MIN_ROUNDS)
|
||||||
throw InvalidRounds(alg ? alg->AlgorithmName() : "VariableRounds", 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() : std::string("VariableRounds"), rounds);
|
throw InvalidRounds(alg ? alg->AlgorithmName() : "VariableRounds", rounds);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -191,10 +194,12 @@ 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 !defined(__BORLANDC__)
|
||||||
#if MIN_KEYLENGTH > 0
|
#if MIN_KEYLENGTH > 0
|
||||||
if (keylength < (size_t)MIN_KEYLENGTH)
|
if (keylength < (size_t)MIN_KEYLENGTH)
|
||||||
return MIN_KEYLENGTH;
|
return MIN_KEYLENGTH;
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (keylength > (size_t)MAX_KEYLENGTH)
|
if (keylength > (size_t)MAX_KEYLENGTH)
|
||||||
return (size_t)MAX_KEYLENGTH;
|
return (size_t)MAX_KEYLENGTH;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue