Submitted By:            Pierre Labastie <pierre dot labastie at neuf dot fr>
Date:                    2023-06-10
Initial Package Version: 3.90
Upstream Status:         Committed
Origin:                  Upstream
Description:             prevents generating an "adcxq" asm instruction, which
                         is not available on old processors.

diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
--- a/nss/lib/freebl/Makefile
+++ b/nss/lib/freebl/Makefile
@@ -566,11 +566,10 @@
 ifneq ($(shell $(CC) -? 2>&1 >/dev/null </dev/null | sed -e 's/:.*//;1q'),lcc)
     ifdef CC_IS_CLANG
             HAVE_INT128_SUPPORT = 1
             DEFINES += -DHAVE_INT128_SUPPORT
     else ifeq (1,$(CC_IS_GCC))
-        SUPPORTS_VALE_CURVE25519 = 1
         ifneq (,$(filter 4.6 4.7 4.8 4.9,$(word 1,$(GCC_VERSION)).$(word 2,$(GCC_VERSION))))
             HAVE_INT128_SUPPORT = 1
             DEFINES += -DHAVE_INT128_SUPPORT
         endif
         ifneq (,$(filter 0 1 2 3 4,$(word 1,$(GCC_VERSION))))
@@ -591,15 +590,10 @@
 
 ifndef HAVE_INT128_SUPPORT
     DEFINES += -DKRML_VERIFIED_UINT128
 endif
 
-ifdef SUPPORTS_VALE_CURVE25519
-    VERIFIED_SRCS += Hacl_Curve25519_64.c
-    DEFINES += -DHACL_CAN_COMPILE_INLINE_ASM
-endif
-
 ifndef NSS_DISABLE_CHACHAPOLY
     ifeq ($(CPU_ARCH),x86_64)
         ifndef NSS_DISABLE_AVX2
             EXTRA_SRCS += Hacl_Poly1305_256.c Hacl_Chacha20_Vec256.c Hacl_Chacha20Poly1305_256.c
             DEFINES += -DHACL_CAN_COMPILE_VEC256
diff --git a/nss/lib/freebl/freebl.gyp b/nss/lib/freebl/freebl.gyp
--- a/nss/lib/freebl/freebl.gyp
+++ b/nss/lib/freebl/freebl.gyp
@@ -864,16 +864,10 @@
               'PPC_GCM',
             ],
           }],
         ],
       }],
-      [ 'supports_vale_curve25519==1', {
-        'defines': [
-          # The Makefile does version-tests on GCC, but we're not doing that here.
-          'HACL_CAN_COMPILE_INLINE_ASM',
-        ],
-      }],
       [ 'OS=="linux" or OS=="android"', {
         'conditions': [
           [ 'target_arch=="x64"', {
             'defines': [
               'MP_IS_LITTLE_ENDIAN',
@@ -932,15 +926,10 @@
     ],
   },
   'variables': {
     'module': 'nss',
     'conditions': [
-      [ 'target_arch=="x64" and cc_is_gcc==1', {
-        'supports_vale_curve25519%': 1,
-      }, {
-        'supports_vale_curve25519%': 0,
-      }],
       [ 'target_arch=="x64" or target_arch=="arm64" or target_arch=="aarch64"', {
         'have_int128_support%': 1,
       }, {
         'have_int128_support%': 0,
       }],
diff --git a/nss/lib/freebl/freebl_base.gypi b/nss/lib/freebl/freebl_base.gypi
--- a/nss/lib/freebl/freebl_base.gypi
+++ b/nss/lib/freebl/freebl_base.gypi
@@ -149,15 +149,10 @@
       'sources': [
         # All other architectures get the generic 32 bit implementation.
         'ecl/curve25519_32.c',
       ],
     }],
-    ['supports_vale_curve25519==1', {
-      'sources': [
-        'verified/Hacl_Curve25519_64.c',
-      ],
-    }],
     ['(target_arch!="ppc64" and target_arch!="ppc64le") or disable_altivec==1', {
       'sources': [
         # Gyp does not support per-file cflags, so working around like this.
         # ppc performance greatly benefits from specific flags.
         'sha512.c',

