diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-11-25 15:59:54 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-12-09 13:26:48 +0100 |
commit | fe8093bc1aef8c6a79fd1dc76f5cc857eae05d50 (patch) | |
tree | 1aa3021d49ec099e16083f12ca4aefcbf5fa1313 /openpgp-ffi/src | |
parent | 531e3252b86f6eacf02d7181c280e8c01c4a55f4 (diff) |
openpgp: Return Result from Signature::key_alive.
- See #371.
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r-- | openpgp-ffi/src/packet/signature.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/openpgp-ffi/src/packet/signature.rs b/openpgp-ffi/src/packet/signature.rs index abc302b5..7e50f3a1 100644 --- a/openpgp-ffi/src/packet/signature.rs +++ b/openpgp-ffi/src/packet/signature.rs @@ -264,15 +264,18 @@ fn pgp_signature_expired(sig: *const Signature, when: time_t) -> bool { /// /// If `when` is 0, then the current time is used. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_signature_key_alive(sig: *const Signature, key: *const Key, +fn pgp_signature_key_alive(errp: Option<&mut *mut crate::error::Error>, + sig: *const Signature, key: *const Key, when: time_t) - -> bool { + -> Status +{ + ffi_make_fry_from_errp!(errp); let t = if when == 0 { None } else { Some(std::time::UNIX_EPOCH + std::time::Duration::new(when as u64, 0)) }; - sig.ref_raw().key_alive(key.ref_raw(), t) + ffi_try_status!(sig.ref_raw().key_alive(key.ref_raw(), t)) } /// Returns whether the signature is expired at the specified time. |