summaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-08-05 18:51:59 +0200
committerWerner Koch <wk@gnupg.org>1998-08-05 18:51:59 +0200
commit9b609091ab3249a41c3a9f2417ba0250405792c8 (patch)
treeeac3b271488722262dd71f003641d88d35fb64a1 /g10/getkey.c
parentadd coprocess facility (diff)
downloadgnupg2-9b609091ab3249a41c3a9f2417ba0250405792c8.tar.xz
gnupg2-9b609091ab3249a41c3a9f2417ba0250405792c8.zip
intermediate check in
Diffstat (limited to 'g10/getkey.c')
-rw-r--r--g10/getkey.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 912c91906..72bb3d990 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -685,6 +685,8 @@ lookup( PKT_public_key *pk, int mode, u32 *keyid,
KBNODE keyblock = NULL;
KBPOS kbpos;
int oldmode = set_packet_list_mode(0);
+ byte namehash[20];
+ int use_namehash=0;
rc = enum_keyblocks( 0, &kbpos, &keyblock );
if( rc ) {
@@ -719,6 +721,10 @@ lookup( PKT_public_key *pk, int mode, u32 *keyid,
u32 aki[2];
keyid_from_pk( kk->pkt->pkt.public_key, aki );
cache_user_id( k->pkt->pkt.user_id, aki );
+ rmd160_hash_buffer( namehash,
+ k->pkt->pkt.user_id->name,
+ k->pkt->pkt.user_id->len );
+ use_namehash = 1;
k = kk;
break;
}
@@ -799,7 +805,8 @@ lookup( PKT_public_key *pk, int mode, u32 *keyid,
if( k ) { /* found */
assert( k->pkt->pkttype == PKT_PUBLIC_KEY
|| k->pkt->pkttype == PKT_PUBLIC_SUBKEY );
- copy_public_key( pk, k->pkt->pkt.public_key );
+ copy_public_key_new_namehash( pk, k->pkt->pkt.public_key,
+ use_namehash? namehash:NULL);
add_stuff_from_selfsig( keyblock, k );
if( ret_keyblock ) {
*ret_keyblock = keyblock;
@@ -950,7 +957,7 @@ lookup_sk( PKT_secret_key *sk, int mode, u32 *keyid, const char *name )
/****************
- * Enumerate all secret keys. Caller must use these procedure:
+ * Enumerate all primary secret keys. Caller must use these procedure:
* 1) create a void pointer and initialize it to NULL
* 2) pass this void pointer by reference to this function
* and provide space for the secret key (pass a buffer for sk)
@@ -997,8 +1004,7 @@ enum_secret_keys( void **context, PKT_secret_key *sk )
while( (rc=parse_packet(c->iobuf, &pkt)) != -1 ) {
if( rc )
; /* e.g. unknown packet */
- else if( pkt.pkttype == PKT_SECRET_KEY
- || pkt.pkttype == PKT_SECRET_SUBKEY ) {
+ else if( pkt.pkttype == PKT_SECRET_KEY ) {
copy_secret_key( sk, pkt.pkt.secret_key );
set_packet_list_mode(save_mode);
return 0; /* found */