linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Mimi Zohar <zohar@linux.ibm.com>
Cc: dhowells@redhat.com, keyrings@vger.kernel.org,
	linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH] KEYS: revert requiring signature "encoding"
Date: Fri, 09 Nov 2018 15:05:27 +0000	[thread overview]
Message-ID: <20321.1541775927@warthog.procyon.org.uk> (raw)
In-Reply-To: <1541772875.3990.29.camel@linux.ibm.com>

Mimi Zohar <zohar@linux.ibm.com> wrote:

> Looking the patch over again, do you prefer the duplicate call or
> defining a local variable and using the ternary conditional operator
> ("?:") like this:
> 
> 	bool rsa = false;
> 
> 	if (!(sig->encoding) && strcmp(pkey->pkey_algo, "rsa") == 0)
>                 rsa = true;
> 
>         ret = software_key_determine_akcipher(rsa ? "pkcs1" : sig->encoding,
>                                               sig->hash_algo,
>                                               pkey, alg_name);

Might be better to do:

	const char *encoding = sig->encoding;

	if (!encoding && strcmp(pkey->pkey_algo, "rsa") == 0)
		encoding = "pkcs1";

	ret = software_key_determine_akcipher(encoding, ...

David

  reply	other threads:[~2018-11-09 15:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  5:59 [PATCH] KEYS: revert requiring signature "encoding" Mimi Zohar
2018-11-09 13:16 ` David Howells
2018-11-09 14:14   ` Mimi Zohar
2018-11-09 15:05     ` David Howells [this message]
2018-11-09 15:06     ` David Howells
2018-11-09 15:28 ` David Howells

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

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

  git send-email \
    --in-reply-to=20321.1541775927@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=zohar@linux.ibm.com \
    /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.
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 NNTP newsgroup(s).