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

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

Merge changes Ie8c7b6e3,I16e1c17d

* changes:
  security: Trigger a ReadRemoteNameRequest on PinCodeRequest
  security: Initialise connection handle to an invalid handle
parents 9236550f e927505e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -734,7 +734,7 @@ void SecurityManagerImpl::OnPairingFinished(security::PairingResultOrFailure pai

void SecurityManagerImpl::WipeLePairingHandler() {
  pending_le_pairing_.handler_.reset();
  pending_le_pairing_.connection_handle_ = 0;
  pending_le_pairing_.connection_handle_ = kInvalidConnectionHandle;
  pending_le_pairing_.address_ = hci::AddressWithType();
}

+3 −1
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ static constexpr hci::AuthenticationRequirements kDefaultAuthenticationRequireme

namespace internal {

static constexpr uint16_t kInvalidConnectionHandle = 0xFFFF;

struct LeFixedChannelEntry {
  std::unique_ptr<l2cap::le::FixedChannel> channel_;
  std::unique_ptr<os::EnqueueBuffer<packet::BasePacketBuilder>> enqueue_buffer_;
@@ -278,7 +280,7 @@ class SecurityManagerImpl : public channel::ISecurityManagerChannelListener, pub

  struct {
    hci::AddressWithType address_;
    uint16_t connection_handle_;
    uint16_t connection_handle_{kInvalidConnectionHandle};
    std::unique_ptr<PairingHandlerLe> handler_;
  } pending_le_pairing_;

+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) {