MCPcopy Index your code
hub / github.com/git/git / verify_gpg_signed_buffer

Function verify_gpg_signed_buffer

gpg-interface.c:349–396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349static int verify_gpg_signed_buffer(struct signature_check *sigc,
350 struct gpg_format *fmt,
351 const char *signature,
352 size_t signature_size)
353{
354 struct child_process gpg = CHILD_PROCESS_INIT;
355 struct tempfile *temp;
356 int ret;
357 struct strbuf gpg_stdout = STRBUF_INIT;
358 struct strbuf gpg_stderr = STRBUF_INIT;
359
360 temp = mks_tempfile_t(".git_vtag_tmpXXXXXX");
361 if (!temp)
362 return error_errno(_("could not create temporary file"));
363 if (write_in_full(temp->fd, signature, signature_size) < 0 ||
364 close_tempfile_gently(temp) < 0) {
365 error_errno(_("failed writing detached signature to '%s'"),
366 temp->filename.buf);
367 delete_tempfile(&temp);
368 return -1;
369 }
370
371 strvec_push(&gpg.args, fmt->program);
372 strvec_pushv(&gpg.args, fmt->verify_args);
373 strvec_pushl(&gpg.args,
374 "--status-fd=1",
375 "--verify", temp->filename.buf, "-",
376 NULL);
377
378 sigchain_push(SIGPIPE, SIG_IGN);
379 ret = pipe_command(&gpg, sigc->payload, sigc->payload_len, &gpg_stdout, 0,
380 &gpg_stderr, 0);
381 sigchain_pop(SIGPIPE);
382
383 delete_tempfile(&temp);
384
385 ret |= !strstr(gpg_stdout.buf, "\n[GNUPG:] GOODSIG ") &&
386 !strstr(gpg_stdout.buf, "\n[GNUPG:] EXPKEYSIG ");
387 sigc->output = strbuf_detach(&gpg_stderr, NULL);
388 sigc->gpg_status = strbuf_detach(&gpg_stdout, NULL);
389
390 parse_gpg_output(sigc);
391
392 strbuf_release(&gpg_stdout);
393 strbuf_release(&gpg_stderr);
394
395 return ret;
396}
397
398static void parse_ssh_output(struct signature_check *sigc)
399{

Callers

nothing calls this directly

Calls 14

mks_tempfile_tFunction · 0.85
error_errnoFunction · 0.85
write_in_fullFunction · 0.85
close_tempfile_gentlyFunction · 0.85
delete_tempfileFunction · 0.85
strvec_pushFunction · 0.85
strvec_pushvFunction · 0.85
strvec_pushlFunction · 0.85
sigchain_pushFunction · 0.85
pipe_commandFunction · 0.85
sigchain_popFunction · 0.85
strbuf_detachFunction · 0.85

Tested by

no test coverage detected