1sequence! { procedure, context,
2    // ACL Connection Established
3    Lower Tester -> IUT: IoCapabilityReq {
4        transaction_id: 0,
5        io_capabilities: 0x02,
6        oob_authentication_data: 0x00,
7        authentication_requirement: 0x01,
8    }
9    IUT -> Upper Tester: IoCapabilityResponse {
10        bd_addr: context.peer_address(),
11        io_capability: IoCapability::KeyboardOnly,
12        oob_data_present: OobDataPresent::NotPresent,
13        authentication_requirements: AuthenticationRequirements::NoBondingMitmProtection,
14    }
15    IUT -> Upper Tester: IoCapabilityRequest {
16        bd_addr: context.peer_address(),
17    }
18    Upper Tester -> IUT: IoCapabilityRequestReply {
19        bd_addr: context.peer_address(),
20        io_capability: IoCapability::DisplayOnly,
21        oob_present: OobDataPresent::NotPresent,
22        authentication_requirements: AuthenticationRequirements::NoBondingMitmProtection,
23    }
24    IUT -> Upper Tester: IoCapabilityRequestReplyComplete {
25        num_hci_command_packets: 1,
26        status: ErrorCode::Success,
27        bd_addr: context.peer_address(),
28    }
29    IUT -> Lower Tester: IoCapabilityRes {
30        transaction_id: 0,
31        io_capabilities: 0x00,
32        oob_authentication_data: 0x00,
33        authentication_requirement: 0x01,
34    }
35    // Public Key Exchange
36    Lower Tester -> IUT: EncapsulatedHeader {
37        transaction_id: 0,
38        major_type: 1,
39        minor_type: 1,
40        payload_length: 48,
41    }
42    IUT -> Lower Tester: Accepted {
43        transaction_id: 0,
44        accepted_opcode: Opcode::EncapsulatedHeader,
45    }
46    repeat 3 times with (part in peer_p192_public_key()) {
47        Lower Tester -> IUT: EncapsulatedPayload {
48            transaction_id: 0,
49            data: part,
50        }
51        IUT -> Lower Tester: Accepted {
52            transaction_id: 0,
53            accepted_opcode: Opcode::EncapsulatedPayload,
54        }
55    }
56    IUT -> Lower Tester: EncapsulatedHeader {
57        transaction_id: 0,
58        major_type: 1,
59        minor_type: 1,
60        payload_length: 48,
61    }
62    Lower Tester -> IUT: Accepted {
63        transaction_id: 0,
64        accepted_opcode: Opcode::EncapsulatedHeader,
65    }
66    repeat 3 times with (part in local_p192_public_key(&context)) {
67        IUT -> Lower Tester: EncapsulatedPayload {
68            transaction_id: 0,
69            data: part,
70        }
71        Lower Tester -> IUT: Accepted {
72            transaction_id: 0,
73            accepted_opcode: Opcode::EncapsulatedPayload,
74        }
75    }
76    // Authentication Stage 1: Passkey Entry Protocol
77    IUT -> Upper Tester: UserPasskeyNotification { bd_addr: context.peer_address(), passkey: 0 }
78    Lower Tester -> IUT: KeypressNotification {
79        transaction_id: 0,
80        notification_type: 0x00,
81    }
82    IUT -> Upper Tester: KeypressNotification {
83         bd_addr: context.peer_address(),
84         notification_type: KeypressNotificationType::EntryStarted,
85    }
86    Lower Tester -> IUT: KeypressNotification {
87        transaction_id: 0,
88        notification_type: 0x04,
89    }
90    IUT -> Upper Tester: KeypressNotification {
91         bd_addr: context.peer_address(),
92         notification_type: KeypressNotificationType::EntryCompleted,
93    }
94    repeat 20 times {
95        Lower Tester -> IUT: SimplePairingConfirm {
96            transaction_id: 0,
97            commitment_value: [0; 16],
98        }
99        IUT -> Lower Tester: SimplePairingConfirm {
100            transaction_id: 0,
101            commitment_value: [0; 16],
102        }
103        Lower Tester -> IUT: SimplePairingNumber {
104            transaction_id: 0,
105            nonce: [0; 16],
106        }
107        IUT -> Lower Tester: Accepted {
108            transaction_id: 0,
109            accepted_opcode: Opcode::SimplePairingNumber,
110        }
111        IUT -> Lower Tester: SimplePairingNumber {
112            transaction_id: 0,
113            nonce: [0; 16],
114        }
115        Lower Tester -> IUT: Accepted {
116            transaction_id: 0,
117            accepted_opcode: Opcode::SimplePairingNumber,
118        }
119    }
120    // Authentication Stage 2
121    Lower Tester -> IUT: DhkeyCheck {
122        transaction_id: 0,
123        confirmation_value: [0; 16],
124    }
125    IUT -> Lower Tester: Accepted { transaction_id: 0, accepted_opcode: Opcode::DhkeyCheck }
126    IUT -> Lower Tester: DhkeyCheck {
127        transaction_id: 0,
128        confirmation_value: [0; 16],
129    }
130    Lower Tester -> IUT: Accepted { transaction_id: 0, accepted_opcode: Opcode::DhkeyCheck }
131    IUT -> Upper Tester: SimplePairingComplete {
132        status: ErrorCode::Success,
133        bd_addr: context.peer_address(),
134    }
135    // Link Key Calculation
136    Lower Tester -> IUT: AuRand {
137        transaction_id: 0,
138        random_number: [0; 16],
139    }
140    IUT -> Lower Tester: Sres {
141        transaction_id: 0,
142        authentication_rsp: [0; 4],
143    }
144    IUT -> Lower Tester: AuRand {
145        transaction_id: 0,
146        random_number: [0; 16],
147    }
148    Lower Tester -> IUT: Sres {
149        transaction_id: 0,
150        authentication_rsp: [0; 4],
151    }
152    IUT -> Upper Tester: LinkKeyNotification {
153        bd_addr: context.peer_address(),
154        key_type: KeyType::AuthenticatedP192,
155        link_key: [0; 16],
156    }
157}
158