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 | |
parent | 531e3252b86f6eacf02d7181c280e8c01c4a55f4 (diff) |
openpgp: Return Result from Signature::key_alive.
- See #371.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r-- | openpgp-ffi/include/sequoia/openpgp.h | 5 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/signature.rs | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h index f35565d3..b93ebb05 100644 --- a/openpgp-ffi/include/sequoia/openpgp.h +++ b/openpgp-ffi/include/sequoia/openpgp.h @@ -501,8 +501,9 @@ bool pgp_signature_expired(pgp_signature_t signature, time_t when); /// /// If `when` is 0, then the current time is used. /*/ -bool pgp_signature_key_alive(pgp_signature_t signature, pgp_key_t key, - time_t when); +pgp_status_t pgp_signature_key_alive(pgp_error_t *errp, + pgp_signature_t signature, pgp_key_t key, + time_t when); /*/ /// Returns whether the signature is expired at the specified time. 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. |