summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2021-09-30 12:51:09 +0200
committerJustus Winter <justus@sequoia-pgp.org>2021-09-30 12:51:51 +0200
commit25dff28a80cd67f722c10a3232a272a668bfd1d5 (patch)
tree9bd03a6e4da0ef1c8b0e6c7e3ab4954745ce03fa
parentfb235f30721f7a8755de7aa365315fe04faac9a6 (diff)
openpgp: Simplify code.
- r is a mem::Protected, no need to explicitly clean it up.
-rw-r--r--openpgp/src/crypto/backend/nettle/ecdh.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/openpgp/src/crypto/backend/nettle/ecdh.rs b/openpgp/src/crypto/backend/nettle/ecdh.rs
index 011ac024..fbad33a5 100644
--- a/openpgp/src/crypto/backend/nettle/ecdh.rs
+++ b/openpgp/src/crypto/backend/nettle/ecdh.rs
@@ -149,13 +149,8 @@ pub fn decrypt<R>(recipient: &Key<key::PublicParts, R>,
// is the recipient's key pair.
let mut S: Protected =
vec![0; curve25519::CURVE25519_SIZE].into();
- let res = curve25519::mul(&mut S, &r[..], V);
-
- unsafe {
- memsec::memzero(r.as_mut_ptr(),
- curve25519::CURVE25519_SIZE);
- }
- res.expect("buffers are of the wrong size");
+ curve25519::mul(&mut S, &r[..], V)
+ .expect("buffers are of the wrong size");
S
}