Loading system/main/shim/hci_layer.cc +0 −14 Original line number Diff line number Diff line Loading @@ -70,20 +70,6 @@ bool register_event_code(bluetooth::hci::EventCode event_code) { // SCO case bluetooth::hci::EventCode::SYNCHRONOUS_CONNECTION_COMPLETE: case bluetooth::hci::EventCode::SYNCHRONOUS_CONNECTION_CHANGED: // SecurityEvents case bluetooth::hci::EventCode::ENCRYPTION_CHANGE: case bluetooth::hci::EventCode::PIN_CODE_REQUEST: case bluetooth::hci::EventCode::LINK_KEY_REQUEST: case bluetooth::hci::EventCode::LINK_KEY_NOTIFICATION: case bluetooth::hci::EventCode::ENCRYPTION_KEY_REFRESH_COMPLETE: case bluetooth::hci::EventCode::IO_CAPABILITY_REQUEST: case bluetooth::hci::EventCode::IO_CAPABILITY_RESPONSE: case bluetooth::hci::EventCode::REMOTE_OOB_DATA_REQUEST: case bluetooth::hci::EventCode::SIMPLE_PAIRING_COMPLETE: case bluetooth::hci::EventCode::USER_PASSKEY_NOTIFICATION: case bluetooth::hci::EventCode::USER_CONFIRMATION_REQUEST: case bluetooth::hci::EventCode::USER_PASSKEY_REQUEST: return true; default: return false; Loading system/stack/btm/btm_sec_cb.cc +14 −0 Original line number Diff line number Diff line Loading @@ -23,15 +23,20 @@ #include <cstdint> #include "hci/hci_layer.h" #include "hci/security_interface.h" #include "internal_include/bt_trace.h" #include "internal_include/stack_config.h" #include "main/shim/entry.h" #include "os/log.h" #include "osi/include/allocator.h" #include "osi/include/fixed_queue.h" #include "osi/include/list.h" #include "stack/btm/btm_dev.h" #include "stack/btm/security_device_record.h" #include "stack/btm/security_event_parser.h" #include "stack/include/bt_psm_types.h" #include "stack/include/main_thread.h" #include "types/raw_address.h" using namespace bluetooth; Loading Loading @@ -59,6 +64,10 @@ void tBTM_SEC_CB::Init(uint8_t initial_security_mode) { *((tBTM_SEC_DEV_REC*)ptr) = {}; osi_free(ptr); }); hci_ = bluetooth::shim::GetHciLayer()->GetSecurityInterface( get_main_thread()->BindOn( &event_parser, &bluetooth::stack::btm::SecurityEventParser::OnSecurityEvent)); } void tBTM_SEC_CB::Free() { Loading @@ -76,6 +85,11 @@ void tBTM_SEC_CB::Free() { alarm_free(execution_wait_timer); execution_wait_timer = nullptr; auto hci = bluetooth::shim::GetHciLayer(); for (auto event : hci::SecurityEvents) { hci->UnregisterEventHandler(event); } } tBTM_SEC_CB btm_sec_cb; Loading system/stack/btm/btm_sec_cb.h +8 −0 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ #include <cstdint> #include "hci/security_interface.h" #include "internal_include/bt_target.h" #include "osi/include/alarm.h" #include "osi/include/fixed_queue.h" #include "osi/include/list.h" #include "stack/btm/btm_sec_int_types.h" #include "stack/btm/security_device_record.h" #include "stack/btm/security_event_parser.h" #include "stack/include/bt_octets.h" #include "stack/include/security_client_callbacks.h" #include "types/raw_address.h" Loading @@ -43,6 +45,12 @@ class tBTM_SEC_CB { uint16_t ediv{0}; /* received ediv value from LTK request */ uint8_t key_size{0}; // Interface with HCI to send commands and receive pairing events. bluetooth::hci::SecurityInterface* hci_{}; private: bluetooth::stack::btm::SecurityEventParser event_parser; public: /***************************************************** ** Security Management Loading system/stack/test/btm/stack_btm_dev_test.cc +9 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> #include "hci/hci_layer_mock.h" #include "stack/btm/btm_dev.h" #include "stack/btm/btm_sec_cb.h" #include "test/common/mock_functions.h" Loading @@ -26,8 +27,14 @@ class StackBtmTest : public testing::Test { public: protected: void SetUp() override { reset_mock_function_count_map(); } void TearDown() override {} void SetUp() override { reset_mock_function_count_map(); bluetooth::hci::testing::mock_hci_layer_ = &hci_; } void TearDown() override { bluetooth::hci::testing::mock_hci_layer_ = nullptr; } bluetooth::hci::testing::MockHciLayer hci_; }; class StackBtmDevTest : public StackBtmTest { Loading Loading
system/main/shim/hci_layer.cc +0 −14 Original line number Diff line number Diff line Loading @@ -70,20 +70,6 @@ bool register_event_code(bluetooth::hci::EventCode event_code) { // SCO case bluetooth::hci::EventCode::SYNCHRONOUS_CONNECTION_COMPLETE: case bluetooth::hci::EventCode::SYNCHRONOUS_CONNECTION_CHANGED: // SecurityEvents case bluetooth::hci::EventCode::ENCRYPTION_CHANGE: case bluetooth::hci::EventCode::PIN_CODE_REQUEST: case bluetooth::hci::EventCode::LINK_KEY_REQUEST: case bluetooth::hci::EventCode::LINK_KEY_NOTIFICATION: case bluetooth::hci::EventCode::ENCRYPTION_KEY_REFRESH_COMPLETE: case bluetooth::hci::EventCode::IO_CAPABILITY_REQUEST: case bluetooth::hci::EventCode::IO_CAPABILITY_RESPONSE: case bluetooth::hci::EventCode::REMOTE_OOB_DATA_REQUEST: case bluetooth::hci::EventCode::SIMPLE_PAIRING_COMPLETE: case bluetooth::hci::EventCode::USER_PASSKEY_NOTIFICATION: case bluetooth::hci::EventCode::USER_CONFIRMATION_REQUEST: case bluetooth::hci::EventCode::USER_PASSKEY_REQUEST: return true; default: return false; Loading
system/stack/btm/btm_sec_cb.cc +14 −0 Original line number Diff line number Diff line Loading @@ -23,15 +23,20 @@ #include <cstdint> #include "hci/hci_layer.h" #include "hci/security_interface.h" #include "internal_include/bt_trace.h" #include "internal_include/stack_config.h" #include "main/shim/entry.h" #include "os/log.h" #include "osi/include/allocator.h" #include "osi/include/fixed_queue.h" #include "osi/include/list.h" #include "stack/btm/btm_dev.h" #include "stack/btm/security_device_record.h" #include "stack/btm/security_event_parser.h" #include "stack/include/bt_psm_types.h" #include "stack/include/main_thread.h" #include "types/raw_address.h" using namespace bluetooth; Loading Loading @@ -59,6 +64,10 @@ void tBTM_SEC_CB::Init(uint8_t initial_security_mode) { *((tBTM_SEC_DEV_REC*)ptr) = {}; osi_free(ptr); }); hci_ = bluetooth::shim::GetHciLayer()->GetSecurityInterface( get_main_thread()->BindOn( &event_parser, &bluetooth::stack::btm::SecurityEventParser::OnSecurityEvent)); } void tBTM_SEC_CB::Free() { Loading @@ -76,6 +85,11 @@ void tBTM_SEC_CB::Free() { alarm_free(execution_wait_timer); execution_wait_timer = nullptr; auto hci = bluetooth::shim::GetHciLayer(); for (auto event : hci::SecurityEvents) { hci->UnregisterEventHandler(event); } } tBTM_SEC_CB btm_sec_cb; Loading
system/stack/btm/btm_sec_cb.h +8 −0 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ #include <cstdint> #include "hci/security_interface.h" #include "internal_include/bt_target.h" #include "osi/include/alarm.h" #include "osi/include/fixed_queue.h" #include "osi/include/list.h" #include "stack/btm/btm_sec_int_types.h" #include "stack/btm/security_device_record.h" #include "stack/btm/security_event_parser.h" #include "stack/include/bt_octets.h" #include "stack/include/security_client_callbacks.h" #include "types/raw_address.h" Loading @@ -43,6 +45,12 @@ class tBTM_SEC_CB { uint16_t ediv{0}; /* received ediv value from LTK request */ uint8_t key_size{0}; // Interface with HCI to send commands and receive pairing events. bluetooth::hci::SecurityInterface* hci_{}; private: bluetooth::stack::btm::SecurityEventParser event_parser; public: /***************************************************** ** Security Management Loading
system/stack/test/btm/stack_btm_dev_test.cc +9 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> #include "hci/hci_layer_mock.h" #include "stack/btm/btm_dev.h" #include "stack/btm/btm_sec_cb.h" #include "test/common/mock_functions.h" Loading @@ -26,8 +27,14 @@ class StackBtmTest : public testing::Test { public: protected: void SetUp() override { reset_mock_function_count_map(); } void TearDown() override {} void SetUp() override { reset_mock_function_count_map(); bluetooth::hci::testing::mock_hci_layer_ = &hci_; } void TearDown() override { bluetooth::hci::testing::mock_hci_layer_ = nullptr; } bluetooth::hci::testing::MockHciLayer hci_; }; class StackBtmDevTest : public StackBtmTest { Loading