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

Commit e927505e authored by David Duarte's avatar David Duarte
Browse files

security: Trigger a ReadRemoteNameRequest on PinCodeRequest

The PinCodeRequest is the first event that we get
when we are in legacy pairing, and we need to have
the name before showing the UI prompt.

This was working before because RootCanal
incorrectly sent an IO Capability Exchange for
the initiator.

Test: gd/cert/run SecurityTest.test_successful_dut_initiated_pin
Change-Id: Ie8c7b6e3a49cd5c007d32c0b0d81058b1e70cdbf
parent e4d902d8
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -143,6 +143,10 @@ void ClassicPairingHandler::OnNameRequestComplete(hci::Address address, bool suc
    device_name_ = tmp_name;
  }
  has_gotten_name_response_ = true;
  // For PIN Pairing
  if (is_legacy_pin_code_) {
    NotifyUiDisplayPinCodeInput();
  }
  // For SSP/Numeric comparison flow
  if (user_confirmation_request_) {
    this->OnReceive(*user_confirmation_request_);
@@ -178,7 +182,10 @@ void ClassicPairingHandler::OnReceive(hci::PinCodeRequestView packet) {
  LOG_INFO("Received: %s", hci::EventCodeText(packet.GetEventCode()).c_str());
  ASSERT_LOG(GetRecord()->GetPseudoAddress()->GetAddress() == packet.GetBdAddr(), "Address mismatch");
  is_legacy_pin_code_ = true;
  NotifyUiDisplayPinCodeInput();
  GetNameDbModule()->ReadRemoteNameRequest(
      GetRecord()->GetPseudoAddress()->GetAddress(),
      common::BindOnce(&ClassicPairingHandler::OnNameRequestComplete, common::Unretained(this)),
      security_handler_);
}

void ClassicPairingHandler::OnReceive(hci::LinkKeyRequestView packet) {