aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/nss/nss/0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch
blob: 72ee1ee009d56d84b0c6170b13dc106d4a216f1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 9937e89c22eb2f2db9a936e7bc4442857b4192f5 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Wed, 18 Dec 2019 12:29:50 +0100
Subject: [PATCH] freebl: add a configure option to disable ARM HW crypto

Not all current hardware supports it, particularly anything
prior to armv8 does not.

Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>

---
 nss/lib/freebl/Makefile | 3 +++
 nss/lib/freebl/gcm.c    | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
index b38889f..4616aac 100644
--- a/nss/lib/freebl/Makefile
+++ b/nss/lib/freebl/Makefile
@@ -139,6 +139,8 @@ endif
         endif
     endif
 endif
+ifdef NSS_USE_ARM_HW_CRYPTO
+    DEFINES += -DNSS_USE_ARM_HW_CRYPTO
 ifeq ($(CPU_ARCH),aarch64)
     ifdef CC_IS_CLANG
         DEFINES += -DUSE_HW_AES -DUSE_HW_SHA1 -DUSE_HW_SHA2
@@ -180,6 +182,7 @@ endif
         endif
     endif
 endif
+endif
 
 ifeq ($(OS_TARGET),OSF1)
     DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_NO_MP_WORD
diff --git a/nss/lib/freebl/gcm.c b/nss/lib/freebl/gcm.c
index ac461b4..04cb180 100644
--- a/nss/lib/freebl/gcm.c
+++ b/nss/lib/freebl/gcm.c
@@ -18,6 +18,7 @@
 
 #include <limits.h>
 
+#ifdef NSS_USE_ARM_HW_CRYPTO
 /* old gcc doesn't support some poly64x2_t intrinsic */
 #if defined(__aarch64__) && defined(IS_LITTLE_ENDIAN) && \
     (defined(__clang__) || defined(__GNUC__) && __GNUC__ > 6)
@@ -27,6 +28,7 @@
 /* We don't test on big endian platform, so disable this on big endian. */
 #define USE_ARM_GCM
 #endif
+#endif
 
 /* Forward declarations */
 SECStatus gcm_HashInit_hw(gcmHashContext *ghash);