0001-Add-support-for-Apple-silicon.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 577ae0352d191fa604f861ea2f0847e7c5eda617 Mon Sep 17 00:00:00 2001
  2. From: Frank Denis <github@pureftpd.org>
  3. Date: Wed, 1 Jul 2020 22:51:43 +0200
  4. Subject: [PATCH] Add support for Apple silicon
  5. [Retrieved from:
  6. https://github.com/angt/aegis256/commit/577ae0352d191fa604f861ea2f0847e7c5eda617]
  7. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  8. ---
  9. aegis256.c | 8 +++++++-
  10. 1 file changed, 7 insertions(+), 1 deletion(-)
  11. diff --git a/mud/aegis256/aegis256.c b/mud/aegis256/aegis256.c
  12. index 9a580bf..75a772c 100644
  13. --- a/mud/aegis256/aegis256.c
  14. +++ b/mud/aegis256/aegis256.c
  15. @@ -36,7 +36,7 @@ typedef __m128i x128;
  16. #define store128(X,Y) _mm_storeu_si128((x128 *)(X), (Y))
  17. #define set2x64(X,Y) _mm_set_epi64x((long long)(X), (long long)(Y))
  18. -#elif defined(__linux__) && (defined(__ARM_NEON_FP) || defined(__aarch64__))
  19. +#elif (defined(__APPLE__) || defined(__linux__)) && (defined(__ARM_NEON_FP) || defined(__aarch64__))
  20. #ifdef __clang__
  21. #pragma clang attribute push (__attribute__((target("crypto"))),apply_to=function)
  22. @@ -48,7 +48,9 @@ typedef __m128i x128;
  23. #endif
  24. #ifdef __ARM_FEATURE_CRYPTO
  25. +#ifdef __linux__
  26. #include <sys/auxv.h>
  27. +#endif
  28. #include <arm_neon.h>
  29. typedef uint8x16_t x128;
  30. @@ -62,11 +64,15 @@ typedef uint8x16_t x128;
  31. int
  32. aegis256_is_available(void)
  33. {
  34. +#ifdef __linux__
  35. return (getauxval(AT_HWCAP) & HWCAP_AES)
  36. #ifdef HWCAP2_AES
  37. || (getauxval(AT_HWCAP2) & HWCAP2_AES)
  38. #endif
  39. ;
  40. +#else // __APPLE__
  41. + return 1;
  42. +#endif
  43. }
  44. #endif // __ARM_FEATURE_CRYPTO