termux-packages/packages/cryptopp/cpu.cpp.patch
2021-05-03 19:10:32 +00:00

173 lines
4.8 KiB
Diff

diff -uNr cryptopp/cpu.cpp cryptopp.mod/cpu.cpp
--- 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__)
+#if defined(__ANDROID__) && !defined(__TERMUX__)
# include "cpu-features.h"
#endif
@@ -822,6 +822,7 @@
inline bool CPU_QueryARMv7()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__arm__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_ARMv7) != 0))
@@ -834,11 +835,13 @@
// Apple hardware is ARMv7 or above.
return true;
#endif
+#endif
return false;
}
inline bool CPU_QueryNEON()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_ASIMD) != 0))
@@ -860,11 +863,13 @@
// Core feature set for Aarch32 and Aarch64.
return true;
#endif
+#endif
return false;
}
inline bool CPU_QueryCRC32()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_CRC32) != 0))
@@ -884,11 +889,13 @@
if (IsAppleMachineARMv82())
return true;
#endif
+#endif
return false;
}
inline bool CPU_QueryPMULL()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_PMULL) != 0))
@@ -908,11 +915,13 @@
if (IsAppleMachineARMv82())
return true;
#endif
+#endif
return false;
}
inline bool CPU_QueryAES()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_AES) != 0))
@@ -930,11 +939,13 @@
#elif defined(__APPLE__) && defined(__aarch64__)
return IsAppleMachineARMv8();
#endif
+#endif
return false;
}
inline bool CPU_QuerySHA1()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SHA1) != 0))
@@ -952,11 +963,13 @@
#elif defined(__APPLE__) && defined(__aarch64__)
return IsAppleMachineARMv8();
#endif
+#endif
return false;
}
inline bool CPU_QuerySHA256()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__)
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SHA2) != 0))
@@ -974,12 +987,14 @@
#elif defined(__APPLE__) && defined(__aarch64__)
return IsAppleMachineARMv8();
#endif
+#endif
return false;
}
// Some ARMv8.2 features are disabled at the moment
inline bool CPU_QuerySHA3()
{
+#ifndef __TERMUX__
// 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;
#endif
+#endif
return false;
}
// Some ARMv8.2 features are disabled at the moment
inline bool CPU_QuerySHA512()
{
+#ifndef __TERMUX__
// 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;
#endif
+#endif
return false;
}
// Some ARMv8.2 features are disabled at the moment
inline bool CPU_QuerySM3()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__) && 0
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SM3) != 0))
@@ -1059,12 +1078,14 @@
#elif defined(__APPLE__) && defined(__aarch64__) && 0
// No Apple support yet.
#endif
+#endif
return false;
}
// Some ARMv8.2 features are disabled at the moment
inline bool CPU_QuerySM4()
{
+#ifndef __TERMUX__
#if defined(__ANDROID__) && defined(__aarch64__) && 0
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_SM4) != 0))
@@ -1082,6 +1103,7 @@
#elif defined(__APPLE__) && defined(__aarch64__) && 0
// No Apple support yet.
#endif
+#endif
return false;
}