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

Commit b94b1fd3 authored by Martin Brabham's avatar Martin Brabham
Browse files

SM: Fix event order logic for Classic Pairing

Bug: 145638034
Test: ./cert/run --host --test_filter=SimpleSecurityTest
Change-Id: I1d8c4cbfe847092f5defdd2761d8715b2f03b02b
parent bfba980e
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -131,8 +131,6 @@ void ClassicPairingHandler::OnReceive(hci::LinkKeyNotificationView packet) {
  LOG_INFO("Received: %s", hci::EventCodeText(packet.GetEventCode()).c_str());
  LOG_INFO("Received: %s", hci::EventCodeText(packet.GetEventCode()).c_str());
  ASSERT_LOG(GetRecord()->GetPseudoAddress().GetAddress() == packet.GetBdAddr(), "Address mismatch");
  ASSERT_LOG(GetRecord()->GetPseudoAddress().GetAddress() == packet.GetBdAddr(), "Address mismatch");
  GetRecord()->SetLinkKey(packet.GetLinkKey(), packet.GetKeyType());
  GetRecord()->SetLinkKey(packet.GetLinkKey(), packet.GetKeyType());
  // We are done with the pairing flow
  Cancel();
}
}


void ClassicPairingHandler::OnReceive(hci::IoCapabilityRequestView packet) {
void ClassicPairingHandler::OnReceive(hci::IoCapabilityRequestView packet) {
@@ -164,8 +162,8 @@ void ClassicPairingHandler::OnReceive(hci::SimplePairingCompleteView packet) {
  if (last_status_ != hci::ErrorCode::SUCCESS) {
  if (last_status_ != hci::ErrorCode::SUCCESS) {
    LOG_INFO("Failed SimplePairingComplete: %s", hci::ErrorCodeText(last_status_).c_str());
    LOG_INFO("Failed SimplePairingComplete: %s", hci::ErrorCodeText(last_status_).c_str());
    // Cancel here since we won't get LinkKeyNotification
    // Cancel here since we won't get LinkKeyNotification
    Cancel();
  }
  }
  Cancel();
}
}


void ClassicPairingHandler::OnReceive(hci::ReturnLinkKeysView packet) {
void ClassicPairingHandler::OnReceive(hci::ReturnLinkKeysView packet) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -182,8 +182,8 @@ class ClassicPairingHandlerTest : public ::testing::Test {
//  <- IoCapabilityResponse
//  <- IoCapabilityResponse
//  <- UserConfirmationRequest
//  <- UserConfirmationRequest
//  -> UserConfirmationRequestReply (auto)
//  -> UserConfirmationRequestReply (auto)
//  <- SimplePairingComplete
//  <- LinkKeyNotification
//  <- LinkKeyNotification
//  <- SimplePairingComplete
//  <- AuthenticationComplete
//  <- AuthenticationComplete
//  -> SetConnectionEncryption
//  -> SetConnectionEncryption
//  <- EncryptionChange
//  <- EncryptionChange