Skip to content

Commit 3b9291e

Browse files
henning-schildgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e333175 commit 3b9291e

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

builtin/receive-pack.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,6 @@ static void prepare_push_cert_sha1(struct child_process *proc)
629629
return;
630630

631631
if (!already_done) {
632-
struct strbuf gpg_output = STRBUF_INIT;
633-
struct strbuf gpg_status = STRBUF_INIT;
634632
int bogs /* beginning_of_gpg_sig */;
635633

636634
already_done = 1;
@@ -639,22 +637,11 @@ static void prepare_push_cert_sha1(struct child_process *proc)
639637
oidclr(&push_cert_oid);
640638

641639
memset(&sigcheck, '\0', sizeof(sigcheck));
642-
sigcheck.result = 'N';
643640

644641
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);
655644

656-
strbuf_release(&gpg_output);
657-
strbuf_release(&gpg_status);
658645
nonce_status = check_nonce(push_cert.buf, bogs);
659646
}
660647
if (!is_null_oid(&push_cert_oid)) {

0 commit comments

Comments
 (0)