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

Commit bf500bbc authored by Thomas Girardier's avatar Thomas Girardier Committed by Gerrit Code Review
Browse files

Merge changes If4ddaad5,I9d2f6600,Ia3e8a8f1,Ic2402826,I80a780bc

* changes:
  Add some LMP SSP backward compatibility procedures test cases
  Add some LMP Secure Simple Pairing Passkey Entry Notification tests
  Add some LMP Secure Simple Pairing failure tests
  Add some LMP Secure Simple Pairing OOB tests
  Add some LMP Secure Simple Pairing Passkey tests
parents 986e30c3 15f29765
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -829,6 +829,7 @@ enum ErrorCode: 8 {
  LINK_LAYER_COLLISION = 0x23,
  ENCRYPTION_MODE_NOT_ACCEPTABLE = 0x25,
  ROLE_SWITCH_FAILED = 0x35,
  HOST_BUSY = 0x38,
  CONTROLLER_BUSY = 0x3A,
  ADVERTISING_TIMEOUT = 0x3C,
  CONNECTION_FAILED_ESTABLISHMENT = 0x3E,
+12 −3
Original line number Diff line number Diff line
@@ -118,9 +118,12 @@ packet NotAccepted : Packet(opcode = NOT_ACCEPTED) {
}

packet AcceptedExt : ExtendedPacket(extended_opcode = ACCEPTED) {
  accepted_opcode: Opcode,
  _fixed_ = 0 : 1,
  accepted_extended_opcode: ExtendedOpcode,
  accepted_opcode: ExtendedOpcode,
}

packet NotAcceptedExt : ExtendedPacket(extended_opcode = NOT_ACCEPTED) {
  not_accepted_opcode: ExtendedOpcode,
  error_code: 8,
}

packet IoCapabilityReq : ExtendedPacket(extended_opcode = IO_CAPABILITY_REQ) {
@@ -167,6 +170,12 @@ packet Sres : Packet(opcode = SRES) {

packet NumericComparaisonFailed: ExtendedPacket(extended_opcode = NUMERIC_COMPARAISON_FAILED) {}

packet PasskeyFailed: ExtendedPacket(extended_opcode = PASSKEY_FAILED) {}

packet KeypressNotification: ExtendedPacket(extended_opcode = KEYPRESS_NOTIFICATION) {
  notification_type: 8,
}

packet InRand : Packet(opcode = IN_RAND) {
  random_number: 8[16],
}
+191 −0
Original line number Diff line number Diff line
@@ -695,6 +695,8 @@ pub async fn respond(ctx: &impl Context, request: lmp::IoCapabilityReqPacket) ->

#[cfg(test)]
mod tests {
    use num_traits::ToPrimitive;

    use crate::ec::PrivateKey;
    use crate::procedure::Context;
    use crate::test::{sequence, TestContext};
@@ -799,4 +801,193 @@ mod tests {

        include!("../../test/SP/BV-13-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn passkey_entry_initiator_failure_on_initiating_side() {
        let context = TestContext::new();
        let procedure = initiate;

        include!("../../test/SP/BV-14-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn passkey_entry_responder_failure_on_initiating_side() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-15-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn passkey_entry_initiator_failure_on_responding_side() {
        let context = TestContext::new();
        let procedure = initiate;

        include!("../../test/SP/BV-16-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn passkey_entry_responder_failure_on_responding_side() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-17-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn oob_protocol_initiator_iut_with_oob_auth_data_success() {
        let context = TestContext::new();
        let procedure = initiate;

        include!("../../test/SP/BV-18-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn oob_protocol_responder_iut_with_oob_auth_data_success() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-19-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn oob_protocol_initiator_lower_tester_with_oob_auth_data_success() {
        let context = TestContext::new();
        let procedure = initiate;

        include!("../../test/SP/BV-20-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn oob_protocol_responder_lower_tester_with_oob_auth_data_success() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-21-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn oob_protocol_initiator_iut_and_lower_tester_with_oob_auth_data_success() {
        let context = TestContext::new();
        let procedure = initiate;

        include!("../../test/SP/BV-22-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn oob_protocol_responder_iut_and_lower_tester_with_oob_auth_data_success() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-23-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn oob_protocol_initiator_iut_with_oob_auth_data_failure() {
        let context = TestContext::new();
        let procedure = initiate;

        include!("../../test/SP/BV-24-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn oob_protocol_responder_iut_with_oob_auth_data_failure() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-25-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn oob_protocol_initiator_lower_tester_with_oob_auth_data_failure() {
        let context = TestContext::new();
        let procedure = initiate;

        include!("../../test/SP/BV-26-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn oob_protocol_responder_lower_tester_with_oob_auth_data_failure() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-27-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn secure_simple_pairing_failed_responder() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-30-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn host_rejects_secure_simple_pairing_initiator() {
        let context = TestContext::new();
        let procedure = initiate;

        include!("../../test/SP/BV-31-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn host_rejects_secure_simple_pairing_responder() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-32-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn passkey_entry_with_keypress_notification_initiator_success() {
        let context = TestContext::new();
        let procedure = initiate;

        include!("../../test/SP/BV-33-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn passkey_entry_with_keypress_notification_responder_success() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-34-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn passkey_entry_with_keypress_notification_initiator_failure_on_responding_side() {
        let context = TestContext::new();
        let procedure = initiate;

        include!("../../test/SP/BV-35-C.in");
    }

    #[test]
    #[should_panic] // TODO: make the test pass
    fn passkey_entry_with_keypress_notificiation_responder_failure_on_responding_side() {
        let context = TestContext::new();
        let procedure = respond;

        include!("../../test/SP/BV-36-C.in");
    }
}
+23 −0
Original line number Diff line number Diff line
sequence! { procedure, context,
    Upper Tester -> IUT: AuthenticationRequested {
        connection_handle: context.peer_handle()
    }
    IUT -> Upper Tester: AuthenticationRequestedStatus {
       num_hci_command_packets: 1,
       status: ErrorCode::Success,
    }
    IUT -> Upper Tester: LinkKeyRequest {
        bd_addr: context.peer_address(),
    }
    Upper Tester -> IUT: LinkKeyRequestNegativeReply {
        bd_addr: context.peer_address(),
    }
    IUT -> Upper Tester: LinkKeyRequestNegativeReplyComplete {
       num_hci_command_packets: 1,
       status: ErrorCode::Success,
       bd_addr: context.peer_address(),
    }
    IUT -> Upper Tester: PinCodeRequest {
        bd_addr: context.peer_address(),
    }
}
+14 −0
Original line number Diff line number Diff line
sequence! { procedure, context,
    // ACL Connection Established
    Lower Tester -> IUT: IoCapabilityReq {
        transaction_id: 0,
        io_capabilities: 0x01,
        oob_authentication_data: 0x00,
        authentication_requirement: 0x01,
    }
    IUT -> Lower Tester: NotAccepted {
        transaction_id: 0,
        not_accepted_opcode: Opcode::IoCapabilityReq,
        error_code: 0x37,
    }
}
Loading