summaryrefslogtreecommitdiff
path: root/rijndael.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-09-04 11:21:47 -0400
committerJeffrey Walton <noloader@gmail.com>2017-09-04 11:21:47 -0400
commit75aef9bded7a65a4d227bde883a094249cf1ffc8 (patch)
treeb6ac9ed16e70837d97980a4e25aa7f9044df9c11 /rijndael.cpp
parent32cc92e048ecdad5b5c1d901a14c5d4f2ab66444 (diff)
downloadcryptopp-git-75aef9bded7a65a4d227bde883a094249cf1ffc8.tar.gz
Fixup under-aligned buffers when using AES on AltiVec and Power8
This commit supports the upcoming AltiVec and Power8 processor. This commit affects a number of classes due to the ubiquitous use of AES. The commit provides the data alignment requirements.
Diffstat (limited to 'rijndael.cpp')
-rw-r--r--rijndael.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/rijndael.cpp b/rijndael.cpp
index 3c2a2cad..5a354cfa 100644
--- a/rijndael.cpp
+++ b/rijndael.cpp
@@ -220,6 +220,15 @@ void Rijndael::Base::FillDecTable()
s_TdFilled = true;
}
+unsigned int Rijndael::Base::OptimalDataAlignment() const
+{
+#if CRYPTOPP_BOOL_ALIGN16
+ return 16;
+#else
+ return GetAlignmentOf<word32>();
+#endif
+}
+
#if (CRYPTOPP_AESNI_AVAILABLE)
extern void Rijndael_UncheckedSetKey_SSE4_AESNI(const byte *userKey, size_t keyLen, word32* rk);
extern void Rijndael_UncheckedSetKeyRev_AESNI(word32 *key, unsigned int rounds);