From: Stephan Mueller <smueller@chronox.de>
To: Mat Martineau <mathew.j.martineau@linux.intel.com>
Cc: David Howells <dhowells@redhat.com>,
keyrings@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: Re: [PATCH v2] KEYS: add SP800-56A KDF support for DH
Date: Fri, 05 Aug 2016 09:10:35 +0200 [thread overview]
Message-ID: <7993056.4BOhkDi2U3@positron.chronox.de> (raw)
In-Reply-To: <alpine.OSX.2.20.1608041258050.55029@mjmartin-mac01.local>
Am Donnerstag, 4. August 2016, 13:41:58 CEST schrieb Mat Martineau:
Hi Mat,
> > +
> > +long keyctl_dh_compute(struct keyctl_dh_params __user *params,
> > + char __user *buffer, size_t buflen,
> > + struct keyctl_kdf_params __user *kdf)
> > +{
> > + struct keyctl_kdf_params kdfcopy;
> > +
> > + if (!kdf)
> > + return __keyctl_dh_compute(params, buffer, buflen, NULL);
> > +
> > + if (copy_from_user(&kdfcopy, kdf, sizeof(kdfcopy)) != 0)
> > + return -EFAULT;
> > +
> > + return __keyctl_dh_compute(params, buffer, buflen, &kdfcopy);
>
> I'd find this more readable if there was one call to __keyctl_dh_compute.
When trying to implement it, I think that it would even be more confusing,
because we need a conditional in any case. Do you like
return __keyctl_dh_compute(params, buffer, buflen, (kdf) ? &kdfcopy : NULL);
better than the already presented code? Besides, this would now imply that we
have two conditionals instead of one.
Ciao
Stephan
next prev parent reply other threads:[~2016-08-05 7:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 18:38 [PATCH v2] KEYS: add SP800-56A KDF support for DH Stephan Mueller
2016-08-04 18:38 ` [PATCH v2] DH support: add KDF handling support Stephan Mueller
2016-08-04 18:45 ` Stephan Mueller
2016-08-04 20:57 ` Mat Martineau
2016-08-05 6:10 ` Stephan Mueller
2016-08-06 6:37 ` [PATCH v3] " Stephan Mueller
2016-08-09 22:38 ` Mat Martineau
2016-08-10 5:16 ` [PATCH v4] " Stephan Mueller
2016-08-04 18:39 ` [PATCH v4 0/4] crypto: Key Derivation Function (SP800-108) Stephan Mueller
2016-08-04 18:40 ` [PATCH v4 1/4] crypto: add template handling for RNGs Stephan Mueller
2016-08-09 10:02 ` Herbert Xu
2016-08-04 18:40 ` [PATCH v4 2/4] crypto: kdf - add known answer tests Stephan Mueller
2016-08-04 18:40 ` [PATCH v4 3/4] crypto: kdf - SP800-108 Key Derivation Function Stephan Mueller
2016-08-04 18:41 ` [PATCH v4 4/4] crypto: kdf - enable compilation Stephan Mueller
2016-08-04 20:41 ` [PATCH v2] KEYS: add SP800-56A KDF support for DH Mat Martineau
2016-08-05 6:12 ` Stephan Mueller
2016-08-05 7:10 ` Stephan Mueller [this message]
2016-08-05 16:08 ` Mat Martineau
2016-08-06 6:33 ` Stephan Mueller
2016-08-06 6:38 ` [PATCH v3] " Stephan Mueller
2016-08-09 22:48 ` Mat Martineau
2016-08-10 5:06 ` Stephan Mueller
2016-08-10 5:15 ` [PATCH v4] " Stephan Mueller
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=7993056.4BOhkDi2U3@positron.chronox.de \
--to=smueller@chronox.de \
--cc=dhowells@redhat.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=mathew.j.martineau@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.