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