OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/crypto.gni") | 5 import("//build/config/crypto.gni") |
6 import("//testing/test.gni") | 6 import("//testing/test.gni") |
7 | 7 |
8 component("crypto") { | 8 component("crypto") { |
9 output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto. | 9 output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto. |
10 sources = [ | 10 sources = [ |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 deps += [ "//third_party/android_tools:cpu_features" ] | 129 deps += [ "//third_party/android_tools:cpu_features" ] |
130 } | 130 } |
131 | 131 |
132 if (use_openssl) { | 132 if (use_openssl) { |
133 # Remove NSS files when using OpenSSL | 133 # Remove NSS files when using OpenSSL |
134 sources -= [ | 134 sources -= [ |
135 "ec_private_key_nss.cc", | 135 "ec_private_key_nss.cc", |
136 "ec_signature_creator_nss.cc", | 136 "ec_signature_creator_nss.cc", |
137 "encryptor_nss.cc", | 137 "encryptor_nss.cc", |
138 "hmac_nss.cc", | 138 "hmac_nss.cc", |
139 "nss_util.cc", | |
140 "nss_util.h", | |
141 "nss_util_internal.h", | |
142 "rsa_private_key_nss.cc", | 139 "rsa_private_key_nss.cc", |
143 "secure_hash_default.cc", | 140 "secure_hash_default.cc", |
144 "signature_creator_nss.cc", | 141 "signature_creator_nss.cc", |
145 "signature_verifier_nss.cc", | 142 "signature_verifier_nss.cc", |
146 "symmetric_key_nss.cc", | 143 "symmetric_key_nss.cc", |
147 "third_party/nss/chromium-blapi.h", | 144 "third_party/nss/chromium-blapi.h", |
148 "third_party/nss/chromium-blapit.h", | 145 "third_party/nss/chromium-blapit.h", |
149 "third_party/nss/chromium-nss.h", | 146 "third_party/nss/chromium-nss.h", |
150 "third_party/nss/pk11akey.cc", | 147 "third_party/nss/pk11akey.cc", |
151 "third_party/nss/rsawrapr.c", | 148 "third_party/nss/rsawrapr.c", |
(...skipping 11 matching lines...) Expand all Loading... |
163 "openssl_util.cc", | 160 "openssl_util.cc", |
164 "openssl_util.h", | 161 "openssl_util.h", |
165 "rsa_private_key_openssl.cc", | 162 "rsa_private_key_openssl.cc", |
166 "secure_hash_openssl.cc", | 163 "secure_hash_openssl.cc", |
167 "signature_creator_openssl.cc", | 164 "signature_creator_openssl.cc", |
168 "signature_verifier_openssl.cc", | 165 "signature_verifier_openssl.cc", |
169 "symmetric_key_openssl.cc", | 166 "symmetric_key_openssl.cc", |
170 ] | 167 ] |
171 } | 168 } |
172 | 169 |
| 170 # NSS is used for neither the internal crypto library nor the platform |
| 171 # certificate library. |
| 172 if (use_openssl && !use_nss_certs) { |
| 173 sources -= [ |
| 174 "nss_util.cc", |
| 175 "nss_util.h", |
| 176 "nss_util_internal.h", |
| 177 ] |
| 178 } |
| 179 |
173 defines = [ "CRYPTO_IMPLEMENTATION" ] | 180 defines = [ "CRYPTO_IMPLEMENTATION" ] |
174 } | 181 } |
175 | 182 |
176 # TODO(GYP): TODO(dpranke), fix the compile errors for this stuff | 183 # TODO(GYP): TODO(dpranke), fix the compile errors for this stuff |
177 # and make it work. | 184 # and make it work. |
178 if (false && is_win) { | 185 if (false && is_win) { |
179 # A minimal crypto subset for hmac-related stuff that small standalone | 186 # A minimal crypto subset for hmac-related stuff that small standalone |
180 # targets can use to reduce code size on Windows. This does not depend on | 187 # targets can use to reduce code size on Windows. This does not depend on |
181 # OpenSSL/NSS but will use Windows APIs for that functionality. | 188 # OpenSSL/NSS but will use Windows APIs for that functionality. |
182 source_set("crypto_minimal_win") { | 189 source_set("crypto_minimal_win") { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 "random_unittest.cc", | 231 "random_unittest.cc", |
225 "rsa_private_key_nss_unittest.cc", | 232 "rsa_private_key_nss_unittest.cc", |
226 "rsa_private_key_unittest.cc", | 233 "rsa_private_key_unittest.cc", |
227 "secure_hash_unittest.cc", | 234 "secure_hash_unittest.cc", |
228 "sha2_unittest.cc", | 235 "sha2_unittest.cc", |
229 "signature_creator_unittest.cc", | 236 "signature_creator_unittest.cc", |
230 "signature_verifier_unittest.cc", | 237 "signature_verifier_unittest.cc", |
231 "symmetric_key_unittest.cc", | 238 "symmetric_key_unittest.cc", |
232 ] | 239 ] |
233 | 240 |
234 if (use_openssl || !is_linux) { | 241 if (use_openssl && !use_nss_certs) { |
235 sources -= [ "rsa_private_key_nss_unittest.cc" ] | 242 # nss_util is built if NSS is used for either the internal crypto library |
| 243 # or the platform certificate library. |
| 244 sources -= [ "nss_util_unittest.cc" ] |
236 } | 245 } |
237 | 246 |
238 if (use_openssl) { | 247 if (use_openssl) { |
239 sources -= [ "nss_util_unittest.cc" ] | 248 sources -= [ "rsa_private_key_nss_unittest.cc" ] |
240 } else { | 249 } else { |
241 sources -= [ "openssl_bio_string_unittest.cc" ] | 250 sources -= [ "openssl_bio_string_unittest.cc" ] |
242 } | 251 } |
243 | 252 |
244 deps = [ | 253 deps = [ |
245 ":crypto", | 254 ":crypto", |
246 ":platform", | 255 ":platform", |
247 ":test_support", | 256 ":test_support", |
248 "//base", | 257 "//base", |
249 "//base/test:run_all_unittests", | 258 "//base/test:run_all_unittests", |
(...skipping 30 matching lines...) Expand all Loading... |
280 sources -= [ | 289 sources -= [ |
281 "scoped_test_nss_chromeos_user.cc", | 290 "scoped_test_nss_chromeos_user.cc", |
282 "scoped_test_nss_chromeos_user.h", | 291 "scoped_test_nss_chromeos_user.h", |
283 "scoped_test_system_nss_key_slot.cc", | 292 "scoped_test_system_nss_key_slot.cc", |
284 "scoped_test_system_nss_key_slot.h", | 293 "scoped_test_system_nss_key_slot.h", |
285 ] | 294 ] |
286 } | 295 } |
287 } | 296 } |
288 | 297 |
289 config("platform_config") { | 298 config("platform_config") { |
290 if (!use_openssl && is_clang) { | 299 if ((!use_openssl || use_nss_certs) && is_clang) { |
291 # There is a broken header guard in /usr/include/nss/secmod.h: | 300 # There is a broken header guard in /usr/include/nss/secmod.h: |
292 # https://bugzilla.mozilla.org/show_bug.cgi?id=884072 | 301 # https://bugzilla.mozilla.org/show_bug.cgi?id=884072 |
293 cflags = [ "-Wno-header-guard" ] | 302 cflags = [ "-Wno-header-guard" ] |
294 } | 303 } |
295 } | 304 } |
296 | 305 |
297 # This is a meta-target that forwards to NSS's SSL library or OpenSSL, | 306 # This is a meta-target that forwards to NSS's SSL library or OpenSSL, |
298 # according to the state of the crypto flags. A target just wanting to depend | 307 # according to the state of the crypto flags. A target just wanting to depend |
299 # on the current SSL library should just depend on this. | 308 # on the current SSL library should just depend on this. |
300 group("platform") { | 309 group("platform") { |
301 if (use_openssl) { | 310 if (use_openssl) { |
302 deps = [ | 311 deps = [ |
303 "//third_party/boringssl", | 312 "//third_party/boringssl", |
304 ] | 313 ] |
305 } else { | 314 } else { |
306 deps = [ | 315 deps = [ |
307 "//net/third_party/nss/ssl:libssl", | 316 "//net/third_party/nss/ssl:libssl", |
308 ] | 317 ] |
| 318 } |
| 319 |
| 320 # Link in NSS if it is used for either the internal crypto library |
| 321 # (!use_openssl) or platform certificate library (use_nss_certs). |
| 322 if (!use_openssl || use_nss_certs) { |
309 if (is_linux) { | 323 if (is_linux) { |
310 # On Linux, we use the system NSS (excepting SSL where we always use our | 324 # On Linux, we use the system NSS (excepting SSL where we always use our |
311 # own). | 325 # own). |
312 # | 326 public_configs = [ ":platform_config" ] |
313 # We always need our SSL header search path to come before the system one | 327 if (!use_openssl) { |
314 # so our versions are used. The libssl target will add the search path we | 328 # If using a bundled copy of NSS's SSL library, ensure the bundled SSL |
315 # want, but according to GN's ordering rules, public_configs' search path | 329 # header search path comes before the system one so our versions are |
316 # will get applied before ones inherited from our dependencies. | 330 # used. The libssl target will add the search path we want, but |
317 # Therefore, we need to explicitly list our custom libssl's config here | 331 # according to GN's ordering rules, public_configs' search path will get |
318 # before the system one. | 332 # applied before ones inherited from our dependencies. Therefore, we |
319 public_configs = [ | 333 # need to explicitly list our custom libssl's config here before the |
320 ":platform_config", | 334 # system one. |
321 "//net/third_party/nss/ssl:ssl_config", | 335 public_configs += [ "//net/third_party/nss/ssl:ssl_config" ] |
322 "//third_party/nss:system_nss_no_ssl_config", | 336 } |
323 ] | 337 public_configs += [ "//third_party/nss:system_nss_no_ssl_config" ] |
324 } else { | 338 } else { |
325 # Non-Linux platforms use the hermetic NSS from the tree. | 339 # Non-Linux platforms use the hermetic NSS from the tree. |
326 deps += [ | 340 deps += [ |
327 "//third_party/nss:nspr", | 341 "//third_party/nss:nspr", |
328 "//third_party/nss:nss", | 342 "//third_party/nss:nss", |
329 ] | 343 ] |
330 } | 344 } |
331 } | 345 } |
332 } | 346 } |
OLD | NEW |