[Pkg-gnupg-commit] [gnupg2] 46/118: gpg: Simplify code to print VALIDSIG.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Thu Sep 15 18:25:06 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch encoding-and-speling
in repository gnupg2.
commit fde9fa81d3d3b25a929b532cc1960d9d9f454a0c
Author: Werner Koch <wk at gnupg.org>
Date: Thu Sep 1 16:34:08 2016 +0200
gpg: Simplify code to print VALIDSIG.
* g10/mainproc.c (check_sig_and_print): Use hexfingerprint and
write_status_printf.
Signed-off-by: Werner Koch <wk at gnupg.org>
---
g10/mainproc.c | 49 ++++++++++++++++++++-----------------------------
1 file changed, 20 insertions(+), 29 deletions(-)
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 716363f..7bb4350 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -2104,35 +2104,26 @@ check_sig_and_print (CTX c, kbnode_t node)
}
/* For good signatures print the VALIDSIG status line. */
- if (!rc && is_status_enabled ())
- {
- if (pk)
- {
- byte array[MAX_FINGERPRINT_LEN], *p;
- char buf[MAX_FINGERPRINT_LEN*4+90], *bufp;
- size_t i, n;
-
- bufp = buf;
- fingerprint_from_pk (pk, array, &n);
- p = array;
- for(i=0; i < n ; i++, p++, bufp += 2)
- sprintf (bufp, "%02X", *p );
- /* TODO: Replace the reserved '0' in the field below
- with bits for status flags (policy url, notation,
- etc.). Remember to make the buffer larger to match! */
- sprintf (bufp, " %s %lu %lu %d 0 %d %d %02X ",
- strtimestamp( sig->timestamp ),
- (ulong)sig->timestamp,(ulong)sig->expiredate,
- sig->version,sig->pubkey_algo,sig->digest_algo,
- sig->sig_class);
- bufp = bufp + strlen (bufp);
- if (!pk->flags.primary)
- fingerprint_from_pk (mainpk, array, &n);
- p = array;
- for (i=0; i < n ; i++, p++, bufp += 2)
- sprintf(bufp, "%02X", *p );
- write_status_text (STATUS_VALIDSIG, buf);
- }
+ if (!rc && is_status_enabled () && pk)
+ {
+ char pkhex[MAX_FINGERPRINT_LEN*2+1];
+ char mainpkhex[MAX_FINGERPRINT_LEN*2+1];
+
+ hexfingerprint (pk, pkhex, sizeof pkhex);
+ hexfingerprint (mainpk, mainpkhex, sizeof mainpkhex);
+
+ /* TODO: Replace the reserved '0' in the field below with
+ bits for status flags (policy url, notation, etc.). */
+ write_status_printf (STATUS_VALIDSIG,
+ "%s %s %lu %lu %d 0 %d %d %02X %s",
+ pkhex,
+ strtimestamp (sig->timestamp),
+ (ulong)sig->timestamp,
+ (ulong)sig->expiredate,
+ sig->version, sig->pubkey_algo,
+ sig->digest_algo,
+ sig->sig_class,
+ mainpkhex);
}
/* For good signatures compute and print the trust information.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list