adds style fix and updates Cargo.lock (#576)

This commit is contained in:
kaczmarczyck
2023-01-04 15:19:26 +01:00
committed by GitHub
parent 6b5f6e53eb
commit 0db393bd1e
5 changed files with 17 additions and 17 deletions

4
fuzz/Cargo.lock generated
View File

@@ -263,9 +263,9 @@ dependencies = [
[[package]]
name = "linked_list_allocator"
version = "0.8.11"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "822add9edb1860698b79522510da17bef885171f75aa395cff099d770c609c24"
checksum = "e322f259d225fbae43a1b053b2dc6a5968a6bdf8b205f5de684dab485b95030e"
[[package]]
name = "log"

View File

@@ -344,8 +344,8 @@ impl CtapHid {
}
/// Helper function to parse a raw packet.
pub fn process_single_packet(packet: &HidPacket) -> (&ChannelID, ProcessedPacket) {
let (cid, rest) = array_refs![packet, 4, 60];
pub fn process_single_packet(packet: &HidPacket) -> (ChannelID, ProcessedPacket) {
let (&cid, rest) = array_refs![packet, 4, 60];
if rest[0] & CtapHid::PACKET_TYPE_MASK != 0 {
let cmd = rest[0] & !CtapHid::PACKET_TYPE_MASK;
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..9].copy_from_slice(&[0x81, 0x00, 0x02, 0x99, 0x99]);
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 {
cmd: CtapHidCommand::Ping as u8,
len: 2,

View File

@@ -89,8 +89,8 @@ impl MessageAssembler {
// If the packet is from the timed-out channel, send back a timeout error.
// Otherwise, proceed with processing the packet.
if *cid == current_cid {
return Err((*cid, CtapHidError::MsgTimeout));
if cid == current_cid {
return Err((cid, CtapHidError::MsgTimeout));
}
}
@@ -98,12 +98,12 @@ impl MessageAssembler {
// Expecting an initialization packet.
match processed_packet {
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 { .. } => {
// CTAP specification (version 20190130) section 8.1.5.4
// Spurious continuation packets will be ignored.
Err((*cid, CtapHidError::UnexpectedContinuation))
Err((cid, CtapHidError::UnexpectedContinuation))
}
}
} else {
@@ -111,8 +111,8 @@ impl MessageAssembler {
// CTAP specification (version 20190130) section 8.1.5.1
// Reject packets from other channels.
if *cid != self.cid {
return Err((*cid, CtapHidError::ChannelBusy));
if cid != self.cid {
return Err((cid, CtapHidError::ChannelBusy));
}
match processed_packet {
@@ -120,16 +120,16 @@ impl MessageAssembler {
ProcessedPacket::InitPacket { cmd, len, data } => {
self.reset();
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 {
Err((*cid, CtapHidError::InvalidSeq))
Err((cid, CtapHidError::InvalidSeq))
}
}
ProcessedPacket::ContinuationPacket { seq, data } => {
if seq != self.seq {
// Reject packets with the wrong sequence number.
self.reset();
Err((*cid, CtapHidError::InvalidSeq))
Err((cid, CtapHidError::InvalidSeq))
} else {
// Update the last timestamp.
self.last_timestamp = timestamp;

View File

@@ -251,7 +251,7 @@ fn send_keepalive_up_needed(
// We only parse one packet, because we only care about CANCEL.
let (received_cid, processed_packet) = CtapHid::process_single_packet(&pkt);
if received_cid != &cid {
if received_cid != cid {
debug_ctap!(
env,
"Received a packet on channel ID {:?} while sending a KEEPALIVE packet",

4
third_party/lang-items/Cargo.lock generated vendored
View File

@@ -36,9 +36,9 @@ dependencies = [
[[package]]
name = "linked_list_allocator"
version = "0.8.11"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "822add9edb1860698b79522510da17bef885171f75aa395cff099d770c609c24"
checksum = "e322f259d225fbae43a1b053b2dc6a5968a6bdf8b205f5de684dab485b95030e"
[[package]]
name = "proc-macro2"