builtin/receive-pack: use check_signature from gpg-interface

The combination of verify_signed_buffer followed by parse_gpg_output is available as check_signature. Use that instead of implementing it again. Signed-off-by: Henning Schild <henning.schild@siemens.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Henning Schild committed Jul 11, 2018 at 10:38 UTC 3b9291e182e158e334ef27bae179cb09232403df
1 file changed +2 -15
builtin/receive-pack.c
+2 -15
@@ -629,8 +629,6 @@ static void prepare_push_cert_sha1(struct child_process *proc)
629 return;
630
631 if (!already_done) {
632 - struct strbuf gpg_output = STRBUF_INIT;
633 - struct strbuf gpg_status = STRBUF_INIT;
632 int bogs /* beginning_of_gpg_sig */;
633
634 already_done = 1;
@@ -639,22 +637,11 @@ static void prepare_push_cert_sha1(struct child_process *proc)
637 oidclr(&push_cert_oid);
638
639 memset(&sigcheck, '\0', sizeof(sigcheck));
642 - sigcheck.result = 'N';
640
641 bogs = parse_signature(push_cert.buf, push_cert.len);
645 - if (verify_signed_buffer(push_cert.buf, bogs,
646 - push_cert.buf + bogs, push_cert.len - bogs,
647 - &gpg_output, &gpg_status) < 0) {
648 - ; /* error running gpg */
649 - } else {
650 - sigcheck.payload = push_cert.buf;
651 - sigcheck.gpg_output = gpg_output.buf;
652 - sigcheck.gpg_status = gpg_status.buf;
653 - parse_gpg_output(&sigcheck);
654 - }
642 + check_signature(push_cert.buf, bogs, push_cert.buf + bogs,
643 + push_cert.len - bogs, &sigcheck);
644
656 - strbuf_release(&gpg_output);
657 - strbuf_release(&gpg_status);
645 nonce_status = check_nonce(push_cert.buf, bogs);
646 }
647 if (!is_null_oid(&push_cert_oid)) {