diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2021-09-30 12:51:09 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2021-09-30 12:51:51 +0200 |
commit | 25dff28a80cd67f722c10a3232a272a668bfd1d5 (patch) | |
tree | 9bd03a6e4da0ef1c8b0e6c7e3ab4954745ce03fa /openpgp/src/crypto/backend | |
parent | fb235f30721f7a8755de7aa365315fe04faac9a6 (diff) |
openpgp: Simplify code.
- r is a mem::Protected, no need to explicitly clean it up.
Diffstat (limited to 'openpgp/src/crypto/backend')
-rw-r--r-- | openpgp/src/crypto/backend/nettle/ecdh.rs | 9 |
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 } |