Loading system/gd/cert/py_security.py +1 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ class PySecurity(Closable): is complete. For the DUT we need to wait for it, for Cert it isn't needed. """ logging.info("DUT: Waiting for Bond Event") self._bond_event_stream.assert_event_occurs(lambda event: event.message_type == expected_bond_event) def enforce_security_policy(self, address, type, policy): Loading system/gd/security/cert/cert_security.py +2 −2 Original line number Diff line number Diff line Loading @@ -166,10 +166,10 @@ class CertSecurity(PySecurity): if reply_boolean: logging.info("Cert: Sending USER_CONFIRMATION_REQUEST_REPLY") self._enqueue_hci_command(hci_packets.UserConfirmationRequestReplyBuilder(dut_address.decode('utf8')), True) logging.info("Cert: Waiting for LINK_KEY_NOTIFICATION") assertThat(self._hci_event_stream).emits(HciMatchers.LinkKeyNotification()) logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE") assertThat(self._hci_event_stream).emits(HciMatchers.SimplePairingComplete()) logging.info("Cert: Waiting for LINK_KEY_NOTIFICATION") assertThat(self._hci_event_stream).emits(HciMatchers.LinkKeyNotification()) else: logging.info("Cert: Sending USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY") self._enqueue_hci_command( Loading system/gd/security/pairing/classic_pairing_handler.cc +2 −1 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ void ClassicPairingHandler::OnReceive(hci::LinkKeyNotificationView packet) { LOG_INFO("Received: %s", hci::EventCodeText(packet.GetEventCode()).c_str()); ASSERT_LOG(GetRecord()->GetPseudoAddress().GetAddress() == packet.GetBdAddr(), "Address mismatch"); GetRecord()->SetLinkKey(packet.GetLinkKey(), packet.GetKeyType()); Cancel(); } void ClassicPairingHandler::OnReceive(hci::IoCapabilityRequestView packet) { Loading Loading @@ -193,9 +194,9 @@ void ClassicPairingHandler::OnReceive(hci::SimplePairingCompleteView packet) { if (last_status_ != hci::ErrorCode::SUCCESS) { LOG_INFO("Failed SimplePairingComplete: %s", hci::ErrorCodeText(last_status_).c_str()); // Cancel here since we won't get LinkKeyNotification } Cancel(); } } void ClassicPairingHandler::OnReceive(hci::ReturnLinkKeysView packet) { ASSERT(packet.IsValid()); Loading system/gd/security/pairing/classic_pairing_handler_unittest.cc +1 −1 Original line number Diff line number Diff line Loading @@ -218,8 +218,8 @@ class ClassicPairingHandlerTest : public ::testing::Test { // <- IoCapabilityResponse // <- UserConfirmationRequest // -> UserConfirmationRequestReply (auto) // <- LinkKeyNotification // <- SimplePairingComplete // <- LinkKeyNotification // <- AuthenticationComplete // -> SetConnectionEncryption // <- EncryptionChange Loading Loading
system/gd/cert/py_security.py +1 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ class PySecurity(Closable): is complete. For the DUT we need to wait for it, for Cert it isn't needed. """ logging.info("DUT: Waiting for Bond Event") self._bond_event_stream.assert_event_occurs(lambda event: event.message_type == expected_bond_event) def enforce_security_policy(self, address, type, policy): Loading
system/gd/security/cert/cert_security.py +2 −2 Original line number Diff line number Diff line Loading @@ -166,10 +166,10 @@ class CertSecurity(PySecurity): if reply_boolean: logging.info("Cert: Sending USER_CONFIRMATION_REQUEST_REPLY") self._enqueue_hci_command(hci_packets.UserConfirmationRequestReplyBuilder(dut_address.decode('utf8')), True) logging.info("Cert: Waiting for LINK_KEY_NOTIFICATION") assertThat(self._hci_event_stream).emits(HciMatchers.LinkKeyNotification()) logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE") assertThat(self._hci_event_stream).emits(HciMatchers.SimplePairingComplete()) logging.info("Cert: Waiting for LINK_KEY_NOTIFICATION") assertThat(self._hci_event_stream).emits(HciMatchers.LinkKeyNotification()) else: logging.info("Cert: Sending USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY") self._enqueue_hci_command( Loading
system/gd/security/pairing/classic_pairing_handler.cc +2 −1 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ void ClassicPairingHandler::OnReceive(hci::LinkKeyNotificationView packet) { LOG_INFO("Received: %s", hci::EventCodeText(packet.GetEventCode()).c_str()); ASSERT_LOG(GetRecord()->GetPseudoAddress().GetAddress() == packet.GetBdAddr(), "Address mismatch"); GetRecord()->SetLinkKey(packet.GetLinkKey(), packet.GetKeyType()); Cancel(); } void ClassicPairingHandler::OnReceive(hci::IoCapabilityRequestView packet) { Loading Loading @@ -193,9 +194,9 @@ void ClassicPairingHandler::OnReceive(hci::SimplePairingCompleteView packet) { if (last_status_ != hci::ErrorCode::SUCCESS) { LOG_INFO("Failed SimplePairingComplete: %s", hci::ErrorCodeText(last_status_).c_str()); // Cancel here since we won't get LinkKeyNotification } Cancel(); } } void ClassicPairingHandler::OnReceive(hci::ReturnLinkKeysView packet) { ASSERT(packet.IsValid()); Loading
system/gd/security/pairing/classic_pairing_handler_unittest.cc +1 −1 Original line number Diff line number Diff line Loading @@ -218,8 +218,8 @@ class ClassicPairingHandlerTest : public ::testing::Test { // <- IoCapabilityResponse // <- UserConfirmationRequest // -> UserConfirmationRequestReply (auto) // <- LinkKeyNotification // <- SimplePairingComplete // <- LinkKeyNotification // <- AuthenticationComplete // -> SetConnectionEncryption // <- EncryptionChange Loading