diff options
author | Kevin Jacobs <kjacobs@mozilla.com> | 2020-06-08 20:14:28 +0000 |
---|---|---|
committer | Kevin Jacobs <kjacobs@mozilla.com> | 2020-06-08 20:14:28 +0000 |
commit | f868a4178608c270b472fecfe60ac954318f4059 (patch) | |
tree | 010804633dbacd3d1567b29123a7c790fbdcaf2b | |
parent | bcca69bc0189f3d9084d509733c34206c81a52e1 (diff) | |
download | nss-hg-f868a4178608c270b472fecfe60ac954318f4059.tar.gz |
Bug 1642802 - Win64 GYP builds to use HACL* curve25519. r=bbeurdouche
This patch causes Windows 64-bit GYP builds to use HACL* curve25519 rather than the 32-bit (fiat-crypto) implementation.
For non-clang/GCC Win64 builds, we define `KRML_VERIFIED_UINT128` to workaround an upstream bug that breaks Win32 builds by selecting a 64-bit `__int128` implementation (in types.h).
For clang/GCC builds, using the compiler-provided type yields a ~5x speedup on Win64.
Differential Revision: https://phabricator.services.mozilla.com/D78549
-rw-r--r-- | lib/freebl/freebl.gyp | 14 | ||||
-rw-r--r-- | lib/freebl/freebl_base.gypi | 3 |
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/freebl/freebl.gyp b/lib/freebl/freebl.gyp index 16fa61c6b..d780b2217 100644 --- a/lib/freebl/freebl.gyp +++ b/lib/freebl/freebl.gyp @@ -654,7 +654,9 @@ 'MP_IS_LITTLE_ENDIAN', ], }], - [ 'have_int128_support==1', { + # MSVC has no __int128 type. Use emulated int128 and leave + # have_int128_support as-is for Curve25519 impl. selection. + [ 'have_int128_support==1 and (OS!="win" or cc_is_clang==1 or cc_is_gcc==1)', { 'defines': [ # The Makefile does version-tests on GCC, but we're not doing that here. 'HAVE_INT128_SUPPORT', @@ -722,14 +724,8 @@ 'variables': { 'module': 'nss', 'conditions': [ - [ 'OS!="win"', { - 'conditions': [ - [ 'target_arch=="x64" or target_arch=="arm64" or target_arch=="aarch64"', { - 'have_int128_support%': 1, - }, { - 'have_int128_support%': 0, - }], - ], + [ 'target_arch=="x64" or target_arch=="arm64" or target_arch=="aarch64"', { + 'have_int128_support%': 1, }, { 'have_int128_support%': 0, }], diff --git a/lib/freebl/freebl_base.gypi b/lib/freebl/freebl_base.gypi index 9ba9169f4..48a92afb9 100644 --- a/lib/freebl/freebl_base.gypi +++ b/lib/freebl/freebl_base.gypi @@ -131,8 +131,7 @@ }], ], }], - ['have_int128_support==1 and \ - (target_arch=="x64" or target_arch=="arm64" or target_arch=="aarch64")', { + ['have_int128_support==1', { 'sources': [ # All intel x64 and 64-bit ARM architectures get the 64 bit version. 'ecl/curve25519_64.c', |