]> the.earth.li Git - onak.git/commitdiff
Include keyid when logging signature checking errors
authorJonathan McDowell <noodles@earth.li>
Sat, 2 Nov 2013 04:31:43 +0000 (21:31 -0700)
committerJonathan McDowell <noodles@earth.li>
Sat, 2 Nov 2013 04:31:43 +0000 (21:31 -0700)
Having information on an unknown signature hash or version is much
more useful if we know what key it's associated with.

sigcheck.c

index a0f4feb2d6bada946f8eaf2f73088e64d997f8e6..2f165bce0dd1e711bff108089ecc70781ca33595 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdint.h>
 
 #include "config.h"
+#include "keyid.h"
 #include "keystructs.h"
 #include "log.h"
 #include "openpgp.h"
@@ -65,6 +66,7 @@ int check_packet_sighash(struct openpgp_publickey *key,
        uint8_t *hashdata[8];
        size_t hashlen[8];
        int chunks, i;
+       uint64_t keyid;
 
        keyheader[0] = 0x99;
        keyheader[1] = key->publickey->length >> 8;
@@ -149,8 +151,10 @@ int check_packet_sighash(struct openpgp_publickey *key,
                sighash = &sig->data[siglen + unhashedlen + 2];
                break;
        default:
-               logthing(LOGTHING_ERROR, "Unknown signature version %d",
-                               sig->data[0]);
+               get_keyid(key, &keyid);
+               logthing(LOGTHING_ERROR,
+                       "Unknown signature version %d on 0x%016" PRIX64,
+                       sig->data[0], keyid);
                return -1;
        }
 
@@ -235,8 +239,11 @@ int check_packet_sighash(struct openpgp_publickey *key,
                return -1;
 #endif
        default:
-               logthing(LOGTHING_ERROR, "Unsupported signature hash type %d",
-                               hashtype);
+               get_keyid(key, &keyid);
+               logthing(LOGTHING_ERROR,
+                       "Unsupported signature hash type %d on 0x%016" PRIX64,
+                       hashtype,
+                       keyid);
                return -1;
        }