Skip to content

Commit

Permalink
[GN] migrate crypto.
Browse files Browse the repository at this point in the history
b/206143348

Change-Id: I3aa335fa4591cbc27b18002cffd1fbb48cbdfe4a
  • Loading branch information
sideb0ard committed Nov 16, 2021
1 parent e773212 commit 6091b6b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build/config/crypto.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# to set up feature flags.

# True if NSS is used for certificate handling.
use_nss_certs = is_linux || is_chromeos
use_nss_certs = (is_linux || is_chromeos) && !is_starboard
1 change: 1 addition & 0 deletions cobalt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ group("gn_all") {
"//cobalt/renderer/rasterizer/egl/shaders",
"//cobalt/storage:storage_constants",
"//content/browser/speech",
"//crypto",
"//nb",
"//third_party/brotli:dec",
"//third_party/brotli:dec_no_dictionary_data",
Expand Down
51 changes: 37 additions & 14 deletions crypto/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# found in the LICENSE file.

import("//build/config/crypto.gni")
import("//testing/test.gni")
if (!is_starboard) {
import("//testing/test.gni")
}

component("crypto") {
output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto.
Expand Down Expand Up @@ -70,6 +72,23 @@ component("crypto") {
"wincrypt_shim.h",
]

if (is_starboard) {
sources -= [
"apple_keychain_ios.mm",
"apple_keychain_mac.mm",
"mock_apple_keychain_ios.cc",
"mock_apple_keychain_mac.cc",
"nss_crypto_module_delegate.h",
"scoped_capi_types.h",
"scoped_nss_types.h",
]
if (is_win) {
cflags += [
"/wd4018", # Comparing signed and unsigned values.
]
}
}

# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]

Expand All @@ -79,9 +98,9 @@ component("crypto") {
"//base/third_party/dynamic_annotations",
]

public_deps = [
"//third_party/boringssl",
]
if (!is_starboard) {
public_deps = [ "//third_party/boringssl" ]
}

if (!is_mac && !is_ios) {
sources -= [
Expand Down Expand Up @@ -127,7 +146,8 @@ component("crypto") {
}
}

test("crypto_unittests") {
target(gtest_target_type, "crypto_unittests") {
testonly = true
sources = [
"aead_unittest.cc",
"ec_private_key_unittest.cc",
Expand Down Expand Up @@ -209,14 +229,17 @@ config("platform_config") {
# 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" ]
if (is_starboard) {
deps = [ "//starboard" ]
public_deps = [ "//third_party/boringssl:crypto" ]
} else {
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" ]
}
}
}

0 comments on commit 6091b6b

Please sign in to comment.