1// Passkey entry initiator, negative reply on responding side:
2// - Test case not present in LMP.TS, but other permutations are described in SP/BV-14-C, SP/BV-15-C
3// - IUT is DisplayOnly, initiator
4// - Lower Tester is KeyboardOnly, responder
5// - Lower Tester fails passkey entry with User_Passkey_Request_NegativeReply, responds Not Accepted to the SimplePairingConfirm
6sequence! { procedure, context,
7    // ACL Connection Established
8    Upper Tester -> IUT: AuthenticationRequested {
9        connection_handle: context.peer_handle()
10    }
11    IUT -> Upper Tester: AuthenticationRequestedStatus {
12       num_hci_command_packets: 1,
13       status: ErrorCode::Success,
14    }
15    IUT -> Upper Tester: LinkKeyRequest {
16        bd_addr: context.peer_address(),
17    }
18    Upper Tester -> IUT: LinkKeyRequestNegativeReply {
19        bd_addr: context.peer_address(),
20    }
21    IUT -> Upper Tester: LinkKeyRequestNegativeReplyComplete {
22       num_hci_command_packets: 1,
23       status: ErrorCode::Success,
24       bd_addr: context.peer_address(),
25    }
26    IUT -> Upper Tester: IoCapabilityRequest {
27        bd_addr: context.peer_address(),
28    }
29    Upper Tester -> IUT: IoCapabilityRequestReply {
30        bd_addr: context.peer_address(),
31        io_capability: IoCapability::DisplayOnly,
32        oob_present: OobDataPresent::NotPresent,
33        authentication_requirements: AuthenticationRequirements::NoBondingMitmProtection,
34    }
35    IUT -> Upper Tester: IoCapabilityRequestReplyComplete {
36        num_hci_command_packets: 1,
37        status: ErrorCode::Success,
38        bd_addr: context.peer_address(),
39    }
40    IUT -> Lower Tester: IoCapabilityReq {
41        transaction_id: 0,
42        io_capabilities: 0x00,
43        oob_authentication_data: 0x00,
44        authentication_requirement: 0x01,
45    }
46    Lower Tester -> IUT: IoCapabilityRes {
47        transaction_id: 0,
48        io_capabilities: 0x02,
49        oob_authentication_data: 0x00,
50        authentication_requirement: 0x01,
51    }
52    IUT -> Upper Tester: IoCapabilityResponse {
53        bd_addr: context.peer_address(),
54        io_capability: IoCapability::KeyboardOnly,
55        oob_data_present: OobDataPresent::NotPresent,
56        authentication_requirements: AuthenticationRequirements::NoBondingMitmProtection,
57    }
58    // Public Key Exchange
59    IUT -> Lower Tester: EncapsulatedHeader {
60        transaction_id: 0,
61        major_type: 1,
62        minor_type: 1,
63        payload_length: 48,
64    }
65    Lower Tester -> IUT: Accepted {
66        transaction_id: 0,
67        accepted_opcode: Opcode::EncapsulatedHeader,
68    }
69    repeat 3 times with (part in local_p192_public_key(&context)) {
70        IUT -> Lower Tester: EncapsulatedPayload {
71            transaction_id: 0,
72            data: part,
73        }
74        Lower Tester -> IUT: Accepted {
75            transaction_id: 0,
76            accepted_opcode: Opcode::EncapsulatedPayload,
77        }
78    }
79    Lower Tester -> IUT: EncapsulatedHeader {
80        transaction_id: 0,
81        major_type: 1,
82        minor_type: 1,
83        payload_length: 48,
84    }
85    IUT -> Lower Tester: Accepted {
86        transaction_id: 0,
87        accepted_opcode: Opcode::EncapsulatedHeader,
88    }
89    repeat 3 times with (part in peer_p192_public_key()) {
90        Lower Tester -> IUT: EncapsulatedPayload {
91            transaction_id: 0,
92            data: part,
93        }
94        IUT -> Lower Tester: Accepted {
95            transaction_id: 0,
96            accepted_opcode: Opcode::EncapsulatedPayload,
97        }
98    }
99    // Authentication Stage 1: Passkey Entry Protocol
100    IUT -> Upper Tester: UserPasskeyNotification { bd_addr: context.peer_address(), passkey: 0 }
101    IUT -> Lower Tester: SimplePairingConfirm {
102        transaction_id: 0,
103        commitment_value: [0; 16],
104    }
105    Lower Tester -> IUT: NotAccepted {
106        transaction_id: 0,
107        not_accepted_opcode: Opcode::SimplePairingConfirm,
108        error_code: ErrorCode::AuthenticationFailure.into(),
109    }
110    IUT -> Upper Tester: SimplePairingComplete {
111        status: ErrorCode::AuthenticationFailure,
112        bd_addr: context.peer_address(),
113    }
114    IUT -> Upper Tester: AuthenticationComplete {
115        status: ErrorCode::AuthenticationFailure,
116        connection_handle: context.peer_handle(),
117    }
118}
119