summaryrefslogtreecommitdiff
path: root/lib/libcrypto/armcap.c
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2019-03-13 10:18:31 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2019-03-13 10:18:31 +0000
commit3b662f914412f8456ea61ce0077df37f9a22c1cb (patch)
treec00aedb15041225ead85808faa5bfecae2335d89 /lib/libcrypto/armcap.c
parentf149cc20d2d70fe3fd7158d15aa684c616682f86 (diff)
Backport support for probing ARMv8 HW acceleration capabilities on armv7
in preparation for adding support for the probing code for arm64. ok bcook@
Diffstat (limited to 'lib/libcrypto/armcap.c')
-rw-r--r--lib/libcrypto/armcap.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/libcrypto/armcap.c b/lib/libcrypto/armcap.c
index 3fda1853261..8c4983280e8 100644
--- a/lib/libcrypto/armcap.c
+++ b/lib/libcrypto/armcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: armcap.c,v 1.7 2018/11/11 03:27:56 bcook Exp $ */
+/* $OpenBSD: armcap.c,v 1.8 2019/03/13 10:18:30 patrick Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -22,6 +22,10 @@ static sigjmp_buf ill_jmp;
* ARM compilers support inline assembler...
*/
void _armv7_neon_probe(void);
+void _armv8_aes_probe(void);
+void _armv8_sha1_probe(void);
+void _armv8_sha256_probe(void);
+void _armv8_pmull_probe(void);
#endif
#if defined(__GNUC__) && __GNUC__>=2
@@ -61,6 +65,21 @@ OPENSSL_cpuid_setup(void)
if (sigsetjmp(ill_jmp, 1) == 0) {
_armv7_neon_probe();
OPENSSL_armcap_P |= ARMV7_NEON;
+ if (sigsetjmp(ill_jmp, 1) == 0) {
+ _armv8_pmull_probe();
+ OPENSSL_armcap_P |= ARMV8_PMULL | ARMV8_AES;
+ } else if (sigsetjmp(ill_jmp, 1) == 0) {
+ _armv8_aes_probe();
+ OPENSSL_armcap_P |= ARMV8_AES;
+ }
+ if (sigsetjmp(ill_jmp, 1) == 0) {
+ _armv8_sha1_probe();
+ OPENSSL_armcap_P |= ARMV8_SHA1;
+ }
+ if (sigsetjmp(ill_jmp, 1) == 0) {
+ _armv8_sha256_probe();
+ OPENSSL_armcap_P |= ARMV8_SHA256;
+ }
}
sigaction (SIGILL, &ill_oact, NULL);