summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-12-09 12:32:35 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-12-09 13:28:28 +0100
commit88f43e115383c89fb83714e5dd6fbd2f9df16047 (patch)
tree865b76d3e02ac77b69b80eeac321f0105e1ff3a4 /openpgp-ffi
parentfe8093bc1aef8c6a79fd1dc76f5cc857eae05d50 (diff)
openpgp: Return result from Cert::alive, remove Cert::expired.
- See #371.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r--openpgp-ffi/include/sequoia/openpgp.h9
-rw-r--r--openpgp-ffi/src/cert.rs15
2 files changed, 5 insertions, 19 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h
index b93ebb05..a5e4b603 100644
--- a/openpgp-ffi/include/sequoia/openpgp.h
+++ b/openpgp-ffi/include/sequoia/openpgp.h
@@ -894,18 +894,11 @@ pgp_cert_t pgp_cert_revoke_in_place (pgp_error_t *errp,
const char *reason);
/*/
-/// Returns whether the Cert has expired.
-///
-/// If `when` is 0, then the current time is used.
-/*/
-int pgp_cert_expired(pgp_cert_t cert, time_t at);
-
-/*/
/// Returns whether the Cert is alive at the specified time.
///
/// If `when` is 0, then the current time is used.
/*/
-int pgp_cert_alive(pgp_cert_t cert, time_t when);
+pgp_status_t pgp_cert_alive(pgp_error_t *errp, pgp_cert_t cert, time_t when);
/*/
/// Changes the Cert's expiration.
diff --git a/openpgp-ffi/src/cert.rs b/openpgp-ffi/src/cert.rs
index 00e7b3b4..c85be4f6 100644
--- a/openpgp-ffi/src/cert.rs
+++ b/openpgp-ffi/src/cert.rs
@@ -315,21 +315,14 @@ fn pgp_cert_revoke_in_place(errp: Option<&mut *mut crate::error::Error>,
cert.revoke_in_place(signer.as_mut(), code, reason).move_into_raw(errp)
}
-/// Returns whether the Cert has expired.
-///
-/// If `when` is 0, then the current time is used.
-#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
-fn pgp_cert_expired(cert: *const Cert, when: time_t) -> c_int {
- cert.ref_raw().expired(maybe_time(when)) as c_int
-}
-
/// Returns whether the Cert is alive at the specified time.
///
/// If `when` is 0, then the current time is used.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
-fn pgp_cert_alive(cert: *const Cert, when: time_t)
- -> c_int {
- cert.ref_raw().alive(maybe_time(when)) as c_int
+fn pgp_cert_alive(errp: Option<&mut *mut crate::error::Error>,
+ cert: *const Cert, when: time_t) -> Status {
+ ffi_make_fry_from_errp!(errp);
+ ffi_try_status!(cert.ref_raw().alive(maybe_time(when)))
}
/// Changes the Cert's expiration.