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

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

Merge changes I4386b836,I27e6b6ce,I84842b13

* changes:
  GD Security Facade
  CertSecurity: Add accept_oob_pairing function
  Cert SecurityTest: Create branching conditional for multi test run
parents e1860a6b 67bfff88
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -263,6 +263,24 @@ class CertSecurity(PySecurity):
            logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE")
            assertThat(self._hci_event_stream).emits(HciMatchers.SimplePairingComplete())

    def accept_oob_pairing(self, dut_address):
        logging.info("Cert: Waiting for IO_CAPABILITY_RESPONSE")
        assertThat(self._hci_event_stream).emits(HciMatchers.IoCapabilityResponse())
        logging.info("Cert: Waiting for IO_CAPABILITY_REQUEST")
        assertThat(self._hci_event_stream).emits(HciMatchers.IoCapabilityRequest())
        logging.info("Cert: Sending IO_CAPABILITY_REQUEST_REPLY")
        oob_data_present = hci_packets.OobDataPresent.NOT_PRESENT
        self._enqueue_hci_command(
            hci_packets.IoCapabilityRequestReplyBuilder(
                dut_address.decode('utf8'), self._io_caps, oob_data_present, self._auth_reqs), True)
        assertThat(self._hci_event_stream).emits(HciMatchers.CommandComplete())
        logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE")
        ssp_complete_capture = HciCaptures.SimplePairingCompleteCapture()
        assertThat(self._hci_event_stream).emits(ssp_complete_capture)
        ssp_complete = ssp_complete_capture.get()
        logging.info(ssp_complete.GetStatus())
        assertThat(ssp_complete.GetStatus()).isEqualTo(hci_packets.ErrorCode.SUCCESS)

    def on_user_input(self, dut_address, reply_boolean, expected_ui_event):
        """
            Cert doesn't need the test to respond to the ui event
+13 −9
Original line number Diff line number Diff line
@@ -288,6 +288,7 @@ class SecurityTest(GdBaseTestClass):
                                    if dut_auth_reqs in self.mitm_auth_reqs or cert_auth_reqs in self.mitm_auth_reqs:
                                        expected_init_bond_event = BondMsgType.DEVICE_BOND_FAILED

                                if cert_oob_present == OobDataPresent.NOT_PRESENT:
                                    self._run_ssp_numeric_comparison(
                                        initiator=self.dut_security,
                                        responder=self.cert_security,
@@ -297,6 +298,9 @@ class SecurityTest(GdBaseTestClass):
                                        expected_resp_ui_event=expected_resp_ui_event,
                                        expected_init_bond_event=expected_init_bond_event,
                                        expected_resp_bond_event=expected_resp_bond_event)
                                else:
                                    logging.error("Code path not yet implemented")
                                    assertThat(False).isTrue()

                                self.dut_security.remove_bond(self.cert_security.get_address(),
                                                              common.BluetoothAddressTypeEnum.PUBLIC_DEVICE_ADDRESS)
+7 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import "hci/facade/le_initiator_address_facade.proto";

service SecurityModuleFacade {
  rpc CreateBond(facade.BluetoothAddressWithType) returns (google.protobuf.Empty) {}
  rpc CreateBondOutOfBand(OobDataBondMessage) returns (google.protobuf.Empty) {}
  rpc CreateBondLe(facade.BluetoothAddressWithType) returns (google.protobuf.Empty) {}
  rpc CancelBond(facade.BluetoothAddressWithType) returns (google.protobuf.Empty) {}
  rpc RemoveBond(facade.BluetoothAddressWithType) returns (google.protobuf.Empty) {}
@@ -37,6 +38,12 @@ message OobDataMessage {
  bytes le_sc_random_value = 3;
}

message OobDataBondMessage {
  facade.BluetoothAddressWithType address = 1;
  OobDataMessage p192_data = 2;
  OobDataMessage p256_data = 3;
}

enum UiMsgType {
  DISPLAY_YES_NO_WITH_VALUE = 0;
  DISPLAY_YES_NO = 1;