diff options
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r-- | openpgp-ffi/src/packet/signature.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/openpgp-ffi/src/packet/signature.rs b/openpgp-ffi/src/packet/signature.rs index 43653bc2..654e9105 100644 --- a/openpgp-ffi/src/packet/signature.rs +++ b/openpgp-ffi/src/packet/signature.rs @@ -170,18 +170,16 @@ fn pgp_signature_key_alive_at(sig: *const Signature, key: *const Key, time::at(time::Timespec::new(when as i64, 0))) } -/// Returns whether the signature is expired. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_signature_key_expired(sig: *const Signature, key: *const Key) - -> bool { - sig.ref_raw().key_expired(key.ref_raw()) -} - /// Returns whether the signature is expired at the specified time. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_signature_key_expired_at(sig: *const Signature, key: *const Key, - when: time_t) -> bool { - sig.ref_raw() - .key_expired_at(key.ref_raw(), - time::at(time::Timespec::new(when as i64, 0))) +/// +/// If `when` is 0, then the current time is used. +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" +fn pgp_signature_key_expired(sig: *const Signature, key: *const Key, + when: time_t) -> bool { + let t = if when == 0 { + None + } else { + Some(time::at(time::Timespec::new(when as i64, 0))) + }; + sig.ref_raw().key_expired(key.ref_raw(), t) } |