summaryrefslogtreecommitdiffstats
path: root/src/include/openssl/cpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/openssl/cpu.h')
-rw-r--r--src/include/openssl/cpu.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/include/openssl/cpu.h b/src/include/openssl/cpu.h
index 981d246..19e11d0 100644
--- a/src/include/openssl/cpu.h
+++ b/src/include/openssl/cpu.h
@@ -94,6 +94,14 @@ extern uint32_t OPENSSL_ia32cap_P[4];
#endif
#if defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)
+
+#if defined(OPENSSL_APPLE)
+/* iOS builds use the static ARM configuration. */
+#define OPENSSL_STATIC_ARMCAP
+#endif
+
+#if !defined(OPENSSL_STATIC_ARMCAP)
+
/* CRYPTO_is_NEON_capable returns true if the current CPU has a NEON unit. Note
* that |OPENSSL_armcap_P| also exists and contains the same information in a
* form that's easier for assembly to use. */
@@ -116,6 +124,46 @@ OPENSSL_EXPORT char CRYPTO_is_NEON_functional(void);
* compiled with |-mfpu=neon| or if |CRYPTO_set_NEON_capable| has been called
* with a non-zero argument. */
OPENSSL_EXPORT void CRYPTO_set_NEON_functional(char neon_functional);
+
+/* CRYPTO_is_ARMv8_AES_capable returns true if the current CPU supports the
+ * ARMv8 AES instruction. */
+int CRYPTO_is_ARMv8_AES_capable(void);
+
+/* CRYPTO_is_ARMv8_PMULL_capable returns true if the current CPU supports the
+ * ARMv8 PMULL instruction. */
+int CRYPTO_is_ARMv8_PMULL_capable(void);
+
+#else
+
+static inline int CRYPTO_is_NEON_capable(void) {
+#if defined(OPENSSL_STATIC_ARMCAP_NEON) || defined(__ARM_NEON__)
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+static inline int CRYPTO_is_NEON_functional(void) {
+ return CRYPTO_is_NEON_capable();
+}
+
+static inline int CRYPTO_is_ARMv8_AES_capable(void) {
+#if defined(OPENSSL_STATIC_ARMCAP_AES)
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+static inline int CRYPTO_is_ARMv8_PMULL_capable(void) {
+#if defined(OPENSSL_STATIC_ARMCAP_PMULL)
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+#endif /* OPENSSL_STATIC_ARMCAP */
#endif /* OPENSSL_ARM */