diff options
author | Jeffrey Walton <noloader@gmail.com> | 2018-12-14 12:17:50 -0500 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2018-12-14 12:17:50 -0500 |
commit | 91e584462544b0113abd4e6ee56cc942cf3f79b5 (patch) | |
tree | 5476b97ec3648fc6bda8aa3537a802eb4b437db1 /donna.h | |
parent | 235c615a10b418974354c38218bc29beda2ae7e4 (diff) | |
download | cryptopp-git-91e584462544b0113abd4e6ee56cc942cf3f79b5.tar.gz |
Enable x25519 64-bit code path for Microsoft compilers
Diffstat (limited to 'donna.h')
-rw-r--r-- | donna.h | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -39,14 +39,23 @@ int curve25519(byte sharedKey[32], const byte secretKey[32], const byte othersKe //****************************** Internal ******************************//
-#if (UINTPTR_MAX == 0xffffffff) || !defined(CRYPTOPP_WORD128_AVAILABLE)
-# define CRYPTOPP_CURVE25519_32BIT 1
-#else
+// CRYPTOPP_WORD128_AVAILABLE mostly depends upon GCC support for
+// __SIZEOF_INT128__. If __SIZEOF_INT128__ is not available then Moon
+// provides routines for MSC and GCC. It should cover most platforms,
+// but there are gaps like MS ARM64 and XLC. We tried to enable the
+// 64-bit path for SunCC from 12.5 but we got the dreaded compile
+// error "The operand ___LCM cannot be assigned to".
+
+#if defined(CRYPTOPP_WORD128_AVAILABLE) || \
+ (defined(_MSC_VER) && defined(_M_X64)) || \
+ (defined(__GNUC__) && (defined(__amd64__) || defined(__x86_64__)))
# define CRYPTOPP_CURVE25519_64BIT 1
+#else
+# define CRYPTOPP_CURVE25519_32BIT 1
#endif
-// Benchmarking on a modern Core i5-6400 shows SSE2 on Linux is
-// not profitable. Here are the numbers in milliseconds/operation:
+// Benchmarking on a modern 64-bit Core i5-6400 shows SSE2 on Linux
+// is not profitable. Here are the numbers in milliseconds/operation:
//
// * Langley, C++, 0.050
// * Moon, C++: 0.040
|