Add constexpr-ness to StaticAlgorithmName member function

This commit is contained in:
Jeffrey Walton 2016-09-07 06:16:46 -04:00
parent 6e324c161f
commit c1556295e6
47 changed files with 107 additions and 107 deletions

2
3way.h
View File

@ -16,7 +16,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief ThreeWay block cipher information
struct ThreeWay_Info : public FixedBlockSize<12>, public FixedKeyLength<12>, public VariableRounds<11>
{
static const char *StaticAlgorithmName() {return "3-Way";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "3-Way";}
};
//! \class ThreeWay

View File

@ -11,7 +11,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! ADLER-32 checksum calculations
//! ADLER-32 checksum calculations
class Adler32 : public HashTransformation
{
public:
@ -20,7 +20,7 @@ public:
void Update(const byte *input, size_t length);
void TruncatedFinal(byte *hash, size_t size);
unsigned int DigestSize() const {return DIGESTSIZE;}
static const char * StaticAlgorithmName() {return "Adler32";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Adler32";}
std::string AlgorithmName() const {return StaticAlgorithmName();}
private:

6
arc4.h
View File

@ -23,13 +23,13 @@ class CRYPTOPP_NO_VTABLE ARC4_Base : public VariableKeyLength<16, 1, 256>, publi
public:
~ARC4_Base();
static const char *StaticAlgorithmName() {return "ARC4";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "ARC4";}
void GenerateBlock(byte *output, size_t size);
void DiscardBytes(size_t n);
void ProcessData(byte *outString, const byte *inString, size_t length);
bool IsRandomAccess() const {return false;}
bool IsSelfInverting() const {return true;}
bool IsForwardTransformation() const {return true;}
@ -55,7 +55,7 @@ DOCUMENTED_TYPEDEF(SymmetricCipherFinal<ARC4_Base>, ARC4)
class CRYPTOPP_NO_VTABLE MARC4_Base : public ARC4_Base
{
public:
static const char *StaticAlgorithmName() {return "MARC4";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "MARC4";}
typedef SymmetricCipherFinal<MARC4_Base> Encryption;
typedef SymmetricCipherFinal<MARC4_Base> Decryption;

View File

@ -39,7 +39,7 @@ struct BLAKE2_Info : public VariableKeyLength<(T_64bit ? 64 : 32),0,(T_64bit ? 6
CRYPTOPP_CONSTANT(SALTSIZE = (T_64bit ? 16 : 8))
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = (T_64bit ? 16 : 8))
static const char *StaticAlgorithmName() {return (T_64bit ? "BLAKE2b" : "BLAKE2s");}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return (T_64bit ? "BLAKE2b" : "BLAKE2s");}
};
//! \class BLAKE2_ParameterBlock
@ -175,7 +175,7 @@ public:
//! \brief Retrieve the static algorithm name
//! \returns the algorithm name (BLAKE2s or BLAKE2b)
static const char *StaticAlgorithmName() {return BLAKE2_Info<T_64bit>::StaticAlgorithmName();}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return BLAKE2_Info<T_64bit>::StaticAlgorithmName();}
//! \brief Retrieve the object's name
//! \returns the object's algorithm name following RFC 7693

View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief Blowfish block cipher information
struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 4, 56>, public FixedRounds<16>
{
static const char *StaticAlgorithmName() {return "Blowfish";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Blowfish";}
};
// <a href="http://www.weidai.com/scan-mirror/cs.html#Blowfish">Blowfish</a>

View File

@ -16,7 +16,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief Camellia block cipher information
struct Camellia_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
{
static const char *StaticAlgorithmName() {return "Camellia";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Camellia";}
};
//! \class Camellia

4
cast.h
View File

@ -23,7 +23,7 @@ protected:
//! \brief CAST128 block cipher information
struct CAST128_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 5, 16>
{
static const char *StaticAlgorithmName() {return "CAST-128";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "CAST-128";}
};
//! \class CAST128
@ -68,7 +68,7 @@ public:
//! \brief CAST256 block cipher information
struct CAST256_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 4>
{
static const char *StaticAlgorithmName() {return "CAST-256";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "CAST-256";}
};
//! \class CAST256

4
crc.h
View File

@ -31,7 +31,7 @@ public:
void Update(const byte *input, size_t length);
void TruncatedFinal(byte *hash, size_t size);
unsigned int DigestSize() const {return DIGESTSIZE;}
static const char * StaticAlgorithmName() {return "CRC32";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "CRC32";}
std::string AlgorithmName() const {return StaticAlgorithmName();}
void UpdateByte(byte b) {m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc);}
@ -55,7 +55,7 @@ public:
void Update(const byte *input, size_t length);
void TruncatedFinal(byte *hash, size_t size);
unsigned int DigestSize() const {return DIGESTSIZE;}
static const char * StaticAlgorithmName() {return "CRC32C";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "CRC32C";}
std::string AlgorithmName() const {return StaticAlgorithmName();}
void UpdateByte(byte b) {m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc);}

