diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index c009fa2..29d433d 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -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" diff --git a/src/ctap/hid/mod.rs b/src/ctap/hid/mod.rs index d750f72..81dab01 100644 --- a/src/ctap/hid/mod.rs +++ b/src/ctap/hid/mod.rs @@ -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, diff --git a/src/ctap/hid/receive.rs b/src/ctap/hid/receive.rs index 2b88648..f026b2b 100644 --- a/src/ctap/hid/receive.rs +++ b/src/ctap/hid/receive.rs @@ -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; diff --git a/src/ctap/mod.rs b/src/ctap/mod.rs index 156ac12..5c897aa 100644 --- a/src/ctap/mod.rs +++ b/src/ctap/mod.rs @@ -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", diff --git a/third_party/lang-items/Cargo.lock b/third_party/lang-items/Cargo.lock index ffd3c29..f6e0d5b 100644 --- a/third_party/lang-items/Cargo.lock +++ b/third_party/lang-items/Cargo.lock @@ -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"