summaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorFabian Stelzer <fs@gigacodes.de>2021-12-09 08:52:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-12-09 21:38:04 (GMT)
commit02769437e1421d837f6de27cfb5c14087cfec8dd (patch)
treec22e72f64810c036e48f4b17adbfc963e43c7e92 /log-tree.c
parentcafd34522f13e66b35bfcf00c04bc82f685a8ce9 (diff)
downloadgit-02769437e1421d837f6de27cfb5c14087cfec8dd.zip
git-02769437e1421d837f6de27cfb5c14087cfec8dd.tar.gz
git-02769437e1421d837f6de27cfb5c14087cfec8dd.tar.bz2
ssh signing: use sigc struct to pass payload
To be able to extend the payload metadata with things like its creation timestamp or the creators ident we remove the payload parameters to check_signature() and use the already existing sigc->payload field instead, only adding the length field to the struct. This also allows us to get rid of the xmemdupz() calls in the verify functions. Since sigc is now used to input data as well as output the result move it to the front of the function list. - Add payload_length to struct signature_check - Populate sigc.payload/payload_len on all call sites - Remove payload parameters to check_signature() - Remove payload parameters to internal verify_* functions and use sigc instead - Remove xmemdupz() used for verbose output since payload is now already populated. Signed-off-by: Fabian Stelzer <fs@gigacodes.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/log-tree.c b/log-tree.c
index 644893f..a46cf60 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -513,8 +513,8 @@ static void show_signature(struct rev_info *opt, struct commit *commit)
if (parse_signed_commit(commit, &payload, &signature, the_hash_algo) <= 0)
goto out;
- status = check_signature(payload.buf, payload.len, signature.buf,
- signature.len, &sigc);
+ sigc.payload = strbuf_detach(&payload, &sigc.payload_len);
+ status = check_signature(&sigc, signature.buf, signature.len);
if (status && !sigc.output)
show_sig_lines(opt, status, "No signature\n");
else
@@ -583,8 +583,8 @@ static int show_one_mergetag(struct commit *commit,
status = -1;
if (parse_signature(extra->value, extra->len, &payload, &signature)) {
/* could have a good signature */
- status = check_signature(payload.buf, payload.len,
- signature.buf, signature.len, &sigc);
+ sigc.payload = strbuf_detach(&payload, &sigc.payload_len);
+ status = check_signature(&sigc, signature.buf, signature.len);
if (sigc.output)
strbuf_addstr(&verify_message, sigc.output);
else