mirror of
https://git.um-react.app/um/lib_um_crypto_rust.git
synced 2026-03-07 20:19:51 +00:00
fix: address clippy warnings
This commit is contained in:
@@ -23,7 +23,7 @@ impl JooxDecipher for Header {
|
||||
|
||||
let (buffer, _) = buffer
|
||||
.split_at_mut_checked(buffer_size)
|
||||
.ok_or_else(|| JooxError::OutputBufferTooSmall(buffer_size))?;
|
||||
.ok_or(JooxError::OutputBufferTooSmall(buffer_size))?;
|
||||
|
||||
let result = (&self.aes_engine)
|
||||
.decrypt_padded_mut::<Pkcs7>(buffer)
|
||||
|
||||
@@ -96,9 +96,9 @@ impl Header {
|
||||
}
|
||||
|
||||
fn get_challenge_data(magic_header: &[u8; 0x10]) -> Result<[u8; 0x10], KugouError> {
|
||||
match magic_header {
|
||||
&KGM_HEADER => Ok(KGM_TEST_DATA),
|
||||
&VPR_HEADER => Ok(VPR_TEST_DATA),
|
||||
match *magic_header {
|
||||
KGM_HEADER => Ok(KGM_TEST_DATA),
|
||||
VPR_HEADER => Ok(VPR_TEST_DATA),
|
||||
_ => Err(KugouError::NotKGMFile)?,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ pub struct DecipherV2 {
|
||||
impl DecipherV2 {
|
||||
pub fn new(header: &Header) -> Result<Self, KugouError> {
|
||||
let mut key = [0u8; 4];
|
||||
key.copy_from_slice(get_slot_key(&header)?);
|
||||
key.copy_from_slice(get_slot_key(header)?);
|
||||
Ok(Self { key })
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ impl MetadataParser for PcV1Legacy {
|
||||
let ekey = payload
|
||||
.iter()
|
||||
.take_while(|&&b| b != 0)
|
||||
.map(|&b| b)
|
||||
.copied()
|
||||
.collect::<Vec<_>>();
|
||||
let ekey = String::from_utf8_lossy(ekey.as_slice());
|
||||
if !is_base64(ekey.as_bytes()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
mod constants;
|
||||
mod des;
|
||||
mod des_impl;
|
||||
mod utils;
|
||||
|
||||
pub use des::{DESMode, QrcDes};
|
||||
pub use des_impl::{DESMode, QrcDes};
|
||||
|
||||
@@ -28,7 +28,7 @@ pub fn make_device_secret<S: AsRef<[u8]>>(
|
||||
let device_id_hash_code_hex = device_id_hash_code_hex.as_bytes();
|
||||
|
||||
let mut device_key = [0u8; 0x10];
|
||||
device_key[..device_id_hash_code_hex.len()].copy_from_slice(&device_id_hash_code_hex);
|
||||
device_key[..device_id_hash_code_hex.len()].copy_from_slice(device_id_hash_code_hex);
|
||||
for (key, salt) in device_key.iter_mut().zip(DEVICE_KEY_SALT) {
|
||||
*key = salt.wrapping_add(*key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user