1 #ifndef CRYPTOPP_VMAC_H
2 #define CRYPTOPP_VMAC_H
7 NAMESPACE_BEGIN(CryptoPP)
13 std::string
AlgorithmName()
const {
return std::string(
"VMAC(") + GetCipher().AlgorithmName() +
")-" + IntToString(DigestSize()*8);}
14 unsigned int IVSize()
const {
return GetCipher().BlockSize();}
16 void Resynchronize(
const byte *nonce,
int length=-1);
18 unsigned int DigestSize()
const {
return m_is128 ? 16 : 8;};
19 void UncheckedSetKey(
const byte *userKey,
unsigned int keylength,
const NameValuePairs ¶ms);
20 void TruncatedFinal(byte *mac,
size_t size);
21 unsigned int BlockSize()
const {
return m_L1KeyLength;}
22 ByteOrder GetByteOrder()
const {
return LITTLE_ENDIAN_ORDER;}
26 virtual int DefaultDigestSize()
const =0;
28 void HashEndianCorrectedBlock(
const word64 *data);
29 size_t HashMultipleBlocks(
const word64 *input,
size_t length);
31 word64* StateBuf() {
return NULL;}
32 word64* DataBuf() {
return (word64 *)m_data();}
34 void VHASH_Update_SSE2(
const word64 *data,
size_t blocksRemainingInWord64,
int tagPart);
35 #if !(defined(_MSC_VER) && _MSC_VER < 1300) // can't use function template here with VC6
36 template <
bool T_128BitTag>
38 void VHASH_Update_Template(
const word64 *data,
size_t blockRemainingInWord128);
39 void VHASH_Update(
const word64 *data,
size_t blocksRemainingInWord128);
41 CRYPTOPP_BLOCK_1(polyState, word64, 4*(m_is128+1))
42 CRYPTOPP_BLOCK_2(nhKey, word64, m_L1KeyLength/sizeof(word64) + 2*m_is128)
43 CRYPTOPP_BLOCK_3(data, byte, m_L1KeyLength)
44 CRYPTOPP_BLOCK_4(l3Key, word64, 2*(m_is128+1))
45 CRYPTOPP_BLOCK_5(nonce, byte, IVSize())
46 CRYPTOPP_BLOCK_6(pad, byte, IVSize())
47 CRYPTOPP_BLOCKS_END(6)
49 bool m_is128, m_padCached, m_isFirstBlock;
54 template <class T_BlockCipher,
int T_DigestBitSize = 128>
58 static std::string StaticAlgorithmName() {
return std::string(
"VMAC(") + T_BlockCipher::StaticAlgorithmName() +
")-" + IntToString(T_DigestBitSize);}
62 int DefaultDigestSize()
const {
return T_DigestBitSize/8;}
63 typename T_BlockCipher::Encryption m_cipher;
std::string AlgorithmName() const
returns name of this algorithm, not universally implemented yet
interface for message authentication codes
unsigned int DigestSize() const
size of the hash/digest/MAC returned by Final()
unsigned int BlockSize() const
block size of underlying compression function, or 0 if not block based
interface for random number generators
interface for one direction (encryption or decryption) of a block cipher
keying interface for crypto algorithms that take byte strings as keys
support query of key length that's the same as another class
unsigned int MinIVLength() const
returns minimal length of IVs accepted by this object
interface for retrieving values given their names