Change mojo demo apps to use Application.
[chromium-blink-merge.git] / crypto / crypto.gyp
blob1f22aa9eb94421d8ba5063b8046266660a124103
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
6   'variables': {
7     'chromium_code': 1,
8     # Put all transitive dependencies for Windows HMAC here.
9     # This is required so that we can build them for nacl win64.
10     'hmac_win64_related_sources': [
11       'hmac.cc',
12       'hmac.h',
13       'hmac_win.cc',
14       'secure_util.cc',
15       'secure_util.h',
16       'symmetric_key.h',
17       'symmetric_key_win.cc',
18       'third_party/nss/chromium-sha256.h',
19       'third_party/nss/sha512.cc',
20     ],
21   },
22   'targets': [
23     {
24       'target_name': 'crypto',
25       'type': '<(component)',
26       'product_name': 'crcrypto',  # Avoid colliding with OpenSSL's libcrypto
27       'dependencies': [
28         '../base/base.gyp:base',
29         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
30       ],
31       'defines': [
32         'CRYPTO_IMPLEMENTATION',
33       ],
34       'msvs_disabled_warnings': [
35         4018,
36       ],
37       'conditions': [
38         [ 'os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
39           'dependencies': [
40             '../build/linux/system.gyp:ssl',
41           ],
42           'export_dependent_settings': [
43             '../build/linux/system.gyp:ssl',
44           ],
45           'conditions': [
46             [ 'chromeos==1', {
47                 'sources/': [ ['include', '_chromeos\\.cc$'] ]
48               },
49             ],
50           ],
51         }, {  # os_posix != 1 or OS == "mac" or OS == "ios" or OS == "android"
52             'sources!': [
53               'hmac_win.cc',
54               'openpgp_symmetric_encryption.cc',
55               'openpgp_symmetric_encryption.h',
56               'symmetric_key_win.cc',
57             ],
58         }],
59         [ 'OS != "mac" and OS != "ios"', {
60           'sources!': [
61             'apple_keychain.h',
62             'mock_apple_keychain.cc',
63             'mock_apple_keychain.h',
64           ],
65         }],
66         [ 'OS == "android"', {
67             'dependencies': [
68               '../third_party/openssl/openssl.gyp:openssl',
69             ],
70             'sources/': [
71               ['exclude', 'ec_private_key_nss\.cc$'],
72               ['exclude', 'ec_signature_creator_nss\.cc$'],
73               ['exclude', 'encryptor_nss\.cc$'],
74               ['exclude', 'hmac_nss\.cc$'],
75               ['exclude', 'signature_verifier_nss\.cc$'],
76               ['exclude', 'symmetric_key_nss\.cc$'],
77             ],
78             'includes': [
79               '../build/android/cpufeatures.gypi',
80             ],
81         }],
82         [ 'os_bsd==1', {
83           'link_settings': {
84             'libraries': [
85               '-L/usr/local/lib -lexecinfo',
86               ],
87             },
88           },
89         ],
90         [ 'OS == "mac"', {
91           'link_settings': {
92             'libraries': [
93               '$(SDKROOT)/System/Library/Frameworks/Security.framework',
94             ],
95           },
96         }, {  # OS != "mac"
97           'sources!': [
98             'cssm_init.cc',
99             'cssm_init.h',
100             'mac_security_services_lock.cc',
101             'mac_security_services_lock.h',
102           ],
103         }],
104         [ 'OS == "mac" or OS == "ios" or OS == "win"', {
105           'dependencies': [
106             '../third_party/nss/nss.gyp:nspr',
107             '../third_party/nss/nss.gyp:nss',
108           ],
109           'export_dependent_settings': [
110             '../third_party/nss/nss.gyp:nspr',
111             '../third_party/nss/nss.gyp:nss',
112           ],
113         }],
114         [ 'OS != "win"', {
115           'sources!': [
116             'capi_util.h',
117             'capi_util.cc',
118           ],
119         }],
120         [ 'OS == "win"', {
121           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
122           'msvs_disabled_warnings': [4267, ],
123         }],
124         [ 'use_openssl==1', {
125             # TODO(joth): Use a glob to match exclude patterns once the
126             #             OpenSSL file set is complete.
127             'sources!': [
128               'ec_private_key_nss.cc',
129               'ec_signature_creator_nss.cc',
130               'encryptor_nss.cc',
131               'hmac_nss.cc',
132               'nss_util.cc',
133               'nss_util.h',
134               'openpgp_symmetric_encryption.cc',
135               'rsa_private_key_nss.cc',
136               'secure_hash_default.cc',
137               'signature_creator_nss.cc',
138               'signature_verifier_nss.cc',
139               'symmetric_key_nss.cc',
140               'third_party/nss/chromium-blapi.h',
141               'third_party/nss/chromium-blapit.h',
142               'third_party/nss/chromium-nss.h',
143               'third_party/nss/chromium-sha256.h',
144               'third_party/nss/pk11akey.cc',
145               'third_party/nss/rsawrapr.c',
146               'third_party/nss/secsign.cc',
147               'third_party/nss/sha512.cc',
148             ],
149           }, {
150             'sources!': [
151               'ec_private_key_openssl.cc',
152               'ec_signature_creator_openssl.cc',
153               'encryptor_openssl.cc',
154               'hmac_openssl.cc',
155               'openssl_util.cc',
156               'openssl_util.h',
157               'rsa_private_key_openssl.cc',
158               'secure_hash_openssl.cc',
159               'signature_creator_openssl.cc',
160               'signature_verifier_openssl.cc',
161               'symmetric_key_openssl.cc',
162             ],
163         },],
164       ],
165       'sources': [
166         # NOTE: all transitive dependencies of HMAC on windows need
167         #     to be placed in the source list above.
168         '<@(hmac_win64_related_sources)',
169         'apple_keychain.h',
170         'apple_keychain_ios.mm',
171         'apple_keychain_mac.mm',
172         'capi_util.cc',
173         'capi_util.h',
174         'crypto_export.h',
175         'cssm_init.cc',
176         'cssm_init.h',
177         'curve25519.cc',
178         'curve25519.h',
179         'curve25519-donna.c',
180         'ghash.cc',
181         'ghash.h',
182         'ec_private_key.h',
183         'ec_private_key_nss.cc',
184         'ec_private_key_openssl.cc',
185         'ec_signature_creator.cc',
186         'ec_signature_creator.h',
187         'ec_signature_creator_impl.h',
188         'ec_signature_creator_nss.cc',
189         'ec_signature_creator_openssl.cc',
190         'encryptor.cc',
191         'encryptor.h',
192         'encryptor_nss.cc',
193         'encryptor_openssl.cc',
194         'hkdf.cc',
195         'hkdf.h',
196         'hmac_nss.cc',
197         'hmac_openssl.cc',
198         'mac_security_services_lock.cc',
199         'mac_security_services_lock.h',
200         'mock_apple_keychain.cc',
201         'mock_apple_keychain.h',
202         'mock_apple_keychain_ios.cc',
203         'mock_apple_keychain_mac.cc',
204         'p224_spake.cc',
205         'p224_spake.h',
206         'nss_crypto_module_delegate.h',
207         'nss_util.cc',
208         'nss_util.h',
209         'nss_util_internal.h',
210         'openpgp_symmetric_encryption.cc',
211         'openpgp_symmetric_encryption.h',
212         'openssl_util.cc',
213         'openssl_util.h',
214         'p224.cc',
215         'p224.h',
216         'random.h',
217         'random.cc',
218         'rsa_private_key.cc',
219         'rsa_private_key.h',
220         'rsa_private_key_nss.cc',
221         'rsa_private_key_openssl.cc',
222         'scoped_capi_types.h',
223         'scoped_nss_types.h',
224         'secure_hash.h',
225         'secure_hash_default.cc',
226         'secure_hash_openssl.cc',
227         'sha2.cc',
228         'sha2.h',
229         'signature_creator.h',
230         'signature_creator_nss.cc',
231         'signature_creator_openssl.cc',
232         'signature_verifier.h',
233         'signature_verifier_nss.cc',
234         'signature_verifier_openssl.cc',
235         'symmetric_key_nss.cc',
236         'symmetric_key_openssl.cc',
237         'third_party/nss/chromium-blapi.h',
238         'third_party/nss/chromium-blapit.h',
239         'third_party/nss/chromium-nss.h',
240         'third_party/nss/pk11akey.cc',
241         'third_party/nss/rsawrapr.c',
242         'third_party/nss/secsign.cc',
243       ],
244     },
245     {
246       'target_name': 'crypto_unittests',
247       'type': 'executable',
248       'sources': [
249         'curve25519_unittest.cc',
250         'ec_private_key_unittest.cc',
251         'ec_signature_creator_unittest.cc',
252         'encryptor_unittest.cc',
253         'ghash_unittest.cc',
254         'hkdf_unittest.cc',
255         'hmac_unittest.cc',
256         'nss_util_unittest.cc',
257         'p224_unittest.cc',
258         'p224_spake_unittest.cc',
259         'random_unittest.cc',
260         'rsa_private_key_unittest.cc',
261         'rsa_private_key_nss_unittest.cc',
262         'secure_hash_unittest.cc',
263         'sha2_unittest.cc',
264         'signature_creator_unittest.cc',
265         'signature_verifier_unittest.cc',
266         'symmetric_key_unittest.cc',
267         'openpgp_symmetric_encryption_unittest.cc',
268       ],
269       'dependencies': [
270         'crypto',
271         '../base/base.gyp:base',
272         '../base/base.gyp:run_all_unittests',
273         '../base/base.gyp:test_support_base',
274         '../testing/gmock.gyp:gmock',
275         '../testing/gtest.gyp:gtest',
276       ],
277       'conditions': [
278         [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
279           'conditions': [
280             [ 'linux_use_tcmalloc==1', {
281                 'dependencies': [
282                   '../base/allocator/allocator.gyp:allocator',
283                 ],
284               },
285             ],
286           ],
287           'dependencies': [
288             '../build/linux/system.gyp:ssl',
289           ],
290         }, {  # os_posix != 1 or OS == "mac" or OS == "android" or OS == "ios"
291           'sources!': [
292             'rsa_private_key_nss_unittest.cc',
293             'openpgp_symmetric_encryption_unittest.cc',
294           ]
295         }],
296         [ 'OS == "mac" or OS == "ios" or OS == "win"', {
297           'dependencies': [
298             '../third_party/nss/nss.gyp:nss',
299           ],
300         }],
301         [ 'OS == "mac"', {
302           'dependencies': [
303             '../third_party/nss/nss.gyp:nspr',
304           ],
305         }],
306         [ 'OS == "win"', {
307           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
308           'msvs_disabled_warnings': [4267, ],
309         }],
310         [ 'use_openssl==1', {
311           'sources!': [
312             'nss_util_unittest.cc',
313             'openpgp_symmetric_encryption_unittest.cc',
314             'rsa_private_key_nss_unittest.cc',
315           ],
316         }],
317       ],
318     },
319   ],
320   'conditions': [
321     ['OS == "win" and target_arch=="ia32"', {
322       'targets': [
323         {
324           'target_name': 'crypto_nacl_win64',
325           # We do not want nacl_helper to depend on NSS because this would
326           # require including a 64-bit copy of NSS. Thus, use the native APIs
327           # for the helper.
328           'type': '<(component)',
329           'dependencies': [
330             '../base/base.gyp:base_win64',
331             '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
332           ],
333           'sources': [
334             '<@(hmac_win64_related_sources)',
335           ],
336           'defines': [
337            'CRYPTO_IMPLEMENTATION',
338            '<@(nacl_win64_defines)',
339           ],
340           'msvs_disabled_warnings': [
341             4018,
342           ],
343           'configurations': {
344             'Common_Base': {
345               'msvs_target_platform': 'x64',
346             },
347           },
348         },
349       ],
350     }],
351   ],