From mboxrd@z Thu Jan 1 00:00:00 1970 From: Herbert Xu Subject: Re: [PATCH v2 3/4] crypto: kdf - SP800-108 Key Derivation Function Date: Wed, 8 Jun 2016 11:13:34 +0800 Message-ID: <20160608031334.GC12283@gondor.apana.org.au> References: <17649236.piPdUxUzaM@positron.chronox.de> <4593825.q48Y9K9RSZ@positron.chronox.de> <20160602085526.GA15919@gondor.apana.org.au> <20634336.6yV5j7Wfmz@tauon.atsec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-crypto@vger.kernel.org, David Howells , Mat Martineau , keyrings@vger.kernel.org To: Stephan Mueller Return-path: Received: from helcar.hengli.com.au ([209.40.204.226]:53876 "EHLO helcar.hengli.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932197AbcFHDNo (ORCPT ); Tue, 7 Jun 2016 23:13:44 -0400 Content-Disposition: inline In-Reply-To: <20634336.6yV5j7Wfmz@tauon.atsec.com> Sender: linux-crypto-owner@vger.kernel.org List-ID: On Thu, Jun 02, 2016 at 05:12:20PM +0200, Stephan Mueller wrote: > > 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. OK. I don't think the RNG API really guarantees that you can do in-place generation anyway. So don't even bother checking for src == dst. When you submit this again can you please send it along with a user? Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt