Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4548374ybh; Tue, 6 Aug 2019 13:43:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwv/6ZC7XyTVQgu2AVHQkO65llm68R80wUZ34KuvMDg+NNBjgDgYd4Pj8wK3cZRlGHzZ1sy X-Received: by 2002:a17:902:8ec7:: with SMTP id x7mr4871005plo.224.1565124238854; Tue, 06 Aug 2019 13:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565124238; cv=none; d=google.com; s=arc-20160816; b=AZ7RlwIBSPhWGR2qcBmXKsDtfguwC9NtQt8QX4DxfbKJuk9f80Tl/bofybqDbAKBGE zj8LcoXK8zEEdn8YWofQ3CdJa2P9NcJTT9IHqeKOqiTSzuhruvSPFUurbcNlIpC8IxSk R0yX4Zv745KnY8au2KzkC1EDgJuXYAHIB/B4H9bqyEutzxxlicdSLihQ93fZ/cCAaGT3 mvFWvJdESYOQyUsXBE7goktqpqygWdTa0rUUo8ulrdce2GUFNjOUeW2DxrQted9prSmS hMM8pN3b4fWjb6UofdjVKXAklynOT0kyaoMfliI1TkwOIOO71XtXAVK8dTgThXtE5ZVB +kxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VR5feK3MwIDa28M66pr8cZaax0HRBgUIy/YXtAlUVAg=; b=HeFLrNwHEfd20hAE10JPP2DY4OlafBdKRGan1CtKEs7LYCxLNwAm1mOmeslRr+DFuK eBeL04YJFjwFy3hqTl1J57JGOv30/eGzS/IhiknPatUrI+tTxwzEku5ikrTkqJYSgMW0 qo2k9VbQhjqInqdZIXJmKP33YXchNyi8g4s+WlCf4xgcqy5ZhElfcolHUrwXL/DzrkXG vnnJenw2nV+LWvyY8Zhhnb+5FwMetSpu4eHZTAxpHdLm+DKVg/OuUavtLVz1K19GKdDU VyKVV19eqz3PbSkYN81B2vTcw06yiRES63KrnRVo2MubbOWVRpvJ/Ge6p5z7LR1PbMhp r5yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Jcbiz/rl"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si46373939plh.380.2019.08.06.13.43.44; Tue, 06 Aug 2019 13:43:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Jcbiz/rl"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726640AbfHFUnm (ORCPT + 99 others); Tue, 6 Aug 2019 16:43:42 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:43611 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbfHFUnm (ORCPT ); Tue, 6 Aug 2019 16:43:42 -0400 Received: by mail-lf1-f65.google.com with SMTP id c19so62285081lfm.10 for ; Tue, 06 Aug 2019 13:43:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VR5feK3MwIDa28M66pr8cZaax0HRBgUIy/YXtAlUVAg=; b=Jcbiz/rlCveea1uGbs0To2AG2Fqr3qcVJByaj30biSJ6IGaZQU269n7UhHiJIq60zt F6m/iDUTKUaAxcfbj3aNcS1UVKWh0iBATpSeFcB2HZZd4zuUH74H+0AsiAw/3vHblfhG rGmoqX4hHVQvNh1Mo2WC3G6d946cIGSfRxOUfOJyomX+NAcaChMCm9wTSq80UpIDDyVy Wsy0W1UJUtub0zWt+iqZy9h9oHmBFsihiepiuxbUw6MWvMUQg0sLWv0bFV1e+nhfBD57 VYDaUrEm2FkddHey3B0zSP911OVgsWvOlf8N8vWL7OUIPVuLGhouTH4qcL5ZHCc7EUMj /u6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VR5feK3MwIDa28M66pr8cZaax0HRBgUIy/YXtAlUVAg=; b=AyNHagh09EOWMZS9/LtqdS1ppK34EDl95FKak33ApAKKlasgowi4FmdEREDZZXP67I 71OnlcvsCdSFsPFcQOc7OYZlf05T+19czzTlJ2tgIwnxIo1ndK823WxFetET9CbAIjUM MSa2S5qXtT3mcrhZRS0TQ25XwVLlYOtMVy1tiBHnDwPRa/NcDcGbfmk0R9Tmdig7esmb XxD4kDUvMa//j1gmaWKgH0IIgRUWuJYKfAij3+qoVJFP4w3rUFIEvr5NTJMH9to6sK2n Za0qVTJMjQMJ2GMAx71EVstxgEFGcLbwOyJBcpm2qNzX2hNmA+pLqKdWgh+Ws3WDJX3A HLHg== X-Gm-Message-State: APjAAAVUBv4AYRbXOyP/A7aecXq48xys5jWiCXb7zS0ktv/E25X7ZRnf eRxyG8ql0KXJYYA51jZBhrmLyB82CrczhDrjmu0ulw== X-Received: by 2002:a19:6f4b:: with SMTP id n11mr3649844lfk.163.1565124219457; Tue, 06 Aug 2019 13:43:39 -0700 (PDT) MIME-Version: 1.0 References: <20190805162521.90882-1-ebiggers@kernel.org> <20190805162521.90882-13-ebiggers@kernel.org> In-Reply-To: <20190805162521.90882-13-ebiggers@kernel.org> From: Paul Crowley Date: Tue, 6 Aug 2019 13:43:27 -0700 Message-ID: Subject: Re: [PATCH v8 12/20] fscrypt: add an HKDF-SHA512 implementation To: Eric Biggers Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-crypto@vger.kernel.org, keyrings@vger.kernel.org, linux-api@vger.kernel.org, Satya Tangirala , "Theodore Ts'o" , Jaegeuk Kim Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, 5 Aug 2019 at 09:28, Eric Biggers wrote: > > From: Eric Biggers > > Add an implementation of HKDF (RFC 5869) to fscrypt, for the purpose of > deriving additional key material from the fscrypt master keys for v2 > encryption policies. HKDF is a key derivation function built on top of > HMAC. We choose SHA-512 for the underlying unkeyed hash, and use an > "hmac(sha512)" transform allocated from the crypto API. > > We'll be using this to replace the AES-ECB based KDF currently used to > derive the per-file encryption keys. While the AES-ECB based KDF is > believed to meet the original security requirements, it is nonstandard > and has problems that don't exist in modern KDFs such as HKDF: > > 1. It's reversible. Given a derived key and nonce, an attacker can > easily compute the master key. This is okay if the master key and > derived keys are equally hard to compromise, but now we'd like to be > more robust against threats such as a derived key being compromised > through a timing attack, or a derived key for an in-use file being > compromised after the master key has already been removed. > > 2. It doesn't evenly distribute the entropy from the master key; each 16 > input bytes only affects the corresponding 16 output bytes. > > 3. It isn't easily extensible to deriving other values or keys, such as > a public hash for securely identifying the key, or per-mode keys. > Per-mode keys will be immediately useful for Adiantum encryption, for > which fscrypt currently uses the master key directly, introducing > unnecessary usage constraints. Per-mode keys will also be useful for > hardware inline encryption, which is currently being worked on. > > HKDF solves all the above problems. > > Reviewed-by: Theodore Ts'o > Signed-off-by: Eric Biggers Looks good, feel free to add: Reviewed-by: Paul Crowley