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