Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller@chronox.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org, David Howells <dhowells@redhat.com>,
	Mat Martineau <mathew.j.martineau@linux.intel.com>,
	keyrings@vger.kernel.org
Subject: Re: [PATCH v2 3/4] crypto: kdf - SP800-108 Key Derivation Function
Date: Thu, 02 Jun 2016 17:12:20 +0200	[thread overview]
Message-ID: <20634336.6yV5j7Wfmz@tauon.atsec.com> (raw)
In-Reply-To: <20160602085526.GA15919@gondor.apana.org.au>

Am Donnerstag, 2. Juni 2016, 16:55:26 schrieb Herbert Xu:

Hi Herbert,

> 
> Why don't you put the result in a temporary buffer and then copy
> it? These things are tiny, right?

The KDFs are usually used for output sizes between one and 4 keys. So, 
commonly it is expected that not more than 200 or 300 bytes are generated by 
one call. But you cannot be sure how much data a user wants. The spec allows 
that the user generates up to 2^50 or so bytes. The implementation I offer is 
limited to unsigned int bytes.

Note, if one would implement a key ladder, it can be expected that many keys 
are generated from one KDF seed.

I tried to avoid memcpy for speed purposes. And all the user needs to do is to 
not invoke an in-place crypto operation.

Maybe I should copy the input data into a private memory location so that the 
KDF can be used like any other cipher: the caller uses a reference to the 
instance to generate data where the caller does not need to ensure that some 
initial data must be left at some specific place.

Ciao
Stephan

  reply	other threads:[~2016-06-02 15:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 11:50 [PATCH v2 0/4] crypto: Key Derivation Function (SP800-108) Stephan Mueller
2016-05-31 11:51 ` [PATCH v2 1/4] crypto: add template handling for RNGs Stephan Mueller
2016-05-31 11:52 ` [PATCH v2 2/4] crypto: kdf - add known answer tests Stephan Mueller
2016-05-31 11:52 ` [PATCH v2 3/4] crypto: kdf - SP800-108 Key Derivation Function Stephan Mueller
2016-06-02  8:55   ` Herbert Xu
2016-06-02 15:12     ` Stephan Mueller [this message]
2016-06-08  3:13       ` Herbert Xu
2016-06-08  4:58         ` Stephan Mueller
2016-05-31 11:53 ` [PATCH v2 4/4] crypto: kdf - enable compilation Stephan Mueller
2016-06-02  8:56 ` [PATCH v2 0/4] crypto: Key Derivation Function (SP800-108) Herbert Xu

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=20634336.6yV5j7Wfmz@tauon.atsec.com \
    --to=smueller@chronox.de \
    --cc=dhowells@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox