diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-01-16 17:33:57 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-01-16 18:01:45 +0100 |
commit | 9a30451890b61aa8121fde7570a7e1d1ebaa3778 (patch) | |
tree | 831f7683a05ebb119e5a3f39cb61b31942cd5fdf /openpgp-ffi | |
parent | f1dabd075d78cf45c4e0b2e61334267c22d7145b (diff) |
openpgp: Remove variant VerificationResult::BadChecksum.
- This is better expressed as an error.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r-- | openpgp-ffi/examples/decrypt-with.c | 14 | ||||
-rw-r--r-- | openpgp-ffi/include/sequoia/openpgp.h | 6 | ||||
-rw-r--r-- | openpgp-ffi/include/sequoia/openpgp/types.h | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/parse/stream.rs | 12 |
4 files changed, 12 insertions, 24 deletions
diff --git a/openpgp-ffi/examples/decrypt-with.c b/openpgp-ffi/examples/decrypt-with.c index d395abd9..3f98c574 100644 --- a/openpgp-ffi/examples/decrypt-with.c +++ b/openpgp-ffi/examples/decrypt-with.c @@ -102,13 +102,15 @@ check_cb (void *cookie_opaque, pgp_message_structure_t structure) fprintf (stderr, "No key to check signature from %s\n", keyid_str); break; - case PGP_VERIFICATION_RESULT_BAD_CHECKSUM: - pgp_verification_result_bad_checksum (result, NULL, NULL, - &key, NULL, NULL); - keyid = pgp_key_keyid (key); - keyid_str = pgp_keyid_to_string (keyid); - fprintf (stderr, "Bad signature from %s\n", keyid_str); + case PGP_VERIFICATION_RESULT_ERROR: { + pgp_error_t err; + pgp_verification_result_error (result, NULL, &err); + char *err_str = pgp_error_to_string (err); + fprintf (stderr, "Bad signature: %s\n", err_str); + free (err_str); + pgp_error_free (err); break; + } default: assert (! "reachable"); diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h index 32794aa3..405cd2c6 100644 --- a/openpgp-ffi/include/sequoia/openpgp.h +++ b/openpgp-ffi/include/sequoia/openpgp.h @@ -1722,12 +1722,6 @@ bool pgp_verification_result_not_alive (pgp_verification_result_t, pgp_revocation_status_t *); bool pgp_verification_result_missing_key (pgp_verification_result_t, pgp_signature_t *); -bool pgp_verification_result_bad_checksum (pgp_verification_result_t, - pgp_signature_t *, - pgp_cert_t *, - pgp_key_t *, - pgp_signature_t *, - pgp_revocation_status_t *); bool pgp_verification_result_error (pgp_verification_result_t, pgp_signature_t *, pgp_error_t *); diff --git a/openpgp-ffi/include/sequoia/openpgp/types.h b/openpgp-ffi/include/sequoia/openpgp/types.h index e85916f3..e9bbc1b7 100644 --- a/openpgp-ffi/include/sequoia/openpgp/types.h +++ b/openpgp-ffi/include/sequoia/openpgp/types.h @@ -489,8 +489,8 @@ typedef struct pgp_verification_result_iter *pgp_verification_result_iter_t; typedef enum pgp_verification_result_variant { PGP_VERIFICATION_RESULT_GOOD_CHECKSUM = 1, PGP_VERIFICATION_RESULT_MISSING_KEY = 2, - PGP_VERIFICATION_RESULT_BAD_CHECKSUM = 3, - PGP_VERIFICATION_RESULT_NOT_ALIVE = 4, + PGP_VERIFICATION_RESULT_NOT_ALIVE = 3, + PGP_VERIFICATION_RESULT_ERROR = 4, /* Dummy value to make sure the enumeration has a defined size. Do not use this value. */ diff --git a/openpgp-ffi/src/parse/stream.rs b/openpgp-ffi/src/parse/stream.rs index 2237c41f..262ff596 100644 --- a/openpgp-ffi/src/parse/stream.rs +++ b/openpgp-ffi/src/parse/stream.rs @@ -171,9 +171,8 @@ fn pgp_verification_result_variant(result: *const VerificationResult) match result.ref_raw() { GoodChecksum { .. } => 1, MissingKey { .. } => 2, - BadChecksum { .. } => 3, - NotAlive { .. } => 4, - Error { .. } => 5, + NotAlive { .. } => 3, + Error { .. } => 4, } } @@ -272,13 +271,6 @@ fn pgp_verification_result_missing_key<'a>( } } -/// Decomposes a ``VerificationResult::BadChecksum`. -/// -/// Returns `true` iff the given value is a -/// `VerificationResult::BadChecksum`, and returns the variants -/// members in `sig_r` and the like iff `sig_r != NULL`. -make_decomposition_fn!(pgp_verification_result_bad_checksum, BadChecksum); - /// Decomposes a `VerificationResult::Error`. /// /// Returns `true` iff the given value is a |