diff --git a/authenc.cpp b/authenc.cpp index fd446b73..0ed9cd14 100644 --- a/authenc.cpp +++ b/authenc.cpp @@ -50,7 +50,7 @@ void AuthenticatedSymmetricCipherBase::SetKey(const byte *userKey, size_t keylen m_bufferedDataLength = 0; m_state = State_Start; - SetKeyWithoutResync(userKey, keylength, params); + this->SetKeyWithoutResync(userKey, keylength, params); m_state = State_KeySet; size_t length; diff --git a/gcm-simd.cpp b/gcm-simd.cpp index 1033bb34..c8b9daa5 100644 --- a/gcm-simd.cpp +++ b/gcm-simd.cpp @@ -219,14 +219,14 @@ bool CPU_TryPMULL_ARMV8() # else # if defined(__ANDROID__) && (defined(__aarch64__) || defined(__aarch32__)) if (android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_PMULL) - return true; + return true; // https://sourceware.org/ml/libc-help/2017-08/msg00012.html # elif defined(__linux__) && defined(__aarch64__) - if (getauxval(AT_HWCAP) & HWCAP_PMULL) - return true; + if (getauxval(AT_HWCAP) & HWCAP_PMULL) + return true; # elif defined(__linux__) && defined(__aarch32__) - if (getauxval(AT_HWCAP2) & HWCAP2_PMULL) - return true; + if (getauxval(AT_HWCAP2) & HWCAP2_PMULL) + return true; # endif // longjmp and clobber warnings. Volatile is required. @@ -322,27 +322,27 @@ uint64x2_t GCM_Multiply_PMULL(const uint64x2_t &x, const uint64x2_t &h, const ui void GCM_SetKeyWithoutResync_PMULL(const byte *hashKey, byte *mulTable, unsigned int tableSize) { - const uint64x2_t r = s_clmulConstants[0]; - const uint64x2_t t = vreinterpretq_u64_u8(vrev64q_u8(vld1q_u8(hashKey))); - const uint64x2_t h0 = vextq_u64(t, t, 1); + const uint64x2_t r = s_clmulConstants[0]; + const uint64x2_t t = vreinterpretq_u64_u8(vrev64q_u8(vld1q_u8(hashKey))); + const uint64x2_t h0 = vextq_u64(t, t, 1); - uint64x2_t h = h0; - unsigned int i; - for (i=0; i blockSize); } else #elif CRYPTOPP_ARM_PMULL_AVAILABLE @@ -137,7 +138,8 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const { // Avoid "parameter not used" error and suppress Coverity finding (void)params.GetIntValue(Name::TableSize(), tableSize); - tableSize = s_cltableSizeInBlocks * REQUIRED_BLOCKSIZE; + tableSize = s_cltableSizeInBlocks * blockSize; + CRYPTOPP_ASSERT(tableSize > blockSize); } else #endif @@ -147,13 +149,13 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const else tableSize = (GetTablesOption() == GCM_64K_Tables) ? 64*1024 : 2*1024; -#if defined(_MSC_VER) && (_MSC_VER < 1400) + //#if defined(_MSC_VER) && (_MSC_VER < 1400) // VC 2003 workaround: compiler generates bad code for 64K tables - tableSize = 2*1024; -#endif + //tableSize = 2*1024; + //#endif } - m_buffer.resize(3*REQUIRED_BLOCKSIZE + tableSize); + m_buffer.resize(3*blockSize + tableSize); byte *mulTable = MulTable(); byte *hashKey = HashKey(); memset(hashKey, 0, blockSize); @@ -283,7 +285,7 @@ inline void GCM_Base::ReverseHashBufferIfNeeded() #elif CRYPTOPP_ARM_NEON_AVAILABLE if (HasNEON()) { - GCM_ReverseHashBufferIfNeeded_NEON(HashBuffer()); + GCM_ReverseHashBufferIfNeeded_NEON(HashBuffer()); } #endif }