summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-03-11 11:34:03 +0100
committerNeal H. Walfield <neal@pep.foundation>2019-03-11 11:34:03 +0100
commit2a22c7b63f3e1118566b123d0ba0fd3a7a0b370a (patch)
tree57a82738b75e8784ffb2f86be427c2da62f22ae4 /openpgp-ffi
parent8d280b4cf59ab57c2e7fa63614e3672277654749 (diff)
openpgp-ffi: Unwrap array of wrapped TPKs.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r--openpgp-ffi/src/serialize.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/openpgp-ffi/src/serialize.rs b/openpgp-ffi/src/serialize.rs
index 04240d0c..362d2aa6 100644
--- a/openpgp-ffi/src/serialize.rs
+++ b/openpgp-ffi/src/serialize.rs
@@ -22,6 +22,7 @@ use self::openpgp::constants::{
use error::Status;
use MoveFromRaw;
+use RefRaw;
use self::openpgp::serialize::{
writer,
@@ -36,7 +37,7 @@ use self::openpgp::serialize::{
},
};
-use super::openpgp::TPK;
+use super::tpk::TPK;
/// Streams an OpenPGP message.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle]
@@ -217,7 +218,7 @@ pub extern "system" fn pgp_encryptor_new
(errp: Option<&mut *mut ::error::Error>,
inner: *mut writer::Stack<'static, Cookie>,
passwords: Option<&*const c_char>, passwords_len: size_t,
- recipients: Option<&&TPK>, recipients_len: size_t,
+ recipients: Option<&*const TPK>, recipients_len: size_t,
encryption_mode: uint8_t)
-> *mut writer::Stack<'static, Cookie>
{
@@ -242,6 +243,8 @@ pub extern "system" fn pgp_encryptor_new
} else {
&[]
};
+ let recipients : Vec<&::sequoia_openpgp::TPK>
+ = recipients.into_iter().map(|&tpk| tpk.ref_raw()).collect();
let encryption_mode = match encryption_mode {
0 => EncryptionMode::AtRest,
1 => EncryptionMode::ForTransport,
@@ -249,6 +252,6 @@ pub extern "system" fn pgp_encryptor_new
};
ffi_try_box!(Encryptor::new(*inner,
&passwords_.iter().collect::<Vec<&Password>>(),
- &recipients,
+ &recipients[..],
encryption_mode))
}