summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer2020-05-16 15:29:00 +0000
committerMatthias Schiffer2020-05-23 11:33:37 +0000
commitf1f65026a94137c91b5466b149ef3ea3f20091e9 (patch)
treec74f479fc4d581661b796453aa60ea78795aefa0
parentf34a383eeed6282fa16fb021157a60c75f33fdcd (diff)
downloadusign-f1f65026a94137c91b5466b149ef3ea3f20091e9.tar.gz
Always pad fingerprints to 16 characters
Fingerprints were not padded with zeros. This led to a ucert failure when the first byte of the fingerprint is 00, as it expects the fingerprint to have a constant length (and this expectation seems reasonable to me). Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> Acked-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/main.c b/main.c
index ef47b28..ebfdfb0 100644
--- a/main.c
+++ b/main.c
@@ -149,7 +149,7 @@ static void write_file(const char *name, const uint8_t *fingerprint,
if (comment)
fputs(comment, f);
else
- fprintf(f, "%s %"PRIx64, prefix,
+ fprintf(f, "%s %016"PRIx64, prefix,
fingerprint_u64(fingerprint));
fprintf(f, "\n%s\n", buf);
fclose(f);
@@ -177,7 +177,7 @@ static int verify(const char *msgfile)
}
if (!pubkeyfile) {
- snprintf(buf, sizeof(buf), "%s/%"PRIx64, pubkeydir,
+ snprintf(buf, sizeof(buf), "%s/%016"PRIx64, pubkeydir,
fingerprint_u64(sig.fingerprint));
pubkeyfile = buf;
}
@@ -276,7 +276,7 @@ static int fingerprint(void)
else
return 1;
- fprintf(stdout, "%"PRIx64"\n", fingerprint_u64(fp));
+ fprintf(stdout, "%016"PRIx64"\n", fingerprint_u64(fp));
return 0;
}