diff options
author | Werner Koch <[email protected]> | 2015-11-13 15:42:59 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2015-11-13 15:42:59 +0000 |
commit | e7d7160ab7cd4e6b460bfe36fd3a7275adadb4e2 (patch) | |
tree | 5a70be6127bd70c5e584f1e24be0c4be0bbe6f7d /g10/tofu.h | |
parent | gpg: Make trusted-key override for Tofu robust against swapped tofu.db. (diff) | |
download | gnupg-e7d7160ab7cd4e6b460bfe36fd3a7275adadb4e2.tar.gz gnupg-e7d7160ab7cd4e6b460bfe36fd3a7275adadb4e2.zip |
gpg: Simplify the tofu interface by using the public key packet.
* g10/tofu.c (fingerprint_str): Remove.
(tofu_register): Take a public key instead of a fingerprint as arg.
Use hexfingerprint() to get a fpr from the PK.
(tofu_get_validity): Ditto.
(tofu_set_policy, tofu_get_policy): Simplify by using hexfingerprint.
* g10/trustdb.c (tdb_get_validity_core): Pass the primary key PK to
instead of the fingerprint to the tofu functions.
--
This change has the advantage that we are not bound to a specific
fingerprint length and will thus helps us to implement rfc4880bis.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/tofu.h')
-rw-r--r-- | g10/tofu.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/g10/tofu.h b/g10/tofu.h index 2d23e86bc..7ee10839b 100644 --- a/g10/tofu.h +++ b/g10/tofu.h @@ -71,14 +71,14 @@ const char *tofu_policy_str (enum tofu_policy policy); (e.g., TRUST_BAD) in light of the current configuration. */ int tofu_policy_to_trust_level (enum tofu_policy policy); -/* Register the binding <FINGERPRINT, USER_ID> and the signature +/* Register the binding <PK, USER_ID> and the signature described by SIGS_DIGEST and SIG_TIME, which it generated. Origin describes where the signed data came from, e.g., "email:claws" (default: "unknown"). If MAY_ASK is 1, then this function may interact with the user in the case of a conflict or if the binding's policy is ask. This function returns the binding's trust level. If an error occurs, it returns TRUST_UNKNOWN. */ -int tofu_register (const byte *fingerprint, const char *user_id, +int tofu_register (PKT_public_key *pk, const char *user_id, const byte *sigs_digest, int sigs_digest_len, time_t sig_time, const char *origin, int may_ask); @@ -88,11 +88,10 @@ int tofu_register (const byte *fingerprint, const char *user_id, int tofu_wot_trust_combine (int tofu, int wot); /* Determine the validity (TRUST_NEVER, etc.) of the binding - <FINGERPRINT, USER_ID>. If MAY_ASK is 1, then this function may + <PK, USER_ID>. If MAY_ASK is 1, then this function may interact with the user. If not, TRUST_UNKNOWN is returned. If an error occurs, TRUST_UNDEFINED is returned. */ -int tofu_get_validity (const byte *fingerprint, const char *user_id, - int may_ask); +int tofu_get_validity (PKT_public_key *pk, const char *user_id, int may_ask); /* Set the policy for all non-revoked user ids in the keyblock KB to POLICY. */ |