From owner-freebsd-fs@freebsd.org Wed Aug 22 19:23:17 2018 Return-Path: Delivered-To: freebsd-fs@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 93EBD1092D1C for ; Wed, 22 Aug 2018 19:23:17 +0000 (UTC) (envelope-from sef@ixsystems.com) Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) (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 0FCD485F85 for ; Wed, 22 Aug 2018 19:23:17 +0000 (UTC) (envelope-from sef@ixsystems.com) Received: by mail-pg1-x52a.google.com with SMTP id h17-v6so1366558pgv.3 for ; Wed, 22 Aug 2018 12:23:17 -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=oMFYtVAcCt+Ee+17pdpVAxOh2ibc+9kxLaxXvgbpnA5wZeUXot8T3GsKcsa7pXZrDa nlPhRknNunzhabHI6I0BSXPLjeRFMSH6OS2jkYmpB/cJLbYRUWFNrvskszGhuc32QsJB dsSWITl/SKvC8lacphUIeceURM+9GJdUsXoZ7BDD+X48Ro6Zb2jQ50wIZ8Caj2k/Ux/5 nE4TUYSn5+tfmAEcnEcKX64Npnm0GdaKiHCLQGvz729AKpOhxWZnui2NVW5Fqx74+fv5 QIDkRH5/s0YkzIayfitI6erPJn4fBCuHAqSS03lY+Cy4i606yEI5t2Pi1J7MMzuYsL9M GPPA== X-Gm-Message-State: AOUpUlEeZqldO7Y3jRQuzG9Ziqe0g3c2l4zMGWLmBmMaCp/ag6xTYcI8 9X1ecCzpQdZ4jTaluqy8oSV33w== 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-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Filesystems 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