summaryrefslogtreecommitdiffstats
path: root/ffi
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2018-11-22 10:28:13 +0100
committerNeal H. Walfield <neal@pep.foundation>2018-11-22 10:28:52 +0100
commitf9725cdcd471a5dbf1d61aef4f40cf229e0c04c1 (patch)
tree39ed66a2b0abb462cff300c21bca967a3ab9bfcd /ffi
parent10a4ccf9670ee3b1c04475a9571fa5f4f5aa39d0 (diff)
ffi: Provide an interface to convert a tsk into a tpk.
Diffstat (limited to 'ffi')
-rw-r--r--ffi/include/sequoia/openpgp.h5
-rw-r--r--ffi/src/openpgp.rs10
2 files changed, 15 insertions, 0 deletions
diff --git a/ffi/include/sequoia/openpgp.h b/ffi/include/sequoia/openpgp.h
index af136b53..64e6a1db 100644
--- a/ffi/include/sequoia/openpgp.h
+++ b/ffi/include/sequoia/openpgp.h
@@ -712,6 +712,11 @@ void sq_tsk_free (sq_tsk_t tsk);
sq_tpk_t sq_tsk_tpk (sq_tsk_t tsk);
/*/
+/// Converts the TSK into a TPK.
+/*/
+sq_tpk_t sq_tsk_into_tpk (sq_tsk_t tsk);
+
+/*/
/// Serializes the TSK.
/*/
sq_status_t sq_tsk_serialize (sq_context_t ctx,
diff --git a/ffi/src/openpgp.rs b/ffi/src/openpgp.rs
index 27df8ff5..1d23ad61 100644
--- a/ffi/src/openpgp.rs
+++ b/ffi/src/openpgp.rs
@@ -1048,6 +1048,16 @@ pub extern "system" fn sq_tsk_tpk(tsk: Option<&TSK>)
tsk.tpk()
}
+/// Converts the TSK into a TPK.
+#[no_mangle]
+pub extern "system" fn sq_tsk_into_tpk(tsk: *mut TSK)
+ -> *mut TPK {
+ let tsk = unsafe {
+ Box::from_raw(tsk)
+ };
+ box_raw!(tsk.into_tpk())
+}
+
/// Serializes the TSK.
#[no_mangle]