summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-05-10 09:20:40 +0200
committerNeal H. Walfield <neal@pep.foundation>2019-05-10 09:36:21 +0200
commitcf7bfeaeb868bea77cc38db818a64cb9fdbfcda8 (patch)
tree4fa4238f6b10430e1380cbecdc8b7f7dd5ff983e
parent7bf4a46b30e2a78734f7e2e1b8e7f33bb4762b86 (diff)
openpgp-ffi: Use new-style unwrapping for packets
- pgp_tpk_merge_packets was still using old-style unwrapping for the array of Packets although Packets now use new-style wrapping. - Likewise pgp_signature_into_packet.
-rw-r--r--openpgp-ffi/src/packet/signature.rs6
-rw-r--r--openpgp-ffi/src/tpk.rs6
2 files changed, 7 insertions, 5 deletions
diff --git a/openpgp-ffi/src/packet/signature.rs b/openpgp-ffi/src/packet/signature.rs
index a4aa94d6..231a9ccb 100644
--- a/openpgp-ffi/src/packet/signature.rs
+++ b/openpgp-ffi/src/packet/signature.rs
@@ -10,6 +10,7 @@
use libc::time_t;
extern crate sequoia_openpgp as openpgp;
+use super::Packet;
use super::super::fingerprint::Fingerprint;
use super::super::keyid::KeyID;
use super::key::Key;
@@ -37,8 +38,9 @@ pub struct Signature(openpgp::packet::Signature);
/// Converts the signature to a packet.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
-fn pgp_signature_into_packet(s: *mut Signature) -> *mut openpgp::Packet {
- box_raw!(s.move_from_raw().into())
+fn pgp_signature_into_packet(s: *mut Signature) -> *mut Packet {
+ let p : openpgp::Packet = s.move_from_raw().into();
+ p.move_into_raw()
}
/// Returns the value of the `Signature` packet's Issuer subpacket.
diff --git a/openpgp-ffi/src/tpk.rs b/openpgp-ffi/src/tpk.rs
index 64a923e6..2080e494 100644
--- a/openpgp-ffi/src/tpk.rs
+++ b/openpgp-ffi/src/tpk.rs
@@ -11,7 +11,6 @@ use libc::{c_char, c_int, size_t, time_t, uint8_t};
extern crate sequoia_openpgp as openpgp;
use self::openpgp::{
- Packet,
autocrypt::Autocrypt,
crypto,
constants::ReasonForRevocation,
@@ -32,6 +31,7 @@ use self::openpgp::{
use ::error::Status;
use super::fingerprint::Fingerprint;
use super::packet::key::Key;
+use super::packet::Packet;
use super::packet::signature::Signature;
use super::packet_pile::PacketPile;
use super::tsk::TSK;
@@ -121,7 +121,7 @@ fn pgp_tpk_merge_packets(errp: Option<&mut *mut ::error::Error>,
slice::from_raw_parts_mut(packets, packets_len)
};
let packets =
- packets.iter_mut().map(|p| *unsafe { Box::from_raw(*p) } ).collect();
+ packets.iter_mut().map(|&mut p| p.move_from_raw()).collect();
tpk.merge_packets(packets).move_into_raw(errp)
}
@@ -677,7 +677,7 @@ pub extern "C" fn pgp_tpk_key_iter_next<'a>(
/// Wrappers a TPKParser for export via the FFI.
pub struct TPKParserWrapper<'a> {
- parser: TPKParser<'a, std::vec::IntoIter<Packet>>,
+ parser: TPKParser<'a, std::vec::IntoIter<self::openpgp::Packet>>,
}
/// Returns a TPKParser.