ErrorCode::UNSUPPORTED_REMOTE_OR_LMP_FEATURE)));
security_manager_.AuthenticationRequest(incoming.GetSourceAddress(),
handle);
+ security_manager_.SetPinRequested(peer);
send_event_(bluetooth::hci::PinCodeRequestBuilder::Create(
incoming.GetSourceAddress()));
return;
security_manager_.InvalidateIoCapabilities();
LOG_INFO("%s doesn't support SSP, try PIN",
incoming.GetSourceAddress().ToString().c_str());
+ security_manager_.SetPinRequested(peer);
send_event_(bluetooth::hci::PinCodeRequestBuilder::Create(
incoming.GetSourceAddress()));
}
} else {
LOG_INFO("PIN pairing %s", properties_.GetAddress().ToString().c_str());
ScheduleTask(milliseconds(5), [this, address]() {
+ security_manager_.SetPinRequested(address);
send_event_(bluetooth::hci::PinCodeRequestBuilder::Create(address));
});
}
});
return ErrorCode::UNKNOWN_CONNECTION;
}
+ if (!security_manager_.GetPinRequested(peer)) {
+ LOG_INFO("No Pin Requested for %s", peer.ToString().c_str());
+ return ErrorCode::COMMAND_DISALLOWED;
+ }
LOG_INFO("Authenticating %s", peer.ToString().c_str());
SaveKeyAndAuthenticate('L', peer); // Legacy
return ErrorCode::SUCCESS;
if (peer != current_peer) {
return ErrorCode::UNKNOWN_CONNECTION;
}
+ if (!security_manager_.GetPinRequested(peer)) {
+ LOG_INFO("No Pin Requested for %s", peer.ToString().c_str());
+ return ErrorCode::COMMAND_DISALLOWED;
+ }
return ErrorCode::SUCCESS;
}
authenticating_ = true;
current_handle_ = handle;
peer_address_ = addr;
+ peer_pin_requested_ = false;
}
void SecurityManager::AuthenticationRequestFinished() {
}
}
+void SecurityManager::SetPinRequested(const Address& addr) {
+ ASSERT(addr == peer_address_);
+ peer_pin_requested_ = true;
+}
+
+bool SecurityManager::GetPinRequested(const Address& addr) {
+ return peer_pin_requested_;
+}
+
} // namespace test_vendor_lib
uint16_t GetAuthenticationHandle();
Address GetAuthenticationAddress();
+ void SetPinRequested(const Address& addr);
+ bool GetPinRequested(const Address& addr);
+
void SetPeerIoCapability(const Address& addr, uint8_t io_capability, uint8_t oob_present_flag,
uint8_t authentication_requirements);
void SetLocalIoCapability(const Address& peer, uint8_t io_capability, uint8_t oob_present_flag,
uint8_t peer_oob_present_flag_{0};
AuthenticationType peer_authentication_requirements_{
AuthenticationType::NO_BONDING};
+ bool peer_pin_requested_{false};
bool host_capabilities_valid_{false};
IoCapabilityType host_io_capability_{IoCapabilityType::DISPLAY_ONLY};