summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-03-03 23:20:33 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-03-03 23:52:03 +0100
commita61bfdab687e9c0b6c5e263ed304f48183059a45 (patch)
tree545d516b6b2fe513f63caf3bcc81024338459583 /openpgp-ffi
parent93dbeb3160262726d4c60b4811cf352c08dfc5b3 (diff)
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.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r--openpgp-ffi/include/sequoia/openpgp.h14
-rw-r--r--openpgp-ffi/src/packet/literal.rs2
-rw-r--r--openpgp-ffi/src/packet/signature.rs2
3 files changed, 2 insertions, 16 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h
index dd0b0fa0..21d85ed2 100644
--- a/openpgp-ffi/include/sequoia/openpgp.h
+++ b/openpgp-ffi/include/sequoia/openpgp.h
@@ -317,13 +317,6 @@ pgp_signature_t pgp_signature_from_bytes (pgp_error_t *errp,
const uint8_t *b, size_t len);
/*/
-/// Serializes this object.
-/*/
-pgp_status_t pgp_signature_serialize (pgp_error_t *errp,
- const pgp_signature_t signature,
- pgp_writer_t writer);
-
-/*/
/// Converts the signature to a packet.
/*/
pgp_packet_t pgp_signature_into_packet (pgp_signature_t signature);
@@ -568,13 +561,6 @@ pgp_literal_t pgp_literal_from_bytes (pgp_error_t *errp,
const uint8_t *b, size_t len);
/*/
-/// Serializes this object.
-/*/
-pgp_status_t pgp_literal_serialize (pgp_error_t *errp,
- const pgp_literal_t literal,
- pgp_writer_t writer);
-
-/*/
/// Converts the literal to a packet.
/*/
pgp_packet_t pgp_literal_into_packet (pgp_literal_t literal);
diff --git a/openpgp-ffi/src/packet/literal.rs b/openpgp-ffi/src/packet/literal.rs
index cf84e038..0628241d 100644
--- a/openpgp-ffi/src/packet/literal.rs
+++ b/openpgp-ffi/src/packet/literal.rs
@@ -30,7 +30,7 @@ use crate::RefRaw;
///
/// [`sequoia-openpgp::packet::literal::Literal`]: ../../../../sequoia_openpgp/packet/literal/struct.Literal.html
#[crate::ffi_wrapper_type(prefix = "pgp_",
- derive = "Debug, Parse, Serialize")]
+ derive = "Debug, Parse")]
pub struct Literal(openpgp::packet::Literal);
/// Converts the literal data packet to a packet.
diff --git a/openpgp-ffi/src/packet/signature.rs b/openpgp-ffi/src/packet/signature.rs
index 60903fc5..fdab2d4f 100644
--- a/openpgp-ffi/src/packet/signature.rs
+++ b/openpgp-ffi/src/packet/signature.rs
@@ -35,7 +35,7 @@ use crate::RefRaw;
///
/// [`sequoia-openpgp::packet::Signature`]: ../../../../sequoia_openpgp/packet/enum.Signature.html
#[crate::ffi_wrapper_type(prefix = "pgp_",
- derive = "Clone, Debug, PartialEq, Parse, Serialize")]
+ derive = "Clone, Debug, PartialEq, Parse")]
pub struct Signature(openpgp::packet::Signature);
/// Converts the signature to a packet.