Re: [PATCH 8/8] gpg-interface: handle alternative signature types

2018-05-03 Thread Ben Toews
On Tue, Apr 17, 2018 at 12:33 PM, Taylor Blau wrote: > > On Tue, Apr 17, 2018 at 12:08:20PM -0600, Ben Toews wrote: > > On Mon, Apr 16, 2018 at 7:54 PM, Junio C Hamano wrote: > > > "brian m. carlson" writes: > > > > > >> If we just want

Re: [PATCH 8/8] gpg-interface: handle alternative signature types

2018-04-17 Thread Ben Toews
On Mon, Apr 16, 2018 at 7:54 PM, Junio C Hamano wrote: > "brian m. carlson" writes: > >> If we just want to add gpgsm support, that's fine, but we should be >> transparent about that fact and try to avoid making an interface which >> is at once too generic and not generic enough. This patch is d

[PATCH v2 6/9] gpg-interface: extract gpg line matching helper

2018-04-13 Thread Ben Toews
From: Jeff King Let's separate the actual line-by-line parsing of signatures from the notion of "is this a gpg signature line". That will make it easier to do more refactoring of this loop in future patches. Signed-off-by: Jeff King Signed-off-by: Ben Toews --- gpg-

[PATCH v2 7/9] gpg-interface: find the last gpg signature line

2018-04-13 Thread Ben Toews
we may be confused by a signature (or a signature-like line) in the actual body. Let's keep parsing and always find the final block, which should be the detached signature over all of the preceding content. Signed-off-by: Jeff King Signed-off-by: Ben Toews --- gpg-interface.c

[PATCH v2 9/9] gpg-interface: handle alternative signature types

2018-04-13 Thread Ben Toews
step refactoring if we want to offer support for more exotic tools (e.g., people have asked before on the list about using OpenBSD signify). Signed-off-by: Ben Toews --- Documentation/config.txt | 42 +--- builtin/fmt-merge-msg.c | 6 +- builtin/receive-pack.c | 7

[PATCH v2 2/9] gpg-interface: handle bool user.signingkey

2018-04-13 Thread Ben Toews
tch, we'll leave it alone for now. We will add some whitespace and returns in preparation for adding more config keys, though. Signed-off-by: Jeff King Signed-off-by: Ben Toews --- gpg-interface.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/gpg-interface.c b/gpg-interface.c i

[PATCH v2 3/9] gpg-interface: modernize function declarations

2018-04-13 Thread Ben Toews
ace. Signed-off-by: Jeff King Signed-off-by: Ben Toews --- gpg-interface.c | 17 - gpg-interface.h | 49 ++--- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/gpg-interface.c b/gpg-interface.c index 61c0690e12..08

[PATCH v2 5/9] gpg-interface: fix const-correctness of "eol" pointer

2018-04-13 Thread Ben Toews
From: Jeff King We accidentally shed the "const" of our buffer by passing it through memchr. Let's fix that, and while we're at it, move our variable declaration inside the loop, which is the only place that uses it. Signed-off-by: Jeff King Signed-off-by: Ben Toews ---

[PATCH v2 4/9] gpg-interface: use size_t for signature buffer size

2018-04-13 Thread Ben Toews
ffer. Signed-off-by: Jeff King Signed-off-by: Ben Toews --- gpg-interface.c | 2 +- gpg-interface.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gpg-interface.c b/gpg-interface.c index 08de0daa41..ac852ad4b9 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -

[PATCH v2 1/9] t7004: fix mistaken tag name

2018-04-13 Thread Ben Toews
From: Jeff King We have a series of tests which create signed tags with various properties, but one test accidentally verifies a tag from much earlier in the series. Signed-off-by: Jeff King Signed-off-by: Ben Toews --- t/t7004-tag.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v2 8/9] gpg-interface: prepare for parsing arbitrary PEM blocks

2018-04-13 Thread Ben Toews
From: Jeff King In preparation for handling more PEM blocks besides "PGP SIGNATURE" and "PGP MESSAGE', let's break up the parsing to parameterize the actual block type. Signed-off-by: Jeff King Signed-off-by: Ben Toews --- gpg-interface.c | 18 +++--

[PATCH v2 0/9] gpg-interface: Multiple signing tools

2018-04-13 Thread Ben Toews
&& + echo 12 >file && test_tick && git commit -a -m twelfth && + test_unconfig gpg.program && git tag twelfth-fake-signed && git cat-file -p twelfth-fake-signed >actual && grep "FAKE SIGNER S

Re: [PATCH 6/8] gpg-interface: find the last gpg signature line

