From owner-freebsd-current@freebsd.org Wed Aug 22 19:23:17 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 869281092D1B for ; Wed, 22 Aug 2018 19:23:17 +0000 (UTC) (envelope-from sef@ixsystems.com) Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 077D585F84 for ; Wed, 22 Aug 2018 19:23:17 +0000 (UTC) (envelope-from sef@ixsystems.com) Received: by mail-pg1-x52b.google.com with SMTP id v66-v6so1353524pgb.10 for ; Wed, 22 Aug 2018 12:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ixsystems-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=D/sOF9M653EyysrHa6kRvzooofB4wXSSbyiXGMKzKho=; b=eYVaWtL1ri+DsgOhZ//EhWj4+Tu/cLRI9J/yuVEb8eLeMiXK5HjZslNIuQLzFhJRIo 7835/ebDJxUaQ4VGS+28XYYX/JzaQ6QvsiLRNvqlUqAZ8xaFBFDUBFqrTf0yXkG+g5eb rYgyXZXc/2NpspVbPA8SXfg5hte4r2E9CYMHAwKrwTWMcf8KpCl6npCLRrGDic4r+tiH liLbRQxem8ZX6srx0HGrDWGjD0pKc5i/osalTEO+TKBw8LlgeeLCRAf48QaB6pdhPwI2 M/DJ2tS5nW5NcVkGdBbPqLVQhFFERfGpgzAiNSU+X/EM61eL6Mzygcvs1iUQGUIxJgYa b5mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=D/sOF9M653EyysrHa6kRvzooofB4wXSSbyiXGMKzKho=; b=SOo7dD2p5cWOJi4s5ylEmsHgOVesR2ex8njikngS36UcyYftoNSpEHWHM/IJHAlWw7 4gf5nWvNQYnXlXv+N90qGmDdJ5HsQZtXbKNgPiqTBhInq7Ylc2EFYrTjZwEjzm72DyZs V/KAP8H2kL5P1MZsAmYwO6mkQyyrnM7MHL5sqKZeHOXiAHRzgOE0L3XQYgox8YjSCqHE ymGCnDYZLbhbST8nlNsz0vAwY5IDXL5ZVaDAEw8/A4wgj+mrrihuQyONCVdxnfnTSxnK HLYBS5hDG2UTcEDjR0jOMb/AcvjCEI4/Kiy9pka8vtKoiMmnmsrrSWj6ApAqIyxs/IMI OUdA== X-Gm-Message-State: AOUpUlFTYyfrNhDmLIL6JqgDx88YOk6H/9IUnLe5DhGphGDmdnwBfi/d MT4zQP6h/LAAGn8u/J+uKPQ6lo3BGus= X-Google-Smtp-Source: AA+uWPy7qBnVsW/ddNGHTfD8QVfJR8B8yh+lvBsj2w0I+v7RXU2FzSkYkz9cgPgts9KVw15fI7rsug== X-Received: by 2002:a63:2b82:: with SMTP id r124-v6mr9594282pgr.159.1534965796135; Wed, 22 Aug 2018 12:23:16 -0700 (PDT) Received: from [10.250.1.167] ([12.229.62.29]) by smtp.gmail.com with ESMTPSA id h130-v6sm6345969pgc.88.2018.08.22.12.23.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Aug 2018 12:23:15 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Native Encryption for ZFS on FreeBSD CFT From: Sean Fagan In-Reply-To: Date: Wed, 22 Aug 2018 12:23:13 -0700 Cc: Matthew Macy , FreeBSD CURRENT , freebsd-fs Content-Transfer-Encoding: quoted-printable Message-Id: References: <9FDF249A-E320-4652-834E-7EEC5C4FB7CA@ixsystems.com> To: Alan Somers X-Mailer: Apple Mail (2.3273) X-Mailman-Approved-At: Wed, 22 Aug 2018 20:21:07 +0000 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2018 19:23:17 -0000 On Aug 22, 2018, at 12:20 PM, Alan Somers wrote: > ]That doesn't answer the question about what happens when dedup is = turned off. In that case, is the HMAC still used as the IV? If so, = then watermarking attacks are still possible. If ZFS switches to a = random IV when dedup is off, then it would probably be ok. =46rom the same file: * Initialization Vector (IV): = =20 * An initialization vector for the encryption algorithms. This is used = to =20 * "tweak" the encryption algorithms so that two blocks of the same data = are =20 * encrypted into different ciphertext outputs, thus obfuscating block = patterns. =20 * The supported encryption modes (AES-GCM and AES-CCM) require that an = IV is =20 * never reused with the same encryption key. This value is stored = unencrypted =20 * and must simply be provided to the decryption function. We use a 96 = bit IV =20 * (as recommended by NIST) for all block encryption. For non-dedup = blocks we =20 * derive the IV randomly. The first 64 bits of the IV are stored in the = second =20 * word of DVA[2] and the remaining 32 bits are stored in the upper 32 = bits of =20 * blk_fill. This is safe because encrypted blocks can't use the upper = 32 bits =20 * of blk_fill. We only encrypt level 0 blocks, which normally have a = fill count =20 * of 1. The only exception is for DMU_OT_DNODE objects, where the fill = count of =20 * level 0 blocks is the number of allocated dnodes in that block. The = on-disk =20 * format supports at most 2^15 slots per L0 dnode block, because the = maximum =20 * block size is 16MB (2^24). In either case, for level 0 blocks this = number =20 * will still be smaller than UINT32_MAX so it is safe to store the IV = in the =20 * top 32 bits of blk_fill, while leaving the bottom 32 bits of the fill = count =20 * for the dnode code. = =20 Sean