Don't consider a Bluetooth adapter present until it has an address.
[chromium-blink-merge.git] / crypto / crypto.gyp
blobc9313080648a7000e1cb32ae353cfe2acb0df1e2
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               ['exclude', '_nss\.cc$'],
54               ['include', 'ec_private_key_nss\.cc$'],
55               ['include', 'ec_signature_creator_nss\.cc$'],
56               ['include', 'encryptor_nss\.cc$'],
57               ['include', 'hmac_nss\.cc$'],
58               ['include', 'signature_verifier_nss\.cc$'],
59               ['include', 'symmetric_key_nss\.cc$'],
60             ],
61             'sources!': [
62               'hmac_win.cc',
63               'openpgp_symmetric_encryption.cc',
64               'openpgp_symmetric_encryption.h',
65               'symmetric_key_win.cc',
66             ],
67         }],
68         [ 'OS != "mac" and OS != "ios"', {
69           'sources!': [
70             'apple_keychain.h',
71             'mock_apple_keychain.cc',
72             'mock_apple_keychain.h',
73           ],
74         }],
75         [ 'OS == "android"', {
76             'dependencies': [
77               '../third_party/openssl/openssl.gyp:openssl',
78             ],
79             'sources/': [
80               ['exclude', 'ec_private_key_nss\.cc$'],
81               ['exclude', 'ec_signature_creator_nss\.cc$'],
82               ['exclude', 'encryptor_nss\.cc$'],
83               ['exclude', 'hmac_nss\.cc$'],
84               ['exclude', 'signature_verifier_nss\.cc$'],
85               ['exclude', 'symmetric_key_nss\.cc$'],
86             ],
87         }],
88         [ 'os_bsd==1', {
89           'link_settings': {
90             'libraries': [
91               '-L/usr/local/lib -lexecinfo',
92               ],
93             },
94           },
95         ],
96         [ 'OS == "ios"', {
97           'sources!': [
98             # This class is stubbed out on iOS.
99             'rsa_private_key.cc',
100           ],
101         }],
102         [ 'OS == "mac"', {
103           'link_settings': {
104             'libraries': [
105               '$(SDKROOT)/System/Library/Frameworks/Security.framework',
106             ],
107           },
108         }, {  # OS != "mac"
109           'sources!': [
110             'cssm_init.cc',
111             'cssm_init.h',
112             'mac_security_services_lock.cc',
113             'mac_security_services_lock.h',
114           ],
115         }],
116         [ 'OS == "mac" or OS == "ios" or OS == "win"', {
117           'dependencies': [
118             '../third_party/nss/nss.gyp:nspr',
119             '../third_party/nss/nss.gyp:nss',
120           ],
121           'export_dependent_settings': [
122             '../third_party/nss/nss.gyp:nspr',
123             '../third_party/nss/nss.gyp:nss',
124           ],
125         }],
126         [ 'OS != "win"', {
127           'sources!': [
128             'capi_util.h',
129             'capi_util.cc',
130           ],
131         }],
132         [ 'use_openssl==1', {
133             # TODO(joth): Use a glob to match exclude patterns once the
134             #             OpenSSL file set is complete.
135             'sources!': [
136               'ec_private_key_nss.cc',
137               'ec_signature_creator_nss.cc',
138               'encryptor_nss.cc',
139               'hmac_nss.cc',
140               'nss_util.cc',
141               'nss_util.h',
142               'openpgp_symmetric_encryption.cc',
143               'rsa_private_key_nss.cc',
144               'secure_hash_default.cc',
145               'signature_creator_nss.cc',
146               'signature_verifier_nss.cc',
147               'symmetric_key_nss.cc',
148               'third_party/nss/chromium-blapi.h',
149               'third_party/nss/chromium-blapit.h',
150               'third_party/nss/chromium-nss.h',
151               'third_party/nss/chromium-sha256.h',
152               'third_party/nss/pk11akey.cc',
153               'third_party/nss/secsign.cc',
154               'third_party/nss/sha512.cc',
155             ],
156           }, {
157             'sources!': [
158               'ec_private_key_openssl.cc',
159               'ec_signature_creator_openssl.cc',
160               'encryptor_openssl.cc',
161               'hmac_openssl.cc',
162               'openssl_util.cc',
163               'openssl_util.h',
164               'rsa_private_key_openssl.cc',
165               'secure_hash_openssl.cc',
166               'signature_creator_openssl.cc',
167               'signature_verifier_openssl.cc',
168               'symmetric_key_openssl.cc',
169             ],
170         },],
171       ],
172       'sources': [
173         # NOTE: all transitive dependencies of HMAC on windows need
174         #     to be placed in the source list above.
175         '<@(hmac_win64_related_sources)',
176         'apple_keychain.h',
177         'apple_keychain_ios.mm',
178         'apple_keychain_mac.mm',
179         'capi_util.cc',
180         'capi_util.h',
181         'crypto_export.h',
182         'crypto_module_blocking_password_delegate.h',
183         'cssm_init.cc',
184         'cssm_init.h',
185         'ec_private_key.h',
186         'ec_private_key_nss.cc',
187         'ec_private_key_openssl.cc',
188         'ec_signature_creator.cc',
189         'ec_signature_creator.h',
190         'ec_signature_creator_impl.h',
191         'ec_signature_creator_nss.cc',
192         'ec_signature_creator_openssl.cc',
193         'encryptor.cc',
194         'encryptor.h',
195         'encryptor_nss.cc',
196         'encryptor_openssl.cc',
197         'hmac_nss.cc',
198         'hmac_openssl.cc',
199         'mac_security_services_lock.cc',
200         'mac_security_services_lock.h',
201         'mock_apple_keychain.cc',
202         'mock_apple_keychain.h',
203         'mock_apple_keychain_ios.cc',
204         'mock_apple_keychain_mac.cc',
205         'p224_spake.cc',
206         'p224_spake.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_ios.cc',
221         'rsa_private_key_mac.cc',
222         'rsa_private_key_nss.cc',
223         'rsa_private_key_openssl.cc',
224         'rsa_private_key_win.cc',
225         'scoped_capi_types.h',
226         'scoped_nss_types.h',
227         'secure_hash.h',
228         'secure_hash_default.cc',
229         'secure_hash_openssl.cc',
230         'sha2.cc',
231         'sha2.h',
232         'signature_creator.h',
233         'signature_creator_mac.cc',
234         'signature_creator_nss.cc',
235         'signature_creator_openssl.cc',
236         'signature_creator_win.cc',
237         'signature_verifier.h',
238         'signature_verifier_nss.cc',
239         'signature_verifier_openssl.cc',
240         'symmetric_key_nss.cc',
241         'symmetric_key_openssl.cc',
242         'third_party/nss/chromium-blapi.h',
243         'third_party/nss/chromium-blapit.h',
244         'third_party/nss/chromium-nss.h',
245         'third_party/nss/pk11akey.cc',
246         'third_party/nss/secsign.cc',
247       ],
248     },
249     {
250       'target_name': 'crypto_unittests',
251       'type': 'executable',
252       'sources': [
253         # Infrastructure files.
254         'run_all_unittests.cc',
256         # Tests.
257         'ec_private_key_unittest.cc',
258         'ec_signature_creator_unittest.cc',
259         'encryptor_unittest.cc',
260         'hmac_unittest.cc',
261         'nss_util_unittest.cc',
262         'p224_unittest.cc',
263         'p224_spake_unittest.cc',
264         'random_unittest.cc',
265         'rsa_private_key_unittest.cc',
266         'rsa_private_key_nss_unittest.cc',
267         'secure_hash_unittest.cc',
268         'sha2_unittest.cc',
269         'signature_creator_unittest.cc',
270         'signature_verifier_unittest.cc',
271         'symmetric_key_unittest.cc',
272         'openpgp_symmetric_encryption_unittest.cc',
273       ],
274       'dependencies': [
275         'crypto',
276         '../base/base.gyp:base',
277         '../base/base.gyp:test_support_base',
278         '../testing/gmock.gyp:gmock',
279         '../testing/gtest.gyp:gtest',
280       ],
281       'conditions': [
282         [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
283           'conditions': [
284             [ 'linux_use_tcmalloc==1', {
285                 'dependencies': [
286                   '../base/allocator/allocator.gyp:allocator',
287                 ],
288               },
289             ],
290           ],
291           'dependencies': [
292             '../build/linux/system.gyp:ssl',
293           ],
294         }, {  # os_posix != 1 or OS == "mac" or OS == "android" or OS == "ios"
295           'sources!': [
296             'rsa_private_key_nss_unittest.cc',
297             'openpgp_symmetric_encryption_unittest.cc',
298           ]
299         }],
300         [ 'OS == "mac" or OS == "ios" or OS == "win"', {
301           'dependencies': [
302             '../third_party/nss/nss.gyp:nss',
303           ],
304         }],
305         ['OS == "ios"', {
306           'sources!': [
307             # These tests are excluded because they test classes that are not
308             # implemented on iOS.
309             'rsa_private_key_unittest.cc',
310             'signature_creator_unittest.cc',
311             'signature_verifier_unittest.cc',
312           ],
313         }],
314         [ 'OS == "mac"', {
315           'dependencies': [
316             '../third_party/nss/nss.gyp:nspr',
317           ],
318         }],
319         [ 'use_openssl==1', {
320           'sources!': [
321             'nss_util_unittest.cc',
322             'openpgp_symmetric_encryption_unittest.cc',
323             'rsa_private_key_nss_unittest.cc',
324           ],
325         }],
326       ],
327     },
328   ],
329   'conditions': [
330     [ 'OS == "win"', {
331       'targets': [
332         {
333           'target_name': 'crypto_nacl_win64',
334           # We do not want nacl_helper to depend on NSS because this would
335           # require including a 64-bit copy of NSS. Thus, use the native APIs
336           # for the helper.
337           'type': '<(component)',
338           'dependencies': [
339             '../base/base.gyp:base_nacl_win64',
340             '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
341           ],
342           'sources': [
343             '<@(hmac_win64_related_sources)',
344           ],
345           'defines': [
346            'CRYPTO_IMPLEMENTATION',
347            '<@(nacl_win64_defines)',
348           ],
349           'msvs_disabled_warnings': [
350             4018,
351           ],
352           'configurations': {
353             'Common_Base': {
354               'msvs_target_platform': 'x64',
355             },
356           },
357         },
358       ],
359     }],
360   ],