Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/sys/crypto Make the AES and ChaCha NEON tests work in ...



details:   https://anonhg.NetBSD.org/src/rev/82f1b68eb2fa
branches:  trunk
changeset: 974948:82f1b68eb2fa
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 17 16:26:02 2020 +0000

description:
Make the AES and ChaCha NEON tests work in softfloat userland.

(`Softfloat' here refers to the ABI, which of course may be running
on a CPU with NEON.)

diffstat:

 tests/sys/crypto/aes/Makefile      |  12 +++++++++---
 tests/sys/crypto/aes/t_aes.c       |   8 ++++----
 tests/sys/crypto/chacha/Makefile   |  11 ++++++++---
 tests/sys/crypto/chacha/t_chacha.c |   8 ++++----
 4 files changed, 25 insertions(+), 14 deletions(-)

diffs (144 lines):

diff -r a8dd1e85cc29 -r 82f1b68eb2fa tests/sys/crypto/aes/Makefile
--- a/tests/sys/crypto/aes/Makefile     Mon Aug 17 15:22:51 2020 +0000
+++ b/tests/sys/crypto/aes/Makefile     Mon Aug 17 16:26:02 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.4 2020/08/16 15:52:14 martin Exp $
+#      $NetBSD: Makefile,v 1.5 2020/08/17 16:26:02 riastradh Exp $
 
 .include <bsd.own.mk>
 
@@ -19,7 +19,7 @@
 SRCS.t_aes+=   aes_ct_enc.c
 SRCS.t_aes+=   aes_selftest.c
 
-.if !empty(MACHINE_ARCH:Mearmv7hf*) || !empty(MACHINE_ARCH:Maarch64*)
+.if !empty(MACHINE_ARCH:Mearmv7*) || !empty(MACHINE_ARCH:Maarch64*)
 
 .PATH: ${NETBSDSRCDIR}/sys/crypto/aes/arch/arm
 CPPFLAGS+=     -I${NETBSDSRCDIR}/sys/crypto/aes/arch/arm
@@ -32,10 +32,16 @@
 SRCS.t_aes+=   aes_neon.c
 SRCS.t_aes+=   aes_neon_impl.c
 SRCS.t_aes+=   aes_neon_subr.c
-.if !empty(MACHINE_ARCH:Mearmv7hf*)
+.if !empty(MACHINE_ARCH:Mearmv7*)
 SRCS.t_aes+=   aes_neon_32.S
 .endif
 
+.if !empty(MACHINE_ARCH:Mearmv7*) && empty(MACHINE_ARCH:Mearmv7hf*)
+COPTS.aes_neon.c+=     -mfloat-abi=softfp -mfpu=neon
+COPTS.aes_neon_subr.c+=        -mfloat-abi=softfp -mfpu=neon
+AOPTS.aes_neon_32.S+=  -D__SOFTFP__
+.endif
+
 .endif                         # earmv7/aarch64
 
 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
diff -r a8dd1e85cc29 -r 82f1b68eb2fa tests/sys/crypto/aes/t_aes.c
--- a/tests/sys/crypto/aes/t_aes.c      Mon Aug 17 15:22:51 2020 +0000
+++ b/tests/sys/crypto/aes/t_aes.c      Mon Aug 17 16:26:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_aes.c,v 1.3 2020/07/26 14:01:14 riastradh Exp $      */
+/*     $NetBSD: t_aes.c,v 1.4 2020/08/17 16:26:02 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
 #include <crypto/aes/arch/arm/aes_armv8.h>
 #endif
 
-#ifdef __ARM_NEON
+#if __ARM_ARCH >= 7
 #include <crypto/aes/arch/arm/aes_neon.h>
 #endif
 
@@ -93,7 +93,7 @@
 AES_SELFTEST(aes_armv8_selftest, &aes_armv8_impl, "ARMv8.0-AES self-test")
 #endif
 
-#ifdef __ARM_NEON
+#if __ARM_ARCH >= 7
 AES_SELFTEST(aes_neon_selftest, &aes_neon_impl, "ARM NEON vpaes self-test")
 #endif
 
@@ -118,7 +118,7 @@
        ATF_TP_ADD_TC(tp, aes_armv8_selftest);
 #endif
 
-#ifdef __ARM_NEON
+#if __ARM_ARCH >= 7
        ATF_TP_ADD_TC(tp, aes_neon_selftest);
 #endif
 
diff -r a8dd1e85cc29 -r 82f1b68eb2fa tests/sys/crypto/chacha/Makefile
--- a/tests/sys/crypto/chacha/Makefile  Mon Aug 17 15:22:51 2020 +0000
+++ b/tests/sys/crypto/chacha/Makefile  Mon Aug 17 16:26:02 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.4 2020/08/16 15:52:14 martin Exp $
+#      $NetBSD: Makefile,v 1.5 2020/08/17 16:26:02 riastradh Exp $
 
 .include <bsd.own.mk>
 
@@ -16,19 +16,24 @@
 SRCS.t_chacha+=        chacha_ref.c
 SRCS.t_chacha+=        chacha_selftest.c
 
-.if !empty(MACHINE_ARCH:Mearmv7hf*) || !empty(MACHINE_ARCH:Maarch64*)
+.if !empty(MACHINE_ARCH:Mearmv7*) || !empty(MACHINE_ARCH:Maarch64*)
 
 .PATH: ${NETBSDSRCDIR}/sys/crypto/chacha/arch/arm
 CPPFLAGS+=     -I${NETBSDSRCDIR}/sys/crypto/chacha/arch/arm
 
 SRCS.t_chacha+=        chacha_neon.c
-.if !empty(MACHINE_ARCH:Mearmv7hf*)
+.if !empty(MACHINE_ARCH:Mearmv7*)
 SRCS.t_chacha+=        chacha_neon_32.S
 .elif !empty(MACHINE_ARCH:Maarch64*)
 SRCS.t_chacha+=        chacha_neon_64.S
 .endif
 SRCS.t_chacha+=        chacha_neon_impl.c
 
+.if !empty(MACHINE_ARCH:Mearmv7*) && empty(MACHINE_ARCH:Mearmv7hf*)
+COPTS.chacha_neon.c+=          -mfloat-abi=softfp -mfpu=neon
+AOPTS.chacha_neon_32.S+=       -D__SOFTFP__
+.endif
+
 .endif                         # earmv7 or aarch64
 
 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
diff -r a8dd1e85cc29 -r 82f1b68eb2fa tests/sys/crypto/chacha/t_chacha.c
--- a/tests/sys/crypto/chacha/t_chacha.c        Mon Aug 17 15:22:51 2020 +0000
+++ b/tests/sys/crypto/chacha/t_chacha.c        Mon Aug 17 16:26:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_chacha.c,v 1.3 2020/07/27 20:59:53 riastradh Exp $   */
+/*     $NetBSD: t_chacha.c,v 1.4 2020/08/17 16:26:02 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include <crypto/chacha/arch/x86/chacha_sse2.h>
 #endif
 
-#ifdef __ARM_NEON
+#if __ARM_ARCH >= 7
 #include <crypto/chacha/arch/arm/chacha_neon.h>
 #endif
 
@@ -81,7 +81,7 @@
                atf_tc_fail("%s self-test failed", (impl)->ci_name);          \
 }
 
-#ifdef __ARM_NEON
+#if __ARM_ARCH >= 7
 CHACHA_SELFTEST(chacha_neon_selftest, &chacha_neon_impl,
     "ARM NEON ChaCha self-test")
 #endif
@@ -96,7 +96,7 @@
 
        ATF_TP_ADD_TC(tp, chacha_ref_selftest);
 
-#ifdef __ARM_NEON
+#if __ARM_ARCH >= 7
        ATF_TP_ADD_TC(tp, chacha_neon_selftest);
 #endif
 



Home | Main Index | Thread Index | Old Index