summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto
diff options
context:
space:
mode:
authorNora Widdecke <nora@sequoia-pgp.org>2021-11-22 12:58:47 +0100
committerNora Widdecke <nora@sequoia-pgp.org>2021-11-29 11:53:55 +0100
commit049055e3ff5ffe86700b668e924fbff96e82be94 (patch)
tree30dfd63e4d1c3016210b698813e99b70787890e8 /openpgp/src/crypto
parent97ce753fefae770ee0b5b02a611d75e29a7cd01d (diff)
Remove unnecessary borrows.
- Fixed with the help of clippy::needless_borrow.
Diffstat (limited to 'openpgp/src/crypto')
-rw-r--r--openpgp/src/crypto/backend/nettle/ecdh.rs6
-rw-r--r--openpgp/src/crypto/ecdh.rs2
-rw-r--r--openpgp/src/crypto/mem.rs4
-rw-r--r--openpgp/src/crypto/s2k.rs2
-rw-r--r--openpgp/src/crypto/symmetric.rs8
5 files changed, 11 insertions, 11 deletions
diff --git a/openpgp/src/crypto/backend/nettle/ecdh.rs b/openpgp/src/crypto/backend/nettle/ecdh.rs
index fbad33a5..75e86133 100644
--- a/openpgp/src/crypto/backend/nettle/ecdh.rs
+++ b/openpgp/src/crypto/backend/nettle/ecdh.rs
@@ -162,7 +162,7 @@ pub fn decrypt<R>(recipient: &Key<key::PublicParts, R>,
let (V, r, field_sz) = match curve {
Curve::NistP256 => {
let V =
- ecc::Point::new::<ecc::Secp256r1>(&Vx, &Vy)?;
+ ecc::Point::new::<ecc::Secp256r1>(Vx, Vy)?;
let r =
ecc::Scalar::new::<ecc::Secp256r1>(scalar.value())?;
@@ -170,7 +170,7 @@ pub fn decrypt<R>(recipient: &Key<key::PublicParts, R>,
}
Curve::NistP384 => {
let V =
- ecc::Point::new::<ecc::Secp384r1>(&Vx, &Vy)?;
+ ecc::Point::new::<ecc::Secp384r1>(Vx, Vy)?;
let r =
ecc::Scalar::new::<ecc::Secp384r1>(scalar.value())?;
@@ -178,7 +178,7 @@ pub fn decrypt<R>(recipient: &Key<key::PublicParts, R>,
}
Curve::NistP521 => {
let V =
- ecc::Point::new::<ecc::Secp521r1>(&Vx, &Vy)?;
+ ecc::Point::new::<ecc::Secp521r1>(Vx, Vy)?;
let r =
ecc::Scalar::new::<ecc::Secp521r1>(scalar.value())?;
diff --git a/openpgp/src/crypto/ecdh.rs b/openpgp/src/crypto/ecdh.rs
index 3407e8a3..1c3e600b 100644
--- a/openpgp/src/crypto/ecdh.rs
+++ b/openpgp/src/crypto/ecdh.rs
@@ -97,7 +97,7 @@ pub fn decrypt_unwrap<R>(recipient: &Key<key::PublicParts, R>,
// Z_len = the key size for the KEK_alg_ID used with AESKeyWrap
// Compute Z = KDF( S, Z_len, Param );
#[allow(non_snake_case)]
- let Z = kdf(&S, sym.key_size()?, *hash, &param)?;
+ let Z = kdf(S, sym.key_size()?, *hash, &param)?;
// Compute m = AESKeyUnwrap( Z, C ) as per [RFC3394]
let m = aes_key_unwrap(*sym, &Z, key)?;
diff --git a/openpgp/src/crypto/mem.rs b/openpgp/src/crypto/mem.rs
index 1fa6266b..8342aa8e 100644
--- a/openpgp/src/crypto/mem.rs
+++ b/openpgp/src/crypto/mem.rs
@@ -65,14 +65,14 @@ impl Clone for Protected {
// Make a vector with the correct size to avoid potential
// reallocations when turning it into a `Protected`.
let mut p = Vec::with_capacity(self.len());
- p.extend_from_slice(&self);
+ p.extend_from_slice(self);
p.into_boxed_slice().into()
}
}
impl PartialEq for Protected {
fn eq(&self, other: &Self) -> bool {
- secure_cmp(&self, &other) == Ordering::Equal
+ secure_cmp(self, other) == Ordering::Equal
}
}
diff --git a/openpgp/src/crypto/s2k.rs b/openpgp/src/crypto/s2k.rs
index d64fde60..98895b5f 100644
--- a/openpgp/src/crypto/s2k.rs
+++ b/openpgp/src/crypto/s2k.rs
@@ -198,7 +198,7 @@ impl S2K {
// Independent of what the hash count is, we
// always hash the whole salt and password once.
hash.update(&salt[..]);
- hash.update(&string);
+ hash.update(string);
},
&S2K::Iterated { ref salt, hash_bytes, .. } => {
// Unroll the processing loop N times.
diff --git a/openpgp/src/crypto/symmetric.rs b/openpgp/src/crypto/symmetric.rs
index d2bec940..fcfd1d23 100644
--- a/openpgp/src/crypto/symmetric.rs
+++ b/openpgp/src/crypto/symmetric.rs
@@ -425,7 +425,7 @@ mod tests {
// Ensure we use CFB128 by default
let iv = hex::decode("000102030405060708090A0B0C0D0E0F").unwrap();
- let mut cfb = algo.make_encrypt_cfb(&key, iv).unwrap();
+ let mut cfb = algo.make_encrypt_cfb(key, iv).unwrap();
let msg = hex::decode("6bc1bee22e409f96e93d7e117393172a").unwrap();
let mut dst = vec![0; msg.len()];
cfb.encrypt(&mut dst, &*msg).unwrap();
@@ -433,7 +433,7 @@ mod tests {
// 32-byte long message
let iv = hex::decode("000102030405060708090A0B0C0D0E0F").unwrap();
- let mut cfb = algo.make_encrypt_cfb(&key, iv).unwrap();
+ let mut cfb = algo.make_encrypt_cfb(key, iv).unwrap();
let msg = b"This is a very important message";
let mut dst = vec![0; msg.len()];
cfb.encrypt(&mut dst, &*msg).unwrap();
@@ -443,7 +443,7 @@ mod tests {
// 33-byte (uneven) long message
let iv = hex::decode("000102030405060708090A0B0C0D0E0F").unwrap();
- let mut cfb = algo.make_encrypt_cfb(&key, iv).unwrap();
+ let mut cfb = algo.make_encrypt_cfb(key, iv).unwrap();
let msg = b"This is a very important message!";
let mut dst = vec![0; msg.len()];
cfb.encrypt(&mut dst, &*msg).unwrap();
@@ -453,7 +453,7 @@ mod tests {
// 33-byte (uneven) long message, chunked
let iv = hex::decode("000102030405060708090A0B0C0D0E0F").unwrap();
- let mut cfb = algo.make_encrypt_cfb(&key, iv).unwrap();
+ let mut cfb = algo.make_encrypt_cfb(key, iv).unwrap();
let mut dst = vec![0; msg.len()];
for (mut dst, msg) in dst.chunks_mut(16).zip(msg.chunks(16)) {
cfb.encrypt(&mut dst, msg).unwrap();