From ff1f37a7b86780ef8d533b66f6aaea9a0f393956 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Fri, 20 Mar 2020 16:38:27 +0100 Subject: 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. --- openpgp-ffi/src/cert.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'openpgp-ffi/src/cert.rs') 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 + -> Maybe> { 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 + -> Maybe> { 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 } -- cgit v1.2.3