diff options
-rw-r--r-- | rijndael-simd.cpp | 5 | ||||
-rw-r--r-- | rijndael.cpp | 9 | ||||
-rw-r--r-- | rijndael.h | 3 |
3 files changed, 16 insertions, 1 deletions
diff --git a/rijndael-simd.cpp b/rijndael-simd.cpp index de5df3e0..4ed94012 100644 --- a/rijndael-simd.cpp +++ b/rijndael-simd.cpp @@ -10,6 +10,9 @@ // Skip Hovsmith and Barry O'Rourke for the mbedTLS project. Stepping
// mbedTLS under a debugger was helped for us to determine problems
// with our subkey generation and scheduling.
+//
+// AltiVec and Power8 code based on "POWER8 in-core cryptography."
+// http://www.ibm.com/developerworks/library/se-power8-in-core-cryptography/index.html
#include "pch.h"
#include "config.h"
@@ -24,7 +27,7 @@ // Hack... We are supposed to use <nmmintrin.h>. GCC 4.8, LLVM Clang 3.5
// and Apple Clang 6.0 conflates SSE4.1 and SSE4.2. If we use <nmmintrin.h>
// then compile fails with "SSE4.2 instruction set not enabled". Also see
-// https://gcc.gnu.org/ml/gcc-help/2017-08/msg00015.html.
+// http://gcc.gnu.org/ml/gcc-help/2017-08/msg00015.html.
# include "smmintrin.h"
# include "wmmintrin.h"
#endif
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);
@@ -39,6 +39,9 @@ class CRYPTOPP_DLL Rijndael : public Rijndael_Info, public BlockCipherDocumentat class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Rijndael_Info>
{
public:
+ // Intel and ARM SIMD units can handle unaligned loads, but AltiVec and Power8 cannot.
+ unsigned int OptimalDataAlignment() const;
+
void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs ¶ms);
protected:
|