]> the.earth.li Git - onak.git/commitdiff
Stop using 32-bit key IDs
authorJonathan McDowell <noodles@earth.li>
Tue, 16 Apr 2019 20:09:29 +0000 (21:09 +0100)
committerJonathan McDowell <noodles@earth.li>
Tue, 16 Apr 2019 20:09:29 +0000 (21:09 +0100)
The time for 32-bit key IDs is long past (and even 64-bits are risky),
so switch to 64-bit IDs everywhere we display a key ID.

gpgwww.c
keyindex.c
stats.c
t/all-040-index-text.t
t/all-045-index-text-v5.t

index 02b4e79972bafa66c1206f130f39df5f2ae2638a..73ef738b54fef35278b26451daf6f47c9c5754ca 100644 (file)
--- a/gpgwww.c
+++ b/gpgwww.c
@@ -173,7 +173,7 @@ int main(int argc, char *argv[])
                                "\">Find reverse path</A>\n",
                                to,
                                from);
-               printf("<A HREF=\"gpgwww?from=0x%08" PRIX64 "&to=0x%08" PRIX64
+               printf("<A HREF=\"gpgwww?from=0x%016" PRIX64 "&to=0x%016" PRIX64
                                "&op=get\">"
                                "Get all keys listed</A></P>\n",
                                from,
index 4883f636cfabdc4f55363a515d906a3a2c783866..f6784d70edaf032a8afb2eba868d9967f9777952 100644 (file)
@@ -234,25 +234,25 @@ int list_sigs(struct onak_dbctx *dbctx,
                }
                if (html && uid != NULL) {
                        printf("%s         <a href=\"lookup?op=get&"
-                               "search=0x%016" PRIX64 "\">%08" PRIX64
+                               "search=0x%016" PRIX64 "\">0x%016" PRIX64
                                "</a>             "
                                "<a href=\"lookup?op=vindex&search=0x%016"
                                PRIX64 "\">%s</a>\n",
                                sig,
                                sigid,
-                               sigid & 0xFFFFFFFF,
+                               sigid,
                                sigid,
                                txt2html(uid));
                } else if (html && uid == NULL) {
-                       printf("%s         %08" PRIX64 "             "
+                       printf("%s         0x%016" PRIX64 "             "
                                "[User id not found]\n",
                                sig,
-                               sigid & 0xFFFFFFFF);
+                               sigid);
                } else {
-                       printf("%s         %08" PRIX64
+                       printf("%s         0x%016" PRIX64
                                "             %s\n",
                                sig,
-                               sigid & 0xFFFFFFFF,
+                               sigid,
                                (uid != NULL) ? uid :
                                "[User id not found]");
                }
@@ -341,10 +341,10 @@ int list_subkeys(struct onak_dbctx *dbctx,
                                        &keyid) != ONAK_E_OK) {
                                logthing(LOGTHING_ERROR, "Couldn't get keyid.");
                        }
-                       printf("sub  %5d%c/%08X %04d/%02d/%02d\n",
+                       printf("sub  %5d%c/0x%016" PRIX64 " %04d/%02d/%02d\n",
                                length,
                                pkalgo2char(type),
-                               (uint32_t) (keyid & 0xFFFFFFFF),
+                               keyid,
                                created->tm_year + 1900,
                                created->tm_mon + 1,
                                created->tm_mday);
@@ -462,20 +462,20 @@ int key_index(struct onak_dbctx *dbctx,
 
                if (html) {
                        printf("pub  %5d%c/<a href=\"lookup?op=get&"
-                               "search=0x%016" PRIX64 "\">%08" PRIX64
+                               "search=0x%016" PRIX64 "\">0x%016" PRIX64
                                "</a> %04d/%02d/%02d ",
                                length,
                                pkalgo2char(type),
                                keyid,
-                               keyid & 0xFFFFFFFF,
+                               keyid,
                                created->tm_year + 1900,
                                created->tm_mon + 1,
                                created->tm_mday);
                } else {
-                       printf("pub  %5d%c/%08" PRIX64 " %04d/%02d/%02d ",
+                       printf("pub  %5d%c/0x%016" PRIX64 " %04d/%02d/%02d ",
                                length,
                                pkalgo2char(type),
-                               keyid & 0xFFFFFFFF,
+                               keyid,
                                created->tm_year + 1900,
                                created->tm_mon + 1,
                                created->tm_mday);
diff --git a/stats.c b/stats.c
index e8e3e2344af9ad71bc663940a1c6892c913dc066..b9692744c2893338927b10146376c4534f5f2a22 100644 (file)
--- a/stats.c
+++ b/stats.c
@@ -176,8 +176,8 @@ void dofindpath(struct onak_dbctx *dbctx,
                        html ? "<BR>" : "");
                if (keyinfoa->colour == 0) {
                        if (pathnum == 0) {
-                               printf("Can't find a link from 0x%08" PRIX64
-                               " to 0x%08" PRIX64 "%s\n",
+                               printf("Can't find a link from 0x%016" PRIX64
+                               " to 0x%016" PRIX64 "%s\n",
                                have,
                                want,
                                html ? "<BR>" : "");
@@ -187,10 +187,10 @@ void dofindpath(struct onak_dbctx *dbctx,
                        }
                        pathnum = count;
                } else {
-                       printf("%d steps from 0x%08" PRIX64 " to 0x%08" PRIX64
-                               "%s\n",
-                               keyinfoa->colour, have & 0xFFFFFFFF,
-                               want & 0xFFFFFFFF,
+                       printf("%d steps from 0x%016" PRIX64 " to 0x%016"
+                               PRIX64 "%s\n",
+                               keyinfoa->colour, have,
+                               want,
                                html ? "<BR>" : "");
                        curkey = keyinfoa;
                        while (curkey != NULL && curkey->keyid != 0) {
@@ -198,30 +198,30 @@ void dofindpath(struct onak_dbctx *dbctx,
                                                curkey->keyid);
                                if (html && uid == NULL) {
                                        printf("<a href=\"lookup?op=get&search="
-                                               "0x%08" PRIX64 "\">0x%08" PRIX64
-                                               "</a> (["
+                                               "0x%016" PRIX64 "\">0x%016"
+                                               PRIX64 "</a> (["
                                                "User id not found])%s<BR>\n",
-                                               curkey->keyid & 0xFFFFFFFF,
-                                               curkey->keyid & 0xFFFFFFFF,
+                                               curkey->keyid,
+                                               curkey->keyid,
                                                (curkey->keyid == fullwant) ?
                                                        "" : " signs");
                                } else if (html && uid != NULL) {
                                        printf("<a href=\"lookup?op=get&search="
-                                               "0x%08" PRIX64 "\">0x%08"
+                                               "0x%016" PRIX64 "\">0x%016"
                                                PRIX64 "</a>"
                                                " (<a href=\"lookup?op=vindex&"
-                                               "search=0x%08" PRIX64 
+                                               "search=0x%016" PRIX64
                                                "\">%s</a>)%s"
                                                "<BR>\n",
-                                               curkey->keyid & 0xFFFFFFFF,
-                                               curkey->keyid & 0xFFFFFFFF,
-                                               curkey->keyid & 0xFFFFFFFF,
+                                               curkey->keyid,
+                                               curkey->keyid,
+                                               curkey->keyid,
                                                txt2html(uid),
                                                (curkey->keyid == fullwant) ?
                                                "" : " signs");
                                } else {
-                                       printf("0x%08" PRIX64 " (%s)%s\n",
-                                               curkey->keyid & 0xFFFFFFFF,
+                                       printf("0x%016" PRIX64 " (%s)%s\n",
+                                               curkey->keyid,
                                                (uid == NULL) ?
                                                        "[User id not found]" :
                                                        uid,
@@ -244,8 +244,8 @@ void dofindpath(struct onak_dbctx *dbctx,
                        }
                        curkey = keyinfoa;
                        while (curkey != NULL && curkey->keyid != 0) {
-                               printf("0x%08" PRIX64 " ",
-                                               curkey->keyid & 0xFFFFFFFF);
+                               printf("0x%016" PRIX64 " ",
+                                               curkey->keyid);
                                curkey = findinhash(curkey->parent);
                        }
                        putchar('\n');
index f0055f63f3ffff87b820a416b3195cfd62f958a2..43b489bb87a5ddaf62d30859580f2ec7a53c96fe 100755 (executable)
@@ -12,7 +12,7 @@ fi
 cd ${WORKDIR}
 ${BUILDDIR}/onak -b -c $1 add < ${TESTSDIR}/../keys/noodles.key
 if ! ${BUILDDIR}/onak -c $1 index noodles 2> /dev/null | \
-       grep -q -- 'pub   4096R/2DA8B985 2008/06/03 Jonathan McDowell'; then
+       grep -q -- 'pub   4096R/0x94FA372B2DA8B985 2008/06/03 Jonathan McDowell'; then
        echo "* Did not correctly retrieve key by text"
        exit 1
 fi
index 0cf8bcc46ae83fcc18afe3d8c94347fde4ad2029..f0875e958b87649b72a7fa7877f28c2a1ad788c7 100755 (executable)
@@ -13,7 +13,7 @@ cd ${WORKDIR}
 ${BUILDDIR}/onak -b -c $1 add < ${TESTSDIR}/../keys/v5-test.key
 if ! ${BUILDDIR}/onak -c $1 index emma 2> /dev/null | \
        grep -q -- \
-       'pub    255E/87246402 2019/03/20 emma.goldman@example.net'; then
+       'pub    255E/0x19347BC987246402 2019/03/20 emma.goldman@example.net'; then
        echo "* Did not correctly retrieve key by text"
        exit 1
 fi