4
des.h
View File

@ -30,7 +30,7 @@ protected:
struct DES_Info : public FixedBlockSize<8>, public FixedKeyLength<8>
{
// disable DES in DLL version by not exporting this function
static const char * StaticAlgorithmName() {return "DES";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "DES";}
};
//! \class DES
@ -122,7 +122,7 @@ public:
//! \brief DESX block cipher information
struct DES_XEX3_Info : public FixedBlockSize<8>, public FixedKeyLength<24>
{
static const char *StaticAlgorithmName() {return "DES-XEX3";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "DES-XEX3";}
};
//! \class DES_XEX3

View File

@ -245,7 +245,7 @@ template <class EC>
class DL_Algorithm_ECDSA : public DL_Algorithm_GDSA<typename EC::Point>
{
public:
static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECDSA";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECDSA";}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Algorithm_ECDSA() {}
@ -257,7 +257,7 @@ template <class EC>
class DL_Algorithm_ECNR : public DL_Algorithm_NR<typename EC::Point>
{
public:
static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECNR";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECNR";}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Algorithm_ECNR() {}

View File

@ -16,8 +16,8 @@
NAMESPACE_BEGIN(CryptoPP)
class CRYPTOPP_NO_VTABLE ElGamalBase : public DL_KeyAgreementAlgorithm_DH<Integer, NoCofactorMultiplication>,
public DL_KeyDerivationAlgorithm<Integer>,
class CRYPTOPP_NO_VTABLE ElGamalBase : public DL_KeyAgreementAlgorithm_DH<Integer, NoCofactorMultiplication>,
public DL_KeyDerivationAlgorithm<Integer>,
public DL_SymmetricEncryptionAlgorithm
{
public:
@ -86,7 +86,7 @@ public:
}
virtual const DL_GroupParameters_GFP & GetGroupParameters() const =0;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ElGamalBase() {}
#endif
@ -127,7 +127,7 @@ struct ElGamal
{
typedef DL_CryptoSchemeOptions<ElGamal, ElGamalKeys, int, int, int> SchemeOptions;
static const char * StaticAlgorithmName() {return "ElgamalEnc/Crypto++Padding";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "ElgamalEnc/Crypto++Padding";}
typedef SchemeOptions::GroupParameters GroupParameters;
//! implements PK_Encryptor interface

View File

@ -61,7 +61,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA512>;
class CRYPTOPP_DLL EMSA2Pad : public EMSA2HashIdLookup<PK_DeterministicSignatureMessageEncodingMethod>
{
public:
static const char * CRYPTOPP_API StaticAlgorithmName() {return "EMSA2";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "EMSA2";}
size_t MinRepresentativeBitLength(size_t hashIdentifierLength, size_t digestLength) const
{CRYPTOPP_UNUSED(hashIdentifierLength); return 8*digestLength + 31;}

View File

@ -90,9 +90,9 @@ template <class T>
class EMSA5Pad : public PK_DeterministicSignatureMessageEncodingMethod
{
public:
static const char *StaticAlgorithmName() {return "EMSA5";}
void ComputeMessageRepresentative(RandomNumberGenerator &rng,
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "EMSA5";}
void ComputeMessageRepresentative(RandomNumberGenerator &rng,
const byte *recoverableMessage, size_t recoverableMessageLength,
HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
byte *representative, size_t representativeBitLength) const

View File

@ -185,7 +185,7 @@ template <class T>
class DL_Algorithm_GDSA : public DL_ElgamalLikeSignatureAlgorithm<T>
{
public:
static const char * CRYPTOPP_API StaticAlgorithmName() {return "DSA-1363";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "DSA-1363";}
void Sign(const DL_GroupParameters<T> &params, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const
{
@ -221,7 +221,7 @@ template <class T>
class DL_Algorithm_NR : public DL_ElgamalLikeSignatureAlgorithm<T>
{
public:
static const char * CRYPTOPP_API StaticAlgorithmName() {return "NR";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "NR";}
void Sign(const DL_GroupParameters<T> &params, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const
{

2
gost.h
View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief GOST block cipher information
struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
{
static const char *StaticAlgorithmName() {return "GOST";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "GOST";}
};
//! \class GOST

2
idea.h
View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief IDEA block cipher information
struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<8>
{
static const char *StaticAlgorithmName() {return "IDEA";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "IDEA";}
};
//! \class IDEA

14
luc.h
View File

@ -205,7 +205,7 @@ public:
{
return GetValueHelper<DL_GroupParameters_IntegerBased>(this, name, valueType, pValue).Assignable();
}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupParameters_LUC() {}
#endif
@ -219,7 +219,7 @@ class DL_GroupParameters_LUC_DefaultSafePrime : public DL_GroupParameters_LUC
{
public:
typedef NoCofactorMultiplication DefaultCofactorOption;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_GroupParameters_LUC_DefaultSafePrime() {}
#endif
@ -232,14 +232,14 @@ protected:
class DL_Algorithm_LUC_HMP : public DL_ElgamalLikeSignatureAlgorithm<Integer>
{
public:
static const char * StaticAlgorithmName() {return "LUC-HMP";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "LUC-HMP";}
void Sign(const DL_GroupParameters<Integer> &params, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const;
bool Verify(const DL_GroupParameters<Integer> &params, const DL_PublicKey<Integer> &publicKey, const Integer &e, const Integer &r, const Integer &s) const;
size_t RLen(const DL_GroupParameters<Integer> &params) const
{return params.GetGroupOrder().ByteCount();}
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_Algorithm_LUC_HMP() {}
#endif
@ -251,7 +251,7 @@ struct DL_SignatureKeys_LUC
typedef DL_GroupParameters_LUC GroupParameters;
typedef DL_PublicKey_GFP<GroupParameters> PublicKey;
typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_SignatureKeys_LUC() {}
#endif
@ -269,7 +269,7 @@ struct DL_CryptoKeys_LUC
typedef DL_GroupParameters_LUC_DefaultSafePrime GroupParameters;
typedef DL_PublicKey_GFP<GroupParameters> PublicKey;
typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~DL_CryptoKeys_LUC() {}
#endif
@ -286,7 +286,7 @@ struct LUC_IES
LUC_IES<> >
{
static std::string StaticAlgorithmName() {return "LUC-IES";} // non-standard name
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~LUC_IES() {}
#endif

2
mars.h
View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief MARS block cipher information
struct MARS_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
{
static const char *StaticAlgorithmName() {return "MARS";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "MARS";}
};
//! \class MARS

2
md2.h
View File

@ -17,7 +17,7 @@ public:
void TruncatedFinal(byte *hash, size_t size);
unsigned int DigestSize() const {return DIGESTSIZE;}
unsigned int BlockSize() const {return BLOCKSIZE;}
static const char * StaticAlgorithmName() {return "MD2";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "MD2";}
CRYPTOPP_CONSTANT(DIGESTSIZE = 16)
CRYPTOPP_CONSTANT(BLOCKSIZE = 16)

2
md4.h
View File

@ -15,7 +15,7 @@ class MD4 : public IteratedHashWithStaticTransform<word32, LittleEndian, 64, 16,
public:
static void InitState(HashWordType *state);
static void Transform(word32 *digest, const word32 *data);
static const char *StaticAlgorithmName() {return "MD4";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "MD4";}
};
}

2
md5.h
View File

@ -13,7 +13,7 @@ class MD5 : public IteratedHashWithStaticTransform<word32, LittleEndian, 64, 16,
public:
static void InitState(HashWordType *state);
static void Transform(word32 *digest, const word32 *data);
static const char * StaticAlgorithmName() {return "MD5";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "MD5";}
};
}

View File

@ -55,7 +55,7 @@ public:
{
#if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS) && defined(IS_LITTLE_ENDIAN)
*((word32*)output) = ByteReverse(NextMersenneWord());
#elif defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS)
#elif defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS)
*((word32*)output) = NextMersenneWord();
#else
temp = NextMersenneWord();
@ -65,7 +65,7 @@ public:
output[0] = CRYPTOPP_GET_BYTE_AS_BYTE(temp, 3);
#endif
}
// No tail bytes
if (size%4 == 0)
{
@ -73,7 +73,7 @@ public:
*((volatile word32*)&temp) = 0;
return;
}
// Handle tail bytes
temp = NextMersenneWord();
switch (size%4)
@ -84,11 +84,11 @@ public:
default: assert(0); ;;
}
// Wipe temp
*((volatile word32*)&temp) = 0;
}
//! \brief Generate a random 32-bit word in the range min to max, inclusive
//! \returns random 32-bit word in the range min to max, inclusive
//! \details If the 32-bit candidate is not within the range, then it is discarded
@ -98,7 +98,7 @@ public:
const word32 range = max-min;
if (range == 0xffffffffL)
return NextMersenneWord();
const int maxBits = BitPrecision(range);
word32 value;
@ -108,7 +108,7 @@ public:
return value+min;
}
//! \brief Generate and discard n bytes
//! \param n the number of bytes to discard, rounded up to a <tt>word32</tt> size
//! \details If n is not a multiple of <tt>word32</tt>, then unused bytes are
@ -120,7 +120,7 @@ public:
for(size_t i=0; i < RoundUpToMultipleOf(n, 4U); i++)
NextMersenneWord();
}
protected:
//! \brief Returns the next 32-bit word from the state array
@ -130,19 +130,19 @@ protected:
word32 NextMersenneWord()
{
if (m_idx >= N) { Twist(); }
word32 temp = m_state[m_idx++];
temp ^= (temp >> 11);
temp ^= (temp << 7) & 0x9D2C5680; // 0x9D2C5680 (2636928640)
temp ^= (temp << 15) & 0xEFC60000; // 0xEFC60000 (4022730752)
return temp ^ (temp >> 18);
}
//! \brief Performs the twist operaton on the state array
void Twist()
{
{
static const unsigned long magic[2]={0x0UL, K};
word32 kk, temp;
@ -152,19 +152,19 @@ protected:
temp = (m_state[kk] & 0x80000000)|(m_state[kk+1] & 0x7FFFFFFF);
m_state[kk] = m_state[kk+M] ^ (temp >> 1) ^ magic[temp & 0x1UL];
}
for (;kk<N-1;kk++)
{
temp = (m_state[kk] & 0x80000000)|(m_state[kk+1] & 0x7FFFFFFF);
m_state[kk] = m_state[kk+(M-N)] ^ (temp >> 1) ^ magic[temp & 0x1UL];
}
temp = (m_state[N-1] & 0x80000000)|(m_state[0] & 0x7FFFFFFF);
m_state[N-1] = m_state[M-1] ^ (temp >> 1) ^ magic[temp & 0x1UL];
// Reset index
m_idx = 0;
// Wipe temp
*((volatile word32*)&temp) = 0;
}
@ -179,7 +179,7 @@ private:
unsigned int m_idx;
};
//! \brief Original MT19937 generator provided in the ACM paper.
//! \brief Original MT19937 generator provided in the ACM paper.
//! \details Also see http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ARTICLES/mt.pdf; uses 4537 as default initial seed.
typedef MersenneTwister<0x9908B0DF /*2567483615*/, 397, 624, 0x10DCD /*69069*/, 4537> MT19937;
@ -191,4 +191,4 @@ typedef MersenneTwister<0x9908B0DF /*2567483615*/, 397, 624, 0x6C078965 /*181243
NAMESPACE_END
#endif // CRYPTOPP_MERSENNE_TWISTER_H

12
modes.h
View File

@ -112,7 +112,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_ModePolicy : public ModePolicyCommonTe
{
public:
IV_Requirement IVRequirement() const {return RANDOM_IV;}
static const char * CRYPTOPP_API StaticAlgorithmName() {return "CFB";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "CFB";}
protected:
unsigned int GetBytesPerIteration() const {return m_feedbackSize;}
@ -143,7 +143,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE OFB_ModePolicy : public ModePolicyCommonTe
public:
bool CipherIsRandomAccess() const {return false;}
IV_Requirement IVRequirement() const {return UNIQUE_IV;}
static const char * CRYPTOPP_API StaticAlgorithmName() {return "OFB";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "OFB";}
private:
unsigned int GetBytesPerIteration() const {return BlockSize();}
@ -159,7 +159,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CTR_ModePolicy : public ModePolicyCommonTe
public:
bool CipherIsRandomAccess() const {return true;}
IV_Requirement IVRequirement() const {return RANDOM_IV;}
static const char * CRYPTOPP_API StaticAlgorithmName() {return "CTR";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "CTR";}
protected:
virtual void IncrementCounterBy256();
@ -216,7 +216,7 @@ public:
IV_Requirement IVRequirement() const {return NOT_RESYNCHRONIZABLE;}
unsigned int OptimalBlockSize() const {return BlockSize() * m_cipher->OptimalNumberOfParallelBlocks();}
void ProcessData(byte *outString, const byte *inString, size_t length);
static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECB";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECB";}
};
//! \class CBC_ModeBase
@ -227,7 +227,7 @@ public:
IV_Requirement IVRequirement() const {return UNPREDICTABLE_RANDOM_IV;}
bool RequireAlignedInput() const {return false;}
unsigned int MinLastBlockSize() const {return 0;}
static const char * CRYPTOPP_API StaticAlgorithmName() {return "CBC";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "CBC";}
};
//! \class CBC_Encryption
@ -246,7 +246,7 @@ public:
void SetStolenIV(byte *iv) {m_stolenIV = iv;}
unsigned int MinLastBlockSize() const {return BlockSize()+1;}
void ProcessLastBlock(byte *outString, const byte *inString, size_t length);
static const char * CRYPTOPP_API StaticAlgorithmName() {return "CBC/CTS";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "CBC/CTS";}
protected:
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)

View File

@ -44,7 +44,7 @@ public:
PanamaHash() {Panama<B>::Reset();}
unsigned int DigestSize() const {return DIGESTSIZE;}
void TruncatedFinal(byte *hash, size_t size);
static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";}
protected:
void Init() {Panama<B>::Reset();}
@ -128,7 +128,7 @@ public:
template <class B>
struct PanamaCipherInfo : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_IV, 32>
{
static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";}
};
//! \class PanamaCipherPolicy

View File

@ -19,7 +19,7 @@ NAMESPACE_BEGIN(CryptoPP)
class PKCS_EncryptionPaddingScheme : public PK_EncryptionMessageEncodingMethod
{
public:
static const char * StaticAlgorithmName() {return "EME-PKCS1-v1_5";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "EME-PKCS1-v1_5";}
size_t MaxUnpaddedLength(size_t paddedLength) const;
void Pad(RandomNumberGenerator &rng, const byte *raw, size_t inputLength, byte *padded, size_t paddedLength, const NameValuePairs &parameters) const;
@ -60,12 +60,12 @@ CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration<SHA512>;
class CRYPTOPP_DLL PKCS1v15_SignatureMessageEncodingMethod : public PK_DeterministicSignatureMessageEncodingMethod
{
public:
static const char * CRYPTOPP_API StaticAlgorithmName() {return "EMSA-PKCS1-v1_5";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "EMSA-PKCS1-v1_5";}
size_t MinRepresentativeBitLength(size_t hashIdentifierSize, size_t digestSize) const
{return 8 * (digestSize + hashIdentifierSize + 10);}
void ComputeMessageRepresentative(RandomNumberGenerator &rng,
void ComputeMessageRepresentative(RandomNumberGenerator &rng,
const byte *recoverableMessage, size_t recoverableMessageLength,
HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
byte *representative, size_t representativeBitLength) const;

View File

@ -712,7 +712,7 @@ CRYPTOPP_DLL void CRYPTOPP_API P1363_MGF1KDF2_Common(HashTransformation &hash, b
class P1363_MGF1 : public MaskGeneratingFunction
{
public:
static const char * CRYPTOPP_API StaticAlgorithmName() {return "MGF1";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "MGF1";}
void GenerateAndMask(HashTransformation &hash, byte *output, size_t outputLength, const byte *input, size_t inputLength, bool mask = true) const
{
P1363_MGF1KDF2_Common(hash, output, outputLength, input, inputLength, NULL, 0, mask, 0);
@ -1978,7 +1978,7 @@ public:
virtual ~DL_KeyAgreementAlgorithm_DH() {}
#endif
static const char * CRYPTOPP_API StaticAlgorithmName()
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName()
{return COFACTOR_OPTION::ToEnum() == INCOMPATIBLE_COFACTOR_MULTIPLICTION ? "DHC" : "DH";}
Element AgreeWithEphemeralPrivateKey(const DL_GroupParameters<Element> &params, const DL_FixedBasePrecomputation<Element> &publicPrecomputation, const Integer &privateExponent) const

2
rc2.h
View File

@ -18,7 +18,7 @@ struct RC2_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 128>
{
CRYPTOPP_CONSTANT(DEFAULT_EFFECTIVE_KEYLENGTH = 1024)
CRYPTOPP_CONSTANT(MAX_EFFECTIVE_KEYLENGTH = 1024)
static const char *StaticAlgorithmName() {return "RC2";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "RC2";}
};
//! \class RC2

2
rc5.h
View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief RC5 block cipher information
struct RC5_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 0, 255>, public VariableRounds<16>
{
static const char *StaticAlgorithmName() {return "RC5";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "RC5";}
typedef word32 RC5_WORD;
};

2
rc6.h
View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief RC6 block cipher information
struct RC6_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>, public VariableRounds<20>
{
static const char *StaticAlgorithmName() {return "RC6";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "RC6";}
typedef word32 RC6_WORD;
};

View File

@ -17,7 +17,7 @@ class RIPEMD160 : public IteratedHashWithStaticTransform<word32, LittleEndian, 6
public:
static void InitState(HashWordType *state);
static void Transform(word32 *digest, const word32 *data);
static const char * StaticAlgorithmName() {return "RIPEMD-160";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "RIPEMD-160";}
};
/*! Digest Length = 320 bits, Security is similar to RIPEMD-160 */
@ -26,7 +26,7 @@ class RIPEMD320 : public IteratedHashWithStaticTransform<word32, LittleEndian, 6
public:
static void InitState(HashWordType *state);
static void Transform(word32 *digest, const word32 *data);
static const char * StaticAlgorithmName() {return "RIPEMD-320";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "RIPEMD-320";}
};
/*! \warning RIPEMD-128 is considered insecure, and should not be used
@ -36,7 +36,7 @@ class RIPEMD128 : public IteratedHashWithStaticTransform<word32, LittleEndian, 6
public:
static void InitState(HashWordType *state);
static void Transform(word32 *digest, const word32 *data);
static const char * StaticAlgorithmName() {return "RIPEMD-128";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "RIPEMD-128";}
};
/*! \warning RIPEMD-256 is considered insecure, and should not be used
@ -46,7 +46,7 @@ class RIPEMD256 : public IteratedHashWithStaticTransform<word32, LittleEndian, 6
public:
static void InitState(HashWordType *state);
static void Transform(word32 *digest, const word32 *data);
static const char * StaticAlgorithmName() {return "RIPEMD-256";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "RIPEMD-256";}
};
NAMESPACE_END

4
rsa.h
View File

@ -152,7 +152,7 @@ public:
//! \brief RSA algorithm
struct CRYPTOPP_DLL RSA
{
static const char * CRYPTOPP_API StaticAlgorithmName() {return "RSA";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "RSA";}
typedef RSAFunction PublicKey;
typedef InvertibleRSAFunction PrivateKey;
};
@ -181,7 +181,7 @@ struct RSASS : public TF_SS<STANDARD, H, RSA>
//! \brief RSA algorithm
struct CRYPTOPP_DLL RSA_ISO
{
static const char * CRYPTOPP_API StaticAlgorithmName() {return "RSA-ISO";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "RSA-ISO";}
typedef RSAFunction_ISO PublicKey;
typedef InvertibleRSAFunction_ISO PrivateKey;
};

View File

@ -66,7 +66,7 @@ protected:
//! \brief SAFER-K block cipher information
struct SAFER_K_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 8, 16, 8>, public VariableRounds<10, 1, 13>
{
static const char *StaticAlgorithmName() {return "SAFER-K";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SAFER-K";}
};
//! \class SAFER_K
@ -83,7 +83,7 @@ public:
//! \brief SAFER-SK block cipher information
struct SAFER_SK_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 8, 16, 8>, public VariableRounds<10, 1, 13>
{
static const char *StaticAlgorithmName() {return "SAFER-SK";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SAFER-SK";}
};
//! \class SAFER_SK

View File

@ -22,7 +22,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief Salsa20 stream cipher information
struct Salsa20_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::UNIQUE_IV, 8>
{
static const char *StaticAlgorithmName() {return "Salsa20";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Salsa20";}
};
//! \class Salsa20_Policy
@ -58,7 +58,7 @@ struct Salsa20 : public Salsa20_Info, public SymmetricCipherDocumentation
//! \brief XSalsa20 stream cipher information
struct XSalsa20_Info : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_IV, 24>
{
static const char *StaticAlgorithmName() {return "XSalsa20";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "XSalsa20";}
};
//! \class XSalsa20_Policy

2
seal.h
View File

@ -17,7 +17,7 @@ NAMESPACE_BEGIN(CryptoPP)
template <class B = BigEndian>
struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4>
{
static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";}
};
//! \class SEAL_Policy

2
seed.h
View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief SEED block cipher information
struct SEED_Info : public FixedBlockSize<16>, public FixedKeyLength<16>, public FixedRounds<16>
{
static const char *StaticAlgorithmName() {return "SEED";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SEED";}
};
//! \class SEED

View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief Serpent block cipher information
struct Serpent_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>, public FixedRounds<32>
{
static const char *StaticAlgorithmName() {return "Serpent";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Serpent";}
};
//! \class Serpent

10
sha.h
View File

@ -23,7 +23,7 @@ class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndi
public:
static void CRYPTOPP_API InitState(HashWordType *state);
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";}
};
typedef SHA1 SHA; // for backwards compatibility
@ -37,7 +37,7 @@ public:
#endif
static void CRYPTOPP_API InitState(HashWordType *state);
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
};
//! implements the SHA-224 standard
@ -49,7 +49,7 @@ public:
#endif
static void CRYPTOPP_API InitState(HashWordType *state);
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
};
//! implements the SHA-512 standard
@ -58,7 +58,7 @@ class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEn
public:
static void CRYPTOPP_API InitState(HashWordType *state);
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data);
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
};
//! implements the SHA-384 standard
@ -67,7 +67,7 @@ class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEn
public:
static void CRYPTOPP_API InitState(HashWordType *state);
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";}
CRYPTOPP_CONSTEXPR static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";}
};
NAMESPACE_END

8
sha3.h
View File

@ -52,7 +52,7 @@ public:
//! \brief Construct a SHA3-224 message digest
SHA3_224() : SHA3(DIGESTSIZE) {}
static const char * StaticAlgorithmName() {return "SHA-3-224";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA-3-224";}
} CRYPTOPP_DEPRECATED("SHA-3 will be changing in the future due to FIPS 202 finalization");
//! \class SHA3_256
@ -64,7 +64,7 @@ public:
//! \brief Construct a SHA3-256 message digest
SHA3_256() : SHA3(DIGESTSIZE) {}
static const char * StaticAlgorithmName() {return "SHA-3-256";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA-3-256";}
} CRYPTOPP_DEPRECATED("SHA-3 will be changing in the future due to FIPS 202 finalization");
//! \class SHA3_384
@ -76,7 +76,7 @@ public:
//! \brief Construct a SHA3-384 message digest
SHA3_384() : SHA3(DIGESTSIZE) {}
static const char * StaticAlgorithmName() {return "SHA-3-384";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA-3-384";}
} CRYPTOPP_DEPRECATED("SHA-3 will be changing in the future due to FIPS 202 finalization");
//! \class SHA3_512
@ -88,7 +88,7 @@ public:
//! \brief Construct a SHA3-512 message digest
SHA3_512() : SHA3(DIGESTSIZE) {}
static const char * StaticAlgorithmName() {return "SHA-3-512";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA-3-512";}
} CRYPTOPP_DEPRECATED("SHA-3 will be changing in the future due to FIPS 202 finalization");
NAMESPACE_END

View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief SHACAL2 block cipher information
struct SHACAL2_Info : public FixedBlockSize<32>, public VariableKeyLength<16, 16, 64>
{
static const char *StaticAlgorithmName() {return "SHACAL-2";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHACAL-2";}
};
//! \class SHACAL2

View File

@ -16,7 +16,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief SHARK block cipher information
struct SHARK_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<6, 2>
{
static const char *StaticAlgorithmName() {return "SHARK-E";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHARK-E";}
};
//! \class SHARK

View File

@ -20,7 +20,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! algorithm info
struct SosemanukInfo : public VariableKeyLength<16, 1, 32, 1, SimpleKeyingInterface::UNIQUE_IV, 16>
{
static const char * StaticAlgorithmName() {return "Sosemanuk";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Sosemanuk";}
};
//! _

View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief Square block cipher information
struct Square_Info : public FixedBlockSize<16>, public FixedKeyLength<16>, FixedRounds<8>
{
static const char *StaticAlgorithmName() {return "Square";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Square";}
};
//! \class Square

6
tea.h
View File

@ -16,7 +16,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief TEA block cipher information
struct TEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<32>
{
static const char *StaticAlgorithmName() {return "TEA";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "TEA";}
};
//! \class TEA
@ -64,7 +64,7 @@ typedef TEA::Decryption TEADecryption;
//! \brief XTEA block cipher information
struct XTEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<32>
{
static const char *StaticAlgorithmName() {return "XTEA";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "XTEA";}
};
//! \class XTEA
@ -109,7 +109,7 @@ public:
//! \brief BTEA block cipher information
struct BTEA_Info : public FixedKeyLength<16>
{
static const char *StaticAlgorithmName() {return "BTEA";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "BTEA";}
};
//! \class BTEA

View File

@ -13,7 +13,7 @@ public:
static void InitState(HashWordType *state);
static void Transform(word64 *digest, const word64 *data);
void TruncatedFinal(byte *hash, size_t size);
static const char * StaticAlgorithmName() {return "Tiger";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Tiger";}
protected:
static const word64 table[4*256+3];

View File

@ -15,7 +15,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! \brief Twofish block cipher information
struct Twofish_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>, FixedRounds<16>
{
static const char *StaticAlgorithmName() {return "Twofish";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Twofish";}
};
//! \class Twofish

2
wake.h
View File

@ -18,7 +18,7 @@ NAMESPACE_BEGIN(CryptoPP)
template <class B = BigEndian>
struct WAKE_OFB_Info : public FixedKeyLength<32>
{
static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";}
};
class CRYPTOPP_NO_VTABLE WAKE_Base

View File

@ -13,7 +13,7 @@ public:
static void InitState(HashWordType *state);
static void Transform(word64 *digest, const word64 *data);
void TruncatedFinal(byte *hash, size_t size);
static const char * StaticAlgorithmName() {return "Whirlpool";}
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Whirlpool";}
};
NAMESPACE_END