xref: /aoo41x/main/nss/nss_linux.patch (revision 7d464770)
1diff -ur misc/nss-3.39/nss/lib/freebl/Makefile misc/build/nss-3.39/nss/lib/freebl/Makefile
2--- misc/nss-3.39/nss/lib/freebl/Makefile	2018-08-31 14:55:53.000000000 +0200
3+++ misc/build/nss-3.39/nss/lib/freebl/Makefile	2022-02-01 19:27:40.141084376 +0100
4@@ -109,6 +109,8 @@
5 # NSS_X64 means the target is a 64-bits 64 CPU architecture
6 # NSS_X86_OR_X64 means the target is either x86 or x64
7 ifeq (,$(filter-out i386 x386 x86 x86_64,$(CPU_ARCH)))
8+# Only on GCC > 4.3
9+ifeq (,$(filter 4.1 4.2 4.3,$(word 1,$(GCC_VERSION)).$(word 2,$(GCC_VERSION))))
10         DEFINES += -DNSS_X86_OR_X64
11         EXTRA_SRCS += gcm-x86.c aes-x86.c
12 $(OBJDIR)/gcm-x86.o: CFLAGS += -mpclmul -maes
13@@ -119,6 +121,7 @@
14         DEFINES += -DNSS_X86
15 endif
16 endif
17+endif
18
19 ifeq ($(OS_TARGET),OSF1)
20     DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_NO_MP_WORD
21@@ -224,8 +227,11 @@
22     DEFINES += -DMP_IS_LITTLE_ENDIAN
23 #   DEFINES += -DMPI_AMD64_ADD
24     # comment the next four lines to turn off Intel HW acceleration.
25+ifeq (,$(filter 4.1 4.2 4.3,$(word 1,$(GCC_VERSION)).$(word 2,$(GCC_VERSION))))
26+    # Only on GCC > 4.3
27     DEFINES += -DUSE_HW_AES -DINTEL_GCM
28     ASFILES += intel-aes.s intel-gcm.s
29+endif
30     EXTRA_SRCS += intel-gcm-wrap.c
31     INTEL_GCM = 1
32     MPI_SRCS += mpi_amd64.c mp_comba.c
33diff -ur misc/nss-3.39/nss/lib/freebl/verified/kremlib.h misc/build/nss-3.39/nss/lib/freebl/verified/kremlib.h
34--- misc/nss-3.39/nss/lib/freebl/verified/kremlib.h	2018-08-31 14:55:53.000000000 +0200
35+++ misc/build/nss-3.39/nss/lib/freebl/verified/kremlib.h	2022-02-01 19:27:47.193464234 +0100
36@@ -179,12 +179,28 @@
37
38 /******************************************************************************/
39 /* Endian-ness macros that can only be implemented in C                       */
40+/* Patched to allow build AOO on older and newer systems                      */
41 /******************************************************************************/
42
43-/* ... for Linux */
44-#if defined(__linux__) || defined(__CYGWIN__)
45+/* We are under Linux */
46 #include <endian.h>
47
48+#if defined(__BYTE_ORDER__)
49+#define AOO_BYTE_ORDER_OK
50+#else
51+/* Older headers use different names for these macros */
52+#define __BYTE_ORDER__ __BYTE_ORDER
53+#define __ORDER_LITTLE_ENDIAN__ __LITTLE_ENDIAN
54+#define __ORDER_BIG_ENDIAN__ __BIG_ENDIAN
55+#endif
56+
57+#ifdef AOO_BYTE_ORDER_OK
58+/* All required macros are defined */
59+
60+/* Otherwise, we will end up in the #ifdef's that will define the ones
61+   we miss.
62+   Please ignore further comments about different architectures.
63+*/
64 /* ... for OSX */
65 #elif defined(__APPLE__)
66 #include <libkern/OSByteOrder.h>
67diff -ur misc/nss-3.39/nss/lib/softoken/sdb.c misc/build/nss-3.39/nss/lib/softoken/sdb.c
68--- misc/nss-3.39/nss/lib/softoken/sdb.c	2018-08-31 14:55:53.000000000 +0200
69+++ misc/build/nss-3.39/nss/lib/softoken/sdb.c	2022-02-01 19:27:40.141084376 +0100
70@@ -37,7 +37,7 @@
71 #elif defined(XP_UNIX)
72 #include <unistd.h>
73 #endif
74-#if defined(LINUX) && !defined(ANDROID)
75+#if defined(LINUX) && !defined(ANDROID) && 0
76 #include <linux/magic.h>
77 #include <sys/vfs.h>
78 #endif
79@@ -1944,7 +1944,7 @@
80     }
81
82     if (checkFSType) {
83-#if defined(LINUX) && !defined(ANDROID)
84+#if defined(LINUX) && !defined(ANDROID) && 0
85         struct statfs statfs_s;
86         if (statfs(dbname, &statfs_s) == 0) {
87             switch (statfs_s.f_type) {
88