Loading system/btif/src/bluetooth.cc +6 −3 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ #include "common/address_obfuscator.h" #include "common/metric_id_allocator.h" #include "common/metrics.h" #include "common/os_utils.h" #include "device/include/interop.h" #include "gd/common/init_flags.h" #include "main/shim/dumpsys.h" Loading Loading @@ -189,11 +190,13 @@ static int disable(void) { static void cleanup(void) { stack_manager_get_interface()->clean_up_stack(); } bool is_restricted_mode() { return restricted_mode; } bool is_common_criteria_mode() { return common_criteria_mode; } bool is_common_criteria_mode() { return is_bluetooth_uid() && common_criteria_mode; } // if common criteria mode disable, will always return // CONFIG_COMPARE_ALL_PASS(0b11) indicate don't check config checksum. int get_common_criteria_config_compare_result() { return common_criteria_mode ? common_criteria_config_compare_result return is_common_criteria_mode() ? common_criteria_config_compare_result : CONFIG_COMPARE_ALL_PASS; } Loading system/btif/src/btif_config.cc +3 −7 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ #include "btif_keystore.h" #include "common/address_obfuscator.h" #include "common/metric_id_allocator.h" #include "common/os_utils.h" #include "main/shim/config.h" #include "main/shim/shim.h" #include "osi/include/alarm.h" Loading Loading @@ -96,9 +95,6 @@ static bool config_checksum_pass(int check_bit) { return ((get_common_criteria_config_compare_result() & check_bit) == check_bit); } static bool btif_is_common_criteria_mode() { return is_bluetooth_uid() && is_common_criteria_mode(); } static bool btif_in_encrypt_key_name_list(std::string key); static const int CONFIG_FILE_COMPARE_PASS = 1; Loading Loading @@ -558,7 +554,7 @@ bool btif_config_get_bin(const std::string& section, const std::string& key, sscanf(ptr, "%02hhx", &value[*length]); } if (btif_is_common_criteria_mode()) { if (is_common_criteria_mode()) { if (!value_str_from_config->empty() && in_encrypt_key_name_list && !is_key_encrypted) { get_bluetooth_keystore_interface()->set_encrypt_key_or_remove_key( Loading Loading @@ -611,7 +607,7 @@ bool btif_config_set_bin(const std::string& section, const std::string& key, } std::string value_str; if ((length > 0) && btif_is_common_criteria_mode() && if ((length > 0) && is_common_criteria_mode() && btif_in_encrypt_key_name_list(key)) { get_bluetooth_keystore_interface()->set_encrypt_key_or_remove_key( section + "-" + key, str); Loading Loading @@ -721,7 +717,7 @@ static void btif_config_write(UNUSED_ATTR uint16_t event, std::unique_lock<std::recursive_mutex> lock(config_lock); rename(CONFIG_FILE_PATH, CONFIG_BACKUP_PATH); config_save(btif_config_cache.PersistentSectionCopy(), CONFIG_FILE_PATH); if (btif_is_common_criteria_mode()) { if (is_common_criteria_mode()) { get_bluetooth_keystore_interface()->set_encrypt_key_or_remove_key( CONFIG_FILE_PREFIX, CONFIG_FILE_HASH); } Loading system/build/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,9 @@ fluoride_defaults { "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", ], cflags: [ "-DOS_ANDROID", ], }, }, } Loading Loading
system/btif/src/bluetooth.cc +6 −3 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ #include "common/address_obfuscator.h" #include "common/metric_id_allocator.h" #include "common/metrics.h" #include "common/os_utils.h" #include "device/include/interop.h" #include "gd/common/init_flags.h" #include "main/shim/dumpsys.h" Loading Loading @@ -189,11 +190,13 @@ static int disable(void) { static void cleanup(void) { stack_manager_get_interface()->clean_up_stack(); } bool is_restricted_mode() { return restricted_mode; } bool is_common_criteria_mode() { return common_criteria_mode; } bool is_common_criteria_mode() { return is_bluetooth_uid() && common_criteria_mode; } // if common criteria mode disable, will always return // CONFIG_COMPARE_ALL_PASS(0b11) indicate don't check config checksum. int get_common_criteria_config_compare_result() { return common_criteria_mode ? common_criteria_config_compare_result return is_common_criteria_mode() ? common_criteria_config_compare_result : CONFIG_COMPARE_ALL_PASS; } Loading
system/btif/src/btif_config.cc +3 −7 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ #include "btif_keystore.h" #include "common/address_obfuscator.h" #include "common/metric_id_allocator.h" #include "common/os_utils.h" #include "main/shim/config.h" #include "main/shim/shim.h" #include "osi/include/alarm.h" Loading Loading @@ -96,9 +95,6 @@ static bool config_checksum_pass(int check_bit) { return ((get_common_criteria_config_compare_result() & check_bit) == check_bit); } static bool btif_is_common_criteria_mode() { return is_bluetooth_uid() && is_common_criteria_mode(); } static bool btif_in_encrypt_key_name_list(std::string key); static const int CONFIG_FILE_COMPARE_PASS = 1; Loading Loading @@ -558,7 +554,7 @@ bool btif_config_get_bin(const std::string& section, const std::string& key, sscanf(ptr, "%02hhx", &value[*length]); } if (btif_is_common_criteria_mode()) { if (is_common_criteria_mode()) { if (!value_str_from_config->empty() && in_encrypt_key_name_list && !is_key_encrypted) { get_bluetooth_keystore_interface()->set_encrypt_key_or_remove_key( Loading Loading @@ -611,7 +607,7 @@ bool btif_config_set_bin(const std::string& section, const std::string& key, } std::string value_str; if ((length > 0) && btif_is_common_criteria_mode() && if ((length > 0) && is_common_criteria_mode() && btif_in_encrypt_key_name_list(key)) { get_bluetooth_keystore_interface()->set_encrypt_key_or_remove_key( section + "-" + key, str); Loading Loading @@ -721,7 +717,7 @@ static void btif_config_write(UNUSED_ATTR uint16_t event, std::unique_lock<std::recursive_mutex> lock(config_lock); rename(CONFIG_FILE_PATH, CONFIG_BACKUP_PATH); config_save(btif_config_cache.PersistentSectionCopy(), CONFIG_FILE_PATH); if (btif_is_common_criteria_mode()) { if (is_common_criteria_mode()) { get_bluetooth_keystore_interface()->set_encrypt_key_or_remove_key( CONFIG_FILE_PREFIX, CONFIG_FILE_HASH); } Loading
system/build/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,9 @@ fluoride_defaults { "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", ], cflags: [ "-DOS_ANDROID", ], }, }, } Loading