2019-09-08 15:04:48 +02:00
|
|
|
diff -uNr cryptopp/cpu.cpp cryptopp.mod/cpu.cpp
|
2021-01-07 13:17:59 +01:00
|
|
|
--- cryptopp/cpu.cpp 2021-01-01 19:03:59.000000000 +0200
|
|
|
|
+++ cryptopp.mod/cpu.cpp 2021-01-07 14:16:48.145624898 +0200
|
|
|
|
@@ -54,7 +54,7 @@
|
2020-05-23 14:43:47 +02:00
|
|
|
// "$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__)
|
2020-05-23 14:43:47 +02:00
|
|
|
# include "cpu-features.h"
|
|
|
|
#endif
|
|
|
|
|
2021-01-07 13:17:59 +01:00
|
|
|
@@ -762,6 +762,7 @@
|
2020-05-23 14:43:47 +02:00
|
|
|
|
|
|
|
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))
|
|
|
|
@@ -774,11 +775,13 @@
|
|
|
|
// Apple hardware is ARMv7 or above.
|
2020-05-23 14:43:47 +02:00
|
|
|
return true;
|
2021-01-07 13:17:59 +01:00
|
|
|
#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
+#endif
|
2021-01-07 13:17:59 +01:00
|
|
|
return false;
|
2020-05-23 14:43:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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))
|
|
|
|
@@ -800,11 +803,13 @@
|
|
|
|
// Core feature set for Aarch32 and Aarch64.
|
2020-05-23 14:43:47 +02:00
|
|
|
return true;
|
2021-01-07 13:17:59 +01:00
|
|
|
#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
+#endif
|
2021-01-07 13:17:59 +01:00
|
|
|
return false;
|
2020-05-23 14:43:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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))
|
|
|
|
@@ -823,11 +828,13 @@
|
|
|
|
// No compiler support. CRC intrinsics result in a failed compiled.
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
+#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
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))
|
|
|
|
@@ -846,11 +853,13 @@
|
|
|
|
// No compiler support. PMULL intrinsics result in a failed compiled.
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
+#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
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))
|
|
|
|
@@ -868,11 +877,13 @@
|
|
|
|
#elif defined(__APPLE__) && defined(__aarch64__)
|
|
|
|
return IsAppleMachineARMv8();
|
|
|
|
#endif
|
|
|
|
+#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
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))
|
|
|
|
@@ -890,11 +901,13 @@
|
|
|
|
#elif defined(__APPLE__) && defined(__aarch64__)
|
|
|
|
return IsAppleMachineARMv8();
|
|
|
|
#endif
|
|
|
|
+#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-01-07 13:17:59 +01:00
|
|
|
inline bool CPU_QuerySHA256()
|
2020-05-23 14:43:47 +02:00
|
|
|
{
|
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))
|
|
|
|
@@ -912,11 +925,13 @@
|
|
|
|
#elif defined(__APPLE__) && defined(__aarch64__)
|
|
|
|
return IsAppleMachineARMv8();
|
|
|
|
#endif
|
|
|
|
+#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool CPU_QuerySHA512()
|
|
|
|
{
|
2021-01-07 13:17:59 +01:00
|
|
|
+#ifndef __TERMUX__
|
|
|
|
// Some ARMv8.4 features are disabled at the moment
|
|
|
|
#if defined(__ANDROID__) && defined(__aarch64__) && 0
|
|
|
|
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
|
|
|
|
@@ -935,11 +950,13 @@
|
|
|
|
#elif defined(__APPLE__) && defined(__aarch64__) && 0
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
+#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool CPU_QuerySHA3()
|
|
|
|
{
|
2021-01-07 13:17:59 +01:00
|
|
|
+#ifndef __TERMUX__
|
|
|
|
// Some ARMv8.4 features are disabled at the moment
|
|
|
|
#if defined(__ANDROID__) && defined(__aarch64__) && 0
|
|
|
|
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
|
|
|
|
@@ -958,11 +975,13 @@
|
|
|
|
#elif defined(__APPLE__) && defined(__aarch64__) && 0
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
+#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool CPU_QuerySM3()
|
|
|
|
{
|
2021-01-07 13:17:59 +01:00
|
|
|
+#ifndef __TERMUX__
|
|
|
|
// Some ARMv8.4 features are disabled at the moment
|
|
|
|
#if defined(__ANDROID__) && defined(__aarch64__) && 0
|
|
|
|
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
|
|
|
|
@@ -981,11 +1000,13 @@
|
|
|
|
#elif defined(__APPLE__) && defined(__aarch64__) && 0
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
+#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool CPU_QuerySM4()
|
|
|
|
{
|
2021-01-07 13:17:59 +01:00
|
|
|
+#ifndef __TERMUX__
|
|
|
|
// Some ARMv8.4 features are disabled at the moment
|
|
|
|
#if defined(__ANDROID__) && defined(__aarch64__) && 0
|
|
|
|
if (((android_getCpuFamily() & ANDROID_CPU_FAMILY_ARM64) != 0) &&
|
|
|
|
@@ -1004,6 +1025,7 @@
|
|
|
|
#elif defined(__APPLE__) && defined(__aarch64__) && 0
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
+#endif
|
2020-05-23 14:43:47 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|