summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/src/cert.rs
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-03-20 16:38:27 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-03-20 19:03:15 +0100
commitff1f37a7b86780ef8d533b66f6aaea9a0f393956 (patch)
tree3a69884f8f6327c683360bc4df551d009290f10e /openpgp-ffi/src/cert.rs
parent1909b1f0a9fe60b588f31155bdfaa5ffbec3e22e (diff)
openpgp-ffi: Change key iterator to return key amalgamations.
- Introduce `KeyAmalgamation` and `ValidKeyAmalgamation` to the C FFI. - Change pgp_cert_key_iter_next and pgp_cert_valid_key_iter_next to return them instead of keys.
Diffstat (limited to 'openpgp-ffi/src/cert.rs')
-rw-r--r--openpgp-ffi/src/cert.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/openpgp-ffi/src/cert.rs b/openpgp-ffi/src/cert.rs
index 4dd2953f..5f04ac8c 100644
--- a/openpgp-ffi/src/cert.rs
+++ b/openpgp-ffi/src/cert.rs
@@ -29,6 +29,7 @@ use super::packet_pile::PacketPile;
use super::tsk::TSK;
use super::revocation_status::RevocationStatus;
use super::policy::Policy;
+use super::key_amalgamation::{KeyAmalgamation, ValidKeyAmalgamation};
use crate::Maybe;
use crate::RefRaw;
@@ -541,14 +542,13 @@ pub extern "C" fn pgp_cert_key_iter_policy<'a>(
#[::sequoia_ffi_macros::extern_fn] #[no_mangle]
pub extern "C" fn pgp_cert_key_iter_next<'a>(
iter_wrapper: *mut KeyIterWrapper<'a>)
- -> Maybe<Key>
+ -> Maybe<KeyAmalgamation<'a>>
{
let iter_wrapper = ffi_param_ref_mut!(iter_wrapper);
iter_wrapper.next_called = true;
if let Some(ka) = iter_wrapper.iter.as_mut().unwrap().next() {
- Some(ka.key().mark_parts_unspecified_ref().mark_role_unspecified_ref())
- .move_into_raw()
+ Some(ka.mark_parts_unspecified()).move_into_raw()
} else {
None
}
@@ -763,7 +763,7 @@ pub extern "C" fn pgp_cert_valid_key_iter_next<'a>(
iter_wrapper: *mut ValidKeyIterWrapper<'a>,
sigo: Option<&mut *mut Signature>,
rso: Option<&mut *mut RevocationStatus<'a>>)
- -> Maybe<Key>
+ -> Maybe<ValidKeyAmalgamation<'a>>
{
let iter_wrapper = ffi_param_ref_mut!(iter_wrapper);
iter_wrapper.next_called = true;
@@ -771,7 +771,6 @@ pub extern "C" fn pgp_cert_valid_key_iter_next<'a>(
if let Some(ka) = iter_wrapper.iter.as_mut().unwrap().next() {
let sig = ka.binding_signature();
let rs = ka.revoked();
- let key = ka.key();
if let Some(ptr) = sigo {
*ptr = sig.move_into_raw();
@@ -781,10 +780,7 @@ pub extern "C" fn pgp_cert_valid_key_iter_next<'a>(
*ptr = rs.move_into_raw();
}
- let key
- = key.mark_parts_unspecified_ref().mark_role_unspecified_ref();
-
- Some(key).move_into_raw()
+ Some(ka.mark_parts_unspecified()).move_into_raw()
} else {
None
}