> Date: Wed, 19 Jun 2019 07:13:19 +0200 > From: Patrick Wildt <patr...@blueri.se> > > Hi, > > this diff adds the necessary helpers to arm64 so that libcrypto knows > which of the hardware crypto features are available on the machine. > Those helpers are used by the existing and matching armv7 code. > > ok?
No objections to the diff per se, but unless I'm missing something, there currently isn't any assembly code that takes advantage of this for arm64. The armv7 code is 32-bit code so I don't think you can use any of it in 64-bit mode. > diff --git a/lib/libcrypto/arch/aarch64/Makefile.inc > b/lib/libcrypto/arch/aarch64/Makefile.inc > index 8742504f2d4..972e5536b5e 100644 > --- a/lib/libcrypto/arch/aarch64/Makefile.inc > +++ b/lib/libcrypto/arch/aarch64/Makefile.inc > @@ -26,3 +26,6 @@ ${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl > /usr/bin/perl \ > ${LCRYPTO_SRC}/${dir}/asm/${f}.pl void ${.TARGET} > ${.TARGET} > .endfor > + > +CFLAGS+= -DOPENSSL_CPUID_OBJ > +SRCS+= arm64cpuid.S armcap.c > diff --git a/lib/libcrypto/arm64cpuid.S b/lib/libcrypto/arm64cpuid.S > new file mode 100644 > index 00000000000..5eeff91c6ea > --- /dev/null > +++ b/lib/libcrypto/arm64cpuid.S > @@ -0,0 +1,47 @@ > +#include "arm_arch.h" > + > +.text > +.arch armv8-a+crypto+sha3 > + > +.align 5 > +.globl _armv7_neon_probe > +.type _armv7_neon_probe,%function > +_armv7_neon_probe: > + orr v15.16b, v15.16b, v15.16b > + ret > +.size _armv7_neon_probe,.-_armv7_neon_probe > + > +.globl _armv8_aes_probe > +.type _armv8_aes_probe,%function > +_armv8_aes_probe: > + aese v0.16b, v0.16b > + ret > +.size _armv8_aes_probe,.-_armv8_aes_probe > + > +.globl _armv8_sha1_probe > +.type _armv8_sha1_probe,%function > +_armv8_sha1_probe: > + sha1h s0, s0 > + ret > +.size _armv8_sha1_probe,.-_armv8_sha1_probe > + > +.globl _armv8_sha256_probe > +.type _armv8_sha256_probe,%function > +_armv8_sha256_probe: > + sha256su0 v0.4s, v0.4s > + ret > +.size _armv8_sha256_probe,.-_armv8_sha256_probe > + > +.globl _armv8_pmull_probe > +.type _armv8_pmull_probe,%function > +_armv8_pmull_probe: > + pmull v0.1q, v0.1d, v0.1d > + ret > +.size _armv8_pmull_probe,.-_armv8_pmull_probe > + > +.globl _armv8_sha512_probe > +.type _armv8_sha512_probe,%function > +_armv8_sha512_probe: > + sha512su0 v0.2d,v0.2d > + ret > +.size _armv8_sha512_probe,.-_armv8_sha512_probe > diff --git a/lib/libcrypto/arm_arch.h b/lib/libcrypto/arm_arch.h > index a64c6da46eb..bb137e6a48e 100644 > --- a/lib/libcrypto/arm_arch.h > +++ b/lib/libcrypto/arm_arch.h > @@ -17,7 +17,11 @@ > * gcc/config/arm/arm.c. On a side note it defines > * __ARMEL__/__ARMEB__ for little-/big-endian. > */ > -# if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \ > +# if defined(__ARM_ARCH) > +# define __ARM_ARCH__ __ARM_ARCH > +# elif defined(__ARM_ARCH_8A__) > +# define __ARM_ARCH__ 8 > +# elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \ > defined(__ARM_ARCH_7R__)|| defined(__ARM_ARCH_7M__) || \ > defined(__ARM_ARCH_7EM__) > # define __ARM_ARCH__ 7 > >