OLD | NEW |
| (Empty) |
1 # Copyright (c) 2013 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 import("//build/config/crypto.gni") | |
6 | |
7 crypto_minimal_sources = [ | |
8 "hmac.cc", | |
9 "hmac.h", | |
10 "hmac_win.cc", | |
11 "secure_util.cc", | |
12 "secure_util.h", | |
13 "symmetric_key.h", | |
14 "symmetric_key_win.cc", | |
15 "third_party/nss/chromium-sha256.h", | |
16 "third_party/nss/sha512.cc", | |
17 ] | |
18 | |
19 component("crypto") { | |
20 output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto. | |
21 sources = [ | |
22 "apple_keychain.h", | |
23 "apple_keychain_ios.mm", | |
24 "apple_keychain_mac.mm", | |
25 "capi_util.cc", | |
26 "capi_util.h", | |
27 "crypto_export.h", | |
28 "crypto_module_blocking_password_delegate.h", | |
29 "cssm_init.cc", | |
30 "cssm_init.h", | |
31 "curve25519.cc", | |
32 "curve25519.h", | |
33 "curve25519-donna.c", | |
34 "ghash.cc", | |
35 "ghash.h", | |
36 "ec_private_key.h", | |
37 "ec_private_key_nss.cc", | |
38 "ec_private_key_openssl.cc", | |
39 "ec_signature_creator.cc", | |
40 "ec_signature_creator.h", | |
41 "ec_signature_creator_impl.h", | |
42 "ec_signature_creator_nss.cc", | |
43 "ec_signature_creator_openssl.cc", | |
44 "encryptor.cc", | |
45 "encryptor.h", | |
46 "encryptor_nss.cc", | |
47 "encryptor_openssl.cc", | |
48 "hkdf.cc", | |
49 "hkdf.h", | |
50 "hmac_nss.cc", | |
51 "hmac_openssl.cc", | |
52 "mac_security_services_lock.cc", | |
53 "mac_security_services_lock.h", | |
54 # TODO(brettw) these mocks should be moved to a test_support_crypto target | |
55 # if possible. | |
56 "mock_apple_keychain.cc", | |
57 "mock_apple_keychain.h", | |
58 "mock_apple_keychain_ios.cc", | |
59 "mock_apple_keychain_mac.cc", | |
60 "p224_spake.cc", | |
61 "p224_spake.h", | |
62 "nss_util.cc", | |
63 "nss_util.h", | |
64 "nss_util_internal.h", | |
65 "openpgp_symmetric_encryption.cc", | |
66 "openpgp_symmetric_encryption.h", | |
67 "openssl_util.cc", | |
68 "openssl_util.h", | |
69 "p224.cc", | |
70 "p224.h", | |
71 "random.h", | |
72 "random.cc", | |
73 "rsa_private_key.cc", | |
74 "rsa_private_key.h", | |
75 "rsa_private_key_nss.cc", | |
76 "rsa_private_key_openssl.cc", | |
77 "scoped_capi_types.h", | |
78 "scoped_nss_types.h", | |
79 "secure_hash.h", | |
80 "secure_hash_default.cc", | |
81 "secure_hash_openssl.cc", | |
82 "sha2.cc", | |
83 "sha2.h", | |
84 "signature_creator.h", | |
85 "signature_creator_nss.cc", | |
86 "signature_creator_openssl.cc", | |
87 "signature_verifier.h", | |
88 "signature_verifier_nss.cc", | |
89 "signature_verifier_openssl.cc", | |
90 "symmetric_key_nss.cc", | |
91 "symmetric_key_openssl.cc", | |
92 "third_party/nss/chromium-blapi.h", | |
93 "third_party/nss/chromium-blapit.h", | |
94 "third_party/nss/chromium-nss.h", | |
95 "third_party/nss/pk11akey.cc", | |
96 "third_party/nss/rsawrapr.c", | |
97 "third_party/nss/secsign.cc", | |
98 ] | |
99 | |
100 deps = [ | |
101 "//base", | |
102 "//base/third_party/dynamic_annotations", | |
103 "//crypto/ssl:metassl", | |
104 ] | |
105 forward_dependent_configs_from = [ "//crypto/ssl:metassl" ] | |
106 | |
107 if (!is_mac && !is_ios) { | |
108 sources -= [ | |
109 "apple_keychain.h", | |
110 "mock_apple_keychain.cc", | |
111 "mock_apple_keychain.h", | |
112 ] | |
113 } | |
114 | |
115 if (!is_linux) { | |
116 if (use_nss) { # Removed for non-NSS in all cases below. | |
117 sources -= [ | |
118 "openpgp_symmetric_encryption.cc", | |
119 "openpgp_symmetric_encryption.h", | |
120 ] | |
121 } | |
122 } | |
123 if (!is_mac) { | |
124 sources -= [ | |
125 "cssm_init.cc", | |
126 "cssm_init.h", | |
127 "mac_security_services_lock.cc", | |
128 "mac_security_services_lock.h", | |
129 ] | |
130 } | |
131 if (!is_win) { | |
132 sources -= [ | |
133 "capi_util.cc", | |
134 "capi_util.h", | |
135 ] | |
136 } | |
137 | |
138 if (use_nss) { | |
139 configs += [ "//third_party/nss:nss_linux_config" ] | |
140 } else { | |
141 sources -= [ | |
142 "ec_private_key_nss.cc", | |
143 "ec_signature_creator_nss.cc", | |
144 "encryptor_nss.cc", | |
145 "hmac_nss.cc", | |
146 "nss_util.cc", | |
147 "nss_util.h", | |
148 "rsa_private_key_nss.cc", | |
149 "secure_hash_default.cc", | |
150 "signature_creator_nss.cc", | |
151 "signature_verifier_nss.cc", | |
152 "symmetric_key_nss.cc", | |
153 "third_party/nss/chromium-blapi.h", | |
154 "third_party/nss/chromium-blapit.h", | |
155 "third_party/nss/chromium-nss.h", | |
156 "third_party/nss/pk11akey.cc", | |
157 "third_party/nss/rsawrapr.c", | |
158 "third_party/nss/secsign.cc", | |
159 ] | |
160 } | |
161 if (!use_openssl) { | |
162 sources -= [ | |
163 "ec_private_key_openssl.cc", | |
164 "ec_signature_creator_openssl.cc", | |
165 "encryptor_openssl.cc", | |
166 "hmac_openssl.cc", | |
167 "openssl_util.cc", | |
168 "openssl_util.h", | |
169 "rsa_private_key_openssl.cc", | |
170 "secure_hash_openssl.cc", | |
171 "signature_creator_openssl.cc", | |
172 "signature_verifier_openssl.cc", | |
173 "symmetric_key_openssl.cc", | |
174 ] | |
175 } | |
176 | |
177 defines = [ "CRYPTO_IMPLEMENTATION" ] | |
178 | |
179 # TODO(brettw) once GYP compat is no longer necessary, just move | |
180 # crypto_minimal_sources to the crypto_minimal target and include a | |
181 # dependency on it here. | |
182 sources += crypto_minimal_sources | |
183 } | |
184 | |
185 # A minimal crypto subset for core features that small standalone targets can | |
186 # use to reduce code size. | |
187 static_library("crypto_minimal") { | |
188 sources = crypto_minimal_sources | |
189 | |
190 deps = [ | |
191 "//base", | |
192 "//base/third_party/dynamic_annotations", | |
193 ] | |
194 | |
195 defines = [ "CRYPTO_IMPLEMENTATION" ] | |
196 } | |
197 | |
198 test("crypto_unittests") { | |
199 sources = [ | |
200 # Tests. | |
201 "curve25519_unittest.cc", | |
202 "ec_private_key_unittest.cc", | |
203 "ec_signature_creator_unittest.cc", | |
204 "encryptor_unittest.cc", | |
205 "ghash_unittest.cc", | |
206 "hkdf_unittest.cc", | |
207 "hmac_unittest.cc", | |
208 "nss_util_unittest.cc", | |
209 "p224_unittest.cc", | |
210 "p224_spake_unittest.cc", | |
211 "random_unittest.cc", | |
212 "rsa_private_key_unittest.cc", | |
213 "rsa_private_key_nss_unittest.cc", | |
214 "secure_hash_unittest.cc", | |
215 "sha2_unittest.cc", | |
216 "signature_creator_unittest.cc", | |
217 "signature_verifier_unittest.cc", | |
218 "symmetric_key_unittest.cc", | |
219 "openpgp_symmetric_encryption_unittest.cc", | |
220 ] | |
221 | |
222 if (use_openssl) { | |
223 sources -= [ | |
224 "nss_util_unittest.cc", | |
225 "openpgp_symmetric_encryption_unittest.cc", | |
226 "rsa_private_key_nss_unittest.cc", | |
227 ] | |
228 } | |
229 | |
230 deps = [ | |
231 ":crypto", | |
232 "//base", | |
233 "//base/test:run_all_unittests", | |
234 "//base/test:test_support", | |
235 "//testing/gmock", | |
236 "//testing/gtest", | |
237 ] | |
238 | |
239 if (is_mac) { | |
240 #deps += "//third_party/nss:nspr" | |
241 } | |
242 } | |
OLD | NEW |