diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-04-29 10:22:48 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-04-29 15:37:41 +0200 |
commit | 4aee697b1a582be8f7e48e9ebc0f95a06d23e2b2 (patch) | |
tree | a911697e0e478303dc24e4f1267a30244d985936 /openpgp-ffi/src | |
parent | 8987c5963bda650dc766bd43a4e001ea0ce283a7 (diff) |
openpgp: Fix ValidKeyAmalgamation::set_expiration_time's return type
- Change `ValidKeyAmalgamation::set_expiration_time` to return a
`Result<Vec<Signature>>` instead of a `Result<Vec<Packet>>`.
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r-- | openpgp-ffi/src/key_amalgamation.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/openpgp-ffi/src/key_amalgamation.rs b/openpgp-ffi/src/key_amalgamation.rs index 0b661533..d25fb2bc 100644 --- a/openpgp-ffi/src/key_amalgamation.rs +++ b/openpgp-ffi/src/key_amalgamation.rs @@ -16,7 +16,6 @@ use self::openpgp::crypto; use super::packet::key::Key; use super::packet::signature::Signature; -use super::packet::Packet; use super::policy::Policy; use super::revocation_status::RevocationStatus; @@ -107,7 +106,7 @@ fn pgp_valid_key_amalgamation_set_expiration_time( ka: *const ValidKeyAmalgamation, primary_signer: *mut Box<dyn crypto::Signer>, expiry: time_t, - packets: *mut *mut *mut Packet, packet_count: *mut size_t) + sigs: *mut *mut *mut Signature, sig_count: *mut size_t) -> Status { ffi_make_fry_from_errp!(errp); @@ -115,22 +114,22 @@ fn pgp_valid_key_amalgamation_set_expiration_time( let ka = ka.ref_raw(); let signer = ffi_param_ref_mut!(primary_signer); let expiry = maybe_time(expiry); - let packets = ffi_param_ref_mut!(packets); - let packet_count = ffi_param_ref_mut!(packet_count); + let sigs = ffi_param_ref_mut!(sigs); + let sig_count = ffi_param_ref_mut!(sig_count); match ka.set_expiration_time(signer.as_mut(), expiry) { - Ok(sigs) => { + Ok(new_sigs) => { let buffer = unsafe { - libc::calloc(sigs.len(), std::mem::size_of::<*mut Packet>()) - as *mut *mut Packet + libc::calloc(new_sigs.len(), std::mem::size_of::<*mut Signature>()) + as *mut *mut Signature }; let sl = unsafe { - slice::from_raw_parts_mut(buffer, sigs.len()) + slice::from_raw_parts_mut(buffer, new_sigs.len()) }; - *packet_count = sigs.len(); - sl.iter_mut().zip(sigs.into_iter()) + *sig_count = new_sigs.len(); + sl.iter_mut().zip(new_sigs.into_iter()) .for_each(|(e, sig)| *e = sig.move_into_raw()); - *packets = buffer; + *sigs = buffer; Status::Success } Err(err) => { |