From 7ccde1b5ed34be980d9b26485d5ccbcb6b18beb1 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 21 Apr 2005 07:12:18 +0000 Subject: [PATCH] (calc_sig_summary): Set the key revoked bit. --- branches/gpgme-1-0-branch/gpgme/ChangeLog | 4 ++++ branches/gpgme-1-0-branch/gpgme/gpgme.h | 2 +- branches/gpgme-1-0-branch/gpgme/verify.c | 25 +++++++++++++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/branches/gpgme-1-0-branch/gpgme/ChangeLog b/branches/gpgme-1-0-branch/gpgme/ChangeLog index a5aa3a3..ac759a0 100644 --- a/branches/gpgme-1-0-branch/gpgme/ChangeLog +++ b/branches/gpgme-1-0-branch/gpgme/ChangeLog @@ -1,3 +1,7 @@ +2005-04-21 Werner Koch + + * verify.c (calc_sig_summary): Set the key revoked bit. + 2004-12-11 Marcus Brinkmann * util.h [HAVE_CONFIG_H && HAVE_TTYNAME_R] (ttyname_r): Define diff --git a/branches/gpgme-1-0-branch/gpgme/gpgme.h b/branches/gpgme-1-0-branch/gpgme/gpgme.h index c3d7e90..88d7603 100644 --- a/branches/gpgme-1-0-branch/gpgme/gpgme.h +++ b/branches/gpgme-1-0-branch/gpgme/gpgme.h @@ -75,7 +75,7 @@ extern "C" { AM_PATH_GPGME macro) check that this header matches the installed library. Warning: Do not edit the next line. configure will do that for you! */ -#define GPGME_VERSION "1.0.2" +#define GPGME_VERSION "1.0.3-cvs" /* Some opaque data types used by GPGME. */ diff --git a/branches/gpgme-1-0-branch/gpgme/verify.c b/branches/gpgme-1-0-branch/gpgme/verify.c index 7e5fd60..b2e0fcc 100644 --- a/branches/gpgme-1-0-branch/gpgme/verify.c +++ b/branches/gpgme-1-0-branch/gpgme/verify.c @@ -94,7 +94,8 @@ static void calc_sig_summary (gpgme_signature_t sig) { unsigned long sum = 0; - + + /* Calculate the red/green flag. */ if (sig->validity == GPGME_VALIDITY_FULL || sig->validity == GPGME_VALIDITY_ULTIMATE) { @@ -113,11 +114,6 @@ calc_sig_summary (gpgme_signature_t sig) else if (gpg_err_code (sig->status) == GPG_ERR_BAD_SIGNATURE) sum |= GPGME_SIGSUM_RED; - if (sig->validity == GPGME_VALIDITY_UNKNOWN) - { - if (gpg_err_code (sig->validity_reason) == GPG_ERR_CRL_TOO_OLD) - sum |= GPGME_SIGSUM_CRL_TOO_OLD; - } /* FIXME: handle the case when key and message are expired. */ switch (gpg_err_code (sig->status)) @@ -143,6 +139,23 @@ calc_sig_summary (gpgme_signature_t sig) break; } + /* Now look at the certain reason codes. */ + switch (gpg_err_code (sig->validity_reason)) + { + case GPG_ERR_CRL_TOO_OLD: + if (sig->validity == GPGME_VALIDITY_UNKNOWN) + sum |= GPGME_SIGSUM_CRL_TOO_OLD; + break; + + case GPG_ERR_CERT_REVOKED: + sum |= GPGME_SIGSUM_KEY_REVOKED; + break; + + default: + break; + } + + /* Check other flags. */ if (sig->wrong_key_usage) sum |= GPGME_SIGSUM_BAD_POLICY; -- 2.26.2