summaryrefslogtreecommitdiff
path: root/rijndael.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-09-21 09:56:37 -0400
committerJeffrey Walton <noloader@gmail.com>2017-09-21 09:56:37 -0400
commite78464a1afe9af086c3f4356ffaef3cd7c1b7ecf (patch)
tree05e93549bdc4f312405ac455590ab5869cc4d689 /rijndael.cpp
parentdfeae9e983322ccadb92d96216d0bcc70b3dcb6b (diff)
downloadcryptopp-git-e78464a1afe9af086c3f4356ffaef3cd7c1b7ecf.tar.gz
Enable little endian Rijndael_UncheckedSetKey_POWER8 using built-ins
The problem was vec_sld is endian sensitive. The built-in required more than us setting up arguments to ensure the vsx load resulted in a big endian value. Thanks to Paul R on Stack Overflow for sharing the information that IBM did not provide. Also see http://stackoverflow.com/q/46341923/608639
Diffstat (limited to 'rijndael.cpp')
-rw-r--r--rijndael.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/rijndael.cpp b/rijndael.cpp
index 06c96d28..7d9c33d6 100644
--- a/rijndael.cpp
+++ b/rijndael.cpp
@@ -253,8 +253,8 @@ 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(const byte* userKey, size_t keyLen, word32* rk,
- const word32* rc, const byte* Se, unsigned int rounds);
+extern void Rijndael_UncheckedSetKey_POWER8(const byte* userKey, size_t keyLen,
+ word32* rk, const word32* rc, const byte* Se);
extern size_t Rijndael_Enc_AdvancedProcessBlocks_POWER8(const word32 *subkeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
@@ -287,8 +287,9 @@ void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keyLen, c
#if CRYPTOPP_POWER8_AES_AVAILABLE
if (HasAES())
{
- // 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);
+ // We still need rcon and Se to fallback to C/C++ for AES-192 and AES-256.
+ // The IBM docs on AES sucks. Intel's docs on AESNI puts IBM to shame.
+ Rijndael_UncheckedSetKey_POWER8(userKey, keyLen, rk, rcon, Se);
return;
}
#endif