1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

* packet.h, pkclist.c (build_pk_list), free-packet.c

(release_public_key_parts): Remove unused namehash element for public
keys.

* trustdb.h, gpgv.c, trustdb.c (get_validity, get_validity_info): Pass a
user ID in rather than a namehash, so we only have to do the hashing in
one place.
This commit is contained in:
David Shaw 2003-01-09 04:04:55 +00:00
parent 8602e35feb
commit e81bae94cb
9 changed files with 31 additions and 35 deletions

View file

@ -785,7 +785,7 @@ is_disabled(void *dummy,u32 *keyid)
* otherwise, a reasonable value for the entire key is returned.
*/
unsigned int
get_validity (PKT_public_key *pk, const byte *namehash)
get_validity (PKT_public_key *pk, PKT_user_id *uid)
{
static int did_nextcheck;
TRUSTREC trec, vrec;
@ -794,6 +794,15 @@ get_validity (PKT_public_key *pk, const byte *namehash)
unsigned int validity;
u32 kid[2];
PKT_public_key *main_pk;
byte namehash[20];
if(uid)
{
if( uid->attrib_data )
rmd160_hash_buffer (namehash,uid->attrib_data,uid->attrib_len);
else
rmd160_hash_buffer (namehash, uid->name, uid->len );
}
init_trustdb ();
if (!did_nextcheck)
@ -853,7 +862,7 @@ get_validity (PKT_public_key *pk, const byte *namehash)
read_record (recno, &vrec, RECTYPE_VALID);
if ( validity < (vrec.r.valid.validity & TRUST_MASK) )
validity = (vrec.r.valid.validity & TRUST_MASK);
if ( namehash && !memcmp (vrec.r.valid.namehash, namehash, 20) )
if ( uid && !memcmp (vrec.r.valid.namehash, namehash, 20) )
break;
recno = vrec.r.valid.next;
}
@ -884,12 +893,12 @@ get_validity (PKT_public_key *pk, const byte *namehash)
}
int
get_validity_info (PKT_public_key *pk, const byte *namehash)
get_validity_info (PKT_public_key *pk, PKT_user_id *uid)
{
int trustlevel;
int c;
trustlevel = get_validity (pk, namehash);
trustlevel = get_validity (pk, uid);
if( trustlevel & TRUST_FLAG_DISABLED )
return 'd';
if( trustlevel & TRUST_FLAG_REVOKED )