aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog14
-rw-r--r--g10/export.c2
-rw-r--r--g10/getkey.c45
-rw-r--r--g10/sig-check.c6
4 files changed, 57 insertions, 10 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index fd516b458..1940576fd 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,17 @@
+2001-04-14 Werner Koch <[email protected]>
+
+ * getkey.c (fixup_uidnode): Removed check for !sig which is
+ pointless here. Thanks to Jan Niehusmann.
+
+2001-04-10 Werner Koch <[email protected]>
+
+ * sig-check.c (check_key_signature2): Use log_info instead of
+ log_error so that messed up keys do not let gpg return an error.
+ Suggested by Christian Kurz.
+
+ * getkey.c (merge_selfsigs_main): Do a fixup_uidnode only if we
+ have both, uid and sig. Thanks to M Taylor.
+
2001-04-05 Werner Koch <[email protected]>
* armor.c (unarmor_pump_new,unarmor_pump_release): New.
diff --git a/g10/export.c b/g10/export.c
index 17f76ca24..d156d1ccd 100644
--- a/g10/export.c
+++ b/g10/export.c
@@ -200,7 +200,7 @@ do_export_stream( IOBUF out, STRLIST users, int secret, int onlyrfc, int *any )
/* delete our verification cache */
delete_sig_subpkt (node->pkt->pkt.signature->unhashed_data,
- SIGSUBPKT_PRIV_VERIFY_CACHE);
+ SIGSUBPKT_PRIV_VERIFY_CACHE);
}
if( secret == 2 && node->pkt->pkttype == PKT_SECRET_KEY ) {
diff --git a/g10/getkey.c b/g10/getkey.c
index 975d567fe..f61482118 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -530,13 +530,16 @@ get_seckey( PKT_secret_key *sk, u32 *keyid )
/****************
- * Check whether the secret key is available
+ * Check whether the secret key is available. This is just a fast
+ * check and does not tell us whether the secret key is valid. It
+ * merely tells other whether there is some secret key.
* Returns: 0 := key is available
- * G10ERR_NO_SECKEY := not availabe
+ * G10ERR_NO_SECKEY := not availabe
*/
int
seckey_available( u32 *keyid )
{
+#if 0
int rc;
struct getkey_ctx_s ctx;
KBNODE kb = NULL;
@@ -552,6 +555,39 @@ seckey_available( u32 *keyid )
get_seckey_end( &ctx );
release_kbnode ( kb );
return rc;
+#endif
+ int rc;
+ int found = 0;
+ int oldmode = set_packet_list_mode (0);
+ KBNODE keyblock = NULL;
+ KBPOS kbpos;
+
+ rc = enum_keyblocks ( 5, &kbpos, NULL );
+ if ( !rc ) {
+ while ( !(rc = enum_keyblocks (1, &kbpos, &keyblock)) ) {
+ KBNODE k;
+
+ for (k=keyblock; k; k = k->next ) {
+ if ( k->pkt->pkttype == PKT_SECRET_KEY
+ || k->pkt->pkttype == PKT_SECRET_SUBKEY ) {
+ u32 aki[2];
+ keyid_from_sk (k->pkt->pkt.secret_key, aki );
+ if( aki[1] == keyid[1] && aki[0] == keyid[0] ) {
+ found = 1;
+ goto leave;
+ }
+ }
+ }
+ release_kbnode (keyblock); keyblock = NULL;
+ }
+ }
+ if( rc && rc != -1 )
+ log_error ("enum_keyblocks failed: %s\n", g10_errstr(rc));
+ leave:
+ release_kbnode (keyblock);
+ enum_keyblocks ( 2, &kbpos, NULL );
+ set_packet_list_mode (oldmode);
+ return found? 0 : G10ERR_NO_SECKEY;
}
@@ -1368,8 +1404,6 @@ fixup_uidnode ( KBNODE uidnode, KBNODE signode )
size_t n;
uid->created = 0; /* not created == invalid */
- if ( !signode )
- return; /* no self-signature */
if ( IS_UID_REV ( sig ) ) {
uid->is_revoked = 1;
return; /* has been revoked */
@@ -1517,7 +1551,7 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
for(k=keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; k = k->next ) {
if ( k->pkt->pkttype == PKT_USER_ID
|| k->pkt->pkttype == PKT_PHOTO_ID ) {
- if ( uidnode )
+ if ( uidnode && signode )
fixup_uidnode ( uidnode, signode );
uidnode = k;
signode = NULL;
@@ -2322,7 +2356,6 @@ lookup( GETKEY_CTX ctx, KBNODE *ret_keyblock, int secmode )
-
/****************
* FIXME: Replace by the generic function
* It does not work as it is right now - it is used at
diff --git a/g10/sig-check.c b/g10/sig-check.c
index 49cc72c32..660919241 100644
--- a/g10/sig-check.c
+++ b/g10/sig-check.c
@@ -546,7 +546,7 @@ check_key_signature2( KBNODE root, KBNODE node, int *is_selfsig,
md_close(md);
}
else {
- log_error("no subkey for subkey revocation packet\n");
+ log_info ("no subkey for subkey revocation packet\n");
rc = G10ERR_SIG_CLASS;
}
}
@@ -569,7 +569,7 @@ check_key_signature2( KBNODE root, KBNODE node, int *is_selfsig,
md_close(md);
}
else {
- log_error("no subkey for key signature packet\n");
+ log_info ("no subkey for key signature packet\n");
rc = G10ERR_SIG_CLASS;
}
}
@@ -602,7 +602,7 @@ check_key_signature2( KBNODE root, KBNODE node, int *is_selfsig,
md_close(md);
}
else {
- log_error("no user ID for key signature packet of class %02x\n",
+ log_info ("no user ID for key signature packet of class %02x\n",
sig->sig_class );
rc = G10ERR_SIG_CLASS;
}