Index: crypto/BUILD.gn |
diff --git a/tools/gn/secondary/crypto/BUILD.gn b/crypto/BUILD.gn |
similarity index 80% |
rename from tools/gn/secondary/crypto/BUILD.gn |
rename to crypto/BUILD.gn |
index 50365c98d3d7232a82646b6d3ad8c3281f46bfea..0bfe6988cff29a99bd2db2b116f07ab0931ec512 100644 |
--- a/tools/gn/secondary/crypto/BUILD.gn |
+++ b/crypto/BUILD.gn |
@@ -4,18 +4,6 @@ |
import("//build/config/crypto.gni") |
-crypto_minimal_sources = [ |
- "hmac.cc", |
- "hmac.h", |
- "hmac_win.cc", |
- "secure_util.cc", |
- "secure_util.h", |
- "symmetric_key.h", |
- "symmetric_key_win.cc", |
- "third_party/nss/chromium-sha256.h", |
- "third_party/nss/sha512.cc", |
-] |
- |
component("crypto") { |
output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto. |
sources = [ |
@@ -98,11 +86,11 @@ component("crypto") { |
] |
deps = [ |
+ ":crypto_minimal", |
+ ":platform", |
"//base", |
"//base/third_party/dynamic_annotations", |
- "//crypto/ssl:metassl", |
] |
- forward_dependent_configs_from = [ "//crypto/ssl:metassl" ] |
if (!is_mac && !is_ios) { |
sources -= [ |
@@ -135,9 +123,7 @@ component("crypto") { |
] |
} |
- if (use_nss) { |
- configs += [ "//third_party/nss:nss_linux_config" ] |
- } else { |
+ if (!use_nss) { |
sources -= [ |
"ec_private_key_nss.cc", |
"ec_signature_creator_nss.cc", |
@@ -175,19 +161,25 @@ component("crypto") { |
} |
defines = [ "CRYPTO_IMPLEMENTATION" ] |
- |
- # TODO(brettw) once GYP compat is no longer necessary, just move |
- # crypto_minimal_sources to the crypto_minimal target and include a |
- # dependency on it here. |
- sources += crypto_minimal_sources |
} |
# A minimal crypto subset for core features that small standalone targets can |
# use to reduce code size. |
-static_library("crypto_minimal") { |
- sources = crypto_minimal_sources |
+source_set("crypto_minimal") { |
+ sources = [ |
+ "hmac.cc", |
+ "hmac.h", |
+ "hmac_win.cc", |
+ "secure_util.cc", |
+ "secure_util.h", |
+ "symmetric_key.h", |
+ "symmetric_key_win.cc", |
+ "third_party/nss/chromium-sha256.h", |
+ "third_party/nss/sha512.cc", |
+ ] |
deps = [ |
+ ":platform", |
Ryan Sleevi
2014/04/14 21:00:59
crypto_minimal doesn't depend on :platform, just n
|
"//base", |
"//base/third_party/dynamic_annotations", |
] |
@@ -227,16 +219,48 @@ test("crypto_unittests") { |
] |
} |
+ if (use_openssl || !is_linux) { |
+ sources -= [ |
+ "rsa_private_key_nss_unittest.cc", |
+ "openpgp_symmetric_encryption_unittest.cc", |
+ ] |
+ } |
+ |
+ if (use_openssl) { |
+ sources -= [ "nss_util_unittest.cc" ] |
+ } |
+ |
deps = [ |
":crypto", |
+ ":platform", |
"//base", |
"//base/test:run_all_unittests", |
"//base/test:test_support", |
"//testing/gmock", |
"//testing/gtest", |
] |
+} |
- if (is_mac) { |
- #deps += "//third_party/nss:nspr" |
+# This is a meta-target that forwards to NSS's SSL library or OpenSSL, |
+# according to the state of the crypto flags. A target just wanting to depend |
+# on the current SSL library should just depend on this. |
+group("platform") { |
+ if (use_openssl) { |
+ deps = [ "//third_party/openssl" ] |
+ } else { |
+ deps = [ "//net/third_party/nss/ssl:libssl" ] |
+ if (is_linux) { |
+ # On Linux, we use the system NSS (excepting SSL where we always use our |
+ # own). |
+ direct_dependent_configs = [ |
+ "//third_party/nss:system_nss_no_ssl_config" |
+ ] |
+ } else { |
+ # Non-Linux platforms use the hermetic NSS from the tree. |
+ deps += [ |
+ "//third_party/nss:nspr", |
+ "//third_party/nss:nss", |
+ ] |
+ } |
} |
} |