Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / crypto / crypto.gyp
bloba9cff553e022c9288b8e723884bc07b376d89399
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   },
9   'includes': [
10     'crypto.gypi',
11   ],
12   'targets': [
13     {
14       'target_name': 'crypto',
15       'type': '<(component)',
16       'product_name': 'crcrypto',  # Avoid colliding with OpenSSL's libcrypto
17       'dependencies': [
18         '../base/base.gyp:base',
19         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
20       ],
21       'defines': [
22         'CRYPTO_IMPLEMENTATION',
23       ],
24       'conditions': [
25         [ 'os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
26           'dependencies': [
27             '../build/linux/system.gyp:ssl',
28           ],
29           'export_dependent_settings': [
30             '../build/linux/system.gyp:ssl',
31           ],
32           'conditions': [
33             [ 'chromeos==1', {
34                 'sources/': [ ['include', '_chromeos\\.cc$'] ]
35               },
36             ],
37           ],
38         }, {  # os_posix != 1 or OS == "mac" or OS == "ios" or OS == "android"
39             'sources!': [
40               'hmac_win.cc',
41               'symmetric_key_win.cc',
42             ],
43         }],
44         [ 'OS != "mac" and OS != "ios"', {
45           'sources!': [
46             'apple_keychain.h',
47             'mock_apple_keychain.cc',
48             'mock_apple_keychain.h',
49           ],
50         }],
51         [ 'OS == "android"', {
52           'dependencies': [
53             '../build/android/ndk.gyp:cpu_features',
54           ],
55         }],
56         [ 'os_bsd==1', {
57           'link_settings': {
58             'libraries': [
59               '-L/usr/local/lib -lexecinfo',
60               ],
61             },
62           },
63         ],
64         [ 'OS == "mac"', {
65           'link_settings': {
66             'libraries': [
67               '$(SDKROOT)/System/Library/Frameworks/Security.framework',
68             ],
69           },
70         }, {  # OS != "mac"
71           'sources!': [
72             'cssm_init.cc',
73             'cssm_init.h',
74             'mac_security_services_lock.cc',
75             'mac_security_services_lock.h',
76           ],
77         }],
78         [ 'use_openssl == 0 and (OS == "mac" or OS == "ios" or OS == "win")', {
79           'dependencies': [
80             '../third_party/nss/nss.gyp:nspr',
81             '../third_party/nss/nss.gyp:nss',
82           ],
83           'export_dependent_settings': [
84             '../third_party/nss/nss.gyp:nspr',
85             '../third_party/nss/nss.gyp:nss',
86           ],
87         }],
88         [ 'OS != "win"', {
89           'sources!': [
90             'capi_util.h',
91             'capi_util.cc',
92           ],
93         }],
94         [ 'OS == "win"', {
95           'msvs_disabled_warnings': [
96             4267,  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
97             4018,
98           ],
99         }],
100         [ 'use_openssl==1', {
101             'dependencies': [
102               '../third_party/boringssl/boringssl.gyp:boringssl',
103             ],
104             # TODO(joth): Use a glob to match exclude patterns once the
105             #             OpenSSL file set is complete.
106             'sources!': [
107               'ec_private_key_nss.cc',
108               'ec_signature_creator_nss.cc',
109               'encryptor_nss.cc',
110               'hmac_nss.cc',
111               'rsa_private_key_nss.cc',
112               'secure_hash_default.cc',
113               'signature_creator_nss.cc',
114               'signature_verifier_nss.cc',
115               'symmetric_key_nss.cc',
116               'third_party/nss/chromium-blapi.h',
117               'third_party/nss/chromium-blapit.h',
118               'third_party/nss/chromium-nss.h',
119               'third_party/nss/chromium-prtypes.h',
120               'third_party/nss/chromium-sha256.h',
121               'third_party/nss/pk11akey.cc',
122               'third_party/nss/rsawrapr.c',
123               'third_party/nss/secsign.cc',
124               'third_party/nss/sha512.cc',
125             ],
126           }, {
127             'sources!': [
128               'ec_private_key_openssl.cc',
129               'ec_signature_creator_openssl.cc',
130               'encryptor_openssl.cc',
131               'hmac_openssl.cc',
132               'openssl_bio_string.cc',
133               'openssl_bio_string.h',
134               'openssl_util.cc',
135               'openssl_util.h',
136               'rsa_private_key_openssl.cc',
137               'secure_hash_openssl.cc',
138               'signature_creator_openssl.cc',
139               'signature_verifier_openssl.cc',
140               'symmetric_key_openssl.cc',
141             ],
142         },],
143         [ 'use_openssl==1 and use_nss_certs==0', {
144             # NSS is used for neither the internal crypto library nor the
145             # platform certificate library.
146             'sources!': [
147               'nss_util.cc',
148               'nss_util.h',
149               'nss_util_internal.h',
150             ],
151         },],
152       ],
153       'sources': [
154         '<@(crypto_sources)',
155       ],
156     },
157     {
158       'target_name': 'crypto_unittests',
159       'type': 'executable',
160       'sources': [
161         'curve25519_unittest.cc',
162         'ec_private_key_unittest.cc',
163         'ec_signature_creator_unittest.cc',
164         'encryptor_unittest.cc',
165         'ghash_unittest.cc',
166         'hkdf_unittest.cc',
167         'hmac_unittest.cc',
168         'nss_util_unittest.cc',
169         'openssl_bio_string_unittest.cc',
170         'p224_unittest.cc',
171         'p224_spake_unittest.cc',
172         'random_unittest.cc',
173         'rsa_private_key_unittest.cc',
174         'rsa_private_key_nss_unittest.cc',
175         'secure_hash_unittest.cc',
176         'sha2_unittest.cc',
177         'signature_creator_unittest.cc',
178         'signature_verifier_unittest.cc',
179         'symmetric_key_unittest.cc',
180       ],
181       'dependencies': [
182         'crypto',
183         'crypto_test_support',
184         '../base/base.gyp:base',
185         '../base/base.gyp:run_all_unittests',
186         '../base/base.gyp:test_support_base',
187         '../testing/gmock.gyp:gmock',
188         '../testing/gtest.gyp:gtest',
189       ],
190       'conditions': [
191         [ 'use_nss_certs == 1', {
192           'conditions': [
193             [ 'use_allocator!="none"', {
194                 'dependencies': [
195                   '../base/allocator/allocator.gyp:allocator',
196                 ],
197               },
198             ],
199           ],
200           'dependencies': [
201             '../build/linux/system.gyp:ssl',
202           ],
203         }],
204         [ 'use_openssl == 1 and use_nss_certs == 0', {
205           # nss_util is built if NSS is used for either the internal crypto
206           # library or the platform certificate library.
207           'sources!': [
208             'nss_util_unittest.cc',
209           ],
210         }],
211         [ 'use_openssl == 0 and (OS == "mac" or OS == "ios" or OS == "win")', {
212           'dependencies': [
213             '../third_party/nss/nss.gyp:nspr',
214           ],
215         }],
216         [ 'OS == "win"', {
217           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
218           'msvs_disabled_warnings': [4267, ],
219         }],
220         [ 'use_openssl==1', {
221           'dependencies': [
222             '../third_party/boringssl/boringssl.gyp:boringssl',
223           ],
224           'sources!': [
225             'rsa_private_key_nss_unittest.cc',
226           ],
227         }, {
228           'sources!': [
229             'openssl_bio_string_unittest.cc',
230           ],
231         }],
232       ],
233     },
234   ],
235   'conditions': [
236     ['OS == "win" and target_arch=="ia32"', {
237       'targets': [
238         {
239           'target_name': 'crypto_nacl_win64',
240           # We do not want nacl_helper to depend on NSS because this would
241           # require including a 64-bit copy of NSS. Thus, use the native APIs
242           # for the helper.
243           'type': '<(component)',
244           'dependencies': [
245             '../base/base.gyp:base_win64',
246             '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
247           ],
248           'sources': [
249             '<@(nacl_win64_sources)',
250           ],
251           'defines': [
252            'CRYPTO_IMPLEMENTATION',
253            '<@(nacl_win64_defines)',
254           ],
255           'msvs_disabled_warnings': [
256             4018,
257           ],
258           'configurations': {
259             'Common_Base': {
260               'msvs_target_platform': 'x64',
261             },
262           },
263         },
264       ],
265     }],
266     ['use_nss_certs==1', {
267       'targets': [
268         {
269           'target_name': 'crypto_test_support',
270           'type': 'static_library',
271           'dependencies': [
272             '../base/base.gyp:base',
273             'crypto',
274           ],
275           'sources': [
276             'scoped_test_nss_db.cc',
277             'scoped_test_nss_db.h',
278             'scoped_test_nss_chromeos_user.cc',
279             'scoped_test_nss_chromeos_user.h',
280             'scoped_test_system_nss_key_slot.cc',
281             'scoped_test_system_nss_key_slot.h',
282           ],
283           'conditions': [
284             ['use_nss_certs==0', {
285               'sources!': [
286                 'scoped_test_nss_db.cc',
287                 'scoped_test_nss_db.h',
288               ],
289             }],
290             [ 'chromeos==0', {
291               'sources!': [
292                 'scoped_test_nss_chromeos_user.cc',
293                 'scoped_test_nss_chromeos_user.h',
294                 'scoped_test_system_nss_key_slot.cc',
295                 'scoped_test_system_nss_key_slot.h',
296               ],
297             }],
298           ],
299         }
300       ]}, {  # use_nss_certs==0
301       'targets': [
302         {
303           'target_name': 'crypto_test_support',
304           'type': 'none',
305           'sources': [],
306         }
307     ]}],
308     ['test_isolation_mode != "noop"', {
309       'targets': [
310         {
311           'target_name': 'crypto_unittests_run',
312           'type': 'none',
313           'dependencies': [
314             'crypto_unittests',
315           ],
316           'includes': [
317             '../build/isolate.gypi',
318                       ],
319           'sources': [
320             'crypto_unittests.isolate',
321           ],
322         },
323       ],
324     }],
325   ],