tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

freebl.gyp (25220B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 {
      5   'includes': [
      6     '../../coreconf/config.gypi'
      7   ],
      8   'targets': [
      9     {
     10       'target_name': 'intel-gcm-s_lib',
     11       'type': 'static_library',
     12       'sources': [
     13         'intel-aes.s',
     14         'intel-gcm.s',
     15       ],
     16       'dependencies': [
     17         '<(DEPTH)/exports.gyp:nss_exports'
     18       ],
     19     },
     20     {
     21       'target_name': 'intel-gcm-wrap_c_lib',
     22       'type': 'static_library',
     23       'sources': [
     24         'intel-gcm-wrap.c',
     25       ],
     26       'conditions': [
     27         [ '(OS=="linux" or OS=="android") and target_arch=="x64"', {
     28           'dependencies': [
     29             'intel-gcm-s_lib',
     30           ],
     31         }],
     32       ],
     33       'dependencies': [
     34         '<(DEPTH)/exports.gyp:nss_exports'
     35       ],
     36       'cflags': [
     37         '-mssse3',
     38       ],
     39       'cflags_mozilla': [
     40         '-mssse3'
     41       ],
     42       # Remove FREEBL_NO_DEPEND so intel-gcm-wrap.c uses real NSS utility
     43       # functions instead of stubs. This is needed for static builds.
     44       'defines!': [
     45         'FREEBL_NO_DEPEND',
     46       ],
     47     },
     48     {
     49       'target_name': 'intel-gcm-wrap-nodepend_c_lib',
     50       'type': 'static_library',
     51       'sources': [
     52         'intel-gcm-wrap.c',
     53       ],
     54       'conditions': [
     55         [ '(OS=="linux" or OS=="android") and target_arch=="x64"', {
     56           'dependencies': [
     57             'intel-gcm-s_lib',
     58           ],
     59         }],
     60       ],
     61       'dependencies': [
     62         '<(DEPTH)/exports.gyp:nss_exports'
     63       ],
     64       'cflags': [
     65         '-mssse3',
     66       ],
     67       'cflags_mozilla': [
     68         '-mssse3'
     69       ],
     70     },
     71     {
     72       'target_name': 'hw-acc-crypto-avx',
     73       'type': 'static_library',
     74       # 'sources': [
     75       #   All AVX hardware accelerated crypto currently requires x64
     76       # ],
     77       'dependencies': [
     78         '<(DEPTH)/exports.gyp:nss_exports'
     79       ],
     80       'conditions': [
     81         [ 'target_arch=="x64"', {
     82           'cflags': [
     83             '-mssse3',
     84             '-msse4.1',
     85             '-msse4.2'
     86           ],
     87           'cflags_mozilla': [
     88             '-mssse3',
     89             '-msse4.1',
     90             '-msse4.2',
     91             '-mpclmul',
     92             '-maes',
     93             '-mavx',
     94           ],
     95           # GCC doesn't define this.
     96           'defines': [
     97             '__SSSE3__',
     98           ],
     99         }],
    100         [ 'OS=="linux" or OS=="android" or OS=="dragonfly" or OS=="freebsd" or \
    101            OS=="netbsd" or OS=="openbsd"', {
    102           'cflags': [
    103             '-mpclmul',
    104             '-maes',
    105             '-mavx',
    106           ],
    107         }],
    108         # macOS build doesn't use cflags.
    109         [ 'OS=="mac" or OS=="ios"', {
    110           'xcode_settings': {
    111             'OTHER_CFLAGS': [
    112               '-mssse3',
    113               '-msse4.1',
    114               '-msse4.2',
    115               '-mpclmul',
    116               '-maes',
    117               '-mavx',
    118             ],
    119           },
    120         }],
    121         [ 'target_arch=="arm"', {
    122           # Gecko doesn't support non-NEON platform on Android, but tier-3
    123           # platform such as Linux/arm will need it
    124           'cflags_mozilla': [
    125             '-mfpu=neon'
    126           ],
    127         }],
    128         [ 'target_arch=="x64"', {
    129           'sources': [
    130             'verified/Hacl_Poly1305_128.c',
    131             'verified/Hacl_Chacha20_Vec128.c',
    132             'verified/Hacl_Chacha20Poly1305_128.c',
    133           ],
    134         }],
    135       ],
    136     },
    137     {
    138       'target_name': 'hw-acc-crypto-avx2',
    139       'type': 'static_library',
    140       # 'sources': [
    141       #   All AVX2 hardware accelerated crypto currently requires x64
    142       # ],
    143       'dependencies': [
    144         '<(DEPTH)/exports.gyp:nss_exports'
    145       ],
    146       'conditions': [
    147         [ 'target_arch=="x64"', {
    148           'cflags': [
    149             '-mssse3',
    150             '-msse4.1',
    151             '-msse4.2'
    152           ],
    153           'cflags_mozilla': [
    154             '-mssse3',
    155             '-msse4.1',
    156             '-msse4.2',
    157             '-mpclmul',
    158             '-maes',
    159             '-mavx',
    160             '-mavx2',
    161           ],
    162           # GCC doesn't define this.
    163           'defines': [
    164             '__SSSE3__',
    165           ],
    166         }],
    167         [ 'OS=="linux" or OS=="android" or OS=="dragonfly" or OS=="freebsd" or \
    168            OS=="netbsd" or OS=="openbsd"', {
    169           'cflags': [
    170             '-mpclmul',
    171             '-maes',
    172             '-mavx',
    173             '-mavx2',
    174           ],
    175         }],
    176         # macOS build doesn't use cflags.
    177         [ 'OS=="mac" or OS=="ios"', {
    178           'xcode_settings': {
    179             'OTHER_CFLAGS': [
    180               '-mssse3',
    181               '-msse4.1',
    182               '-msse4.2',
    183               '-mpclmul',
    184               '-maes',
    185               '-mavx',
    186               '-mavx2',
    187             ],
    188           },
    189         }],
    190         [ 'target_arch=="arm"', {
    191           # Gecko doesn't support non-NEON platform on Android, but tier-3
    192           # platform such as Linux/arm will need it
    193           'cflags_mozilla': [
    194             '-mfpu=neon'
    195           ],
    196         }],
    197         [ 'target_arch=="x64"', {
    198           'sources': [
    199             'verified/Hacl_Poly1305_256.c',
    200             'verified/Hacl_Chacha20_Vec256.c',
    201             'verified/Hacl_Chacha20Poly1305_256.c',
    202           ],
    203         }],
    204       ],
    205     },
    206     {
    207       'target_name': 'gcm-aes-x86_c_lib',
    208       'type': 'static_library',
    209       'sources': [
    210         'gcm-x86.c', 'aes-x86.c'
    211       ],
    212       'dependencies': [
    213         '<(DEPTH)/exports.gyp:nss_exports'
    214       ],
    215       # Enable isa option for pclmul and aes-ni; supported since gcc 4.4.
    216       # This is only supported by x84/x64. It's not needed for Windows,
    217       # unless clang-cl is used.
    218       'cflags_mozilla': [
    219         '-mpclmul', '-maes'
    220       ],
    221       'conditions': [
    222         [ 'OS=="linux" or OS=="android" or OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or OS=="openbsd"', {
    223           'cflags': [
    224             '-mpclmul', '-maes'
    225           ],
    226         }],
    227         # macOS build doesn't use cflags.
    228         [ 'OS=="mac" or OS=="ios"', {
    229           'xcode_settings': {
    230             'OTHER_CFLAGS': [
    231               '-mpclmul', '-maes'
    232             ],
    233           },
    234         }]
    235       ]
    236     },
    237     {
    238       'target_name': 'sha-x86_c_lib',
    239       'type': 'static_library',
    240       'sources': [
    241         'sha256-x86.c'
    242       ],
    243       'dependencies': [
    244         '<(DEPTH)/exports.gyp:nss_exports'
    245       ],
    246       'cflags': [
    247         '-msha',
    248         '-mssse3',
    249         '-msse4.1'
    250       ],
    251       'cflags_mozilla': [
    252         '-msha',
    253         '-mssse3',
    254         '-msse4.1'
    255       ],
    256       'conditions': [
    257         # macOS build doesn't use cflags.
    258         [ 'OS=="mac" or OS=="ios"', {
    259           'xcode_settings': {
    260             'OTHER_CFLAGS': [
    261               '-msha',
    262               '-mssse3',
    263               '-msse4.1'
    264             ],
    265           },
    266         }]
    267       ]
    268     },
    269     {
    270       'target_name': 'gcm-aes-arm32-neon_c_lib',
    271       'type': 'static_library',
    272       'sources': [
    273         'gcm-arm32-neon.c'
    274       ],
    275       'dependencies': [
    276         '<(DEPTH)/exports.gyp:nss_exports'
    277       ],
    278       'cflags': [
    279         '-march=armv7',
    280         '-mfpu=neon',
    281         '<@(softfp_cflags)',
    282       ],
    283       'cflags_mozilla': [
    284         '-mfpu=neon',
    285         '<@(softfp_cflags)',
    286       ]
    287     },
    288     {
    289       'target_name': 'gcm-aes-aarch64_c_lib',
    290       'type': 'static_library',
    291       'sources': [
    292         'gcm-aarch64.c'
    293       ],
    294       'dependencies': [
    295         '<(DEPTH)/exports.gyp:nss_exports'
    296       ],
    297       'cflags': [
    298         '-march=armv8-a+crypto'
    299       ],
    300       'cflags_mozilla': [
    301         '-march=armv8-a+crypto'
    302       ]
    303     },
    304     {
    305       'target_name': 'gcm-aes-ppc_c_lib',
    306       'type': 'static_library',
    307       'sources': [
    308         'gcm-ppc.c',
    309       ],
    310       'dependencies': [
    311         '<(DEPTH)/exports.gyp:nss_exports'
    312       ],
    313       'conditions': [
    314         [ 'disable_crypto_vsx==0', {
    315           'cflags': [
    316             '-mcrypto',
    317             '-maltivec'
    318            ],
    319            'cflags_mozilla': [
    320              '-mcrypto',
    321              '-maltivec'
    322            ],
    323         }, 'disable_crypto_vsx==1', {
    324           'cflags': [
    325             '-maltivec'
    326           ],
    327           'cflags_mozilla': [
    328             '-maltivec'
    329           ],
    330         }],
    331       ]
    332     },
    333     {
    334       'target_name': 'gcm-aes-ppc_lib',
    335       'type': 'static_library',
    336       'sources': [
    337         'ppc-gcm.s',
    338       ],
    339       'dependencies': [
    340         '<(DEPTH)/exports.gyp:nss_exports'
    341       ],
    342     },
    343     {
    344       'target_name': 'ppc-gcm-wrap-nodepend_c_lib',
    345       'type': 'static_library',
    346       'sources': [
    347         'ppc-gcm-wrap.c',
    348       ],
    349       'dependencies': [
    350         '<(DEPTH)/exports.gyp:nss_exports',
    351         'gcm-aes-ppc_lib',
    352       ],
    353     },
    354     {
    355       'target_name': 'ppc-gcm-wrap_c_lib',
    356       'type': 'static_library',
    357       'sources': [
    358         'ppc-gcm-wrap.c',
    359       ],
    360       'dependencies': [
    361         '<(DEPTH)/exports.gyp:nss_exports',
    362         'gcm-aes-ppc_lib',
    363       ],
    364       'defines!': [
    365         'FREEBL_NO_DEPEND',
    366       ],
    367     },
    368     {
    369       'target_name': 'sha512-nodepend-ppc_c_lib',
    370       'type': 'static_library',
    371       'sources': [
    372         'sha512.c',
    373       ],
    374       'dependencies': [
    375         '<(DEPTH)/exports.gyp:nss_exports'
    376       ],
    377       'conditions': [
    378         [ 'ppc_abi==2', {
    379           'sources': [
    380             'sha512-p8.s',
    381           ],
    382         }],
    383         [ 'disable_crypto_vsx==0', {
    384           'cflags': [
    385             '-mcrypto',
    386             '-maltivec',
    387             '-mvsx',
    388             '-funroll-loops',
    389             '-fpeel-loops'
    390            ],
    391            'cflags_mozilla': [
    392             '-mcrypto',
    393             '-maltivec',
    394             '-mvsx',
    395             '-funroll-loops',
    396             '-fpeel-loops'
    397            ],
    398         }, 'disable_crypto_vsx==1', {
    399           'cflags': [
    400             '-maltivec',
    401             '-funroll-loops',
    402             '-fpeel-loops'
    403           ],
    404           'cflags_mozilla': [
    405             '-maltivec',
    406             '-funroll-loops',
    407             '-fpeel-loops'
    408           ],
    409         }]
    410       ]
    411     },
    412     {
    413       'target_name': 'sha512-ppc_c_lib',
    414       'type': 'static_library',
    415       'sources': [
    416         'sha512.c',
    417       ],
    418       'dependencies': [
    419         '<(DEPTH)/exports.gyp:nss_exports'
    420       ],
    421       'conditions': [
    422         [ 'ppc_abi==2', {
    423           'sources': [
    424             'sha512-p8.s',
    425           ],
    426         }],
    427         [ 'disable_crypto_vsx==0', {
    428           'cflags': [
    429             '-mcrypto',
    430             '-maltivec',
    431             '-mvsx',
    432             '-funroll-loops',
    433             '-fpeel-loops'
    434            ],
    435            'cflags_mozilla': [
    436             '-mcrypto',
    437             '-maltivec',
    438             '-mvsx',
    439             '-funroll-loops',
    440             '-fpeel-loops'
    441            ],
    442         }, 'disable_crypto_vsx==1', {
    443           'cflags': [
    444             '-maltivec',
    445             '-funroll-loops',
    446             '-fpeel-loops'
    447           ],
    448           'cflags_mozilla': [
    449             '-maltivec',
    450             '-funroll-loops',
    451             '-fpeel-loops'
    452           ],
    453         }]
    454       ],
    455       'defines!': [
    456         'FREEBL_NO_DEPEND',
    457       ],
    458     },
    459     {
    460       'target_name': 'chacha20-ppc_lib',
    461       'type': 'static_library',
    462       'sources': [
    463         'chacha20poly1305-ppc.c',
    464         'chacha20-ppc64le.S',
    465       ]
    466     },
    467     {
    468       'target_name': 'armv8_c_lib',
    469       'type': 'static_library',
    470       'sources': [
    471         'aes-armv8.c',
    472         'sha1-armv8.c',
    473         'sha256-armv8.c',
    474       ],
    475       'dependencies': [
    476         '<(DEPTH)/exports.gyp:nss_exports'
    477       ],
    478       'conditions': [
    479         [ 'target_arch=="arm"', {
    480           'cflags': [
    481             '-march=armv8-a',
    482             '-mfpu=crypto-neon-fp-armv8',
    483             '<@(softfp_cflags)',
    484           ],
    485           'cflags_mozilla': [
    486             '-march=armv8-a',
    487             '-mfpu=crypto-neon-fp-armv8',
    488             '<@(softfp_cflags)',
    489           ],
    490         }, 'target_arch=="arm64" or target_arch=="aarch64"', {
    491           'cflags': [
    492             '-march=armv8-a+crypto'
    493           ],
    494           'cflags_mozilla': [
    495             '-march=armv8-a+crypto'
    496           ],
    497         }]
    498       ]
    499     },
    500     {
    501       'target_name': 'freebl',
    502       'type': 'static_library',
    503       'sources': [
    504         'loader.c'
    505       ],
    506       'dependencies': [
    507         '<(DEPTH)/exports.gyp:nss_exports'
    508       ]
    509     },
    510     # Build a static freebl library so we can statically link it into
    511     # the binary. This way we don't have to dlopen() the shared lib
    512     # but can directly call freebl functions.
    513     {
    514       'target_name': 'freebl_static',
    515       'type': 'static_library',
    516       'includes': [
    517         'freebl_base.gypi',
    518       ],
    519       'dependencies': [
    520         '<(DEPTH)/exports.gyp:nss_exports',
    521         'hw-acc-crypto-avx',
    522         'hw-acc-crypto-avx2',
    523       ],
    524       'conditions': [
    525         [ 'target_arch=="ia32" or target_arch=="x64"', {
    526           'dependencies': [
    527             'gcm-aes-x86_c_lib',
    528             'intel-gcm-wrap_c_lib',
    529           ],
    530         }],
    531         [ '(disable_arm_hw_aes==0 or disable_arm_hw_sha1==0 or disable_arm_hw_sha2==0) and (target_arch=="arm" or target_arch=="arm64" or target_arch=="aarch64")', {
    532           'dependencies': [
    533             'armv8_c_lib'
    534           ],
    535         }],
    536         [ '(target_arch=="ia32" or target_arch=="x64") and disable_intel_hw_sha==0', {
    537           'dependencies': [
    538             'sha-x86_c_lib',
    539           ],
    540         }],
    541         [ 'disable_arm32_neon==0 and target_arch=="arm"', {
    542           'dependencies': [
    543             'gcm-aes-arm32-neon_c_lib',
    544           ],
    545         }],
    546         [ 'disable_arm32_neon==1 and target_arch=="arm"', {
    547           'defines!': [
    548             'NSS_DISABLE_ARM32_NEON',
    549           ],
    550         }],
    551         [ 'target_arch=="arm64" or target_arch=="aarch64"', {
    552           'dependencies': [
    553             'gcm-aes-aarch64_c_lib',
    554           ],
    555         }],
    556         [ 'disable_altivec==0 and target_arch=="ppc64"', {
    557           'dependencies': [
    558             'gcm-aes-ppc_c_lib',
    559             'sha512-ppc_c_lib',
    560           ],
    561         }],
    562         [ 'disable_altivec==0 and target_arch=="ppc64le"', {
    563           'dependencies': [
    564             'gcm-aes-ppc_c_lib',
    565             'sha512-ppc_c_lib',
    566             'chacha20-ppc_lib',
    567             'ppc-gcm-wrap_c_lib',
    568           ],
    569         }],
    570         [ 'disable_altivec==1 and (target_arch=="ppc64" or target_arch=="ppc64le")', {
    571           'defines': [
    572             'NSS_DISABLE_ALTIVEC',
    573           ],
    574         }],
    575         [ 'disable_crypto_vsx==1 and (target_arch=="ppc" or target_arch=="ppc64" or target_arch=="ppc64le")', {
    576           'defines': [
    577             'NSS_DISABLE_CRYPTO_VSX',
    578           ],
    579         }],
    580         [ 'OS=="linux"', {
    581           'defines!': [
    582             'FREEBL_NO_DEPEND',
    583             'FREEBL_LOWHASH',
    584           ],
    585         }],
    586       ],
    587     },
    588     {
    589       'target_name': '<(freebl_name)',
    590       'type': 'shared_library',
    591       'includes': [
    592         'freebl_base.gypi',
    593       ],
    594       'dependencies': [
    595         '<(DEPTH)/exports.gyp:nss_exports',
    596         'hw-acc-crypto-avx',
    597         'hw-acc-crypto-avx2',
    598       ],
    599       'conditions': [
    600         [ 'target_arch=="ia32" or target_arch=="x64"', {
    601           'dependencies': [
    602             'gcm-aes-x86_c_lib',
    603             'intel-gcm-wrap-nodepend_c_lib',
    604           ]
    605         }],
    606         [ 'target_arch=="arm" or target_arch=="arm64" or target_arch=="aarch64"', {
    607           'dependencies': [
    608             'armv8_c_lib',
    609           ],
    610         }],
    611         [ '(target_arch=="ia32" or target_arch=="x64") and disable_intel_hw_sha==0', {
    612           'dependencies': [
    613             'sha-x86_c_lib',
    614           ],
    615         }],
    616         [ 'disable_arm32_neon==0 and target_arch=="arm"', {
    617           'dependencies': [
    618             'gcm-aes-arm32-neon_c_lib',
    619           ],
    620         }],
    621         [ 'disable_arm32_neon==1 and target_arch=="arm"', {
    622           'defines!': [
    623             'NSS_DISABLE_ARM32_NEON',
    624           ],
    625         }],
    626         [ 'target_arch=="arm64" or target_arch=="aarch64"', {
    627           'dependencies': [
    628             'gcm-aes-aarch64_c_lib',
    629           ],
    630         }],
    631         [ 'disable_altivec==0', {
    632           'conditions': [
    633             [ 'target_arch=="ppc64"', {
    634               'dependencies': [
    635                 'gcm-aes-ppc_c_lib',
    636                 'sha512-nodepend-ppc_c_lib',
    637               ],
    638             }, 'target_arch=="ppc64le"', {
    639                'dependencies': [
    640                  'gcm-aes-ppc_c_lib',
    641                  'sha512-nodepend-ppc_c_lib',
    642                  'ppc-gcm-wrap-nodepend_c_lib',
    643                ],
    644             }],
    645           ],
    646         }],
    647         [ 'disable_altivec==1 and (target_arch=="ppc64" or target_arch=="ppc64le")', {
    648           'defines': [
    649             'NSS_DISABLE_ALTIVEC',
    650           ],
    651         }],
    652         [ 'disable_crypto_vsx==1 and (target_arch=="ppc" or target_arch=="ppc64" or target_arch=="ppc64le")', {
    653           'defines': [
    654             'NSS_DISABLE_CRYPTO_VSX',
    655           ],
    656         }],
    657         [ 'OS!="linux"', {
    658           'conditions': [
    659             [ 'moz_fold_libs==0', {
    660               'dependencies': [
    661                 '<(DEPTH)/lib/util/util.gyp:nssutil3',
    662               ],
    663             }, {
    664               'libraries': [
    665                 '<(moz_folded_library_name)',
    666               ],
    667             }],
    668           ],
    669         }],
    670         [ 'OS=="linux"', {
    671           'sources': [
    672             'nsslowhash.c',
    673             'stubs.c',
    674           ],
    675         }],
    676       ],
    677       'variables': {
    678        'conditions': [
    679          [ 'OS=="linux"', {
    680            'mapfile': 'freebl_hash_vector.def',
    681          }, {
    682            'mapfile': 'freebl.def',
    683          }],
    684        ]
    685       },
    686     },
    687     {
    688       'target_name': 'freebl_64int_3',
    689       'includes': [
    690         'freebl_base.gypi',
    691       ],
    692       'type': 'shared_library',
    693       'dependencies': [
    694         '<(DEPTH)/exports.gyp:nss_exports',
    695         'hw-acc-crypto-avx',
    696         'hw-acc-crypto-avx2',
    697       ],
    698     },
    699     {
    700       'target_name': 'freebl_64fpu_3',
    701       'includes': [
    702         'freebl_base.gypi',
    703       ],
    704       'type': 'shared_library',
    705       'sources': [
    706         'mpi/mpi_sparc.c',
    707         'mpi/mpv_sparcv9.s',
    708         'mpi/montmulfv9.s',
    709       ],
    710       'dependencies': [
    711         '<(DEPTH)/exports.gyp:nss_exports',
    712         'hw-acc-crypto-avx',
    713         'hw-acc-crypto-avx2',
    714       ],
    715       'asflags_mozilla': [
    716         '-mcpu=v9', '-Wa,-xarch=v9a'
    717       ],
    718       'defines': [
    719         'MP_NO_MP_WORD',
    720         'MP_USE_UINT_DIGIT',
    721         'MP_ASSEMBLY_MULTIPLY',
    722         'MP_USING_MONT_MULF',
    723         'MP_MONT_USE_MP_MUL',
    724       ],
    725     },
    726   ],
    727   'conditions': [
    728     [ 'OS=="linux"', {
    729       # stub build
    730       'targets': [
    731         {
    732           'target_name': 'freebl3',
    733           'type': 'shared_library',
    734           'defines': [
    735             'FREEBL_NO_DEPEND',
    736           ],
    737           'sources': [
    738             'lowhash_vector.c'
    739           ],
    740           'dependencies': [
    741             '<(DEPTH)/exports.gyp:nss_exports'
    742           ],
    743           'variables': {
    744             'mapfile': 'freebl_hash.def'
    745           }
    746         },
    747       ],
    748     }],
    749   ],
    750   'target_defaults': {
    751     'include_dirs': [
    752       'mpi',
    753       'ecl',
    754       'verified',
    755       'verified/internal',
    756       'verified/karamel/include',
    757       'verified/karamel/krmllib/dist/minimal',
    758       'deprecated',
    759       'verified/eurydice',
    760     ],
    761     'defines': [
    762       'SHLIB_SUFFIX=\"<(dll_suffix)\"',
    763       'SHLIB_PREFIX=\"<(dll_prefix)\"',
    764       'SHLIB_VERSION=\"3\"',
    765       'SOFTOKEN_SHLIB_VERSION=\"3\"',
    766       'RIJNDAEL_INCLUDE_TABLES',
    767       'MP_API_COMPATIBLE',
    768       # Bug 1918767 / Bug 1918711 - by setting KRML_MUSTINLINE=inline here, we
    769       # avoid it being defined to `inline __forceinline` (for msvc) or `inline
    770       # __attribute((always_inline))` (for gcc/clang) in
    771       # verified/karamel/include/krml/internal/target.h. These other
    772       # configurations can cause excessive stack usage.
    773       'KRML_MUSTINLINE=inline'
    774     ],
    775     'conditions': [
    776       [ 'OS=="win" and target_arch=="ia32"', {
    777         'msvs_settings': {
    778           'VCCLCompilerTool': {
    779             #TODO: -Ox optimize flags
    780             'PreprocessorDefinitions': [
    781               'MP_ASSEMBLY_MULTIPLY',
    782               'MP_ASSEMBLY_SQUARE',
    783               'MP_ASSEMBLY_DIV_2DX1D',
    784               'MP_USE_UINT_DIGIT',
    785               'MP_NO_MP_WORD',
    786               'USE_HW_AES',
    787               'INTEL_GCM',
    788             ],
    789           },
    790         },
    791       }],
    792       [ 'OS=="win" and target_arch=="x64"', {
    793         'msvs_settings': {
    794           'VCCLCompilerTool': {
    795             #TODO: -Ox optimize flags
    796             'PreprocessorDefinitions': [
    797               # Should be copied to mingw defines below
    798               'NSS_BEVAND_ARCFOUR',
    799               'MPI_AMD64',
    800               'MP_ASSEMBLY_MULTIPLY',
    801               'NSS_USE_COMBA',
    802               'USE_HW_AES',
    803               'INTEL_GCM',
    804             ],
    805           },
    806         },
    807       }],
    808       [ '(OS=="win" or OS=="mac" or OS=="ios") and (target_arch=="ia32" or target_arch=="x64") and disable_intel_hw_sha==0', {
    809         'defines': [
    810           'USE_HW_SHA2',
    811         ],
    812       }],
    813       [ '(OS=="win" or OS=="mac" or OS=="ios") and (target_arch=="arm64" or target_arch=="aarch64") and disable_arm_hw_aes==0', {
    814         'defines': [
    815           'USE_HW_AES',
    816         ],
    817       }],
    818       [ '(OS=="win" or OS=="mac" or OS=="ios") and (target_arch=="arm64" or target_arch=="aarch64") and disable_arm_hw_sha1==0', {
    819         'defines': [
    820           'USE_HW_SHA1',
    821         ],
    822       }],
    823       [ '(OS=="win" or OS=="mac" or OS=="ios") and (target_arch=="arm64" or target_arch=="aarch64") and disable_arm_hw_sha2==0', {
    824         'defines': [
    825           'USE_HW_SHA2',
    826         ],
    827       }],
    828       # Poly1305_256 requires the flag to run
    829       ['target_arch=="x64"', {
    830         'defines':[
    831           'HACL_CAN_COMPILE_VEC128',
    832           'HACL_CAN_COMPILE_VEC256',
    833           'HACL_CAN_COMPILE_INTRINSICS',
    834         ],
    835       }],
    836       # MSVC has no __int128 type. Use emulated int128 and leave
    837       # have_int128_support as-is for Curve25519 impl. selection.
    838       [ 'have_int128_support==1 and (OS!="win" or cc_is_clang==1 or cc_is_gcc==1)', {
    839         'defines': [
    840           # The Makefile does version-tests on GCC, but we're not doing that here.
    841           'HAVE_INT128_SUPPORT',
    842           'HACL_CAN_COMPILE_UINT128'
    843         ],
    844       }, {
    845         'defines': [
    846           'KRML_VERIFIED_UINT128',
    847         ],
    848       }],
    849       [ 'OS=="linux"', {
    850         'defines': [
    851           'FREEBL_LOWHASH',
    852           'FREEBL_NO_DEPEND',
    853         ],
    854         'conditions': [
    855           [ 'disable_altivec==0 and target_arch=="ppc64le"', {
    856             'defines': [
    857               'PPC_GCM',
    858             ],
    859           }],
    860         ],
    861       }],
    862       [ 'OS=="linux" or OS=="android"', {
    863         'conditions': [
    864           [ 'target_arch=="x64"', {
    865             'defines': [
    866               'NSS_BEVAND_ARCFOUR',
    867               'MPI_AMD64',
    868               'MP_ASSEMBLY_MULTIPLY',
    869               'NSS_USE_COMBA',
    870             ],
    871           }],
    872           [ 'target_arch=="x64"', {
    873             'defines': [
    874               'USE_HW_AES',
    875               'INTEL_GCM',
    876             ],
    877           }],
    878           [ 'target_arch=="ia32"', {
    879             'defines': [
    880               'MP_ASSEMBLY_MULTIPLY',
    881               'MP_ASSEMBLY_SQUARE',
    882               'MP_ASSEMBLY_DIV_2DX1D',
    883               'MP_USE_UINT_DIGIT',
    884             ],
    885           }],
    886           [ 'target_arch=="arm"', {
    887             'defines': [
    888               'MP_ASSEMBLY_MULTIPLY',
    889               'MP_ASSEMBLY_SQUARE',
    890               'MP_USE_UINT_DIGIT',
    891               'SHA_NO_LONG_LONG',
    892               'ARMHF',
    893             ],
    894           }],
    895           [ 'disable_intel_hw_sha==0 and (target_arch=="ia32" or target_arch=="x64")', {
    896             'defines': [
    897               'USE_HW_SHA2',
    898             ],
    899           }],
    900           [ 'disable_arm_hw_aes==0 and (target_arch=="arm" or target_arch=="arm64" or target_arch=="aarch64")', {
    901             'defines': [
    902               'USE_HW_AES',
    903             ],
    904           }],
    905           [ 'disable_arm_hw_sha1==0 and (target_arch=="arm" or target_arch=="arm64" or target_arch=="aarch64")', {
    906             'defines': [
    907               'USE_HW_SHA1',
    908             ],
    909           }],
    910           [ 'disable_arm_hw_sha2==0 and (target_arch=="arm" or target_arch=="arm64" or target_arch=="aarch64")', {
    911             'defines': [
    912               'USE_HW_SHA2',
    913             ],
    914           }],
    915         ],
    916       }],
    917     ],
    918   },
    919   'variables': {
    920     'module': 'nss',
    921     'conditions': [
    922       [ 'target_arch=="x64" or target_arch=="arm64" or target_arch=="aarch64"', {
    923         'have_int128_support%': 1,
    924       }, {
    925         'have_int128_support%': 0,
    926       }],
    927       [ 'target_arch=="arm"', {
    928         # When the compiler uses the softfloat ABI, we want to use the compatible softfp ABI when enabling NEON for these objects.
    929         # Confusingly, __SOFTFP__ is the name of the define for the softfloat ABI, not for the softfp ABI.
    930         'softfp_cflags': '<!(sh -c "${CC:-cc} -o - -E -dM - ${CFLAGS} < /dev/null | grep __SOFTFP__ > /dev/null && echo -mfloat-abi=softfp || true")',
    931       }],
    932       [ 'target_arch=="ppc64" or target_arch=="ppc64le"', {
    933        'ppc_abi': '<!(sh -c "${CC:-cc} -dM -E - < /dev/null | awk \'\\$2 == \\"_CALL_ELF\\" {print \\$3}\'")',
    934       }],
    935     ],
    936   }
    937 }