summaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/log-tree.c b/log-tree.c
index 4e32638de8..52127427ff 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -449,22 +449,22 @@ static void show_signature(struct rev_info *opt, struct commit *commit)
{
struct strbuf payload = STRBUF_INIT;
struct strbuf signature = STRBUF_INIT;
- struct signature_check sigc = { 0 };
+ struct strbuf gpg_output = STRBUF_INIT;
int status;
if (parse_signed_commit(commit, &payload, &signature) <= 0)
goto out;
- status = check_signature(payload.buf, payload.len, signature.buf,
- signature.len, &sigc);
- if (status && sigc.result == 'N')
- show_sig_lines(opt, status, "No signature\n");
- else {
- show_sig_lines(opt, status, sigc.gpg_output);
- signature_check_clear(&sigc);
- }
+ status = verify_signed_buffer(payload.buf, payload.len,
+ signature.buf, signature.len,
+ &gpg_output, NULL);
+ if (status && !gpg_output.len)
+ strbuf_addstr(&gpg_output, "No signature\n");
+
+ show_sig_lines(opt, status, gpg_output.buf);
out:
+ strbuf_release(&gpg_output);
strbuf_release(&payload);
strbuf_release(&signature);
}
@@ -497,11 +497,11 @@ static int show_one_mergetag(struct commit *commit,
struct object_id oid;
struct tag *tag;
struct strbuf verify_message;
- struct signature_check sigc = { 0 };
int status, nth;
size_t payload_size, gpg_message_offset;
- hash_object_file(extra->value, extra->len, type_name(OBJ_TAG), &oid);
+ hash_object_file(the_hash_algo, extra->value, extra->len,
+ type_name(OBJ_TAG), &oid);
tag = lookup_tag(the_repository, &oid);
if (!tag)
return -1; /* error message already given */
@@ -516,7 +516,7 @@ static int show_one_mergetag(struct commit *commit,
"merged tag '%s'\n", tag->tag);
else if ((nth = which_parent(&tag->tagged->oid, commit)) < 0)
strbuf_addf(&verify_message, "tag %s names a non-parent %s\n",
- tag->tag, tag->tagged->oid.hash);
+ tag->tag, oid_to_hex(&tag->tagged->oid));
else
strbuf_addf(&verify_message,
"parent #%d, tagged '%s'\n", nth + 1, tag->tag);
@@ -526,13 +526,12 @@ static int show_one_mergetag(struct commit *commit,
status = -1;
if (extra->len > payload_size) {
/* could have a good signature */
- if (!check_signature(extra->value, payload_size,
- extra->value + payload_size,
- extra->len - payload_size, &sigc)) {
- strbuf_addstr(&verify_message, sigc.gpg_output);
- signature_check_clear(&sigc);
+ if (!verify_signed_buffer(extra->value, payload_size,
+ extra->value + payload_size,
+ extra->len - payload_size,
+ &verify_message, NULL))
status = 0; /* good */
- } else if (verify_message.len <= gpg_message_offset)
+ else if (verify_message.len <= gpg_message_offset)
strbuf_addstr(&verify_message, "No signature\n");
/* otherwise we couldn't verify, which is shown as bad */
}