package/libnss: fix build on ARM big endian
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Sat, 7 Aug 2021 21:32:54 +0000 (23:32 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sun, 8 Aug 2021 20:18:14 +0000 (22:18 +0200)
Fix the follownig build failure on ARM big endian raised since bump to
version 3.68 in commit 0a73b9b962421ce7a72c88e5f5bbd8849f21b041:

Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here

Fixes:
 - http://autobuild.buildroot.org/results/237aba0c16a34fec1b0fe50fe08cace438eda1bf

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch [new file with mode: 0644]

diff --git a/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch b/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
new file mode 100644 (file)
index 0000000..f925f20
--- /dev/null
@@ -0,0 +1,47 @@
+From 434d79c52db5b680accc531572319bd7094fa470 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sat, 7 Aug 2021 23:19:01 +0200
+Subject: [PATCH] lib/freebl/sha512.c: fix SHA256 redefinition on ARM big
+ endian
+
+For an unknown reason, SHA256_{Compress,Update}_Native are defined in
+lib/freebl/sha512.c if IS_LITTLE_ENDIAN is undefined since version 3.68
+and
+https://github.com/nss-dev/nss/commit/e1e00f21f2d73e0d5d27651ad5606efa5714abe4
+
+This raises the following build failure on ARM big endian:
+
+Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
+sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
+Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
+Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
+sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
+Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here
+
+Revert this change as it seems completely unrelated to the commit title
+"Bug 1655493 - Support SHA2 HW acceleration using Intel SHA Extension"
+
+Fixes:
+ - http://autobuild.buildroot.org/results/237aba0c16a34fec1b0fe50fe08cace438eda1bf
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ nss/lib/freebl/sha512.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nss/lib/freebl/sha512.c b/nss/lib/freebl/sha512.c
+index 946ab9f7f..3ec414b52 100644
+--- a/nss/lib/freebl/sha512.c
++++ b/nss/lib/freebl/sha512.c
+@@ -164,7 +164,7 @@ static void SHA256_Compress_Generic(SHA256Context *ctx);
+ static void SHA256_Update_Generic(SHA256Context *ctx, const unsigned char *input,
+                                   unsigned int inputLen);
+-#if !defined(USE_HW_SHA2) || !defined(IS_LITTLE_ENDIAN)
++#if !defined(USE_HW_SHA2)
+ void
+ SHA256_Compress_Native(SHA256Context *ctx)
+ {
+-- 
+2.30.2
+