Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1aa0ff37 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "SM: Fix the flow for Classic Pairing"

parents b196e223 1e9a7869
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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):
+2 −2
Original line number Diff line number Diff line
@@ -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(
+2 −1
Original line number Diff line number Diff line
@@ -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) {
@@ -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());
+1 −1
Original line number Diff line number Diff line
@@ -218,8 +218,8 @@ class ClassicPairingHandlerTest : public ::testing::Test {
//  <- IoCapabilityResponse
//  <- UserConfirmationRequest
//  -> UserConfirmationRequestReply (auto)
//  <- LinkKeyNotification
//  <- SimplePairingComplete
//  <- LinkKeyNotification
//  <- AuthenticationComplete
//  -> SetConnectionEncryption
//  <- EncryptionChange