- add sources.
[platform/framework/web/crosswalk.git] / src / crypto / crypto.gyp
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.
4
5 {
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         }],
79         [ 'os_bsd==1', {
80           'link_settings': {
81             'libraries': [
82               '-L/usr/local/lib -lexecinfo',
83               ],
84             },
85           },
86         ],
87         [ 'OS == "mac"', {
88           'link_settings': {
89             'libraries': [
90               '$(SDKROOT)/System/Library/Frameworks/Security.framework',
91             ],
92           },
93         }, {  # OS != "mac"
94           'sources!': [
95             'cssm_init.cc',
96             'cssm_init.h',
97             'mac_security_services_lock.cc',
98             'mac_security_services_lock.h',
99           ],
100         }],
101         [ 'OS == "mac" or OS == "ios" or OS == "win"', {
102           'dependencies': [
103             '../third_party/nss/nss.gyp:nspr',
104             '../third_party/nss/nss.gyp:nss',
105           ],
106           'export_dependent_settings': [
107             '../third_party/nss/nss.gyp:nspr',
108             '../third_party/nss/nss.gyp:nss',
109           ],
110         }],
111         [ 'OS != "win"', {
112           'sources!': [
113             'capi_util.h',
114             'capi_util.cc',
115           ],
116         }],
117         [ 'OS == "win"', {
118           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
119           'msvs_disabled_warnings': [4267, ],
120         }],
121         [ 'use_openssl==1', {
122             # TODO(joth): Use a glob to match exclude patterns once the
123             #             OpenSSL file set is complete.
124             'sources!': [
125               'ec_private_key_nss.cc',
126               'ec_signature_creator_nss.cc',
127               'encryptor_nss.cc',
128               'hmac_nss.cc',
129               'nss_util.cc',
130               'nss_util.h',
131               'openpgp_symmetric_encryption.cc',
132               'rsa_private_key_nss.cc',
133               'secure_hash_default.cc',
134               'signature_creator_nss.cc',
135               'signature_verifier_nss.cc',
136               'symmetric_key_nss.cc',
137               'third_party/nss/chromium-blapi.h',
138               'third_party/nss/chromium-blapit.h',
139               'third_party/nss/chromium-nss.h',
140               'third_party/nss/chromium-sha256.h',
141               'third_party/nss/pk11akey.cc',
142               'third_party/nss/rsawrapr.c',
143               'third_party/nss/secsign.cc',
144               'third_party/nss/sha512.cc',
145             ],
146           }, {
147             'sources!': [
148               'ec_private_key_openssl.cc',
149               'ec_signature_creator_openssl.cc',
150               'encryptor_openssl.cc',
151               'hmac_openssl.cc',
152               'openssl_util.cc',
153               'openssl_util.h',
154               'rsa_private_key_openssl.cc',
155               'secure_hash_openssl.cc',
156               'signature_creator_openssl.cc',
157               'signature_verifier_openssl.cc',
158               'symmetric_key_openssl.cc',
159             ],
160         },],
161       ],
162       'sources': [
163         # NOTE: all transitive dependencies of HMAC on windows need
164         #     to be placed in the source list above.
165         '<@(hmac_win64_related_sources)',
166         'apple_keychain.h',
167         'apple_keychain_ios.mm',
168         'apple_keychain_mac.mm',
169         'capi_util.cc',
170         'capi_util.h',
171         'crypto_export.h',
172         'crypto_module_blocking_password_delegate.h',
173         'cssm_init.cc',
174         'cssm_init.h',
175         'curve25519.cc',
176         'curve25519.h',
177         'curve25519-donna.c',
178         'ghash.cc',
179         'ghash.h',
180         'ec_private_key.h',
181         'ec_private_key_nss.cc',
182         'ec_private_key_openssl.cc',
183         'ec_signature_creator.cc',
184         'ec_signature_creator.h',
185         'ec_signature_creator_impl.h',
186         'ec_signature_creator_nss.cc',
187         'ec_signature_creator_openssl.cc',
188         'encryptor.cc',
189         'encryptor.h',
190         'encryptor_nss.cc',
191         'encryptor_openssl.cc',
192         'hkdf.cc',
193         'hkdf.h',
194         'hmac_nss.cc',
195         'hmac_openssl.cc',
196         'mac_security_services_lock.cc',
197         'mac_security_services_lock.h',
198         'mock_apple_keychain.cc',
199         'mock_apple_keychain.h',
200         'mock_apple_keychain_ios.cc',
201         'mock_apple_keychain_mac.cc',
202         'p224_spake.cc',
203         'p224_spake.h',
204         'nss_util.cc',
205         'nss_util.h',
206         'nss_util_internal.h',
207         'openpgp_symmetric_encryption.cc',
208         'openpgp_symmetric_encryption.h',
209         'openssl_util.cc',
210         'openssl_util.h',
211         'p224.cc',
212         'p224.h',
213         'random.h',
214         'random.cc',
215         'rsa_private_key.cc',
216         'rsa_private_key.h',
217         'rsa_private_key_nss.cc',
218         'rsa_private_key_openssl.cc',
219         'scoped_capi_types.h',
220         'scoped_nss_types.h',
221         'secure_hash.h',
222         'secure_hash_default.cc',
223         'secure_hash_openssl.cc',
224         'sha2.cc',
225         'sha2.h',
226         'signature_creator.h',
227         'signature_creator_nss.cc',
228         'signature_creator_openssl.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/rsawrapr.c',
239         'third_party/nss/secsign.cc',
240       ],
241     },
242     {
243       'target_name': 'crypto_unittests',
244       'type': 'executable',
245       'sources': [
246         'curve25519_unittest.cc',
247         'ec_private_key_unittest.cc',
248         'ec_signature_creator_unittest.cc',
249         'encryptor_unittest.cc',
250         'ghash_unittest.cc',
251         'hkdf_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:run_all_unittests',
270         '../base/base.gyp:test_support_base',
271         '../testing/gmock.gyp:gmock',
272         '../testing/gtest.gyp:gtest',
273       ],
274       'conditions': [
275         [ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
276           'conditions': [
277             [ 'linux_use_tcmalloc==1', {
278                 'dependencies': [
279                   '../base/allocator/allocator.gyp:allocator',
280                 ],
281               },
282             ],
283           ],
284           'dependencies': [
285             '../build/linux/system.gyp:ssl',
286           ],
287         }, {  # os_posix != 1 or OS == "mac" or OS == "android" or OS == "ios"
288           'sources!': [
289             'rsa_private_key_nss_unittest.cc',
290             'openpgp_symmetric_encryption_unittest.cc',
291           ]
292         }],
293         [ 'OS == "mac" or OS == "ios" or OS == "win"', {
294           'dependencies': [
295             '../third_party/nss/nss.gyp:nss',
296           ],
297         }],
298         [ 'OS == "mac"', {
299           'dependencies': [
300             '../third_party/nss/nss.gyp:nspr',
301           ],
302         }],
303         [ 'OS == "win"', {
304           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
305           'msvs_disabled_warnings': [4267, ],
306         }],
307         [ 'use_openssl==1', {
308           'sources!': [
309             'nss_util_unittest.cc',
310             'openpgp_symmetric_encryption_unittest.cc',
311             'rsa_private_key_nss_unittest.cc',
312           ],
313         }],
314       ],
315     },
316   ],
317   'conditions': [
318     ['OS == "win" and target_arch=="ia32"', {
319       'targets': [
320         {
321           'target_name': 'crypto_nacl_win64',
322           # We do not want nacl_helper to depend on NSS because this would
323           # require including a 64-bit copy of NSS. Thus, use the native APIs
324           # for the helper.
325           'type': '<(component)',
326           'dependencies': [
327             '../base/base.gyp:base_nacl_win64',
328             '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
329           ],
330           'sources': [
331             '<@(hmac_win64_related_sources)',
332           ],
333           'defines': [
334            'CRYPTO_IMPLEMENTATION',
335            '<@(nacl_win64_defines)',
336           ],
337           'msvs_disabled_warnings': [
338             4018,
339           ],
340           'configurations': {
341             'Common_Base': {
342               'msvs_target_platform': 'x64',
343             },
344           },
345         },
346       ],
347     }],
348   ],
349 }