From 252c51430560b2ca5a34aa9007adbfadaa6dab5a Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Fri, 28 Dec 2018 16:24:07 +0100 Subject: ffi: Add sq_signature_to_packet. --- ffi/include/sequoia/openpgp.h | 5 +++++ ffi/src/openpgp.rs | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/ffi/include/sequoia/openpgp.h b/ffi/include/sequoia/openpgp.h index 01aa1aab..88d43863 100644 --- a/ffi/include/sequoia/openpgp.h +++ b/ffi/include/sequoia/openpgp.h @@ -538,6 +538,11 @@ sq_status_t sq_packet_pile_serialize (sq_context_t ctx, /*/ void sq_signature_free (sq_signature_t signature); +/*/ +/// Converts the signature to a packet. +/*/ +sq_packet_t sq_signature_to_packet (sq_signature_t signature); + /*/ /// Returns the value of the `Signature` packet's Issuer subpacket. /// diff --git a/ffi/src/openpgp.rs b/ffi/src/openpgp.rs index 9b994724..cddc4848 100644 --- a/ffi/src/openpgp.rs +++ b/ffi/src/openpgp.rs @@ -1521,6 +1521,17 @@ pub extern "system" fn sq_signature_free(s: *mut Signature) { } } +/// Converts the signature to a packet. +#[no_mangle] +pub extern "system" fn sq_signature_to_packet(s: *mut Signature) + -> *mut Packet +{ + assert!(! s.is_null()); + unsafe { + box_raw!(Box::from_raw(s).to_packet()) + } +} + /// Returns the value of the `Signature` packet's Issuer subpacket. /// /// If there is no Issuer subpacket, this returns NULL. Note: if -- cgit v1.2.3