Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crypto/aes/asm/aesv8-armx.pl8
-rw-r--r--crypto/cpu-aarch64-linux.c44
-rw-r--r--crypto/modes/asm/ghashv8-armx.pl8
3 files changed, 44 insertions, 16 deletions
diff --git a/crypto/aes/asm/aesv8-armx.pl b/crypto/aes/asm/aesv8-armx.pl
index 89e6f874..c41175a6 100644
--- a/crypto/aes/asm/aesv8-armx.pl
+++ b/crypto/aes/asm/aesv8-armx.pl
@@ -51,15 +51,7 @@ $code=<<___;
.text
___
$code.=<<___ if ($flavour =~ /64/);
-#if !defined(__clang__)
.arch armv8-a+crypto
-#elif defined(ANDROID) && defined(__clang__)
-#if __clang_major__ > 3
-.arch armv8-a+crypto
-#else
-.arch armv8-a+crypto,+neon
-#endif
-#endif
___
$code.=".arch armv7-a\n.fpu neon\n.code 32\n" if ($flavour !~ /64/);
#^^^^^^ this is done to simplify adoption by not depending
diff --git a/crypto/cpu-aarch64-linux.c b/crypto/cpu-aarch64-linux.c
index 1b0f3955..93d12237 100644
--- a/crypto/cpu-aarch64-linux.c
+++ b/crypto/cpu-aarch64-linux.c
@@ -25,6 +25,48 @@
extern uint32_t OPENSSL_armcap_P;
+#if defined(__FreeBSD__)
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <machine/armreg.h>
+
+// Support for older version of armreg.h
+#ifndef ID_AA64ISAR0_AES_VAL
+#define ID_AA64ISAR0_AES_VAL ID_AA64ISAR0_AES
+#endif
+#ifndef ID_AA64ISAR0_SHA1_VAL
+#define ID_AA64ISAR0_SHA1_VAL ID_AA64ISAR0_SHA1
+#endif
+#ifndef ID_AA64ISAR0_SHA2_VAL
+#define ID_AA64ISAR0_SHA2_VAL ID_AA64ISAR0_SHA2
+#endif
+
+void OPENSSL_cpuid_setup(void) {
+ if (getenv("QEMU_EMULATING") != NULL) {
+ return;
+ }
+
+ uint64_t isar0_val = READ_SPECIALREG(id_aa64isar0_el1);
+
+ OPENSSL_armcap_P |= ARMV7_NEON;
+
+ if (ID_AA64ISAR0_AES_VAL(isar0_val) >= ID_AA64ISAR0_AES_BASE) {
+ OPENSSL_armcap_P |= ARMV8_PMULL;
+ }
+ if (ID_AA64ISAR0_AES_VAL(isar0_val) >= ID_AA64ISAR0_AES_PMULL) {
+ OPENSSL_armcap_P |= ARMV8_PMULL;
+ }
+ if (ID_AA64ISAR0_SHA1_VAL(isar0_val) >= ID_AA64ISAR0_SHA1_BASE) {
+ OPENSSL_armcap_P |= ARMV8_SHA1;
+ }
+ if (ID_AA64ISAR0_SHA2_VAL(isar0_val) >= ID_AA64ISAR0_SHA2_BASE) {
+ OPENSSL_armcap_P |= ARMV8_SHA256;
+ }
+}
+
+#else // linux
+
void OPENSSL_cpuid_setup(void) {
unsigned long hwcap = getauxval(AT_HWCAP);
@@ -58,4 +100,6 @@ void OPENSSL_cpuid_setup(void) {
}
}
+#endif
+
#endif /* OPENSSL_AARCH64 && !OPENSSL_STATIC_ARMCAP */
diff --git a/crypto/modes/asm/ghashv8-armx.pl b/crypto/modes/asm/ghashv8-armx.pl
index 73421405..eabef0cb 100644
--- a/crypto/modes/asm/ghashv8-armx.pl
+++ b/crypto/modes/asm/ghashv8-armx.pl
@@ -59,15 +59,7 @@ $code=<<___;
.text
___
$code.=<<___ if ($flavour =~ /64/);
-#if !defined(__clang__)
.arch armv8-a+crypto
-#elif defined(ANDROID) && defined(__clang__)
-#if __clang_major__ > 3
-.arch armv8-a+crypto
-#else
-.arch armv8-a+crypto,+neon
-#endif
-#endif
___
$code.=".fpu neon\n.code 32\n" if ($flavour !~ /64/);