| # Copyright 2019 The Chromium OS 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("//common-mk/mojom_bindings_generator.gni") |
| import("//common-mk/pkg_config.gni") |
| import("//common-mk/proto_library.gni") |
| |
| keymaster_src = "../../../aosp/system/keymaster" |
| |
| group("all") { |
| deps = [ ":arc-keymasterd" ] |
| if (use.test) { |
| deps += [ ":arc-keymasterd_testrunner" ] |
| } |
| if (use.fuzzer) { |
| deps += [ ":arc_keymasterd_fuzzer" ] |
| } |
| } |
| |
| # Binary |
| executable("arc-keymasterd") { |
| sources = [ |
| "cert_store_instance.cc", |
| "conversion.cc", |
| "daemon.cc", |
| "keymaster_server.cc", |
| "main.cc", |
| ] |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| "libmojo", |
| ] |
| deps = [ |
| ":keymaster_mojo_bindings", |
| ":libarckeymaster_context", |
| ":libkeymaster", |
| ] |
| } |
| |
| # Mojo bindings |
| generate_mojom_bindings("keymaster_mojo_bindings") { |
| sources = [ |
| "mojo/cert_store.mojom", |
| "mojo/keymaster.mojom", |
| ] |
| } |
| |
| # BoringSSL |
| config("boringssl_config") { |
| libs = [ |
| "boringcrypto", |
| "pthread", |
| ] |
| } |
| |
| # Keymaster context |
| pkg_config("libarckeymaster_context_config") { |
| pkg_deps = [ "libsession_manager-client" ] |
| libs = [ "chaps" ] |
| } |
| |
| shared_library("libarckeymaster_context") { |
| sources = [ |
| "${keymaster_src}/android_keymaster/logger.cpp", |
| "${keymaster_src}/contexts/pure_soft_keymaster_context.cpp", |
| "${keymaster_src}/contexts/soft_attestation_cert.cpp", |
| "${keymaster_src}/km_openssl/attestation_utils.cpp", |
| "${keymaster_src}/km_openssl/soft_keymaster_enforcement.cpp", |
| "context/arc_keymaster_context.cc", |
| "context/chaps_client.cc", |
| "context/chaps_crypto_operation.cc", |
| "context/context_adaptor.cc", |
| "context/cros_key.cc", |
| "context/crypto_operation.cc", |
| "context/openssl_utils.cc", |
| "keymaster_logger.cc", |
| ] |
| public_configs = [ ":libarckeymaster_context_config" ] |
| configs += [ |
| # Needed since the keymaster context doesn't follow CrOS's guidelines. |
| # gnlint: disable=GnLintVisibilityFlags |
| "//common-mk:visibility_default", |
| ":boringssl_config", |
| ] |
| |
| # NOSORT |
| pkg_deps = [ |
| "libchrome", |
| |
| # system_api depends on protobuf. It must appear before protobuf here so the |
| # linker flags are in the right order. |
| "system_api", |
| "protobuf", |
| ] |
| deps = [ |
| ":context_proto", |
| ":libkeymaster", |
| ] |
| } |
| |
| # Keymaster |
| config("libkeymaster_config") { |
| include_dirs = [ "${keymaster_src}/include" ] |
| cflags = [ |
| "-Wno-defaulted-function-deleted", |
| "-Wno-format-nonliteral", |
| "-Wno-implicit-fallthrough", |
| ] |
| } |
| |
| shared_library("libkeymaster") { |
| sources = [ |
| "${keymaster_src}/android_keymaster/android_keymaster.cpp", |
| "${keymaster_src}/android_keymaster/android_keymaster_messages.cpp", |
| "${keymaster_src}/android_keymaster/android_keymaster_utils.cpp", |
| "${keymaster_src}/android_keymaster/authorization_set.cpp", |
| "${keymaster_src}/android_keymaster/keymaster_enforcement.cpp", |
| "${keymaster_src}/android_keymaster/keymaster_stl.cpp", |
| "${keymaster_src}/android_keymaster/keymaster_tags.cpp", |
| "${keymaster_src}/android_keymaster/operation.cpp", |
| "${keymaster_src}/android_keymaster/operation_table.cpp", |
| "${keymaster_src}/android_keymaster/serializable.cpp", |
| "${keymaster_src}/key_blob_utils/auth_encrypted_key_blob.cpp", |
| "${keymaster_src}/key_blob_utils/integrity_assured_key_blob.cpp", |
| "${keymaster_src}/key_blob_utils/ocb.c", |
| "${keymaster_src}/key_blob_utils/ocb_utils.cpp", |
| "${keymaster_src}/key_blob_utils/software_keyblobs.cpp", |
| "${keymaster_src}/km_openssl/aes_key.cpp", |
| "${keymaster_src}/km_openssl/aes_operation.cpp", |
| "${keymaster_src}/km_openssl/asymmetric_key.cpp", |
| "${keymaster_src}/km_openssl/asymmetric_key_factory.cpp", |
| "${keymaster_src}/km_openssl/attestation_record.cpp", |
| "${keymaster_src}/km_openssl/block_cipher_operation.cpp", |
| "${keymaster_src}/km_openssl/ckdf.cpp", |
| "${keymaster_src}/km_openssl/ec_key.cpp", |
| "${keymaster_src}/km_openssl/ec_key_factory.cpp", |
| "${keymaster_src}/km_openssl/ecdsa_operation.cpp", |
| "${keymaster_src}/km_openssl/ecies_kem.cpp", |
| "${keymaster_src}/km_openssl/hkdf.cpp", |
| "${keymaster_src}/km_openssl/hmac.cpp", |
| "${keymaster_src}/km_openssl/hmac_key.cpp", |
| "${keymaster_src}/km_openssl/hmac_operation.cpp", |
| "${keymaster_src}/km_openssl/iso18033kdf.cpp", |
| "${keymaster_src}/km_openssl/kdf.cpp", |
| "${keymaster_src}/km_openssl/nist_curve_key_exchange.cpp", |
| "${keymaster_src}/km_openssl/openssl_err.cpp", |
| "${keymaster_src}/km_openssl/openssl_utils.cpp", |
| "${keymaster_src}/km_openssl/rsa_key.cpp", |
| "${keymaster_src}/km_openssl/rsa_key_factory.cpp", |
| "${keymaster_src}/km_openssl/rsa_operation.cpp", |
| "${keymaster_src}/km_openssl/software_random_source.cpp", |
| "${keymaster_src}/km_openssl/symmetric_key.cpp", |
| "${keymaster_src}/km_openssl/triple_des_key.cpp", |
| "${keymaster_src}/km_openssl/triple_des_operation.cpp", |
| "${keymaster_src}/km_openssl/wrapped_key.cpp", |
| ] |
| public_configs = [ ":libkeymaster_config" ] |
| configs += [ |
| "//common-mk:visibility_default", |
| ":boringssl_config", |
| ] |
| } |
| |
| # Key data protobuf |
| pkg_config("context_proto_config") { |
| pkg_deps = [ "protobuf" ] |
| } |
| |
| proto_library("context_proto") { |
| proto_in_dir = "./proto" |
| proto_out_dir = "include/arc/keymaster" |
| use_pic = true |
| standalone = true |
| sources = [ "proto/key_data.proto" ] |
| |
| all_dependent_configs = [ ":context_proto_config" ] |
| } |
| |
| # Test target |
| if (use.test) { |
| pkg_config("arc-keymasterd_testrunner_config") { |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| "libchrome-test", |
| ] |
| } |
| executable("arc-keymasterd_testrunner") { |
| sources = [ |
| "context/arc_keymaster_context_test.cc", |
| "context/chaps_client_test.cc", |
| "context/chaps_crypto_operation_test.cc", |
| "context/cros_key_test.cc", |
| "context/crypto_operation_test.cc", |
| "context/openssl_utils_test.cc", |
| "conversion.cc", |
| "conversion_test.cc", |
| "keymaster_logger_test.cc", |
| ] |
| configs += [ |
| "//common-mk:test", |
| ":arc-keymasterd_testrunner_config", |
| ":boringssl_config", |
| ] |
| deps = [ |
| ":keymaster_mojo_bindings", |
| ":libarckeymaster_context", |
| ":libkeymaster", |
| "//common-mk/testrunner:testrunner", |
| ] |
| } |
| } |
| |
| # Fuzzer target. |
| if (use.fuzzer) { |
| pkg_config("arc_keymasterd_fuzzer_config") { |
| pkg_deps = [ "libchrome" ] |
| } |
| executable("arc_keymasterd_fuzzer") { |
| sources = [ |
| "conversion.cc", |
| "conversion_fuzzer.cc", |
| ] |
| configs += [ |
| "//common-mk/common_fuzzer:common_fuzzer", |
| ":arc_keymasterd_fuzzer_config", |
| ] |
| deps = [ |
| ":keymaster_mojo_bindings", |
| ":libarckeymaster_context", |
| ":libkeymaster", |
| ] |
| } |
| } |