diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-14 23:25:13 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-14 23:25:13 +0000 |
commit | 7a7e08546c85dd5a039c8dd0e57bae1cd384fc44 (patch) | |
tree | a316212f6372e5d9bd8fd814a62c786d0fd7baf5 /tools | |
parent | 7ff2cc13a2d85f02aaca8bd0edd2c45dae527065 (diff) | |
download | chromium_src-7a7e08546c85dd5a039c8dd0e57bae1cd384fc44.zip chromium_src-7a7e08546c85dd5a039c8dd0e57bae1cd384fc44.tar.gz chromium_src-7a7e08546c85dd5a039c8dd0e57bae1cd384fc44.tar.bz2 |
Add SSL support to the GN build
This moves files from the secondary tree to the main one, and renames the "meta" one to //crypto:ssl. It also adds the crypto unit tests.
R=rsleevi@chromium.org
Review URL: https://codereview.chromium.org/231673006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263744 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gn/secondary/crypto/BUILD.gn | 242 | ||||
-rw-r--r-- | tools/gn/secondary/crypto/ssl/BUILD.gn | 28 | ||||
-rw-r--r-- | tools/gn/secondary/net/BUILD.gn | 2 | ||||
-rw-r--r-- | tools/gn/secondary/net/third_party/nss/BUILD.gn | 93 | ||||
-rw-r--r-- | tools/gn/secondary/third_party/nss/BUILD.gn | 12 |
5 files changed, 11 insertions, 366 deletions
diff --git a/tools/gn/secondary/crypto/BUILD.gn b/tools/gn/secondary/crypto/BUILD.gn deleted file mode 100644 index 50365c9..0000000 --- a/tools/gn/secondary/crypto/BUILD.gn +++ /dev/null @@ -1,242 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -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 = [ - "apple_keychain.h", - "apple_keychain_ios.mm", - "apple_keychain_mac.mm", - "capi_util.cc", - "capi_util.h", - "crypto_export.h", - "crypto_module_blocking_password_delegate.h", - "cssm_init.cc", - "cssm_init.h", - "curve25519.cc", - "curve25519.h", - "curve25519-donna.c", - "ghash.cc", - "ghash.h", - "ec_private_key.h", - "ec_private_key_nss.cc", - "ec_private_key_openssl.cc", - "ec_signature_creator.cc", - "ec_signature_creator.h", - "ec_signature_creator_impl.h", - "ec_signature_creator_nss.cc", - "ec_signature_creator_openssl.cc", - "encryptor.cc", - "encryptor.h", - "encryptor_nss.cc", - "encryptor_openssl.cc", - "hkdf.cc", - "hkdf.h", - "hmac_nss.cc", - "hmac_openssl.cc", - "mac_security_services_lock.cc", - "mac_security_services_lock.h", - # TODO(brettw) these mocks should be moved to a test_support_crypto target - # if possible. - "mock_apple_keychain.cc", - "mock_apple_keychain.h", - "mock_apple_keychain_ios.cc", - "mock_apple_keychain_mac.cc", - "p224_spake.cc", - "p224_spake.h", - "nss_util.cc", - "nss_util.h", - "nss_util_internal.h", - "openpgp_symmetric_encryption.cc", - "openpgp_symmetric_encryption.h", - "openssl_util.cc", - "openssl_util.h", - "p224.cc", - "p224.h", - "random.h", - "random.cc", - "rsa_private_key.cc", - "rsa_private_key.h", - "rsa_private_key_nss.cc", - "rsa_private_key_openssl.cc", - "scoped_capi_types.h", - "scoped_nss_types.h", - "secure_hash.h", - "secure_hash_default.cc", - "secure_hash_openssl.cc", - "sha2.cc", - "sha2.h", - "signature_creator.h", - "signature_creator_nss.cc", - "signature_creator_openssl.cc", - "signature_verifier.h", - "signature_verifier_nss.cc", - "signature_verifier_openssl.cc", - "symmetric_key_nss.cc", - "symmetric_key_openssl.cc", - "third_party/nss/chromium-blapi.h", - "third_party/nss/chromium-blapit.h", - "third_party/nss/chromium-nss.h", - "third_party/nss/pk11akey.cc", - "third_party/nss/rsawrapr.c", - "third_party/nss/secsign.cc", - ] - - deps = [ - "//base", - "//base/third_party/dynamic_annotations", - "//crypto/ssl:metassl", - ] - forward_dependent_configs_from = [ "//crypto/ssl:metassl" ] - - if (!is_mac && !is_ios) { - sources -= [ - "apple_keychain.h", - "mock_apple_keychain.cc", - "mock_apple_keychain.h", - ] - } - - if (!is_linux) { - if (use_nss) { # Removed for non-NSS in all cases below. - sources -= [ - "openpgp_symmetric_encryption.cc", - "openpgp_symmetric_encryption.h", - ] - } - } - if (!is_mac) { - sources -= [ - "cssm_init.cc", - "cssm_init.h", - "mac_security_services_lock.cc", - "mac_security_services_lock.h", - ] - } - if (!is_win) { - sources -= [ - "capi_util.cc", - "capi_util.h", - ] - } - - if (use_nss) { - configs += [ "//third_party/nss:nss_linux_config" ] - } else { - sources -= [ - "ec_private_key_nss.cc", - "ec_signature_creator_nss.cc", - "encryptor_nss.cc", - "hmac_nss.cc", - "nss_util.cc", - "nss_util.h", - "rsa_private_key_nss.cc", - "secure_hash_default.cc", - "signature_creator_nss.cc", - "signature_verifier_nss.cc", - "symmetric_key_nss.cc", - "third_party/nss/chromium-blapi.h", - "third_party/nss/chromium-blapit.h", - "third_party/nss/chromium-nss.h", - "third_party/nss/pk11akey.cc", - "third_party/nss/rsawrapr.c", - "third_party/nss/secsign.cc", - ] - } - if (!use_openssl) { - sources -= [ - "ec_private_key_openssl.cc", - "ec_signature_creator_openssl.cc", - "encryptor_openssl.cc", - "hmac_openssl.cc", - "openssl_util.cc", - "openssl_util.h", - "rsa_private_key_openssl.cc", - "secure_hash_openssl.cc", - "signature_creator_openssl.cc", - "signature_verifier_openssl.cc", - "symmetric_key_openssl.cc", - ] - } - - 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 - - deps = [ - "//base", - "//base/third_party/dynamic_annotations", - ] - - defines = [ "CRYPTO_IMPLEMENTATION" ] -} - -test("crypto_unittests") { - sources = [ - # Tests. - "curve25519_unittest.cc", - "ec_private_key_unittest.cc", - "ec_signature_creator_unittest.cc", - "encryptor_unittest.cc", - "ghash_unittest.cc", - "hkdf_unittest.cc", - "hmac_unittest.cc", - "nss_util_unittest.cc", - "p224_unittest.cc", - "p224_spake_unittest.cc", - "random_unittest.cc", - "rsa_private_key_unittest.cc", - "rsa_private_key_nss_unittest.cc", - "secure_hash_unittest.cc", - "sha2_unittest.cc", - "signature_creator_unittest.cc", - "signature_verifier_unittest.cc", - "symmetric_key_unittest.cc", - "openpgp_symmetric_encryption_unittest.cc", - ] - - if (use_openssl) { - sources -= [ - "nss_util_unittest.cc", - "openpgp_symmetric_encryption_unittest.cc", - "rsa_private_key_nss_unittest.cc", - ] - } - - deps = [ - ":crypto", - "//base", - "//base/test:run_all_unittests", - "//base/test:test_support", - "//testing/gmock", - "//testing/gtest", - ] - - if (is_mac) { - #deps += "//third_party/nss:nspr" - } -} diff --git a/tools/gn/secondary/crypto/ssl/BUILD.gn b/tools/gn/secondary/crypto/ssl/BUILD.gn deleted file mode 100644 index 42e0078..0000000 --- a/tools/gn/secondary/crypto/ssl/BUILD.gn +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//build/config/crypto.gni") -import("//build/config/linux/pkg_config.gni") - -config("ssl_preprocessor_flags") { - if (use_openssl) { - defines = [ "USE_OPENSSL" ] - } else if (use_nss) { - defines = [ "USE_NSS" ] - } -} - -# This meta-target will include the SSL library according to the build flags. -group("metassl") { - direct_dependent_configs = [ ":ssl_preprocessor_flags" ] - - if (use_openssl) { - assert(is_linux) - deps = [ "//third_party/openssl" ] - } else { - deps = [ "//net/third_party/nss:ssl" ] - } - - forward_dependent_configs_from = deps -} diff --git a/tools/gn/secondary/net/BUILD.gn b/tools/gn/secondary/net/BUILD.gn index f6461c0..01ab0c8 100644 --- a/tools/gn/secondary/net/BUILD.gn +++ b/tools/gn/secondary/net/BUILD.gn @@ -1061,7 +1061,7 @@ component("net") { "//base:i18n", "//base/third_party/dynamic_annotations", "//crypto", - "//crypto/ssl:metassl", + "//crypto:ssl", "//sdch", "//third_party/icu", "//third_party/zlib", diff --git a/tools/gn/secondary/net/third_party/nss/BUILD.gn b/tools/gn/secondary/net/third_party/nss/BUILD.gn deleted file mode 100644 index 624c813..0000000 --- a/tools/gn/secondary/net/third_party/nss/BUILD.gn +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -config("ssl_config") { - include_dirs = [ - "//net/third_party/nss/ssl", - ] -} - -# TODO(brettw) move this to net/third_party/nss/ssl once GYP backwards-compat -# is no longer needed. -component("ssl") { - # Not named "ssl" so the lib doesn't conflict with OpenSSL's libssl - output_name = "crssl" - - sources = [ - "ssl/authcert.c", - "ssl/cmpcert.c", - "ssl/derive.c", - "ssl/dtlscon.c", - #"ssl/os2_err.c", - #"ssl/os2_err.h", - "ssl/preenc.h", - "ssl/prelib.c", - "ssl/ssl.h", - "ssl/ssl3con.c", - "ssl/ssl3ecc.c", - "ssl/ssl3ext.c", - "ssl/ssl3gthr.c", - "ssl/ssl3prot.h", - "ssl/sslauth.c", - "ssl/sslcon.c", - "ssl/ssldef.c", - "ssl/sslenum.c", - "ssl/sslerr.c", - "ssl/sslerr.h", - "ssl/SSLerrs.h", - "ssl/sslerrstrs.c", - "ssl/sslgathr.c", - "ssl/sslimpl.h", - "ssl/sslinfo.c", - "ssl/sslinit.c", - "ssl/sslmutex.c", - "ssl/sslmutex.h", - "ssl/sslnonce.c", - "ssl/sslplatf.c", - "ssl/sslproto.h", - "ssl/sslreveal.c", - "ssl/sslsecur.c", - "ssl/sslsnce.c", - "ssl/sslsock.c", - "ssl/sslt.h", - "ssl/ssltrace.c", - "ssl/sslver.c", - "ssl/unix_err.c", - "ssl/unix_err.h", - "ssl/win32err.c", - "ssl/win32err.h", - "ssl/bodge/secitem_array.c", - ] - - defines = [ - "NO_PKCS11_BYPASS", - "NSS_ENABLE_ECC", - "USE_UTIL_DIRECTLY", - ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - - direct_dependent_configs = [ ":ssl_config" ] - - if (is_win) { - sources -= [ - "ssl/unix_err.c", - "ssl/unix_err.h", - ] - } else { - sources -= [ - "ssl/win32err.c", - "ssl/win32err.h", - ] - } - - if (is_linux) { - include_dirs = [ "ssl/bodge" ] - configs += [ "//third_party/nss:nss_linux_config" ] - } - if (is_mac) { - sources -= [ "ssl/bodge/secitem_array.c" ] - } -} diff --git a/tools/gn/secondary/third_party/nss/BUILD.gn b/tools/gn/secondary/third_party/nss/BUILD.gn index e175904..340180d 100644 --- a/tools/gn/secondary/third_party/nss/BUILD.gn +++ b/tools/gn/secondary/third_party/nss/BUILD.gn @@ -4,9 +4,17 @@ import("//build/config/linux/pkg_config.gni") -# On Linux we always use the system NSS except for SSL. if (is_linux) { - pkg_config("nss_linux_config") { + # This is a dependency on NSS with no libssl. On Linux we use a built-in SSL + # library but the system NSS libraries. Non-Linux platforms using NSS use the + # hermetic one in //third_party/nss. + # + # Generally you should depend on //crypto:platform instead of using this + # config since that will properly pick up NSS or OpenSSL depending on + # platform and build config. + pkg_config("system_nss_no_ssl_config") { packages = [ "nss" ] + extra_args = [ "-v", "-lssl3" ] } } + |