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

Commit faad53c7 authored by Myles Watson's avatar Myles Watson Committed by Jakub Pawlowski
Browse files

RootCanal: Request Le LongTermKey

Use OwnAddressType for scanning and connections.

Make Random (for LE security) be an 8-byte array.

Bug: 155399771
Test: cert/run --host LeSecurityTest
Tag: #gd-refactor
Change-Id: I5d6044769dfdeb51dd247ce69ee3b5e357b70497
parent 2eee86b5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ class SimpleHalTest(GdBaseTestClass):
            phy_scan_params.le_scan_type = hci_packets.LeScanType.ACTIVE

            self.send_dut_hci_command(
                hci_packets.LeSetExtendedScanParametersBuilder(hci_packets.AddressType.RANDOM_DEVICE_ADDRESS,
                hci_packets.LeSetExtendedScanParametersBuilder(hci_packets.OwnAddressType.RANDOM_DEVICE_ADDRESS,
                                                               hci_packets.LeScanningFilterPolicy.ACCEPT_ALL, 1,
                                                               [phy_scan_params]))
            self.send_dut_hci_command(
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ class DirectHciTest(GdBaseTestClass):
        phy_scan_params.le_scan_type = hci_packets.LeScanType.ACTIVE

        self.dut_hci.send_command_with_complete(
            hci_packets.LeSetExtendedScanParametersBuilder(hci_packets.AddressType.RANDOM_DEVICE_ADDRESS,
            hci_packets.LeSetExtendedScanParametersBuilder(hci_packets.OwnAddressType.RANDOM_DEVICE_ADDRESS,
                                                           hci_packets.LeScanningFilterPolicy.ACCEPT_ALL, 1,
                                                           [phy_scan_params]))
        self.dut_hci.send_command_with_complete(
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ class LeAdvertisingManagerTest(GdBaseTestClass):
            scan_parameters.le_scan_interval = 40
            scan_parameters.le_scan_window = 20
            self.enqueue_hci_command(
                hci_packets.LeSetExtendedScanParametersBuilder(hci_packets.AddressType.RANDOM_DEVICE_ADDRESS,
                hci_packets.LeSetExtendedScanParametersBuilder(hci_packets.OwnAddressType.RANDOM_DEVICE_ADDRESS,
                                                               hci_packets.LeScanningFilterPolicy.ACCEPT_ALL, 1,
                                                               [scan_parameters]), True)
            self.enqueue_hci_command(
+11 −12
Original line number Diff line number Diff line
@@ -2527,11 +2527,18 @@ enum LeScanningFilterPolicy : 8 {
  CONNECT_LIST_AND_INITIATORS_IDENTITY = 0x03,
}

enum OwnAddressType : 8 {
  PUBLIC_DEVICE_ADDRESS = 0x00,
  RANDOM_DEVICE_ADDRESS = 0x01,
  RESOLVABLE_OR_PUBLIC_ADDRESS = 0x02,
  RESOLVABLE_OR_RANDOM_ADDRESS = 0x03,
}

packet LeSetScanParameters : LeScanningCommand (op_code = LE_SET_SCAN_PARAMETERS) {
  le_scan_type : LeScanType,
  le_scan_interval : 16, // 0x0004-0x4000 Default 0x10 (10ms)
  le_scan_window : 16, // Default 0x10 (10ms)
  own_address_type : AddressType,
  own_address_type : OwnAddressType,
  scanning_filter_policy : LeScanningFilterPolicy,
}

@@ -2553,13 +2560,6 @@ enum InitiatorFilterPolicy : 8 {
  USE_CONNECT_LIST = 0x01,
}

enum OwnAddressType : 8 {
  PUBLIC_DEVICE_ADDRESS = 0x00,
  RANDOM_DEVICE_ADDRESS = 0x01,
  RESOLVABLE_OR_PUBLIC_ADDRESS = 0x02,
  RESOLVABLE_OR_RANDOM_ADDRESS = 0x03,
}

packet LeCreateConnection : LeConnectionManagementCommand (op_code = LE_CREATE_CONNECTION) {
  le_scan_interval : 16, // 0x0004-0x4000
  le_scan_window : 16, // < = LeScanInterval
@@ -3153,7 +3153,7 @@ struct PhyScanParameters {
}

packet LeSetExtendedScanParameters : LeScanningCommand (op_code = LE_SET_EXTENDED_SCAN_PARAMETERS) {
  own_address_type : AddressType,
  own_address_type : OwnAddressType,
  scanning_filter_policy : LeScanningFilterPolicy,
  scanning_phys : 8,
  parameters : PhyScanParameters[],
@@ -3818,7 +3818,7 @@ packet LeExtendedScanParams : LeScanningCommand (op_code = LE_EXTENDED_SCAN_PARA
  le_scan_type : LeScanType,
  le_scan_interval : 32, // 0x0004-0x4000 Default 0x10 (10ms)
  le_scan_window : 32, // Default 0x10 (10ms)
  own_address_type : AddressType,
  own_address_type : OwnAddressType,
  scanning_filter_policy : LeScanningFilterPolicy,
}

@@ -4284,10 +4284,9 @@ packet LeReadRemoteFeaturesComplete : LeMetaEvent (subevent_code = READ_REMOTE_F
}

packet LeLongTermKeyRequest : LeMetaEvent (subevent_code = LONG_TERM_KEY_REQUEST) {
  status : ErrorCode,
  connection_handle : 12,
  _reserved_ : 4,
  random_number : 64,
  random_number : 8[8],
  encrypted_diversifier : 16,
}

+1 −1
Original line number Diff line number Diff line
@@ -275,7 +275,7 @@ TEST(HciPacketsTest, testLeSetScanParameters) {
  ASSERT_EQ(LeScanType::ACTIVE, view.GetLeScanType());
  ASSERT_EQ(0x12, view.GetLeScanInterval());
  ASSERT_EQ(0x12, view.GetLeScanWindow());
  ASSERT_EQ(AddressType::RANDOM_DEVICE_ADDRESS, view.GetOwnAddressType());
  ASSERT_EQ(OwnAddressType::RANDOM_DEVICE_ADDRESS, view.GetOwnAddressType());
  ASSERT_EQ(LeScanningFilterPolicy::ACCEPT_ALL, view.GetScanningFilterPolicy());
}

Loading