diff options
author | Jeffrey Walton <noloader@gmail.com> | 2017-09-21 01:08:44 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2017-09-21 01:08:44 -0400 |
commit | c6b096ddd44f14a7db19a847af7cdaf65ee89643 (patch) | |
tree | ac8683637408dedd49f6912af03e883c76cfd946 /rijndael.cpp | |
parent | 9fd5d023f9231f1c5f8ec7241aaf31d624334422 (diff) | |
download | cryptopp-git-c6b096ddd44f14a7db19a847af7cdaf65ee89643.tar.gz |
Move Rijndael_UncheckedSetKey_POWER8 prior to GetUserKey call
Arg... GetUserKey was performing a 32-bit word reverse. It was part of the problem on little endian machines
Diffstat (limited to 'rijndael.cpp')
-rw-r--r-- | rijndael.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/rijndael.cpp b/rijndael.cpp index 56ea9e77..06c96d28 100644 --- a/rijndael.cpp +++ b/rijndael.cpp @@ -253,7 +253,7 @@ extern size_t Rijndael_Dec_AdvancedProcessBlocks_ARMV8(const word32 *subkeys, si #if (CRYPTOPP_POWER8_AES_AVAILABLE)
extern void ReverseByteArrayLE(byte src[16]);
-extern void Rijndael_UncheckedSetKey_POWER8(word32* rk, size_t keyLen,
+extern void Rijndael_UncheckedSetKey_POWER8(const byte* userKey, size_t keyLen, word32* rk,
const word32* rc, const byte* Se, unsigned int rounds);
extern size_t Rijndael_Enc_AdvancedProcessBlocks_POWER8(const word32 *subkeys, size_t rounds,
@@ -284,18 +284,19 @@ void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keyLen, c }
#endif
- GetUserKey(BIG_ENDIAN_ORDER, rk, keyLen/4, userKey, keyLen);
- const word32 *rc = rcon;
- word32 temp;
-
#if CRYPTOPP_POWER8_AES_AVAILABLE
if (HasAES())
{
- Rijndael_UncheckedSetKey_POWER8(rk, keyLen, rc, Se, m_rounds);
+ // We still need rcon and Se to fallback to C/C++ for AES-192 and AES-256
+ Rijndael_UncheckedSetKey_POWER8(userKey, keyLen, rk, rcon, Se, m_rounds);
return;
}
#endif
+ GetUserKey(BIG_ENDIAN_ORDER, rk, keyLen/4, userKey, keyLen);
+ const word32 *rc = rcon;
+ word32 temp;
+
while (true)
{
temp = rk[keyLen/4-1];
|