Fix clippy warnings: unused imports, minor style fixes

This commit is contained in:
Warren
2026-06-20 21:08:50 +08:00
parent 24029501d9
commit dbca6e6d35
7 changed files with 18 additions and 21 deletions

View File

@@ -13,7 +13,6 @@ use chacha20poly1305::{
ChaCha20Poly1305, Key as ChaKey, Nonce as ChaNonce, // Phase 5: ChaCha20-Poly1305 AEAD
};
use anyhow::{anyhow, Result};
use byteorder::{BigEndian, WriteBytesExt};
use cipher::{KeyIvInit, StreamCipher};
use ctr::Ctr128BE;
use hmac::{Hmac, Mac};
@@ -1046,7 +1045,7 @@ impl EncryptedPacket {
let cipher = Aes256GcmAead::new_from_slice(&key_bytes[..32])
.map_err(|e| anyhow!("AES-GCM key init failed: {}", e))?;
let nonce = Nonce::from_slice(&prep.nonce_bytes);
let packet_length_bytes = (prep.packet_length as u32).to_be_bytes();
let packet_length_bytes = prep.packet_length.to_be_bytes();
let ciphertext = cipher
.encrypt(
nonce,
@@ -1068,7 +1067,7 @@ impl EncryptedPacket {
// Full packet: [packet_length (plaintext)] [ciphertext (payload + padding + tag)]
let mut full_buf = SshBuf::with_capacity(4 + ciphertext.len());
full_buf.put(&(prep.packet_length as u32).to_be_bytes())?;
full_buf.put(&prep.packet_length.to_be_bytes())?;
full_buf.put(&ciphertext)?;
packets.push(Self {