termux-packages/packages/cryptopp/cpu.cpp.patch

173 lines
4.8 KiB
Diff
Raw Normal View History

diff -uNr cryptopp/cpu.cpp cryptopp.mod/cpu.cpp
2021-05-03 21:10:32 +02:00
--- cryptopp/cpu.cpp 2021-03-08 03:42:24.000000000 +0000
+++ cryptopp.mod/cpu.cpp 2021-05-03 19:07:55.060824805 +0000
@@ -55,7 +55,7 @@
// "$ANDROID_NDK_ROOT/sources/android/cpufeatures".
// setenv-android.sh will copy the header and source file
// into PWD and the makefile will build it in place.
-#if defined(__ANDROID__)
2021-01-07 13:17:59 +01:00
+#if defined(__ANDROID__) && !defined(__TERMUX__)
# include "cpu-features.h"
#endif
2021-05-03 21:10:32 +02:00
@@ -822,6 +822,7 @@
inline bool CPU_QueryARMv7()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__arm__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_ARMv7) != 0))
2021-05-03 21:10:32 +02:00
@@ -834,11 +835,13 @@
2021-01-07 13:17:59 +01:00
// Apple hardware is ARMv7 or above.
return true;
2021-01-07 13:17:59 +01:00
#endif
+#endif
2021-01-07 13:17:59 +01:00
return false;
}
inline bool CPU_QueryNEON()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_ASIMD) != 0))
2021-05-03 21:10:32 +02:00
@@ -860,11 +863,13 @@
2021-01-07 13:17:59 +01:00
// Core feature set for Aarch32 and Aarch64.
return true;
2021-01-07 13:17:59 +01:00
#endif
+#endif
2021-01-07 13:17:59 +01:00
return false;
}
inline bool CPU_QueryCRC32()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_CRC32) != 0))
2021-05-03 21:10:32 +02:00
@@ -884,11 +889,13 @@
if (IsAppleMachineARMv82())
return true;
2021-01-07 13:17:59 +01:00
#endif
+#endif
return false;
}
inline bool CPU_QueryPMULL()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_PMULL) != 0))
2021-05-03 21:10:32 +02:00
@@ -908,11 +915,13 @@
if (IsAppleMachineARMv82())
return true;
2021-01-07 13:17:59 +01:00
#endif
+#endif
return false;
}
inline bool CPU_QueryAES()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_AES) != 0))
2021-05-03 21:10:32 +02:00
@@ -930,11 +939,13 @@
2021-01-07 13:17:59 +01:00
#elif defined(__APPLE__) && defined(__aarch64__)
return IsAppleMachineARMv8();
#endif
+#endif
return false;
}
inline bool CPU_QuerySHA1()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SHA1) != 0))
2021-05-03 21:10:32 +02:00
@@ -952,11 +963,13 @@
2021-01-07 13:17:59 +01:00
#elif defined(__APPLE__) && defined(__aarch64__)
return IsAppleMachineARMv8();
#endif
+#endif
return false;
}
2021-01-07 13:17:59 +01:00
inline bool CPU_QuerySHA256()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SHA2) != 0))
2021-05-03 21:10:32 +02:00
@@ -974,12 +987,14 @@
2021-01-07 13:17:59 +01:00
#elif defined(__APPLE__) && defined(__aarch64__)
return IsAppleMachineARMv8();
#endif
+#endif
return false;
}
2021-05-03 21:10:32 +02:00
// Some ARMv8.2 features are disabled at the moment
inline bool CPU_QuerySHA3()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
2021-05-03 21:10:32 +02:00
// According to the ARM manual, SHA3 depends upon SHA1 and SHA2.
// If SHA1 and SHA2 are not present, then SHA3 and SHA512 are
// not present. Also see Arm A64 Instruction Set Architecture,
@@ -1005,12 +1020,14 @@
if (IsAppleMachineARMv82())
return true;
2021-01-07 13:17:59 +01:00
#endif
+#endif
return false;
}
2021-05-03 21:10:32 +02:00
// Some ARMv8.2 features are disabled at the moment
inline bool CPU_QuerySHA512()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
2021-05-03 21:10:32 +02:00
// According to the ARM manual, SHA512 depends upon SHA1 and SHA2.
// If SHA1 and SHA2 are not present, then SHA3 and SHA512 are
// not present. Also see Arm A64 Instruction Set Architecture,
@@ -1036,12 +1053,14 @@
if (IsAppleMachineARMv82())
return true;
2021-01-07 13:17:59 +01:00
#endif
+#endif
return false;
}
2021-05-03 21:10:32 +02:00
// Some ARMv8.2 features are disabled at the moment
inline bool CPU_QuerySM3()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__) && 0
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
2021-05-03 21:10:32 +02:00
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SM3) != 0))
@@ -1059,12 +1078,14 @@
2021-01-07 13:17:59 +01:00
#elif defined(__APPLE__) && defined(__aarch64__) && 0
2021-05-03 21:10:32 +02:00
// No Apple support yet.
2021-01-07 13:17:59 +01:00
#endif
+#endif
return false;
}
2021-05-03 21:10:32 +02:00
// Some ARMv8.2 features are disabled at the moment
inline bool CPU_QuerySM4()
{
2021-01-07 13:17:59 +01:00
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__) && 0
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
2021-05-03 21:10:32 +02:00
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SM4) != 0))
@@ -1082,6 +1103,7 @@
2021-01-07 13:17:59 +01:00
#elif defined(__APPLE__) && defined(__aarch64__) && 0
2021-05-03 21:10:32 +02:00
// No Apple support yet.
2021-01-07 13:17:59 +01:00
#endif
+#endif
return false;
}