git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Ibrahim El <ibrahim.el@pm.me>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/5] Signing API: Added new signing interface API
Date: Mon, 26 Aug 2019 23:04:29 +0000	[thread overview]
Message-ID: <20190826230429.GB11334@genre.crustytoothpaste.net> (raw)
In-Reply-To: <CkxnpIEi2c1o1FmI2ZJP8CJQybGMZFbL6uQAd3w7ApKdaki4vcCrlgbTWmPMrrfIedBSvLV56q6txzvCo7bnO1wHlS6cB3bUYpYfNW80w_s=@pm.me>

[-- Attachment #1: Type: text/plain, Size: 2367 bytes --]

On 2019-08-26 at 19:58:00, Ibrahim El wrote:
> From: Ibrahim El Rhezzali <ibrahim.el@pm.me>
> 
> 7e3e6c9e4 Added new signing interface API
> 
> Adding files for the new signing interface and also support drivers for the two existing GPG and GPGSM X.509 tools

I'd like to see an explanation here why a new signing interface is
necessary and we need to make a wholesale replacement of the existing
one instead of making incremental changes.

> diff --git a/signing-interface.c b/signing-interface.c
> new file mode 100644
> index 000000000..c744ef499
> --- /dev/null
> +++ b/signing-interface.c
> @@ -0,0 +1,487 @@
> +#include <sys/types.h>
> +#include <unistd.h>
> +#include "cache.h"
> +#include "config.h"
> +#include "run-command.h"
> +#include "strbuf.h"
> +#include "signing-interface.h"
> +#include "signing-tool.h"
> +#include "sigchain.h"
> +#include "tempfile.h"
> +
> +extern const struct signing_tool openpgp_tool;
> +extern const struct signing_tool x509_tool;
> +
> +static const struct signing_tool *signing_tools[SIGNATURE_TYPE_COUNT] = {
> +	&openpgp_tool,
> +	&x509_tool,
> +};

It looks like we've hard-coded only two tools here.  I was under the
impression this series was supposed to make signing pluggable with any
tool, but that doesn't seem to be the case.

> +size_t parse_signatures(const char *payload, size_t size, 
> +		struct signatures *sigs)
> +{
> +	enum signature_type st;
> +	size_t first;
> +	size_t begin = 0;
> +	const struct signing_tool *tool;
> +	struct signature *psig = NULL;
> +
> +	first = size;
> +	for (st = SIGNATURE_TYPE_FIRST; st < SIGNATURE_TYPE_LAST; st++) {
> +		tool = signing_tools[st];
> +
> +		if (!tool || !tool->parse)
> +			BUG("signing tool %s undefined", signature_type_name(st));

If this is supposed to make parsing generic, won't we have to add
support for each individual tool in the codebase so tool->parse is
defined?  Having to do that would defeat the point of having a pluggable
interface set up in the configuration.

> +	buf = xstrdup(var);
> +	t1 = strtok(buf, ".");
> +	t2 = strtok(NULL, ".");
> +	t3 = strtok(NULL, ".");

I don't think we make a lot of use of strtok.  Perhaps you'd like to use
parse_config_key or another function in config.c?
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]

  reply	other threads:[~2019-08-26 23:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 19:58 [PATCH 2/5] Signing API: Added new signing interface API Ibrahim El
2019-08-26 23:04 ` brian m. carlson [this message]
2019-08-27 18:53   ` Ibrahim El

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190826230429.GB11334@genre.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=ibrahim.el@pm.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).