Loading system/btif/include/btif_api.h +18 −2 Original line number Original line Diff line number Diff line Loading @@ -105,7 +105,7 @@ bool is_restricted_mode(void); /******************************************************************************* /******************************************************************************* * * * Function is_single_user_mode_ * Function is_niap_mode_ * * * Description Checks if BT was enabled in single user mode. In this * Description Checks if BT was enabled in single user mode. In this * mode, use of keystore for key attestation of LTK is limitee * mode, use of keystore for key attestation of LTK is limitee Loading @@ -114,7 +114,23 @@ bool is_restricted_mode(void); * Returns bool * Returns bool * * ******************************************************************************/ ******************************************************************************/ bool is_single_user_mode(void); bool is_niap_mode(void); /******************************************************************************* * * Function get_niap_config_compare_result * * Description Get the niap config compare result for confirming the config * checksum compare result. When the niap mode doesn't enable, * it should be all pass (0b11). * Bit define: * CONFIG_FILE_COMPARE_PASS = 0b01 * CONFIG_BACKUP_COMPARE_PASS = 0b10 * * Returns int * ******************************************************************************/ int get_niap_config_compare_result(void); /******************************************************************************* /******************************************************************************* * * Loading system/btif/src/bluetooth.cc +16 −6 Original line number Original line Diff line number Diff line Loading @@ -84,7 +84,9 @@ using bluetooth::hearing_aid::HearingAidInterface; bt_callbacks_t* bt_hal_cbacks = NULL; bt_callbacks_t* bt_hal_cbacks = NULL; bool restricted_mode = false; bool restricted_mode = false; bool single_user_mode = false; bool niap_mode = false; const int CONFIG_COMPARE_ALL_PASS = 0b11; int niap_config_compare_result = CONFIG_COMPARE_ALL_PASS; /******************************************************************************* /******************************************************************************* * Externs * Externs Loading Loading @@ -137,9 +139,10 @@ static bool is_profile(const char* p1, const char* p2) { ****************************************************************************/ ****************************************************************************/ static int init(bt_callbacks_t* callbacks, bool start_restricted, static int init(bt_callbacks_t* callbacks, bool start_restricted, bool is_single_user_mode) { bool is_niap_mode, int config_compare_result) { LOG_INFO(LOG_TAG, "%s: start restricted = %d ; single user = %d", __func__, LOG_INFO(LOG_TAG, start_restricted, is_single_user_mode); "%s: start restricted = %d ; niap = %d, config compare result = %d", __func__, start_restricted, is_niap_mode, config_compare_result); if (bluetooth::shim::is_gd_shim_enabled()) { if (bluetooth::shim::is_gd_shim_enabled()) { LOG_INFO(LOG_TAG, "%s Enable Gd bluetooth functionality", __func__); LOG_INFO(LOG_TAG, "%s Enable Gd bluetooth functionality", __func__); Loading @@ -155,7 +158,9 @@ static int init(bt_callbacks_t* callbacks, bool start_restricted, bt_hal_cbacks = callbacks; bt_hal_cbacks = callbacks; restricted_mode = start_restricted; restricted_mode = start_restricted; single_user_mode = is_single_user_mode; niap_mode = is_niap_mode; niap_config_compare_result = config_compare_result; stack_manager_get_interface()->init_stack(); stack_manager_get_interface()->init_stack(); btif_debug_init(); btif_debug_init(); return BT_STATUS_SUCCESS; return BT_STATUS_SUCCESS; Loading @@ -178,7 +183,12 @@ static int disable(void) { static void cleanup(void) { stack_manager_get_interface()->clean_up_stack(); } static void cleanup(void) { stack_manager_get_interface()->clean_up_stack(); } bool is_restricted_mode() { return restricted_mode; } bool is_restricted_mode() { return restricted_mode; } bool is_single_user_mode() { return single_user_mode; } bool is_niap_mode() { return niap_mode; } // if niap mode disable, will always return CONFIG_COMPARE_ALL_PASS(0b11) // indicate don't check config checksum. int get_niap_config_compare_result() { return niap_mode ? niap_config_compare_result : CONFIG_COMPARE_ALL_PASS; } static int get_adapter_properties(void) { static int get_adapter_properties(void) { /* sanity check */ /* sanity check */ Loading system/include/hardware/bluetooth.h +5 −3 Original line number Original line Diff line number Diff line Loading @@ -469,10 +469,12 @@ typedef struct { * The |start_restricted| flag inits the adapter in restricted mode. In * The |start_restricted| flag inits the adapter in restricted mode. In * restricted mode, bonds that are created are marked as restricted in the * restricted mode, bonds that are created are marked as restricted in the * config file. These devices are deleted upon leaving restricted mode. * config file. These devices are deleted upon leaving restricted mode. * The |is_single_user_mode| flag inits the adapter in NIAP mode. * The |is_niap_mode| flag inits the adapter in NIAP mode. * The |config_compare_result| flag show the config checksum check result if * is in NIAP mode. */ */ int (*init)(bt_callbacks_t* callbacks, bool guest_mode, int (*init)(bt_callbacks_t* callbacks, bool guest_mode, bool is_niap_mode, bool is_single_user_mode); int config_compare_result); /** Enable Bluetooth. */ /** Enable Bluetooth. */ int (*enable)(); int (*enable)(); Loading system/service/hal/bluetooth_interface.cc +1 −1 Original line number Original line Diff line number Diff line Loading @@ -254,7 +254,7 @@ class BluetoothInterfaceImpl : public BluetoothInterface { // Initialize the Bluetooth interface. Set up the adapter (Bluetooth DM) API // Initialize the Bluetooth interface. Set up the adapter (Bluetooth DM) API // callbacks. // callbacks. status = hal_iface_->init(&bt_callbacks, false, false); status = hal_iface_->init(&bt_callbacks, false, false, 0); if (status != BT_STATUS_SUCCESS) { if (status != BT_STATUS_SUCCESS) { LOG(ERROR) << "Failed to initialize Bluetooth stack"; LOG(ERROR) << "Failed to initialize Bluetooth stack"; return false; return false; Loading system/test/headless/headless.cc +1 −1 Original line number Original line Diff line number Diff line Loading @@ -141,7 +141,7 @@ bt_os_callouts_t bt_os_callouts{ void HeadlessStack::SetUp() { void HeadlessStack::SetUp() { LOG(INFO) << __func__ << " Entry"; LOG(INFO) << __func__ << " Entry"; int status = bluetoothInterface.init(&bt_callbacks, false, false); int status = bluetoothInterface.init(&bt_callbacks, false, false, 0); (status == BT_STATUS_SUCCESS) (status == BT_STATUS_SUCCESS) ? LOG(INFO) << __func__ << " Initialized bluetooth callbacks" ? LOG(INFO) << __func__ << " Initialized bluetooth callbacks" : LOG(FATAL) << "Failed to initialize Bluetooth stack"; : LOG(FATAL) << "Failed to initialize Bluetooth stack"; Loading Loading
system/btif/include/btif_api.h +18 −2 Original line number Original line Diff line number Diff line Loading @@ -105,7 +105,7 @@ bool is_restricted_mode(void); /******************************************************************************* /******************************************************************************* * * * Function is_single_user_mode_ * Function is_niap_mode_ * * * Description Checks if BT was enabled in single user mode. In this * Description Checks if BT was enabled in single user mode. In this * mode, use of keystore for key attestation of LTK is limitee * mode, use of keystore for key attestation of LTK is limitee Loading @@ -114,7 +114,23 @@ bool is_restricted_mode(void); * Returns bool * Returns bool * * ******************************************************************************/ ******************************************************************************/ bool is_single_user_mode(void); bool is_niap_mode(void); /******************************************************************************* * * Function get_niap_config_compare_result * * Description Get the niap config compare result for confirming the config * checksum compare result. When the niap mode doesn't enable, * it should be all pass (0b11). * Bit define: * CONFIG_FILE_COMPARE_PASS = 0b01 * CONFIG_BACKUP_COMPARE_PASS = 0b10 * * Returns int * ******************************************************************************/ int get_niap_config_compare_result(void); /******************************************************************************* /******************************************************************************* * * Loading
system/btif/src/bluetooth.cc +16 −6 Original line number Original line Diff line number Diff line Loading @@ -84,7 +84,9 @@ using bluetooth::hearing_aid::HearingAidInterface; bt_callbacks_t* bt_hal_cbacks = NULL; bt_callbacks_t* bt_hal_cbacks = NULL; bool restricted_mode = false; bool restricted_mode = false; bool single_user_mode = false; bool niap_mode = false; const int CONFIG_COMPARE_ALL_PASS = 0b11; int niap_config_compare_result = CONFIG_COMPARE_ALL_PASS; /******************************************************************************* /******************************************************************************* * Externs * Externs Loading Loading @@ -137,9 +139,10 @@ static bool is_profile(const char* p1, const char* p2) { ****************************************************************************/ ****************************************************************************/ static int init(bt_callbacks_t* callbacks, bool start_restricted, static int init(bt_callbacks_t* callbacks, bool start_restricted, bool is_single_user_mode) { bool is_niap_mode, int config_compare_result) { LOG_INFO(LOG_TAG, "%s: start restricted = %d ; single user = %d", __func__, LOG_INFO(LOG_TAG, start_restricted, is_single_user_mode); "%s: start restricted = %d ; niap = %d, config compare result = %d", __func__, start_restricted, is_niap_mode, config_compare_result); if (bluetooth::shim::is_gd_shim_enabled()) { if (bluetooth::shim::is_gd_shim_enabled()) { LOG_INFO(LOG_TAG, "%s Enable Gd bluetooth functionality", __func__); LOG_INFO(LOG_TAG, "%s Enable Gd bluetooth functionality", __func__); Loading @@ -155,7 +158,9 @@ static int init(bt_callbacks_t* callbacks, bool start_restricted, bt_hal_cbacks = callbacks; bt_hal_cbacks = callbacks; restricted_mode = start_restricted; restricted_mode = start_restricted; single_user_mode = is_single_user_mode; niap_mode = is_niap_mode; niap_config_compare_result = config_compare_result; stack_manager_get_interface()->init_stack(); stack_manager_get_interface()->init_stack(); btif_debug_init(); btif_debug_init(); return BT_STATUS_SUCCESS; return BT_STATUS_SUCCESS; Loading @@ -178,7 +183,12 @@ static int disable(void) { static void cleanup(void) { stack_manager_get_interface()->clean_up_stack(); } static void cleanup(void) { stack_manager_get_interface()->clean_up_stack(); } bool is_restricted_mode() { return restricted_mode; } bool is_restricted_mode() { return restricted_mode; } bool is_single_user_mode() { return single_user_mode; } bool is_niap_mode() { return niap_mode; } // if niap mode disable, will always return CONFIG_COMPARE_ALL_PASS(0b11) // indicate don't check config checksum. int get_niap_config_compare_result() { return niap_mode ? niap_config_compare_result : CONFIG_COMPARE_ALL_PASS; } static int get_adapter_properties(void) { static int get_adapter_properties(void) { /* sanity check */ /* sanity check */ Loading
system/include/hardware/bluetooth.h +5 −3 Original line number Original line Diff line number Diff line Loading @@ -469,10 +469,12 @@ typedef struct { * The |start_restricted| flag inits the adapter in restricted mode. In * The |start_restricted| flag inits the adapter in restricted mode. In * restricted mode, bonds that are created are marked as restricted in the * restricted mode, bonds that are created are marked as restricted in the * config file. These devices are deleted upon leaving restricted mode. * config file. These devices are deleted upon leaving restricted mode. * The |is_single_user_mode| flag inits the adapter in NIAP mode. * The |is_niap_mode| flag inits the adapter in NIAP mode. * The |config_compare_result| flag show the config checksum check result if * is in NIAP mode. */ */ int (*init)(bt_callbacks_t* callbacks, bool guest_mode, int (*init)(bt_callbacks_t* callbacks, bool guest_mode, bool is_niap_mode, bool is_single_user_mode); int config_compare_result); /** Enable Bluetooth. */ /** Enable Bluetooth. */ int (*enable)(); int (*enable)(); Loading
system/service/hal/bluetooth_interface.cc +1 −1 Original line number Original line Diff line number Diff line Loading @@ -254,7 +254,7 @@ class BluetoothInterfaceImpl : public BluetoothInterface { // Initialize the Bluetooth interface. Set up the adapter (Bluetooth DM) API // Initialize the Bluetooth interface. Set up the adapter (Bluetooth DM) API // callbacks. // callbacks. status = hal_iface_->init(&bt_callbacks, false, false); status = hal_iface_->init(&bt_callbacks, false, false, 0); if (status != BT_STATUS_SUCCESS) { if (status != BT_STATUS_SUCCESS) { LOG(ERROR) << "Failed to initialize Bluetooth stack"; LOG(ERROR) << "Failed to initialize Bluetooth stack"; return false; return false; Loading
system/test/headless/headless.cc +1 −1 Original line number Original line Diff line number Diff line Loading @@ -141,7 +141,7 @@ bt_os_callouts_t bt_os_callouts{ void HeadlessStack::SetUp() { void HeadlessStack::SetUp() { LOG(INFO) << __func__ << " Entry"; LOG(INFO) << __func__ << " Entry"; int status = bluetoothInterface.init(&bt_callbacks, false, false); int status = bluetoothInterface.init(&bt_callbacks, false, false, 0); (status == BT_STATUS_SUCCESS) (status == BT_STATUS_SUCCESS) ? LOG(INFO) << __func__ << " Initialized bluetooth callbacks" ? LOG(INFO) << __func__ << " Initialized bluetooth callbacks" : LOG(FATAL) << "Failed to initialize Bluetooth stack"; : LOG(FATAL) << "Failed to initialize Bluetooth stack"; Loading