platform_system_security/keystore/Android.bp
Branden Archer 84e7231d73 Grant VTS tests all permissions in keystore on userdebug/eng
A VTS test for the Wifi Keystore HAL is being created. The test
is run as root and attempts various operations that directly
use the Keystore service. By default that test will not be
able to perform necessary actions to exercise the HAL code,
such as creating keys for tests.

This change will enable the root user to perform all key
operations, but only on userdebug and eng builds. In addition,
the root user will be able to perform actions on behalf of the
wifi user; this is necessary as some operations in the Wifi
Keystore HAL assume the wifi user.

Bug: 120182820
Test: atest system/hardware/interfaces/wifi/keystore/1.0/vts/
      functional/VtsHalWifiKeystoreV1_0TargetTest.cpp

Change-Id: Ic6eb5748e0e19b64a44c4bdf88a7074f7367db3d
2019-01-29 11:16:53 -08:00

313 lines
7.5 KiB
Text

cc_defaults {
name: "keystore_defaults",
cflags: [
"-Wall",
"-Werror",
"-Wextra",
"-Wunused",
],
sanitize: {
misc_undefined: ["integer"],
},
clang: true,
}
cc_binary {
name: "keystore",
defaults: ["keystore_defaults"],
srcs: [
":IKeyAttestationApplicationIdProvider.aidl",
"KeyStore.cpp",
"auth_token_table.cpp",
"blob.cpp",
"confirmation_manager.cpp",
"grant_store.cpp",
"key_config.proto",
"key_proto_handler.cpp",
"key_store_service.cpp",
"keyblob_utils.cpp",
"keymaster_enforcement.cpp",
"keymaster_worker.cpp",
"keystore_attestation_id.cpp",
"keystore_main.cpp",
"keystore_utils.cpp",
"legacy_keymaster_device_wrapper.cpp",
"operation.cpp",
"operation_config.proto",
"operation_proto_handler.cpp",
"permissions.cpp",
"user_state.cpp",
],
shared_libs: [
"android.hardware.confirmationui@1.0",
"android.hardware.keymaster@3.0",
"android.hardware.keymaster@4.0",
"android.system.wifi.keystore@1.0",
"libbase",
"libbinder",
"libcrypto",
"libcutils",
"libhardware",
"libhidlbase",
"libhidltransport",
"libhwbinder",
"libkeymaster4support",
"libkeymaster_messages",
"libkeymaster_portable",
"libkeystore_aidl",
"libkeystore_binder",
"libkeystore_parcelables",
"liblog",
"libprotobuf-cpp-lite",
"libselinux",
"libservices",
"libsoftkeymasterdevice",
"libutils",
"libwifikeystorehal",
],
init_rc: ["keystore.rc"],
aidl: {
include_dirs: ["frameworks/base/core/java/"],
},
product_variables: {
pdk: {
enabled: false,
},
debuggable: {
cflags: [
// Allow VTS tests running as root to have
// additional permissions.
"-DGRANT_ROOT_ALL_PERMISSIONS",
],
},
},
required: ["keystore_cli_v2"],
}
cc_binary {
name: "keystore_cli",
defaults: ["keystore_defaults"],
srcs: ["keystore_cli.cpp"],
shared_libs: [
"android.hardware.keymaster@4.0",
"libbinder",
"libcrypto",
"libcutils",
"libhidlbase",
"libhwbinder",
"libkeystore_aidl", // for IKeyStoreService.asInterface()
"libkeystore_binder",
"libkeystore_parcelables",
"liblog",
"libutils",
],
}
cc_binary {
name: "keystore_cli_v2",
defaults: ["keystore_defaults"],
cflags: [
"-DKEYMASTER_NAME_TAGS",
"-Wno-unused-parameter",
],
srcs: ["keystore_cli_v2.cpp"],
shared_libs: [
"android.hardware.confirmationui@1.0",
"libbinder",
"android.hardware.keymaster@4.0",
"libchrome",
"libutils",
"libhidlbase",
"libhwbinder",
"libkeymaster4support",
"libkeystore_aidl",
"libkeystore_binder",
"libkeystore_parcelables",
],
local_include_dirs: ["include"],
}
cc_library_shared {
name: "libkeystore_parcelables",
defaults: ["keystore_defaults"],
export_include_dirs: ["include"],
srcs: [
"KeyAttestationApplicationId.cpp",
"KeyAttestationPackageInfo.cpp",
"KeymasterArguments.cpp",
"keystore_aidl_hidl_marshalling_utils.cpp",
"KeystoreResponse.cpp",
"OperationResult.cpp",
"Signature.cpp",
],
shared_libs: [
"android.hardware.keymaster@4.0",
"libbinder",
"libhardware",
"libhidlbase",
"libhwbinder",
"libkeymaster4support",
"liblog",
"libprotobuf-cpp-lite",
"libutils",
],
export_shared_lib_headers: [
"android.hardware.keymaster@4.0",
"libbinder",
"libhidlbase",
"libhwbinder",
"libkeymaster4support",
],
}
// Library for keystore clients
cc_library_shared {
name: "libkeystore_binder",
defaults: ["keystore_defaults"],
srcs: [
"keyblob_utils.cpp",
"keystore_client.proto",
"keystore_client_impl.cpp",
"keystore_get.cpp",
],
shared_libs: [
"android.hardware.keymaster@4.0",
"libbinder",
"libhidlbase",
"libhwbinder",
"libkeymaster4support",
"libkeystore_aidl",
"libkeystore_parcelables",
"liblog",
"libprotobuf-cpp-lite",
"libutils",
],
proto: {
type: "lite",
export_proto_headers: true,
},
aidl: {
export_aidl_headers: true,
include_dirs: ["frameworks/base/core/java/"],
},
export_include_dirs: ["include"],
export_shared_lib_headers: [
"android.hardware.keymaster@4.0",
"libbinder",
"libhidlbase",
"libhwbinder",
"libkeystore_aidl",
"libkeystore_parcelables",
],
}
// Library for keystore clients using the WiFi HIDL interface
cc_library_shared {
name: "libkeystore-wifi-hidl",
defaults: ["keystore_defaults"],
srcs: ["keystore_get_wifi_hidl.cpp"],
shared_libs: [
"android.system.wifi.keystore@1.0",
"libbase",
"libhidlbase",
"libhidltransport",
"liblog",
"libutils",
],
export_include_dirs: ["include"],
vendor: true,
}
// Library for unit tests
cc_library_static {
name: "libkeystore_test",
defaults: ["keystore_defaults"],
srcs: [
":IKeyAttestationApplicationIdProvider.aidl",
"auth_token_table.cpp",
"blob.cpp",
"keystore_attestation_id.cpp",
"KeyAttestationApplicationId.cpp",
"KeyAttestationPackageInfo.cpp",
"Signature.cpp",
],
cflags: [ "-O0", ],
static_libs: ["libgtest_main"],
shared_libs: [
"android.hardware.keymaster@4.0",
"libbinder",
"libcrypto",
"libhidlbase",
"libhwbinder",
"libkeymaster4support",
"libutils",
"libkeystore_aidl",
"libkeystore_parcelables",
],
export_shared_lib_headers: [
"android.hardware.keymaster@4.0",
"libhidlbase",
"libhwbinder",
"libkeymaster4support",
],
aidl: {
include_dirs: ["frameworks/base/core/java/"],
},
export_include_dirs: ["include"],
}
filegroup {
name: "keystore_aidl",
srcs: [
"binder/android/security/IConfirmationPromptCallback.aidl",
"binder/android/security/keystore/IKeystoreCertificateChainCallback.aidl",
"binder/android/security/keystore/IKeystoreExportKeyCallback.aidl",
"binder/android/security/keystore/IKeystoreKeyCharacteristicsCallback.aidl",
"binder/android/security/keystore/IKeystoreOperationResultCallback.aidl",
"binder/android/security/keystore/IKeystoreResponseCallback.aidl",
"binder/android/security/keystore/IKeystoreService.aidl",
],
path: "binder",
}
cc_library_shared {
name: "libkeystore_aidl",
srcs: [":keystore_aidl"],
aidl: {
export_aidl_headers: true,
include_dirs: [
"system/security/keystore/binder",
],
},
shared_libs: [
"libbinder",
"libcutils",
"libhardware",
"libhidlbase",
"libhidltransport",
"libhwbinder",
"libkeystore_parcelables",
"liblog",
"libselinux",
"libutils",
],
export_shared_lib_headers: [
"libbinder",
"libkeystore_parcelables",
],
}