diff --git a/src/internal.rs b/src/internal.rs index 1df9429..44fac1d 100644 --- a/src/internal.rs +++ b/src/internal.rs @@ -79,6 +79,7 @@ impl Drop for DesKey { } /// 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]) { output.copy_from_slice(input); 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 +#[allow(clippy::trivially_copy_pass_by_ref)] pub fn des_decrypt(key: &DesKey, input: &[u8; DES_LEN_DES], output: &mut [u8; DES_LEN_DES]) { output.copy_from_slice(input); TdesEde3::new(GenericArray::from_slice(&key.0)) diff --git a/src/yubikey.rs b/src/yubikey.rs index 6aa238d..9f2e146 100644 --- a/src/yubikey.rs +++ b/src/yubikey.rs @@ -844,7 +844,7 @@ pub unsafe fn ykpiv_authenticate( des_encrypt(&mgm_key, &challenge, &mut response); // TODO(tarcieri): constant time comparison! - if response == &data[4..12] { + if response == data[4..12] { res = Ok(()); } else { res = Err(ErrorKind::AuthenticationError);