From: Jonathan McDowell Date: Tue, 16 Apr 2019 20:09:29 +0000 (+0100) Subject: Stop using 32-bit key IDs X-Git-Tag: onak-0.6.0~54 X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=41b7047c909cb5d8243901080db4931ebf165acf;p=onak.git Stop using 32-bit key IDs 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. --- diff --git a/gpgwww.c b/gpgwww.c index 02b4e79..73ef738 100644 --- a/gpgwww.c +++ b/gpgwww.c @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) "\">Find reverse path\n", to, from); - printf("" "Get all keys listed

\n", from, diff --git a/keyindex.c b/keyindex.c index 4883f63..f6784d7 100644 --- a/keyindex.c +++ b/keyindex.c @@ -234,25 +234,25 @@ int list_sigs(struct onak_dbctx *dbctx, } if (html && uid != NULL) { printf("%s %08" PRIX64 + "search=0x%016" PRIX64 "\">0x%016" PRIX64 " " "%s\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/%08" PRIX64 + "search=0x%016" PRIX64 "\">0x%016" PRIX64 " %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 e8e3e23..b969274 100644 --- a/stats.c +++ b/stats.c @@ -176,8 +176,8 @@ void dofindpath(struct onak_dbctx *dbctx, html ? "
" : ""); 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 ? "
" : ""); @@ -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 ? "
" : ""); 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("0x%08" PRIX64 - " ([" + "0x%016" PRIX64 "\">0x%016" + PRIX64 " ([" "User id not found])%s
\n", - curkey->keyid & 0xFFFFFFFF, - curkey->keyid & 0xFFFFFFFF, + curkey->keyid, + curkey->keyid, (curkey->keyid == fullwant) ? "" : " signs"); } else if (html && uid != NULL) { printf("0x%08" + "0x%016" PRIX64 "\">0x%016" PRIX64 "" " (%s)%s" "
\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'); diff --git a/t/all-040-index-text.t b/t/all-040-index-text.t index f0055f6..43b489b 100755 --- a/t/all-040-index-text.t +++ b/t/all-040-index-text.t @@ -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 diff --git a/t/all-045-index-text-v5.t b/t/all-045-index-text-v5.t index 0cf8bcc..f0875e9 100755 --- a/t/all-045-index-text-v5.t +++ b/t/all-045-index-text-v5.t @@ -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