Initial cut-in of CRYPTOPP_USE_FIPS_202_SHA3 macro

This commit is contained in:
Jeffrey Walton 2016-04-23 18:47:23 -04:00
parent 62a72f9dfa
commit df1c94a38a
3 changed files with 14 additions and 0 deletions

View File

@ -43,6 +43,10 @@
// # define CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
#endif
// Define this to choose the FIPS 202 version of SHA3, and not the original version of SHA3. NIST selected Keccak as SHA3
// in January 2013. SHA3 was finalized in FIPS 202 in August 2015, and it was a modified version of the original selection.
// #define CRYPTOPP_USE_FIPS_202_SHA3
// ***************** Less Important Settings ***************
// Library version

View File

@ -43,6 +43,10 @@
# define CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
#endif
// Define this to choose the FIPS 202 version of SHA3, and not the original version of SHA3. NIST selected Keccak as SHA3
// in January 2013. SHA3 was finalized in FIPS 202 in August 2015, and it was a modified version of the original selection.
#define CRYPTOPP_USE_FIPS_202_SHA3
// ***************** Less Important Settings ***************
// Library version

View File

@ -280,7 +280,13 @@ void SHA3::Restart()
void SHA3::TruncatedFinal(byte *hash, size_t size)
{
ThrowIfInvalidTruncatedSize(size);
#if defined(CRYPTOPP_USE_FIPS_202_SHA3)
m_state.BytePtr()[m_counter] ^= 0x06;
#else
m_state.BytePtr()[m_counter] ^= 1;
#endif
m_state.BytePtr()[r()-1] ^= 0x80;
KeccakF1600(m_state);
memcpy(hash, m_state, size);