Address clippy lints
This commit is contained in:
@@ -79,6 +79,7 @@ impl Drop for DesKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Encrypt with DES key
|
/// Encrypt with DES key
|
||||||
|
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||||
pub fn des_encrypt(key: &DesKey, input: &[u8; DES_LEN_DES], output: &mut [u8; DES_LEN_DES]) {
|
pub fn des_encrypt(key: &DesKey, input: &[u8; DES_LEN_DES], output: &mut [u8; DES_LEN_DES]) {
|
||||||
output.copy_from_slice(input);
|
output.copy_from_slice(input);
|
||||||
TdesEde3::new(GenericArray::from_slice(&key.0))
|
TdesEde3::new(GenericArray::from_slice(&key.0))
|
||||||
@@ -86,6 +87,7 @@ pub fn des_encrypt(key: &DesKey, input: &[u8; DES_LEN_DES], output: &mut [u8; DE
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Decrypt with DES key
|
/// Decrypt with DES key
|
||||||
|
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||||
pub fn des_decrypt(key: &DesKey, input: &[u8; DES_LEN_DES], output: &mut [u8; DES_LEN_DES]) {
|
pub fn des_decrypt(key: &DesKey, input: &[u8; DES_LEN_DES], output: &mut [u8; DES_LEN_DES]) {
|
||||||
output.copy_from_slice(input);
|
output.copy_from_slice(input);
|
||||||
TdesEde3::new(GenericArray::from_slice(&key.0))
|
TdesEde3::new(GenericArray::from_slice(&key.0))
|
||||||
|
|||||||
+1
-1
@@ -844,7 +844,7 @@ pub unsafe fn ykpiv_authenticate(
|
|||||||
des_encrypt(&mgm_key, &challenge, &mut response);
|
des_encrypt(&mgm_key, &challenge, &mut response);
|
||||||
|
|
||||||
// TODO(tarcieri): constant time comparison!
|
// TODO(tarcieri): constant time comparison!
|
||||||
if response == &data[4..12] {
|
if response == data[4..12] {
|
||||||
res = Ok(());
|
res = Ok(());
|
||||||
} else {
|
} else {
|
||||||
res = Err(ErrorKind::AuthenticationError);
|
res = Err(ErrorKind::AuthenticationError);
|
||||||
|
|||||||
Reference in New Issue
Block a user