Cleared warning 'extra ";" ignored'
parent
f0f060bb8b
commit
bc52b1abf8
24
blake2.cpp
24
blake2.cpp
|
|
@ -64,7 +64,7 @@ struct CRYPTOPP_NO_VTABLE BLAKE2_IV {};
|
||||||
template<>
|
template<>
|
||||||
struct CRYPTOPP_NO_VTABLE BLAKE2_IV<false>
|
struct CRYPTOPP_NO_VTABLE BLAKE2_IV<false>
|
||||||
{
|
{
|
||||||
CRYPTOPP_CONSTANT(IVSIZE = 8);
|
CRYPTOPP_CONSTANT(IVSIZE = 8)
|
||||||
// Always align for NEON and SSE
|
// Always align for NEON and SSE
|
||||||
CRYPTOPP_ALIGN_DATA(16) static const word32 iv[8];
|
CRYPTOPP_ALIGN_DATA(16) static const word32 iv[8];
|
||||||
};
|
};
|
||||||
|
|
@ -79,7 +79,7 @@ const word32 BLAKE2_IV<false>::iv[8] = {
|
||||||
template<>
|
template<>
|
||||||
struct CRYPTOPP_NO_VTABLE BLAKE2_IV<true>
|
struct CRYPTOPP_NO_VTABLE BLAKE2_IV<true>
|
||||||
{
|
{
|
||||||
CRYPTOPP_CONSTANT(IVSIZE = 8);
|
CRYPTOPP_CONSTANT(IVSIZE = 8)
|
||||||
// Always align for NEON and SSE
|
// Always align for NEON and SSE
|
||||||
CRYPTOPP_ALIGN_DATA(16) static const word64 iv[8];
|
CRYPTOPP_ALIGN_DATA(16) static const word64 iv[8];
|
||||||
};
|
};
|
||||||
|
|
@ -278,7 +278,7 @@ void BLAKE2_Base<W, T_64bit>::UncheckedSetKey(const byte *key, unsigned int leng
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zero everything except the two trailing strings
|
// Zero everything except the two trailing strings
|
||||||
ParameterBlock& block = *m_block;
|
ParameterBlock& block = *m_block.data();
|
||||||
const size_t head = sizeof(block) - sizeof(block.personalization) - sizeof(block.salt);
|
const size_t head = sizeof(block) - sizeof(block.personalization) - sizeof(block.salt);
|
||||||
memset(m_block.data(), 0x00, head);
|
memset(m_block.data(), 0x00, head);
|
||||||
|
|
||||||
|
|
@ -351,7 +351,7 @@ template <class W, bool T_64bit>
|
||||||
void BLAKE2_Base<W, T_64bit>::Restart()
|
void BLAKE2_Base<W, T_64bit>::Restart()
|
||||||
{
|
{
|
||||||
static const W zero[2] = {0,0};
|
static const W zero[2] = {0,0};
|
||||||
Restart(*m_block, zero);
|
Restart(*m_block.data(), zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class W, bool T_64bit>
|
template <class W, bool T_64bit>
|
||||||
|
|
@ -362,11 +362,11 @@ void BLAKE2_Base<W, T_64bit>::Restart(const BLAKE2_ParameterBlock<T_64bit>& bloc
|
||||||
if (&block != m_block.data())
|
if (&block != m_block.data())
|
||||||
{
|
{
|
||||||
memcpy_s(m_block, sizeof(block), &block, sizeof(block));
|
memcpy_s(m_block, sizeof(block), &block, sizeof(block));
|
||||||
(*m_block).digestLength = (byte)m_digestSize;
|
(*m_block.data()).digestLength = (byte)m_digestSize;
|
||||||
(*m_block).keyLength = (byte)m_key.size();
|
(*m_block.data()).keyLength = (byte)m_key.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
State& state = *m_state;
|
State& state = *m_state.data();
|
||||||
state.t[0] = state.t[1] = 0, state.f[0] = state.f[1] = 0, state.length = 0;
|
state.t[0] = state.t[1] = 0, state.f[0] = state.f[1] = 0, state.length = 0;
|
||||||
|
|
||||||
if (counter != NULL)
|
if (counter != NULL)
|
||||||
|
|
@ -388,7 +388,7 @@ void BLAKE2_Base<W, T_64bit>::Restart(const BLAKE2_ParameterBlock<T_64bit>& bloc
|
||||||
template <class W, bool T_64bit>
|
template <class W, bool T_64bit>
|
||||||
void BLAKE2_Base<W, T_64bit>::Update(const byte *input, size_t length)
|
void BLAKE2_Base<W, T_64bit>::Update(const byte *input, size_t length)
|
||||||
{
|
{
|
||||||
State& state = *m_state;
|
State& state = *m_state.data();
|
||||||
if (state.length + length > BLOCKSIZE)
|
if (state.length + length > BLOCKSIZE)
|
||||||
{
|
{
|
||||||
// Complete current block
|
// Complete current block
|
||||||
|
|
@ -423,7 +423,7 @@ void BLAKE2_Base<W, T_64bit>::TruncatedFinal(byte *hash, size_t size)
|
||||||
this->ThrowIfInvalidTruncatedSize(size);
|
this->ThrowIfInvalidTruncatedSize(size);
|
||||||
|
|
||||||
// Set last block unconditionally
|
// Set last block unconditionally
|
||||||
State& state = *m_state;
|
State& state = *m_state.data();
|
||||||
state.f[0] = static_cast<W>(-1);
|
state.f[0] = static_cast<W>(-1);
|
||||||
|
|
||||||
// Set last node if tree mode
|
// Set last node if tree mode
|
||||||
|
|
@ -445,7 +445,7 @@ void BLAKE2_Base<W, T_64bit>::TruncatedFinal(byte *hash, size_t size)
|
||||||
template <class W, bool T_64bit>
|
template <class W, bool T_64bit>
|
||||||
void BLAKE2_Base<W, T_64bit>::IncrementCounter(size_t count)
|
void BLAKE2_Base<W, T_64bit>::IncrementCounter(size_t count)
|
||||||
{
|
{
|
||||||
State& state = *m_state;
|
State& state = *m_state.data();
|
||||||
state.t[0] += static_cast<W>(count);
|
state.t[0] += static_cast<W>(count);
|
||||||
state.t[1] += !!(state.t[0] < count);
|
state.t[1] += !!(state.t[0] < count);
|
||||||
}
|
}
|
||||||
|
|
@ -455,7 +455,7 @@ void BLAKE2_Base<word64, true>::Compress(const byte *input)
|
||||||
{
|
{
|
||||||
// Selects the most advanced implmentation at runtime
|
// Selects the most advanced implmentation at runtime
|
||||||
static const pfnCompress64 s_pfn = InitializeCompress64Fn();
|
static const pfnCompress64 s_pfn = InitializeCompress64Fn();
|
||||||
s_pfn(input, *m_state);
|
s_pfn(input, *m_state.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
@ -463,7 +463,7 @@ void BLAKE2_Base<word32, false>::Compress(const byte *input)
|
||||||
{
|
{
|
||||||
// Selects the most advanced implmentation at runtime
|
// Selects the most advanced implmentation at runtime
|
||||||
static const pfnCompress32 s_pfn = InitializeCompress32Fn();
|
static const pfnCompress32 s_pfn = InitializeCompress32Fn();
|
||||||
s_pfn(input, *m_state);
|
s_pfn(input, *m_state.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLAKE2_CXX_Compress64(const byte* input, BLAKE2_State<word64, true>& state)
|
void BLAKE2_CXX_Compress64(const byte* input, BLAKE2_State<word64, true>& state)
|
||||||
|
|
|
||||||
34
blake2.h
34
blake2.h
|
|
@ -30,9 +30,9 @@ template <bool T_64bit>
|
||||||
struct CRYPTOPP_NO_VTABLE BLAKE2_Info : public VariableKeyLength<(T_64bit ? 64 : 32),0,(T_64bit ? 64 : 32),1,SimpleKeyingInterface::NOT_RESYNCHRONIZABLE>
|
struct CRYPTOPP_NO_VTABLE BLAKE2_Info : public VariableKeyLength<(T_64bit ? 64 : 32),0,(T_64bit ? 64 : 32),1,SimpleKeyingInterface::NOT_RESYNCHRONIZABLE>
|
||||||
{
|
{
|
||||||
typedef VariableKeyLength<(T_64bit ? 64 : 32),0,(T_64bit ? 64 : 32),1,SimpleKeyingInterface::NOT_RESYNCHRONIZABLE> KeyBase;
|
typedef VariableKeyLength<(T_64bit ? 64 : 32),0,(T_64bit ? 64 : 32),1,SimpleKeyingInterface::NOT_RESYNCHRONIZABLE> KeyBase;
|
||||||
CRYPTOPP_CONSTANT(MIN_KEYLENGTH = KeyBase::MIN_KEYLENGTH);
|
CRYPTOPP_CONSTANT(MIN_KEYLENGTH = KeyBase::MIN_KEYLENGTH)
|
||||||
CRYPTOPP_CONSTANT(MAX_KEYLENGTH = KeyBase::MAX_KEYLENGTH);
|
CRYPTOPP_CONSTANT(MAX_KEYLENGTH = KeyBase::MAX_KEYLENGTH)
|
||||||
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH = KeyBase::DEFAULT_KEYLENGTH);
|
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH = KeyBase::DEFAULT_KEYLENGTH)
|
||||||
|
|
||||||
CRYPTOPP_CONSTANT(BLOCKSIZE = (T_64bit ? 128 : 64))
|
CRYPTOPP_CONSTANT(BLOCKSIZE = (T_64bit ? 128 : 64))
|
||||||
CRYPTOPP_CONSTANT(DIGESTSIZE = (T_64bit ? 64 : 32))
|
CRYPTOPP_CONSTANT(DIGESTSIZE = (T_64bit ? 64 : 32))
|
||||||
|
|
@ -56,9 +56,9 @@ struct CRYPTOPP_NO_VTABLE BLAKE2_ParameterBlock
|
||||||
template<>
|
template<>
|
||||||
struct CRYPTOPP_NO_VTABLE BLAKE2_ParameterBlock<true>
|
struct CRYPTOPP_NO_VTABLE BLAKE2_ParameterBlock<true>
|
||||||
{
|
{
|
||||||
CRYPTOPP_CONSTANT(SALTSIZE = BLAKE2_Info<true>::SALTSIZE);
|
CRYPTOPP_CONSTANT(SALTSIZE = BLAKE2_Info<true>::SALTSIZE)
|
||||||
CRYPTOPP_CONSTANT(DIGESTSIZE = BLAKE2_Info<true>::DIGESTSIZE);
|
CRYPTOPP_CONSTANT(DIGESTSIZE = BLAKE2_Info<true>::DIGESTSIZE)
|
||||||
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = BLAKE2_Info<true>::PERSONALIZATIONSIZE);
|
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = BLAKE2_Info<true>::PERSONALIZATIONSIZE)
|
||||||
|
|
||||||
BLAKE2_ParameterBlock()
|
BLAKE2_ParameterBlock()
|
||||||
{
|
{
|
||||||
|
|
@ -91,9 +91,9 @@ struct CRYPTOPP_NO_VTABLE BLAKE2_ParameterBlock<true>
|
||||||
template<>
|
template<>
|
||||||
struct CRYPTOPP_NO_VTABLE BLAKE2_ParameterBlock<false>
|
struct CRYPTOPP_NO_VTABLE BLAKE2_ParameterBlock<false>
|
||||||
{
|
{
|
||||||
CRYPTOPP_CONSTANT(SALTSIZE = BLAKE2_Info<false>::SALTSIZE);
|
CRYPTOPP_CONSTANT(SALTSIZE = BLAKE2_Info<false>::SALTSIZE)
|
||||||
CRYPTOPP_CONSTANT(DIGESTSIZE = BLAKE2_Info<false>::DIGESTSIZE);
|
CRYPTOPP_CONSTANT(DIGESTSIZE = BLAKE2_Info<false>::DIGESTSIZE)
|
||||||
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = BLAKE2_Info<false>::PERSONALIZATIONSIZE);
|
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = BLAKE2_Info<false>::PERSONALIZATIONSIZE)
|
||||||
|
|
||||||
BLAKE2_ParameterBlock()
|
BLAKE2_ParameterBlock()
|
||||||
{
|
{
|
||||||
|
|
@ -131,7 +131,7 @@ struct CRYPTOPP_NO_VTABLE BLAKE2_ParameterBlock<false>
|
||||||
template <class W, bool T_64bit>
|
template <class W, bool T_64bit>
|
||||||
struct CRYPTOPP_NO_VTABLE BLAKE2_State
|
struct CRYPTOPP_NO_VTABLE BLAKE2_State
|
||||||
{
|
{
|
||||||
CRYPTOPP_CONSTANT(BLOCKSIZE = BLAKE2_Info<T_64bit>::BLOCKSIZE);
|
CRYPTOPP_CONSTANT(BLOCKSIZE = BLAKE2_Info<T_64bit>::BLOCKSIZE)
|
||||||
|
|
||||||
BLAKE2_State()
|
BLAKE2_State()
|
||||||
{
|
{
|
||||||
|
|
@ -157,14 +157,14 @@ template <class W, bool T_64bit>
|
||||||
class BLAKE2_Base : public SimpleKeyingInterfaceImpl<MessageAuthenticationCode, BLAKE2_Info<T_64bit> >
|
class BLAKE2_Base : public SimpleKeyingInterfaceImpl<MessageAuthenticationCode, BLAKE2_Info<T_64bit> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH = BLAKE2_Info<T_64bit>::DEFAULT_KEYLENGTH);
|
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH = BLAKE2_Info<T_64bit>::DEFAULT_KEYLENGTH)
|
||||||
CRYPTOPP_CONSTANT(MIN_KEYLENGTH = BLAKE2_Info<T_64bit>::MIN_KEYLENGTH);
|
CRYPTOPP_CONSTANT(MIN_KEYLENGTH = BLAKE2_Info<T_64bit>::MIN_KEYLENGTH)
|
||||||
CRYPTOPP_CONSTANT(MAX_KEYLENGTH = BLAKE2_Info<T_64bit>::MAX_KEYLENGTH);
|
CRYPTOPP_CONSTANT(MAX_KEYLENGTH = BLAKE2_Info<T_64bit>::MAX_KEYLENGTH)
|
||||||
|
|
||||||
CRYPTOPP_CONSTANT(DIGESTSIZE = BLAKE2_Info<T_64bit>::DIGESTSIZE);
|
CRYPTOPP_CONSTANT(DIGESTSIZE = BLAKE2_Info<T_64bit>::DIGESTSIZE)
|
||||||
CRYPTOPP_CONSTANT(BLOCKSIZE = BLAKE2_Info<T_64bit>::BLOCKSIZE);
|
CRYPTOPP_CONSTANT(BLOCKSIZE = BLAKE2_Info<T_64bit>::BLOCKSIZE)
|
||||||
CRYPTOPP_CONSTANT(SALTSIZE = BLAKE2_Info<T_64bit>::SALTSIZE);
|
CRYPTOPP_CONSTANT(SALTSIZE = BLAKE2_Info<T_64bit>::SALTSIZE)
|
||||||
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = BLAKE2_Info<T_64bit>::PERSONALIZATIONSIZE);
|
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = BLAKE2_Info<T_64bit>::PERSONALIZATIONSIZE)
|
||||||
|
|
||||||
typedef BLAKE2_ParameterBlock<T_64bit> ParameterBlock;
|
typedef BLAKE2_ParameterBlock<T_64bit> ParameterBlock;
|
||||||
typedef BLAKE2_State<W, T_64bit> State;
|
typedef BLAKE2_State<W, T_64bit> State;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue