VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2021-08-15 23:00:31 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2021-08-16 00:26:37 +0200
commitd448713e614c308305ef1bd50fcb1719d45ddf63 (patch)
treef653c747eb78358fac38e5f93f79c7cbcb272a73
parent8ae5a715d66dcbc598017f262089165b762f42c5 (diff)
downloadVeraCrypt-d448713e614c308305ef1bd50fcb1719d45ddf63.tar.gz
VeraCrypt-d448713e614c308305ef1bd50fcb1719d45ddf63.zip
MacOSX: Make AESNI availability linked to compiler target and not compilation host
-rw-r--r--src/Crypto/cpu.h1
-rw-r--r--src/Volume/Cipher.cpp5
-rw-r--r--src/Volume/Cipher.h7
3 files changed, 4 insertions, 9 deletions
diff --git a/src/Crypto/cpu.h b/src/Crypto/cpu.h
index e4e05a0c..58729f32 100644
--- a/src/Crypto/cpu.h
+++ b/src/Crypto/cpu.h
@@ -209,6 +209,7 @@ extern "C" {
#endif
#define CRYPTOPP_CPUID_AVAILABLE
+#define TC_AES_HW_CPU
// these should not be used directly
extern volatile int g_x86DetectionDone;
diff --git a/src/Volume/Cipher.cpp b/src/Volume/Cipher.cpp
index 40507a2d..02ee6989 100644
--- a/src/Volume/Cipher.cpp
+++ b/src/Volume/Cipher.cpp
@@ -22,7 +22,6 @@
#ifdef TC_AES_HW_CPU
# include "Crypto/Aes_hw_cpu.h"
#endif
-#include "Crypto/cpu.h"
extern "C" int IsAesHwCpuSupported ()
{
@@ -32,7 +31,7 @@ extern "C" int IsAesHwCpuSupported ()
if (!stateValid)
{
- state = g_hasAESNI ? true : false;
+ state = HasAESNI() ? true : false;
stateValid = true;
}
return state && VeraCrypt::Cipher::IsHwSupportEnabled();
@@ -203,7 +202,7 @@ namespace VeraCrypt
if (!stateValid)
{
- state = g_hasAESNI ? true : false;
+ state = HasAESNI() ? true : false;
stateValid = true;
}
return state && HwSupportEnabled;
diff --git a/src/Volume/Cipher.h b/src/Volume/Cipher.h
index 18d1d2ed..061dcc38 100644
--- a/src/Volume/Cipher.h
+++ b/src/Volume/Cipher.h
@@ -14,8 +14,7 @@
#define TC_HEADER_Encryption_Ciphers
#include "Platform/Platform.h"
-#include "Crypto/config.h"
-
+#include "Crypto/cpu.h"
namespace VeraCrypt
{
@@ -126,10 +125,6 @@ namespace VeraCrypt
#undef TC_EXCEPTION
-#if (defined (TC_ARCH_X86) || defined (TC_ARCH_X64)) && !defined (__ppc__)
-# define TC_AES_HW_CPU
-#endif
-
}
#endif // TC_HEADER_Encryption_Ciphers