summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-02-24 18:20:36 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-02-24 18:48:15 +0100
commit37a8dde935d39d239db67fc9ce0ce3fdde6731c7 (patch)
tree3eb44c341eaa1c93018aeb9a54af7ba66e482d50
parent1ed1ba13602470caf483385cdb62e92d92c86894 (diff)
openpgp: Improve protection of unencrypted key material.
-rw-r--r--openpgp/src/serialize/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/openpgp/src/serialize/mod.rs b/openpgp/src/serialize/mod.rs
index 8a857335..6799c558 100644
--- a/openpgp/src/serialize/mod.rs
+++ b/openpgp/src/serialize/mod.rs
@@ -1428,8 +1428,9 @@ impl<P, R> Key4<P, R>
write_byte(o, 0)?;
// To compute the checksum, serialize to a buffer first.
- let mut buf = Vec::new(); // XXX: Protect this vec.
+ let mut buf = Vec::new();
mpis.serialize(&mut buf)?;
+ let buf: crate::crypto::mem::Protected = buf.into();
let checksum: usize = buf.iter().map(|x| *x as usize)
.sum();