Source: nss
Version: 2:3.39-1
Severity: normal
Tags: patch

There is an assumption in the Makefile for freebl that aarch64 is
always a 64bit ABI. This is not correct as it can be ILP32 as well
(arm64ilp32 in debian).

The simple attached patch fixes the code so that it builds on
arm64ilp32 as well as arm64.

I'll send this upstream along with the nspr patch I filed a while ago.

The patch also incldues a comment clarification (comment out of date
WRT code, mentionning only intel).
diff -Nru a/debian/patches/arm64ilp32-support.patch 
b/debian/patches/arm64ilp32-support.patch
--- a/debian/patches/arm64ilp32-support.patch   1970-01-01 00:00:00.000000000 
+0000
+++ b/debian/patches/arm64ilp32-support.patch   2018-09-28 01:52:03.000000000 
+0000
@@ -0,0 +1,39 @@
+Description: Support arm64ilp32 in freebl Makefile
+ Correct config logic so that aarch64 is not assumed to be LP64 only
+ It can be ILP32.
+ Also update text to match code re 32/64 Curve25519 implmentation
+Author: Wookey <woo...@wookware.org>
+Last-Update: 2018-09-28
+
+--- nss-3.39.orig/nss/lib/freebl/Makefile
++++ nss-3.39/nss/lib/freebl/Makefile
+@@ -521,9 +521,11 @@ ifndef NSS_DISABLE_CHACHAPOLY
+         endif
+     else
+         ifeq ($(CPU_ARCH),aarch64)
+-            EXTRA_SRCS += Hacl_Poly1305_64.c
+-        else
+-            EXTRA_SRCS += Hacl_Poly1305_32.c
++          ifdef USE_64 #LP64
++                EXTRA_SRCS += Hacl_Poly1305_64.c
++            else #ILP32
++                EXTRA_SRCS += Hacl_Poly1305_32.c
++            endif
+         endif
+     endif # x86_64
+ 
+@@ -532,12 +534,12 @@ ifndef NSS_DISABLE_CHACHAPOLY
+ endif # NSS_DISABLE_CHACHAPOLY
+ 
+ ifeq (,$(filter-out i386 x386 x86 x86_64 aarch64,$(CPU_ARCH)))
+-    # All intel architectures get the 64 bit version
++    # All intel architectures and aarch64 get the 64 bit version
+     # With custom uint128 if necessary (faster than generic 32 bit version).
+     ECL_SRCS += curve25519_64.c
+     VERIFIED_SRCS += Hacl_Curve25519.c
+ else
+-    # All non intel architectures get the generic 32 bit implementation 
(slow!)
++    # All non intel/aarch64 architectures get the generic 32 bit 
implementation (slow!)
+     ECL_SRCS += curve25519_32.c
+ endif
+ 
diff -Nru a/debian/patches/series b/debian/patches/series
--- a/debian/patches/series     2018-06-24 22:24:52.000000000 +0000
+++ b/debian/patches/series     2018-09-28 01:52:03.000000000 +0000
@@ -2,3 +2,4 @@
 80_security_tools.patch
 85_security_load.patch
 38_hppa.patch
+arm64ilp32-support.patch

Reply via email to