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 # Remove nss_util when NSS is used for neither the internal crypto library |
| 171 # nor the platform 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 "random_unittest.cc", | 229 "random_unittest.cc", |
223 "rsa_private_key_nss_unittest.cc", | 230 "rsa_private_key_nss_unittest.cc", |
224 "rsa_private_key_unittest.cc", | 231 "rsa_private_key_unittest.cc", |
225 "secure_hash_unittest.cc", | 232 "secure_hash_unittest.cc", |
226 "sha2_unittest.cc", | 233 "sha2_unittest.cc", |
227 "signature_creator_unittest.cc", | 234 "signature_creator_unittest.cc", |
228 "signature_verifier_unittest.cc", | 235 "signature_verifier_unittest.cc", |
229 "symmetric_key_unittest.cc", | 236 "symmetric_key_unittest.cc", |
230 ] | 237 ] |
231 | 238 |
232 if (use_openssl || !is_linux) { | 239 # Remove nss_util when NSS is used for neither the internal crypto library |
233 sources -= [ "rsa_private_key_nss_unittest.cc" ] | 240 # nor the platform certificate library. |
| 241 if (use_openssl && !use_nss_certs) { |
| 242 sources -= [ "nss_util_unittest.cc" ] |
234 } | 243 } |
235 | 244 |
236 if (use_openssl) { | 245 if (use_openssl) { |
237 sources -= [ "nss_util_unittest.cc" ] | 246 sources -= [ "rsa_private_key_nss_unittest.cc" ] |
238 } else { | 247 } else { |
239 sources -= [ "openssl_bio_string_unittest.cc" ] | 248 sources -= [ "openssl_bio_string_unittest.cc" ] |
240 } | 249 } |
241 | 250 |
242 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] | 251 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
243 | 252 |
244 deps = [ | 253 deps = [ |
245 ":crypto", | 254 ":crypto", |
246 ":platform", | 255 ":platform", |
247 ":test_support", | 256 ":test_support", |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 sources -= [ | 288 sources -= [ |
280 "scoped_test_nss_chromeos_user.cc", | 289 "scoped_test_nss_chromeos_user.cc", |
281 "scoped_test_nss_chromeos_user.h", | 290 "scoped_test_nss_chromeos_user.h", |
282 "scoped_test_system_nss_key_slot.cc", | 291 "scoped_test_system_nss_key_slot.cc", |
283 "scoped_test_system_nss_key_slot.h", | 292 "scoped_test_system_nss_key_slot.h", |
284 ] | 293 ] |
285 } | 294 } |
286 } | 295 } |
287 | 296 |
288 config("platform_config") { | 297 config("platform_config") { |
289 if (!use_openssl && is_clang) { | 298 if ((!use_openssl || use_nss_certs) && is_clang) { |
290 # There is a broken header guard in /usr/include/nss/secmod.h: | 299 # There is a broken header guard in /usr/include/nss/secmod.h: |
291 # https://bugzilla.mozilla.org/show_bug.cgi?id=884072 | 300 # https://bugzilla.mozilla.org/show_bug.cgi?id=884072 |
292 cflags = [ "-Wno-header-guard" ] | 301 cflags = [ "-Wno-header-guard" ] |
293 } | 302 } |
294 } | 303 } |
295 | 304 |
296 # This is a meta-target that forwards to NSS's SSL library or OpenSSL, | 305 # This is a meta-target that forwards to NSS's SSL library or OpenSSL, |
297 # according to the state of the crypto flags. A target just wanting to depend | 306 # according to the state of the crypto flags. A target just wanting to depend |
298 # on the current SSL library should just depend on this. | 307 # on the current SSL library should just depend on this. |
299 group("platform") { | 308 group("platform") { |
300 if (use_openssl) { | 309 if (use_openssl) { |
301 deps = [ | 310 deps = [ |
302 "//third_party/boringssl", | 311 "//third_party/boringssl", |
303 ] | 312 ] |
304 } else { | 313 } else { |
305 deps = [ | 314 deps = [ |
306 "//net/third_party/nss/ssl:libssl", | 315 "//net/third_party/nss/ssl:libssl", |
307 ] | 316 ] |
| 317 } |
| 318 |
| 319 # Link in NSS if it is used for either the internal crypto library |
| 320 # (!use_openssl) or platform certificate library (use_nss_certs). |
| 321 if (!use_openssl || use_nss_certs) { |
308 if (is_linux) { | 322 if (is_linux) { |
309 # On Linux, we use the system NSS (excepting SSL where we always use our | 323 # On Linux, we use the system NSS (excepting SSL where we always use our |
310 # own). | 324 # own). |
311 # | 325 public_configs = [ ":platform_config" ] |
312 # We always need our SSL header search path to come before the system one | 326 if (!use_openssl) { |
313 # so our versions are used. The libssl target will add the search path we | 327 # If using a bundled copy of NSS's SSL library, ensure the bundled SSL |
314 # want, but according to GN's ordering rules, public_configs' search path | 328 # header search path comes before the system one so our versions are |
315 # will get applied before ones inherited from our dependencies. | 329 # used. The libssl target will add the search path we want, but |
316 # Therefore, we need to explicitly list our custom libssl's config here | 330 # according to GN's ordering rules, public_configs' search path will get |
317 # before the system one. | 331 # applied before ones inherited from our dependencies. Therefore, we |
318 public_configs = [ | 332 # need to explicitly list our custom libssl's config here before the |
319 ":platform_config", | 333 # system one. |
320 "//net/third_party/nss/ssl:ssl_config", | 334 public_configs += [ "//net/third_party/nss/ssl:ssl_config" ] |
321 "//third_party/nss:system_nss_no_ssl_config", | 335 } |
322 ] | 336 public_configs += [ "//third_party/nss:system_nss_no_ssl_config" ] |
323 } else { | 337 } else { |
324 # Non-Linux platforms use the hermetic NSS from the tree. | 338 # Non-Linux platforms use the hermetic NSS from the tree. |
325 deps += [ | 339 deps += [ |
326 "//third_party/nss:nspr", | 340 "//third_party/nss:nspr", |
327 "//third_party/nss:nss", | 341 "//third_party/nss:nss", |
328 ] | 342 ] |
329 } | 343 } |
330 } | 344 } |
331 } | 345 } |
OLD | NEW |