blob: b7f1b01a141afab1324508f3649dfc3a45a13138 [file] [log] [blame]
Patrick Williams03514f12024-04-05 07:04:11 -05001From 7c8f367faf8848a43a414079189e10270d6c0fcc Mon Sep 17 00:00:00 2001
Andrew Geissler82c905d2020-04-13 13:39:40 -05002From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Wed, 18 Dec 2019 12:29:50 +0100
4Subject: [PATCH] freebl: add a configure option to disable ARM HW crypto
5
6Not all current hardware supports it, particularly anything
7prior to armv8 does not.
8
9Upstream-Status: Pending
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Andrew Geissler82c905d2020-04-13 13:39:40 -050011
Andrew Geissler748a4832020-07-24 16:24:21 -050012---
Andrew Geisslerbbbd5f42020-10-30 15:42:48 -050013 nss/lib/freebl/Makefile | 3 +++
Andrew Geissler748a4832020-07-24 16:24:21 -050014 nss/lib/freebl/gcm.c | 2 ++
Andrew Geisslerbbbd5f42020-10-30 15:42:48 -050015 2 files changed, 5 insertions(+)
Andrew Geissler748a4832020-07-24 16:24:21 -050016
Andrew Geisslerbbbd5f42020-10-30 15:42:48 -050017diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
Patrick Williams03514f12024-04-05 07:04:11 -050018index 7ee8736..f9b4925 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050019--- a/nss/lib/freebl/Makefile
20+++ b/nss/lib/freebl/Makefile
Patrick Williams03514f12024-04-05 07:04:11 -050021@@ -142,6 +142,8 @@ endif
Andrew Geissler595f6302022-01-24 19:11:47 +000022 endif
23 endif
Andrew Geissler82c905d2020-04-13 13:39:40 -050024 endif
Andrew Geissler82c905d2020-04-13 13:39:40 -050025+ifdef NSS_USE_ARM_HW_CRYPTO
26+ DEFINES += -DNSS_USE_ARM_HW_CRYPTO
27 ifeq ($(CPU_ARCH),aarch64)
Andrew Geisslerbbbd5f42020-10-30 15:42:48 -050028 ifdef CC_IS_CLANG
29 DEFINES += -DUSE_HW_AES -DUSE_HW_SHA1 -DUSE_HW_SHA2
Patrick Williams03514f12024-04-05 07:04:11 -050030@@ -183,6 +185,7 @@ endif
Andrew Geissler82c905d2020-04-13 13:39:40 -050031 endif
32 endif
33 endif
34+endif
35
Patrick Williams03514f12024-04-05 07:04:11 -050036 ifeq (OS2,$(OS_TARGET))
37 ASFILES = mpi_x86_os2.s
Andrew Geisslerbbbd5f42020-10-30 15:42:48 -050038diff --git a/nss/lib/freebl/gcm.c b/nss/lib/freebl/gcm.c
Patrick Williams03514f12024-04-05 07:04:11 -050039index 2dae724..9ee7fc8 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050040--- a/nss/lib/freebl/gcm.c
41+++ b/nss/lib/freebl/gcm.c
Andrew Geisslerbbbd5f42020-10-30 15:42:48 -050042@@ -18,6 +18,7 @@
43
44 #include <limits.h>
45
46+#ifdef NSS_USE_ARM_HW_CRYPTO
Andrew Geissler82c905d2020-04-13 13:39:40 -050047 /* old gcc doesn't support some poly64x2_t intrinsic */
48 #if defined(__aarch64__) && defined(IS_LITTLE_ENDIAN) && \
49 (defined(__clang__) || defined(__GNUC__) && __GNUC__ > 6)
Andrew Geisslerbbbd5f42020-10-30 15:42:48 -050050@@ -27,6 +28,7 @@
Andrew Geisslerd688a012020-09-18 13:36:00 -050051 /* We don't test on big endian platform, so disable this on big endian. */
Andrew Geisslerbbbd5f42020-10-30 15:42:48 -050052 #define USE_ARM_GCM
53 #endif
54+#endif
55
56 /* Forward declarations */
57 SECStatus gcm_HashInit_hw(gcmHashContext *ghash);