Loading system/btif/Android.bp +17 −17 Original line number Diff line number Diff line Loading @@ -24,8 +24,8 @@ btifCommonIncludes = [ "packages/modules/Bluetooth/system/utils/include", "packages/modules/Bluetooth/system/include", "system/libhwbinder/include", "system/security/keystore/include", "hardware/interfaces/keymaster/4.0/support/include", //"system/security/keystore/include", //"hardware/interfaces/keymaster/4.0/support/include", ] // libbtif static library for target Loading Loading @@ -73,7 +73,7 @@ cc_library_static { "src/btif_hf_client.cc", "src/btif_hh.cc", "src/btif_hd.cc", "src/btif_keystore.cc", //"src/btif_keystore.cc", "src/btif_mce.cc", "src/btif_pan.cc", "src/btif_profile_queue.cc", Loading Loading @@ -107,12 +107,12 @@ cc_library_static { "libhidlbase", "libutils", "libcrypto", "android.hardware.keymaster@4.0", "android.hardware.keymaster@3.0", "libkeymaster4support", "libkeystore_aidl", "libkeystore_binder", "libkeystore_parcelables", //"android.hardware.keymaster@4.0", //"android.hardware.keymaster@3.0", //"libkeymaster4support", //"libkeystore_aidl", //"libkeystore_binder", //"libkeystore_parcelables", ], whole_static_libs: [ "avrcp-target-service", Loading @@ -135,7 +135,7 @@ cc_test { include_dirs: btifCommonIncludes, srcs: [ "test/btif_storage_test.cc", "test/btif_keystore_test.cc" //"test/btif_keystore_test.cc" ], header_libs: ["libbluetooth_headers"], shared_libs: [ Loading @@ -150,13 +150,13 @@ cc_test { "libprocessgroup", "libutils", "libcrypto", "android.hardware.keymaster@4.0", "android.hardware.keymaster@3.0", "libkeymaster4support", "libkeystore_aidl", "libkeystore_binder", "libkeystore_parcelables", "libbinder", //"android.hardware.keymaster@4.0", //"android.hardware.keymaster@3.0", //"libkeymaster4support", //"libkeystore_aidl", //"libkeystore_binder", //"libkeystore_parcelables", //"libbinder", ], static_libs: [ "libbt-bta", Loading system/btif/src/btif_config.cc +23 −21 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ #include "btif_api.h" #include "btif_common.h" #include "btif_config_transcode.h" #include "btif_keystore.h" //#include "btif_keystore.h" #include "btif_util.h" #include "common/address_obfuscator.h" #include "osi/include/alarm.h" Loading @@ -58,15 +58,15 @@ #define DISABLED "disabled" static const char* TIME_STRING_FORMAT = "%Y-%m-%d %H:%M:%S"; constexpr int kBufferSize = 400 * 10; // initial file is ~400B // constexpr int kBufferSize = 400 * 10; // initial file is ~400B static bool use_key_attestation() { /*static bool use_key_attestation() { return getuid() == AID_BLUETOOTH && is_single_user_mode(); } }*/ #define BT_CONFIG_METRICS_SECTION "Metrics" #define BT_CONFIG_METRICS_SALT_256BIT "Salt256Bit" using bluetooth::BtifKeystore; // using bluetooth::BtifKeystore; using bluetooth::common::AddressObfuscator; // TODO(armansito): Find a better way than searching by a hardcoded path. Loading @@ -93,9 +93,10 @@ static void btif_config_remove_restricted(config_t* config); static std::unique_ptr<config_t> btif_config_open(const char* filename, const char* checksum_filename); // Key attestation static std::string hash_file(const char* filename); static std::string read_checksum_file(const char* filename); static void write_checksum_file(const char* filename, const std::string& hash); // static std::string hash_file(const char* filename); // static std::string read_checksum_file(const char* filename); // static void write_checksum_file(const char* filename, const std::string& // hash); static enum ConfigSource { NOT_LOADED, Loading Loading @@ -176,16 +177,17 @@ static std::recursive_mutex config_lock; // protects operations on |config|. static std::unique_ptr<config_t> config; static alarm_t* config_timer; static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl); // static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl); // Module lifecycle functions static future_t* init(void) { std::unique_lock<std::recursive_mutex> lock(config_lock); if (is_factory_reset() || if (is_factory_reset()) delete_config_files(); /*if (is_factory_reset() || (use_key_attestation() && !btif_keystore.DoesKeyExist())) delete_config_files(); delete_config_files();*/ std::string file_source; Loading Loading @@ -264,7 +266,7 @@ error: } static std::unique_ptr<config_t> btif_config_open(const char* filename, const char* checksum_filename) { // START KEY ATTESTATION /*// START KEY ATTESTATION // Get hash of current file std::string current_hash = hash_file(filename); // Get stored hash Loading @@ -280,7 +282,7 @@ static std::unique_ptr<config_t> btif_config_open(const char* filename, const ch if (current_hash != stored_hash) { return nullptr; } // END KEY ATTESTATION // END KEY ATTESTATION*/ std::unique_ptr<config_t> config = config_new(filename); if (!config) return nullptr; Loading Loading @@ -514,11 +516,11 @@ bool btif_config_clear(void) { bool ret = config_save(*config, CONFIG_FILE_PATH); btif_config_source = RESET; // Save encrypted hash /*// Save encrypted hash std::string current_hash = hash_file(CONFIG_FILE_PATH); if (!current_hash.empty()) { write_checksum_file(CONFIG_FILE_CHECKSUM_PATH, current_hash); } }*/ return ret; } Loading @@ -541,11 +543,11 @@ static void btif_config_write(UNUSED_ATTR uint16_t event, std::unique_ptr<config_t> config_paired = config_new_clone(*config); btif_config_remove_unpaired(config_paired.get()); config_save(*config_paired, CONFIG_FILE_PATH); // Save hash /*// Save hash std::string current_hash = hash_file(CONFIG_FILE_PATH); if (!current_hash.empty()) { write_checksum_file(CONFIG_FILE_CHECKSUM_PATH, current_hash); } }*/ } static void btif_config_remove_unpaired(config_t* conf) { Loading Loading @@ -637,12 +639,12 @@ static bool is_factory_reset(void) { static void delete_config_files(void) { remove(CONFIG_FILE_PATH); remove(CONFIG_BACKUP_PATH); remove(CONFIG_FILE_CHECKSUM_PATH); remove(CONFIG_BACKUP_CHECKSUM_PATH); // remove(CONFIG_FILE_CHECKSUM_PATH); // remove(CONFIG_BACKUP_CHECKSUM_PATH); osi_property_set("persist.bluetooth.factoryreset", "false"); } static std::string hash_file(const char* filename) { /*static std::string hash_file(const char* filename) { if (!use_key_attestation()) { LOG(INFO) << __func__ << ": Disabled for multi-user"; return DISABLED; Loading Loading @@ -698,4 +700,4 @@ static void write_checksum_file(const char* checksum_filename, << __func__ << ": Failed encrypting checksum"; CHECK(checksum_save(encrypted_checksum, checksum_filename)) << __func__ << ": Failed to save checksum!"; } }*/ system/main/Android.bp +3 −6 Original line number Diff line number Diff line Loading @@ -69,12 +69,9 @@ cc_library_shared { "libtinyxml2", "libz", "libcrypto", "android.hardware.keymaster@4.0", "android.hardware.keymaster@3.0", "libkeymaster4support", "libkeystore_aidl", "libkeystore_binder", "libkeystore_parcelables", //"android.hardware.keymaster@4.0", //"libkeymaster4support", //"libkeystore_binder", ], static_libs: [ "libbt-sbc-decoder", Loading Loading
system/btif/Android.bp +17 −17 Original line number Diff line number Diff line Loading @@ -24,8 +24,8 @@ btifCommonIncludes = [ "packages/modules/Bluetooth/system/utils/include", "packages/modules/Bluetooth/system/include", "system/libhwbinder/include", "system/security/keystore/include", "hardware/interfaces/keymaster/4.0/support/include", //"system/security/keystore/include", //"hardware/interfaces/keymaster/4.0/support/include", ] // libbtif static library for target Loading Loading @@ -73,7 +73,7 @@ cc_library_static { "src/btif_hf_client.cc", "src/btif_hh.cc", "src/btif_hd.cc", "src/btif_keystore.cc", //"src/btif_keystore.cc", "src/btif_mce.cc", "src/btif_pan.cc", "src/btif_profile_queue.cc", Loading Loading @@ -107,12 +107,12 @@ cc_library_static { "libhidlbase", "libutils", "libcrypto", "android.hardware.keymaster@4.0", "android.hardware.keymaster@3.0", "libkeymaster4support", "libkeystore_aidl", "libkeystore_binder", "libkeystore_parcelables", //"android.hardware.keymaster@4.0", //"android.hardware.keymaster@3.0", //"libkeymaster4support", //"libkeystore_aidl", //"libkeystore_binder", //"libkeystore_parcelables", ], whole_static_libs: [ "avrcp-target-service", Loading @@ -135,7 +135,7 @@ cc_test { include_dirs: btifCommonIncludes, srcs: [ "test/btif_storage_test.cc", "test/btif_keystore_test.cc" //"test/btif_keystore_test.cc" ], header_libs: ["libbluetooth_headers"], shared_libs: [ Loading @@ -150,13 +150,13 @@ cc_test { "libprocessgroup", "libutils", "libcrypto", "android.hardware.keymaster@4.0", "android.hardware.keymaster@3.0", "libkeymaster4support", "libkeystore_aidl", "libkeystore_binder", "libkeystore_parcelables", "libbinder", //"android.hardware.keymaster@4.0", //"android.hardware.keymaster@3.0", //"libkeymaster4support", //"libkeystore_aidl", //"libkeystore_binder", //"libkeystore_parcelables", //"libbinder", ], static_libs: [ "libbt-bta", Loading
system/btif/src/btif_config.cc +23 −21 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ #include "btif_api.h" #include "btif_common.h" #include "btif_config_transcode.h" #include "btif_keystore.h" //#include "btif_keystore.h" #include "btif_util.h" #include "common/address_obfuscator.h" #include "osi/include/alarm.h" Loading @@ -58,15 +58,15 @@ #define DISABLED "disabled" static const char* TIME_STRING_FORMAT = "%Y-%m-%d %H:%M:%S"; constexpr int kBufferSize = 400 * 10; // initial file is ~400B // constexpr int kBufferSize = 400 * 10; // initial file is ~400B static bool use_key_attestation() { /*static bool use_key_attestation() { return getuid() == AID_BLUETOOTH && is_single_user_mode(); } }*/ #define BT_CONFIG_METRICS_SECTION "Metrics" #define BT_CONFIG_METRICS_SALT_256BIT "Salt256Bit" using bluetooth::BtifKeystore; // using bluetooth::BtifKeystore; using bluetooth::common::AddressObfuscator; // TODO(armansito): Find a better way than searching by a hardcoded path. Loading @@ -93,9 +93,10 @@ static void btif_config_remove_restricted(config_t* config); static std::unique_ptr<config_t> btif_config_open(const char* filename, const char* checksum_filename); // Key attestation static std::string hash_file(const char* filename); static std::string read_checksum_file(const char* filename); static void write_checksum_file(const char* filename, const std::string& hash); // static std::string hash_file(const char* filename); // static std::string read_checksum_file(const char* filename); // static void write_checksum_file(const char* filename, const std::string& // hash); static enum ConfigSource { NOT_LOADED, Loading Loading @@ -176,16 +177,17 @@ static std::recursive_mutex config_lock; // protects operations on |config|. static std::unique_ptr<config_t> config; static alarm_t* config_timer; static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl); // static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl); // Module lifecycle functions static future_t* init(void) { std::unique_lock<std::recursive_mutex> lock(config_lock); if (is_factory_reset() || if (is_factory_reset()) delete_config_files(); /*if (is_factory_reset() || (use_key_attestation() && !btif_keystore.DoesKeyExist())) delete_config_files(); delete_config_files();*/ std::string file_source; Loading Loading @@ -264,7 +266,7 @@ error: } static std::unique_ptr<config_t> btif_config_open(const char* filename, const char* checksum_filename) { // START KEY ATTESTATION /*// START KEY ATTESTATION // Get hash of current file std::string current_hash = hash_file(filename); // Get stored hash Loading @@ -280,7 +282,7 @@ static std::unique_ptr<config_t> btif_config_open(const char* filename, const ch if (current_hash != stored_hash) { return nullptr; } // END KEY ATTESTATION // END KEY ATTESTATION*/ std::unique_ptr<config_t> config = config_new(filename); if (!config) return nullptr; Loading Loading @@ -514,11 +516,11 @@ bool btif_config_clear(void) { bool ret = config_save(*config, CONFIG_FILE_PATH); btif_config_source = RESET; // Save encrypted hash /*// Save encrypted hash std::string current_hash = hash_file(CONFIG_FILE_PATH); if (!current_hash.empty()) { write_checksum_file(CONFIG_FILE_CHECKSUM_PATH, current_hash); } }*/ return ret; } Loading @@ -541,11 +543,11 @@ static void btif_config_write(UNUSED_ATTR uint16_t event, std::unique_ptr<config_t> config_paired = config_new_clone(*config); btif_config_remove_unpaired(config_paired.get()); config_save(*config_paired, CONFIG_FILE_PATH); // Save hash /*// Save hash std::string current_hash = hash_file(CONFIG_FILE_PATH); if (!current_hash.empty()) { write_checksum_file(CONFIG_FILE_CHECKSUM_PATH, current_hash); } }*/ } static void btif_config_remove_unpaired(config_t* conf) { Loading Loading @@ -637,12 +639,12 @@ static bool is_factory_reset(void) { static void delete_config_files(void) { remove(CONFIG_FILE_PATH); remove(CONFIG_BACKUP_PATH); remove(CONFIG_FILE_CHECKSUM_PATH); remove(CONFIG_BACKUP_CHECKSUM_PATH); // remove(CONFIG_FILE_CHECKSUM_PATH); // remove(CONFIG_BACKUP_CHECKSUM_PATH); osi_property_set("persist.bluetooth.factoryreset", "false"); } static std::string hash_file(const char* filename) { /*static std::string hash_file(const char* filename) { if (!use_key_attestation()) { LOG(INFO) << __func__ << ": Disabled for multi-user"; return DISABLED; Loading Loading @@ -698,4 +700,4 @@ static void write_checksum_file(const char* checksum_filename, << __func__ << ": Failed encrypting checksum"; CHECK(checksum_save(encrypted_checksum, checksum_filename)) << __func__ << ": Failed to save checksum!"; } }*/
system/main/Android.bp +3 −6 Original line number Diff line number Diff line Loading @@ -69,12 +69,9 @@ cc_library_shared { "libtinyxml2", "libz", "libcrypto", "android.hardware.keymaster@4.0", "android.hardware.keymaster@3.0", "libkeymaster4support", "libkeystore_aidl", "libkeystore_binder", "libkeystore_parcelables", //"android.hardware.keymaster@4.0", //"libkeymaster4support", //"libkeystore_binder", ], static_libs: [ "libbt-sbc-decoder", Loading