adds style fix and updates Cargo.lock (#576)
This commit is contained in:
4
fuzz/Cargo.lock
generated
4
fuzz/Cargo.lock
generated
@@ -263,9 +263,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked_list_allocator"
|
name = "linked_list_allocator"
|
||||||
version = "0.8.11"
|
version = "0.10.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "822add9edb1860698b79522510da17bef885171f75aa395cff099d770c609c24"
|
checksum = "e322f259d225fbae43a1b053b2dc6a5968a6bdf8b205f5de684dab485b95030e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
|
|||||||
@@ -344,8 +344,8 @@ impl CtapHid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to parse a raw packet.
|
/// Helper function to parse a raw packet.
|
||||||
pub fn process_single_packet(packet: &HidPacket) -> (&ChannelID, ProcessedPacket) {
|
pub fn process_single_packet(packet: &HidPacket) -> (ChannelID, ProcessedPacket) {
|
||||||
let (cid, rest) = array_refs![packet, 4, 60];
|
let (&cid, rest) = array_refs![packet, 4, 60];
|
||||||
if rest[0] & CtapHid::PACKET_TYPE_MASK != 0 {
|
if rest[0] & CtapHid::PACKET_TYPE_MASK != 0 {
|
||||||
let cmd = rest[0] & !CtapHid::PACKET_TYPE_MASK;
|
let cmd = rest[0] & !CtapHid::PACKET_TYPE_MASK;
|
||||||
let len = (rest[1] as usize) << 8 | (rest[2] as usize);
|
let len = (rest[1] as usize) << 8 | (rest[2] as usize);
|
||||||
@@ -605,7 +605,7 @@ mod test {
|
|||||||
packet[..4].copy_from_slice(&cid);
|
packet[..4].copy_from_slice(&cid);
|
||||||
packet[4..9].copy_from_slice(&[0x81, 0x00, 0x02, 0x99, 0x99]);
|
packet[4..9].copy_from_slice(&[0x81, 0x00, 0x02, 0x99, 0x99]);
|
||||||
let (processed_cid, processed_packet) = CtapHid::process_single_packet(&packet);
|
let (processed_cid, processed_packet) = CtapHid::process_single_packet(&packet);
|
||||||
assert_eq!(processed_cid, &cid);
|
assert_eq!(processed_cid, cid);
|
||||||
let expected_packet = ProcessedPacket::InitPacket {
|
let expected_packet = ProcessedPacket::InitPacket {
|
||||||
cmd: CtapHidCommand::Ping as u8,
|
cmd: CtapHidCommand::Ping as u8,
|
||||||
len: 2,
|
len: 2,
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ impl MessageAssembler {
|
|||||||
|
|
||||||
// If the packet is from the timed-out channel, send back a timeout error.
|
// If the packet is from the timed-out channel, send back a timeout error.
|
||||||
// Otherwise, proceed with processing the packet.
|
// Otherwise, proceed with processing the packet.
|
||||||
if *cid == current_cid {
|
if cid == current_cid {
|
||||||
return Err((*cid, CtapHidError::MsgTimeout));
|
return Err((cid, CtapHidError::MsgTimeout));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,12 +98,12 @@ impl MessageAssembler {
|
|||||||
// Expecting an initialization packet.
|
// Expecting an initialization packet.
|
||||||
match processed_packet {
|
match processed_packet {
|
||||||
ProcessedPacket::InitPacket { cmd, len, data } => {
|
ProcessedPacket::InitPacket { cmd, len, data } => {
|
||||||
self.parse_init_packet(env, *cid, cmd, len, data, timestamp)
|
self.parse_init_packet(env, cid, cmd, len, data, timestamp)
|
||||||
}
|
}
|
||||||
ProcessedPacket::ContinuationPacket { .. } => {
|
ProcessedPacket::ContinuationPacket { .. } => {
|
||||||
// CTAP specification (version 20190130) section 8.1.5.4
|
// CTAP specification (version 20190130) section 8.1.5.4
|
||||||
// Spurious continuation packets will be ignored.
|
// Spurious continuation packets will be ignored.
|
||||||
Err((*cid, CtapHidError::UnexpectedContinuation))
|
Err((cid, CtapHidError::UnexpectedContinuation))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -111,8 +111,8 @@ impl MessageAssembler {
|
|||||||
|
|
||||||
// CTAP specification (version 20190130) section 8.1.5.1
|
// CTAP specification (version 20190130) section 8.1.5.1
|
||||||
// Reject packets from other channels.
|
// Reject packets from other channels.
|
||||||
if *cid != self.cid {
|
if cid != self.cid {
|
||||||
return Err((*cid, CtapHidError::ChannelBusy));
|
return Err((cid, CtapHidError::ChannelBusy));
|
||||||
}
|
}
|
||||||
|
|
||||||
match processed_packet {
|
match processed_packet {
|
||||||
@@ -120,16 +120,16 @@ impl MessageAssembler {
|
|||||||
ProcessedPacket::InitPacket { cmd, len, data } => {
|
ProcessedPacket::InitPacket { cmd, len, data } => {
|
||||||
self.reset();
|
self.reset();
|
||||||
if cmd == CtapHidCommand::Init as u8 {
|
if cmd == CtapHidCommand::Init as u8 {
|
||||||
self.parse_init_packet(env, *cid, cmd, len, data, timestamp)
|
self.parse_init_packet(env, cid, cmd, len, data, timestamp)
|
||||||
} else {
|
} else {
|
||||||
Err((*cid, CtapHidError::InvalidSeq))
|
Err((cid, CtapHidError::InvalidSeq))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ProcessedPacket::ContinuationPacket { seq, data } => {
|
ProcessedPacket::ContinuationPacket { seq, data } => {
|
||||||
if seq != self.seq {
|
if seq != self.seq {
|
||||||
// Reject packets with the wrong sequence number.
|
// Reject packets with the wrong sequence number.
|
||||||
self.reset();
|
self.reset();
|
||||||
Err((*cid, CtapHidError::InvalidSeq))
|
Err((cid, CtapHidError::InvalidSeq))
|
||||||
} else {
|
} else {
|
||||||
// Update the last timestamp.
|
// Update the last timestamp.
|
||||||
self.last_timestamp = timestamp;
|
self.last_timestamp = timestamp;
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ fn send_keepalive_up_needed(
|
|||||||
|
|
||||||
// We only parse one packet, because we only care about CANCEL.
|
// We only parse one packet, because we only care about CANCEL.
|
||||||
let (received_cid, processed_packet) = CtapHid::process_single_packet(&pkt);
|
let (received_cid, processed_packet) = CtapHid::process_single_packet(&pkt);
|
||||||
if received_cid != &cid {
|
if received_cid != cid {
|
||||||
debug_ctap!(
|
debug_ctap!(
|
||||||
env,
|
env,
|
||||||
"Received a packet on channel ID {:?} while sending a KEEPALIVE packet",
|
"Received a packet on channel ID {:?} while sending a KEEPALIVE packet",
|
||||||
|
|||||||
4
third_party/lang-items/Cargo.lock
generated
vendored
4
third_party/lang-items/Cargo.lock
generated
vendored
@@ -36,9 +36,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked_list_allocator"
|
name = "linked_list_allocator"
|
||||||
version = "0.8.11"
|
version = "0.10.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "822add9edb1860698b79522510da17bef885171f75aa395cff099d770c609c24"
|
checksum = "e322f259d225fbae43a1b053b2dc6a5968a6bdf8b205f5de684dab485b95030e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
|
|||||||
Reference in New Issue
Block a user