naiveproxy/src/crypto/BUILD.gn
2021-07-23 19:16:49 +08:00

162 lines
3.7 KiB
Plaintext

# 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/chromeos/ui_mode.gni")
import("//build/config/crypto.gni")
component("crypto") {
output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto.
sources = [
"aead.cc",
"aead.h",
"crypto_export.h",
"ec_private_key.cc",
"ec_private_key.h",
"ec_signature_creator.cc",
"ec_signature_creator.h",
"ec_signature_creator_impl.cc",
"ec_signature_creator_impl.h",
"encryptor.cc",
"encryptor.h",
"hkdf.cc",
"hkdf.h",
"hmac.cc",
"hmac.h",
"openssl_util.cc",
"openssl_util.h",
"p224_spake.cc",
"p224_spake.h",
"random.cc",
"random.h",
"rsa_private_key.cc",
"rsa_private_key.h",
"scoped_capi_types.h",
"scoped_nss_types.h",
"secure_hash.cc",
"secure_hash.h",
"secure_util.cc",
"secure_util.h",
"sha2.cc",
"sha2.h",
"signature_creator.cc",
"signature_creator.h",
"signature_verifier.cc",
"signature_verifier.h",
"symmetric_key.cc",
"symmetric_key.h",
"unexportable_key.cc",
"unexportable_key.h",
]
deps = [
":platform",
"//base",
"//base/third_party/dynamic_annotations",
]
public_deps = [ "//third_party/boringssl" ]
if (is_apple) {
sources += [
"apple_keychain.h",
# TODO(brettw): these mocks should be moved to a test_support_crypto
# target if possible.
"mock_apple_keychain.cc",
"mock_apple_keychain.h",
]
if (is_mac) {
sources += [
"apple_keychain_mac.mm",
# TODO(brettw): these mocks should be moved to a test_support_crypto
# target if possible.
"mock_apple_keychain_mac.cc",
]
}
if (is_ios) {
sources += [
"apple_keychain_ios.mm",
# TODO(brettw): these mocks should be moved to a test_support_crypto
# target if possible.
"mock_apple_keychain_ios.cc",
]
}
frameworks = [
"CoreFoundation.framework",
"Security.framework",
]
}
if (is_mac) {
sources += [
"mac_security_services_lock.cc",
"mac_security_services_lock.h",
]
}
if (is_win) {
sources += [
"capi_util.cc",
"capi_util.h",
"unexportable_key_win.cc",
]
libs = [ "ncrypt.lib" ]
}
# Some files are built when NSS is used for the platform certificate library.
if (use_nss_certs) {
sources += [
"nss_crypto_module_delegate.h",
"nss_key_util.cc",
"nss_key_util.h",
"nss_util.cc",
"nss_util.h",
"nss_util_internal.h",
]
deps += [ "//build:chromeos_buildflags" ]
}
if (is_chromeos_ash) {
sources += [ "nss_util_chromeos.cc" ]
}
if (is_chromeos || is_chromeos_lacros) {
sources += [
"chaps_support.cc",
"chaps_support.h",
]
}
defines = [ "CRYPTO_IMPLEMENTATION" ]
if (is_nacl) {
deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
}
}
config("platform_config") {
if (use_nss_certs && is_clang) {
# There is a broken header guard in /usr/include/nss/secmod.h:
# https://bugzilla.mozilla.org/show_bug.cgi?id=884072
cflags = [ "-Wno-header-guard" ]
}
}
# 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") {
public_deps = [ "//third_party/boringssl" ]
# Link in NSS if it is used for the platform certificate library
# (use_nss_certs).
if (use_nss_certs) {
public_configs = [ ":platform_config" ]
public_configs += [ "//build/config/linux/nss:system_nss_no_ssl_config" ]
}
}