VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/cpu.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-02-12 18:49:12 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-02-12 19:06:14 +0100
commit86f0fde6e7914f055c5872bf7f2f565cc09977fc (patch)
treefea427f46509ccaa1cb77ec233cb2ab41157576e /src/Crypto/cpu.h
parenta5943c07fbc2754e0785cfa3d4645e96ae87b405 (diff)
downloadVeraCrypt-86f0fde6e7914f055c5872bf7f2f565cc09977fc.tar.gz
VeraCrypt-86f0fde6e7914f055c5872bf7f2f565cc09977fc.zip
Windows: Use Hardware RNG based on CPU timing jitter "Jitterentropy" by Stephan Mueller as a good alternative to RDRAND (http://www.chronox.de/jent.html, smueller@chronox.de)
Diffstat (limited to 'src/Crypto/cpu.h')
-rw-r--r--src/Crypto/cpu.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Crypto/cpu.h b/src/Crypto/cpu.h
index 9fac453b..12576b47 100644
--- a/src/Crypto/cpu.h
+++ b/src/Crypto/cpu.h
@@ -25,6 +25,23 @@
#define ATT_NOPREFIX
#endif
+#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64
+#if defined(TC_WINDOWS_DRIVER) || defined (_UEFI)
+#if defined(__cplusplus)
+extern "C" {
+#endif
+extern unsigned __int64 __rdtsc();
+#if defined(__cplusplus)
+}
+#endif
+#else
+#include <intrin.h>
+#ifdef _MSC_VER
+#pragma intrinsic(__rdtsc)
+#endif
+#endif
+#endif
+
#ifdef CRYPTOPP_GENERATE_X64_MASM
#define CRYPTOPP_X86_ASM_AVAILABLE