2018-04-11 Thread Ben Toews
-tag.sh > +++ b/t/t7004-tag.sh > @@ -1056,7 +1056,7 @@ test_expect_success GPG \ > git tag -s -F sigblanknonlfile blanknonlfile-signed-tag && > get_tag_msg blanknonlfile-signed-tag >actual && > test_cmp expect actual && > - git tag -v signed-tag > + git tag -v blanknonlfile-signed-tag > ' > > # messages with commented lines for signed tags: > -- > 2.17.0-140-g0b0cc9f867 > -- -Ben Toews

Re: [PATCH 8/8] gpg-interface: handle alternative signature types

2018-04-10 Thread Ben Toews
On Tue, Apr 10, 2018 at 3:35 AM, Junio C Hamano wrote: > Ben Toews writes: > >> From: Ben Toews >> >> Currently you can only sign commits and tags using "gpg". >> ... >> have asked before on the list about using OpenBSD signify). >> --- &g

Re: [PATCH 8/8] gpg-interface: handle alternative signature types

2018-04-10 Thread Ben Toews
On Tue, Apr 10, 2018 at 2:24 AM, Eric Sunshine wrote: > On Mon, Apr 9, 2018 at 4:41 PM, Ben Toews wrote: >> [...] >> This patch introduces a set of configuration options for >> defining a "signing tool", of which gpg may be just one. >> With this patch you

Re: [PATCH 6/8] gpg-interface: find the last gpg signature line

2018-04-10 Thread Ben Toews
On Tue, Apr 10, 2018 at 3:44 AM, Junio C Hamano wrote: > Ben Toews writes: > >> diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh >> index ee093b393d..e3f1e014aa 100755 >> --- a/t/t7004-tag.sh >> +++ b/t/t7004-tag.sh >> @@ -1059,6 +1059,17 @@ test_expe

[PATCH 8/8] gpg-interface: handle alternative signature types

2018-04-09 Thread Ben Toews
From: Ben Toews Currently you can only sign commits and tags using "gpg". You can _almost_ plug in a related tool like "gpgsm" (which uses S/MIME-style signatures instead of PGP) using gpg.program, as it has command-line compatibility. But there are a few rough edges:

[PATCH 1/8] gpg-interface: handle bool user.signingkey

2018-04-09 Thread Ben Toews
From: Jeff King The config handler for user.signingkey does not check for a boolean value, and thus: git -c user.signingkey tag will segfault. We could fix this and even shorten the code by using git_config_string(). But our set_signing_key() helper is used by other code outside of gpg-interf

[PATCH 3/8] gpg-interface: use size_t for signature buffer size

2018-04-09 Thread Ben Toews
From: Jeff King Even though our object sizes (from which these buffers would come) are typically "unsigned long", this is something we'd like to eventually fix (since it's only 32-bits even on 64-bit Windows). It makes more sense to use size_t when taking an in-memory buffer. --- gpg-interface.c

[PATCH 2/8] gpg-interface: modernize function declarations

2018-04-09 Thread Ben Toews
From: Jeff King Let's drop "extern" from our declarations, which brings us in line with our modern style guidelines. While we're here, let's wrap some of the overly long lines, and move docstrings for public functions to their declarations, since they document the interface. --- gpg-interface.c

[PATCH 4/8] gpg-interface: fix const-correctness of "eol" pointer

2018-04-09 Thread Ben Toews
From: Jeff King We accidentally shed the "const" of our buffer by passing it through memchr. Let's fix that, and while we're at it, move our variable declaration inside the loop, which is the only place that uses it. --- gpg-interface.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) di

[PATCH 6/8] gpg-interface: find the last gpg signature line

2018-04-09 Thread Ben Toews
From: Jeff King A signed tag has a detached signature like this: object ... [...more header...] This is the tag body. -BEGIN PGP SIGNATURE- [opaque gpg data] -END PGP SIGNATURE- Our parser finds the _first_ line that appears to start a PGP signature block, meaning

[PATCH 7/8] gpg-interface: prepare for parsing arbitrary PEM blocks

2018-04-09 Thread Ben Toews
From: Jeff King In preparation for handling more PEM blocks besides "PGP SIGNATURE" and "PGP MESSAGE', let's break up the parsing to parameterize the actual block type. --- gpg-interface.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/gpg-interface.c b/g

[PATCH 0/8] gpg-interface: Multiple signing tools

2018-04-09 Thread Ben Toews
This series extends the configuration to allow Git to better work with multiple signing tools. Ben Toews (1): gpg-interface: handle alternative signature types Jeff King (7): gpg-interface: handle bool user.signingkey gpg-interface: modernize function declarations gpg-interface: use

[PATCH 5/8] gpg-interface: extract gpg line matching helper

2018-04-09 Thread Ben Toews
From: Jeff King Let's separate the actual line-by-line parsing of signatures from the notion of "is this a gpg signature line". That will make it easier to do more refactoring of this loop in future patches. --- gpg-interface.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff