diff --git a/g10/key-clean.c b/g10/key-clean.c index 9320428c8..c8a6efe50 100644 --- a/g10/key-clean.c +++ b/g10/key-clean.c @@ -35,14 +35,19 @@ #include "key-clean.h" +#define NF_USABLE 8 /* Usable signature and not a revocation. */ +#define NF_CONSIDER 9 /* Internal use. */ +#define NF_PROCESSED 10 /* Internal use. */ +#define NF_REVOC 11 /* Usable revocation. */ +#define NF_NOKEY 12 /* Key not available. */ + /* * Mark the signature of the given UID which are used to certify it. * To do this, we first remove all signatures which are not valid and * from the remaining we look for the latest one. If this is not a * certification revocation signature we mark the signature by setting - * node flag bit 8. Revocations are marked with flag 11, and sigs - * from unavailable keys are marked with flag 12. Note that flag bits - * 9 and 10 are used for internal purposes. + * node flag bit NF_USABLE. Revocations are marked with NF_REVOC, and + * sigs from unavailable keys are marked with NF_NOKEY. */ void mark_usable_uid_certs (ctrl_t ctrl, kbnode_t keyblock, kbnode_t uidnode, @@ -57,7 +62,8 @@ mark_usable_uid_certs (ctrl_t ctrl, kbnode_t keyblock, kbnode_t uidnode, { int rc; - node->flag &= ~(1<<8 | 1<<9 | 1<<10 | 1<<11 | 1<<12); + node->flag &= ~(1<pkt->pkttype == PKT_USER_ID || node->pkt->pkttype == PKT_PUBLIC_SUBKEY || node->pkt->pkttype == PKT_SECRET_SUBKEY) @@ -81,19 +87,20 @@ mark_usable_uid_certs (ctrl_t ctrl, kbnode_t keyblock, kbnode_t uidnode, /* we ignore anything that won't verify, but tag the no_pubkey case */ if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY) - node->flag |= 1<<12; + node->flag |= 1<flag |= 1<<9; + node->flag |= 1<next) - node->flag &= ~(1<<8 | 1<<9 | 1<<10 | 1<<11 | 1<<12); + node->flag &= ~(1<next; node; node = node->next) @@ -105,11 +112,11 @@ mark_usable_uid_certs (ctrl_t ctrl, kbnode_t keyblock, kbnode_t uidnode, if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY || node->pkt->pkttype == PKT_SECRET_SUBKEY) break; - if ( !(node->flag & (1<<9)) ) + if ( !(node->flag & (1<flag & (1<<10)) ) + if ( (node->flag & (1<flag |= (1<<10); /* mark this node as processed */ + node->flag |= (1<pkt->pkt.signature; signode = node; sigdate = sig->timestamp; @@ -121,14 +128,14 @@ mark_usable_uid_certs (ctrl_t ctrl, kbnode_t keyblock, kbnode_t uidnode, if (n->pkt->pkttype == PKT_PUBLIC_SUBKEY || n->pkt->pkttype == PKT_SECRET_SUBKEY) break; - if ( !(n->flag & (1<<9)) ) + if ( !(n->flag & (1<flag & (1<<10)) ) + if ( (n->flag & (1<pkt->pkt.signature; if (kid[0] != sig->keyid[0] || kid[1] != sig->keyid[1]) continue; - n->flag |= (1<<10); /* mark this node as processed */ + n->flag |= (1< curtime ) { - signode->flag |= (1<<8); /* yeah, found a good cert */ + signode->flag |= (1<flag |= (1<<11); + signode->flag |= (1<pkt->pkt.signature->keyid[1] == keyid[1]) : 1; /* Keep usable uid sigs ... */ - if ((node->flag & (1<<8)) && keep) + if ((node->flag & (1<flag & (1<<11)) && keep) + if ((node->flag & (1<flag & (1<<12)) + if(node->flag & (1<pkt->pkt.signature->keyid), uidnode->pkt->pkt.user_id->name, - node->flag&(1<<12)? "key unavailable": - node->flag&(1<<9)? "signature superseded" - /* */ :"invalid signature" ); + node->flag&(1<flag&(1<