summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/src/parse/stream.rs
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-01-14 09:37:04 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-01-14 10:07:09 +0100
commit33ab7dd6d9b7f92afab67d8e00902a71a677c341 (patch)
tree75934a3bff0ae3e537807764634726548fa278c0 /openpgp-ffi/src/parse/stream.rs
parent9e4e94e3378093baf569404b4be1ca8b7fedbe1b (diff)
openpgp: Remove unneeded fields from VerificationResult::NotAlive.
- VerificationResult::NotAlive means that the signature is not alive. This has nothing to do with a specific key. Indeed, there might not even be a key available, but we can still detect this error condition. - As such, remove the cert and key fields from VerificationResult::NotAlive.
Diffstat (limited to 'openpgp-ffi/src/parse/stream.rs')
-rw-r--r--openpgp-ffi/src/parse/stream.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/openpgp-ffi/src/parse/stream.rs b/openpgp-ffi/src/parse/stream.rs
index 2bc43280..2237c41f 100644
--- a/openpgp-ffi/src/parse/stream.rs
+++ b/openpgp-ffi/src/parse/stream.rs
@@ -233,7 +233,22 @@ make_decomposition_fn!(pgp_verification_result_good_checksum, GoodChecksum);
/// Returns `true` iff the given value is a
/// `VerificationResult::NotAlive`, and returns the variant's members
/// in `sig_r` and the like iff `sig_r != NULL`.
-make_decomposition_fn!(pgp_verification_result_not_alive, NotAlive);
+#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
+fn pgp_verification_result_not_alive<'a>(
+ result: *const VerificationResult<'a>,
+ sig_r: Maybe<*mut Signature>)
+ -> bool
+{
+ use self::stream::VerificationResult::*;
+ if let NotAlive { sig, .. } = result.ref_raw() {
+ if let Some(mut p) = sig_r {
+ *unsafe { p.as_mut() } = sig.move_into_raw();
+ }
+ true
+ } else {
+ false
+ }
+}
/// Decomposes a `VerificationResult::MissingKey`.
///