diff options
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 3 | ||||
-rw-r--r-- | g10/getkey.c | 7 | ||||
-rw-r--r-- | g10/keydb.h | 1 | ||||
-rw-r--r-- | g10/keygen.c | 7 |
4 files changed, 17 insertions, 1 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index abb9005ec..2e60f2d81 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,8 @@ 2001-03-27 Werner Koch <[email protected]> + * getkey.c (cache_public_key): Made global. + * keygen.c (write_selfsig, write_keybinding): Cache the new key. + * getkey.c (key_byname): Add new arg secmode and changed all callers to request explicitly the mode. Deriving this information from the other supplied parameters does not work if neither pk nor diff --git a/g10/getkey.c b/g10/getkey.c index d0ec1e368..09633c98a 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -40,6 +40,11 @@ #define MAX_PK_CACHE_ENTRIES 200 #define MAX_UID_CACHE_ENTRIES 200 +#if MAX_PK_CACHE_ENTRIES < 2 + #error We need the cache for key creation +#endif + + /* A map of the all characters valid used for word_match() * Valid characters are in in this table converted to uppercase. * because the upper 128 bytes have special meaning, we assume @@ -177,7 +182,7 @@ print_stats() #endif -static void +void cache_public_key( PKT_public_key *pk ) { #if MAX_PK_CACHE_ENTRIES diff --git a/g10/keydb.h b/g10/keydb.h index 3aeb39aed..8468a272e 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -142,6 +142,7 @@ char *get_last_passphrase(void); /*-- getkey.c --*/ int classify_user_id( const char *name, u32 *keyid, byte *fprint, const char **retstr, size_t *retlen ); +void cache_public_key( PKT_public_key *pk ); void getkey_disable_caches(void); int get_pubkey( PKT_public_key *pk, u32 *keyid ); KBNODE get_pubkeyblock( u32 *keyid ); diff --git a/g10/keygen.c b/g10/keygen.c index 727bca385..00fbb301b 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -185,6 +185,9 @@ write_selfsig( KBNODE root, KBNODE pub_root, PKT_secret_key *sk ) if( !node ) BUG(); pk = node->pkt->pkt.public_key; + /* we have to cache the key, so that the verification of the signature + * creation is able to retrieve the public key */ + cache_public_key (pk); /* and make the signature */ rc = make_keysig_packet( &sig, pk, uid, NULL, sk, 0x13, 0, @@ -218,6 +221,10 @@ write_keybinding( KBNODE root, KBNODE pub_root, PKT_secret_key *sk ) if( !node ) BUG(); pk = node->pkt->pkt.public_key; + /* we have to cache the key, so that the verification of the signature + * creation is able to retrieve the public key */ + cache_public_key (pk); + /* find the last subkey */ subpk = NULL; for(node=pub_root; node; node = node->next ) { |