CTAP HID Lock (#605)
* Implements the CTAP HID Lock command This is a direct translation of our internal implementation. * adds more HID Lock tests
This commit is contained in:
@@ -85,7 +85,7 @@ fn initialize(ctap: &mut Ctap<TestEnv>) -> ChannelID {
|
||||
let mut result_cid: ChannelID = Default::default();
|
||||
for pkt_request in HidPacketIterator::new(message).unwrap() {
|
||||
for pkt_reply in ctap.process_hid_packet(&pkt_request, Transport::MainHid) {
|
||||
if let Ok(Some(result)) = assembler_reply.parse_packet(ctap.env(), &pkt_reply) {
|
||||
if let Ok(Some(result)) = assembler_reply.parse_packet(ctap.env(), &pkt_reply, None) {
|
||||
result_cid.copy_from_slice(&result.payload[8..12]);
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ fn process_message(data: &[u8], ctap: &mut Ctap<TestEnv>) {
|
||||
for pkt_request in hid_packet_iterator {
|
||||
for pkt_reply in ctap.process_hid_packet(&pkt_request, Transport::MainHid) {
|
||||
// Only checks for assembling crashes, not for semantics.
|
||||
let _ = assembler_reply.parse_packet(ctap.env(), &pkt_reply);
|
||||
let _ = assembler_reply.parse_packet(ctap.env(), &pkt_reply, None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,10 +264,10 @@ pub fn split_assemble_hid_packets(data: &[u8]) -> arbitrary::Result<()> {
|
||||
let packets: Vec<HidPacket> = hid_packet_iterator.collect();
|
||||
if let Some((last_packet, first_packets)) = packets.split_last() {
|
||||
for packet in first_packets {
|
||||
assert_eq!(assembler.parse_packet(&mut env, packet), Ok(None));
|
||||
assert_eq!(assembler.parse_packet(&mut env, packet, None), Ok(None));
|
||||
}
|
||||
assert_eq!(
|
||||
assembler.parse_packet(&mut env, last_packet),
|
||||
assembler.parse_packet(&mut env, last_packet, None),
|
||||
Ok(Some(message))
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user