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

Commit e626e2d0 authored by Martin Brabham's avatar Martin Brabham Committed by Myles Watson
Browse files

ClassicPairingHandler: Add Out of Band support.

Adds support for p192, p256, and both.  As well as
secure connections "extended data" versions of the
RemoteOobDataRequestReply.

Add several unit tests to verify the pairing handler
correctly behaves.

Bug: 162984360
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Test: atest --host bluetooth_test_gd -- --test-arg com.android.tradefed.testtype.GTest:native-test-flag:--gtest_filter=ClassicPairingHandlerTest*
Change-Id: I72016f380a29ad11ec9bdd9e0dcb3383c092c830
parent 73a9866d
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -101,13 +101,6 @@ class PySecurity(Closable):
            auth_reqs, "ERROR"))
        self._device.security.SetAuthenticationRequirements(AuthenticationRequirementsMessage(requirement=auth_reqs))

    def set_oob_data(self, data_present):
        """
            Set the Out-of-band data present flag for SSP pairing
        """
        logging.info("DUT: setting OOB data present to '%s'" % data_present)
        self._device.security.SetOobDataPresent(OobDataPresentMessage(data_present=data_present))

    def send_ui_callback(self, address, callback_type, b, uid):
        """
            Send a callback from the UI as if the user pressed a button on the dialog
+0 −8
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ class CertSecurity(PySecurity):

    _hci_event_stream = None
    _io_caps = hci_packets.IoCapability.DISPLAY_ONLY
    _remote_oob_data = None
    _auth_reqs = hci_packets.AuthenticationRequirements.DEDICATED_BONDING_MITM_PROTECTION
    _secure_connections_enabled = False

@@ -131,13 +130,6 @@ class CertSecurity(PySecurity):
            auth_reqs, "ERROR"))
        self._auth_reqs = self._auth_req_lookup.get(auth_reqs, hci_packets.AuthenticationRequirements.GENERAL_BONDING)

    def set_remote_oob_data(self, remote_data):
        """
            Set the Out-of-band data for SSP pairing
        """
        logging.info("Cert: setting OOB data present to '%s'" % remote_data)
        self._remote_oob_data = remote_data

    def get_oob_data_from_controller(self, pb_oob_data_type):
        """
            Get the Out-of-band data for SSP pairing
+0 −9
Original line number Diff line number Diff line
@@ -191,15 +191,6 @@ class SecurityModuleFacadeService : public SecurityModuleFacade::Service, public
    return ::grpc::Status::OK;
  }

  ::grpc::Status SetOobDataPresent(
      ::grpc::ServerContext* context,
      const OobDataPresentMessage* request,
      ::google::protobuf::Empty* response) override {
    security_module_->GetFacadeConfigurationApi()->SetOobDataPresent(
        static_cast<hci::OobDataPresent>(request->data_present()));
    return ::grpc::Status::OK;
  }

  ::grpc::Status SetLeAuthRequirements(
      ::grpc::ServerContext* context,
      const LeAuthRequirementsMessage* request,
+0 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ service SecurityModuleFacade {
  rpc RemoveBond(facade.BluetoothAddressWithType) returns (google.protobuf.Empty) {}
  rpc SetIoCapability(IoCapabilityMessage) returns (google.protobuf.Empty) {}
  rpc SetAuthenticationRequirements(AuthenticationRequirementsMessage) returns (google.protobuf.Empty) {}
  rpc SetOobDataPresent(OobDataPresentMessage) returns (google.protobuf.Empty) {}
  rpc SetLeIoCapability(LeIoCapabilityMessage) returns (google.protobuf.Empty) {}
  rpc SetLeAuthRequirements(LeAuthRequirementsMessage) returns (google.protobuf.Empty) {}
  rpc SetLeMaximumEncryptionKeySize(LeMaximumEncryptionKeySizeMessage) returns (google.protobuf.Empty) {}
+0 −4
Original line number Diff line number Diff line
@@ -39,10 +39,6 @@ void FacadeConfigurationApi::SetAuthenticationRequirements(hci::AuthenticationRe
      authentication_requirement);
}

void FacadeConfigurationApi::SetOobDataPresent(hci::OobDataPresent data_present) {
  security_handler_->CallOn(security_manager_impl_, &internal::SecurityManagerImpl::SetOobDataPresent, data_present);
}

void FacadeConfigurationApi::SetLeIoCapability(security::IoCapability io_capability) {
  security_handler_->CallOn(security_manager_impl_, &internal::SecurityManagerImpl::SetLeIoCapability, io_capability);
}
Loading