summaryrefslogtreecommitdiffstats
path: root/security/nss/lib/freebl/freebl_base.gypi
blob: 8ef46da6303c88365625bc54dc9c2c89ac8af235 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
{
  'sources': [
    'aeskeywrap.c',
    'cmac.c',
    'alghmac.c',
    'arcfive.c',
    'arcfour.c',
    'blake2b.c',
    'camellia.c',
    'chacha20poly1305.c',
    'crypto_primitives.c',
    'ctr.c',
    'cts.c',
    'des.c',
    'desblapi.c',
    'dh.c',
    'drbg.c',
    'dsa.c',
    'ec.c',
    'ecdecode.c',
    'ecl/ec_naf.c',
    'ecl/ecl.c',
    'ecl/ecl_gf.c',
    'ecl/ecl_mult.c',
    'ecl/ecp_25519.c',
    'ecl/ecp_256.c',
    'ecl/ecp_256_32.c',
    'ecl/ecp_384.c',
    'ecl/ecp_521.c',
    'ecl/ecp_aff.c',
    'ecl/ecp_jac.c',
    'ecl/ecp_jm.c',
    'ecl/ecp_mont.c',
    'ecl/ecp_secp256r1.c',
    'ecl/ecp_secp384r1.c',
    'ecl/ecp_secp384r1_wrap.c',
    'ecl/ecp_secp521r1.c',
    'ecl/ecp_secp521r1_wrap.c',
    'verified/Hacl_P256.c',
    'verified/Hacl_P384.c',
    'verified/Hacl_P521.c',
    'fipsfreebl.c',
    'blinit.c',
    'freeblver.c',
    'gcm.c',
    'hmacct.c',
    'jpake.c',
    'kyber.c',
    'kyber-pqcrystals-ref.c',
    'ldvector.c',
    'md2.c',
    'md5.c',
    'mpi/mp_gf2m.c',
    'mpi/mpcpucache.c',
    'mpi/mpi.c',
    'mpi/mplogic.c',
    'mpi/mpmontg.c',
    'mpi/mpprime.c',
    'pqg.c',
    'rawhash.c',
    'rijndael.c',
    'rsa.c',
    'rsa_blind.c',
    'rsapkcs.c',
    'sha_fast.c',
    'shvfy.c',
    'sysrand.c',
    'tlsprfalg.c',
    'secmpi.c',
    'verified/Hacl_Hash_SHA3.c',
    'sha3.c',
    'shake.c',
  ],
  'defines': [
    # For kyber-pqcrystals-ref.c. If we ever decide to support Kyber512 or
    # Kyber1024, we'll need to build separate static libraries with different
    # values of KYBER_K.
    'KYBER_K=3',
  ],
  'conditions': [
    [ 'OS=="linux" or OS=="android"', {
      'conditions': [
        [ 'target_arch=="x64"', {
          'sources': [
            'arcfour-amd64-gas.s',
            'mpi/mpi_amd64.c',
            'mpi/mpi_amd64_common.S',
            'mpi/mp_comba.c',
          ],
          'conditions': [
            [ 'cc_is_clang==1 and fuzz!=1 and coverage!=1 and force_integrated_as!=1', {
              'cflags': [
                '-no-integrated-as',
              ],
              'cflags_mozilla': [
                '-no-integrated-as',
              ],
              'asflags_mozilla': [
                '-no-integrated-as',
              ],
            }],
          ],
        }],
        [ 'target_arch=="ia32"', {
          'sources': [
            'mpi/mpi_x86.s',
          ],
        }],
        [ 'target_arch=="arm"', {
          'sources': [
            'mpi/mpi_arm.c',
          ],
        }],
        [ 'target_arch=="ppc64le"', {
          'sources': [
            'chacha20poly1305-ppc.c',
            'chacha20-ppc64le.S',
          ],
        }]
      ],
    }],
    [ 'OS=="win"', {
      'libraries': [
        '-ladvapi32',
      ],
      'conditions': [
        [ 'cc_use_gnu_ld!=1 and target_arch=="x64"', {
          'sources': [
            'arcfour-amd64-masm.asm',
            'mpi/mpi_amd64.c',
            'mpi/mpi_amd64_masm.asm',
            'mpi/mp_comba_amd64_masm.asm',
            'intel-aes-x64-masm.asm',
            'intel-gcm-x64-masm.asm',
          ],
        }],
        [ 'cc_use_gnu_ld!=1 and target_arch=="ia32"', {
          'sources': [
            'mpi/mpi_x86_asm.c',
            'intel-aes-x86-masm.asm',
            'intel-gcm-x86-masm.asm',
          ],
        }],
        [ 'cc_use_gnu_ld==1', {
          # mingw
          'sources': [
          ],
        }],
        [ 'cc_is_clang!=1', {
          # MSVC
          'sources': [
            'intel-gcm-wrap.c',
          ],
        }],
      ],
    }],
    ['have_int128_support==1', {
      'sources': [
        # All intel x64 and 64-bit ARM architectures get the 64 bit version.
        'ecl/curve25519_64.c',
        'verified/Hacl_Curve25519_51.c',
      ],
    }, {
      'sources': [
        # All other architectures get the generic 32 bit implementation.
        'ecl/curve25519_32.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',
      ],
    }],
    [ 'disable_chachapoly==0', {
      # The ChaCha20 code is linked in through the static ssse3-crypto lib on
      # all platforms that support SSSE3. There are runtime checks in place to
      # choose the correct ChaCha implementation at runtime.
      'sources': [
        'verified/Hacl_Chacha20.c',
        'verified/Hacl_Chacha20Poly1305_32.c',
        'verified/Hacl_Poly1305_32.c',
      ],
    }],
    [ 'disable_deprecated_seed==0', {
      'sources': [
        'deprecated/seed.c',
      ],
    }],
    [ 'disable_deprecated_rc2==0', {
      'sources': [
        'deprecated/alg2268.c',
      ],
    }],
    [ 'fuzz==1', {
      'sources!': [ 'drbg.c' ],
      'sources': [ 'det_rng.c' ],
    }],
    [ 'fuzz_tls==1', {
      'defines': [
        'UNSAFE_FUZZER_MODE',
      ],
    }],
    [ 'ct_verif==1', {
      'defines': [
        'CT_VERIF',
      ],
    }],
    [ 'only_dev_random==1', {
      'defines': [
        'SEED_ONLY_DEV_URANDOM',
      ]
    }],
    [ 'OS=="mac"', {
      'conditions': [
        [ 'target_arch=="ia32"', {
          'sources': [
            'mpi/mpi_sse2.s',
          ],
          'defines': [
            'MP_USE_UINT_DIGIT',
            'MP_ASSEMBLY_MULTIPLY',
            'MP_ASSEMBLY_SQUARE',
            'MP_ASSEMBLY_DIV_2DX1D',
          ],
        }, 'target_arch=="x64"', {
          'sources': [
            'mpi/mpi_amd64.c',
            'mpi/mpi_amd64_common.S',
            'mpi/mp_comba.c',
          ],
          'defines': [
            'MP_IS_LITTLE_ENDIAN',
            'MPI_AMD64',
            'MP_ASSEMBLY_MULTIPLY',
            'NSS_USE_COMBA',
          ],
        }],
      ],
    }],
  ],
 'ldflags': [
   '-Wl,-Bsymbolic'
 ],
}