From a61bfdab687e9c0b6c5e263ed304f48183059a45 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Tue, 3 Mar 2020 23:20:33 +0100 Subject: openpgp: Only impl Serialize for objects that are normally exported. - Add two new traits: `Marshal` and `MarshalInto`. - Implement them instead of `Serialize` and `SerializeInto`. - Only implement `Serialize` and `SerializeInto` for data structures that are normally exported. - This should prevent users from accidentally serializing a bare signature (`Signature`) when they meant to serialize a signature packet (`Packet`), for instance. - Fixes #368. --- openpgp/src/crypto/s2k.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openpgp/src/crypto/s2k.rs') diff --git a/openpgp/src/crypto/s2k.rs b/openpgp/src/crypto/s2k.rs index fc29a7e1..d738a37d 100644 --- a/openpgp/src/crypto/s2k.rs +++ b/openpgp/src/crypto/s2k.rs @@ -290,7 +290,6 @@ mod tests { use crate::SymmetricAlgorithm; use crate::Packet; use crate::parse::{Parse, PacketParser}; - use crate::serialize::Serialize; #[test] fn s2k_parser_test() { @@ -423,7 +422,8 @@ mod tests { quickcheck! { fn s2k_roundtrip(s2k: S2K) -> bool { - use crate::serialize::SerializeInto; + use crate::serialize::Marshal; + use crate::serialize::MarshalInto; eprintln!("in {:?}", s2k); use std::io::Cursor; -- cgit v1.2.3