Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp126657pxu; Wed, 6 Jan 2021 23:57:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJygtANtqhsoBqS+9D5FmzZLGgTefGutyZbKgsoEabC6ie084BPn8XWsWXaE/5IKWEo1FD93 X-Received: by 2002:a17:906:589:: with SMTP id 9mr5595100ejn.229.1610006231444; Wed, 06 Jan 2021 23:57:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610006231; cv=none; d=google.com; s=arc-20160816; b=gf/e/KBRUmMCdvIdZfUFrTP64f5lkmWlYF9a9xasdiRSbZFgf62QmBEKE7G6PSxXSq ynw5+ULU4Py0oSW1S6ZedR4/Dus0VALcce+ha4rcmFpNg0UZXp5/VsEG+oKH7Jonk0tN bebZUuRqQ2IymHVEu05TTAHpnMtVOILNLmAUt3QhDvLZV8EFZq98hqqoJyKI1Z2wA/8b XxmTyEkjRlBB/lr8pXGUjb1F4mUrA5ZFFmi4wFfOBuYLFzcXRGQOUbUZZNS/hvqC6/xJ pPKlk32xgzDDXErO1GWH+nzEn18Z/VRY2uA5uqaguGIwfub4I2/LexedXl9+i0jBCXM7 ED3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=KeYZOhheY0c+6YwZ/Ytl1iRm8ID+YfLlMyMcKez+UfA=; b=H7Jl05aje69MnIMpZA8NodXXYgzT/FywI/QoTzOnGTf0MM9WWydFEgKXRTsHqFyPHp LdPwmRUdUoPxE6R9oH08s91cFSIJaAOciNPtwsKY6jKfwQNsUWhyCvKzPRYeCwDCh2f2 dRzn5uHaUvp5k6Ojo7BPkgp3D/hPPXbUZkkRxkuFo/3FEWVXRjC9XDxH1TJKkJkiD20+ p8O3m5MHpEKf5sP+S3Nc65KinNSs4Ig+CMZJbkHWmlBPBkZvmSFaLsJJ5/5APx6Ib0iz 72wcaU4kBusel19RIecxiZ6aEPQoR5fhqlkMS+2Cmf7pSwiO6ZElzmTmUuqNmZoMzjDV VkgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chronox.de header.s=strato-dkim-0002 header.b=l5xUZ+JK; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si1983251edx.272.2021.01.06.23.56.51; Wed, 06 Jan 2021 23:57:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chronox.de header.s=strato-dkim-0002 header.b=l5xUZ+JK; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726110AbhAGH4I (ORCPT + 99 others); Thu, 7 Jan 2021 02:56:08 -0500 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.52]:23466 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbhAGH4I (ORCPT ); Thu, 7 Jan 2021 02:56:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1610005995; s=strato-dkim-0002; d=chronox.de; h=References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:From: Subject:Sender; bh=KeYZOhheY0c+6YwZ/Ytl1iRm8ID+YfLlMyMcKez+UfA=; b=l5xUZ+JK8oIyy+KMdfjWHfEazaQAwGhpjZq3zAhn7o0OvAd6dQh2hmItMN59R6zeQV ZOgmg/HuP6BzanUkI58/EE66+Z6S6XthfpqielTkQhm8q6n6J2lzyiMnf2SZCDkI11JA z/bOAasrBznNcE1mUtTSd3ohdr9F2U2cY7YxqYcAgSXjPxT5/5HXRzgn7YfzmDenJKw4 4o2kgzSshSNbH1yVUrdi5U/czXB+Mloy+zHOUCs/OAMwnNsmR/H0j41TSHz7buYjj2Bh Wmfp5HtY+VywBWlNYvaiKYJYMzYlvnlf4p88bx63BueVKVypR40NAmRgxWsWzcYYa4HA osww== X-RZG-AUTH: ":P2ERcEykfu11Y98lp/T7+hdri+uKZK8TKWEqNzyCzy1Sfr67uExK884EC0GFGHavJShPkMRYMkE=" X-RZG-CLASS-ID: mo00 Received: from tauon.chronox.de by smtp.strato.de (RZmta 47.12.1 DYNA|AUTH) with ESMTPSA id Z04c46x077rFCYk (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 7 Jan 2021 08:53:15 +0100 (CET) Message-ID: Subject: Re: [PATCH 3/5] crypto: add RFC5869 HKDF From: Stephan Mueller To: Eric Biggers Cc: herbert@gondor.apana.org.au, mathew.j.martineau@linux.intel.com, dhowells@redhat.com, linux-crypto@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org Date: Thu, 07 Jan 2021 08:53:15 +0100 In-Reply-To: References: <4616980.31r3eYUQgx@positron.chronox.de> <12679948.uLZWGnKmhe@positron.chronox.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.2 (3.38.2-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Am Mittwoch, dem 06.01.2021 um 23:30 -0800 schrieb Eric Biggers: > On Mon, Jan 04, 2021 at 10:49:13PM +0100, Stephan Müller wrote: > > RFC5869 specifies an extract and expand two-step key derivation > > function. The HKDF implementation is provided as a service function that > > operates on a caller-provided HMAC cipher handle. > > HMAC isn't a "cipher". > > > The extract function is invoked via the crypto_hkdf_setkey call. > > Any reason not to call this crypto_hkdf_extract(), to match the > specification? I named it to match the other KDF implementation. But you are right, I will name it accordingly. > > > RFC5869 > > allows two optional parameters to be provided to the extract operation: > > the salt and additional information. Both are to be provided with the > > seed parameter where the salt is the first entry of the seed parameter > > and all subsequent entries are handled as additional information. If > > the caller intends to invoke the HKDF without salt, it has to provide a > > NULL/0 entry as first entry in seed. > > Where does "additional information" for extract come from?  RFC 5869 has: > >         HKDF-Extract(salt, IKM) -> PRK > >         Inputs: >               salt     optional salt value (a non-secret random value); >                        if not provided, it is set to a string of HashLen > zeros. >               IKM      input keying material > > There's no "additional information". I used the terminology from SP800-108. I will update the description accordingly. > > > > > The expand function is invoked via the crypto_hkdf_generate and can be > > invoked multiple times. This function allows the caller to provide a > > context for the key derivation operation. As specified in RFC5869, it is > > optional. In case such context is not provided, the caller must provide > > NULL / 0 for the info / info_nvec parameters. > > Any reason not to call this crypto_hkdf_expand() to match the specification? I will update the function name. Thanks Stephan > > - Eric