Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6331854iob; Tue, 10 May 2022 16:12:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxquESfq4brWvFJ0wOAeotiY9sx8aMa/AMGyM757edJtqH9DsG9dHQDNNL+NgetnAormgHY X-Received: by 2002:a17:902:ab59:b0:15c:f4f3:7e3b with SMTP id ij25-20020a170902ab5900b0015cf4f37e3bmr23263502plb.24.1652224355634; Tue, 10 May 2022 16:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652224355; cv=none; d=google.com; s=arc-20160816; b=IDnnfdQ3h9OgEAT1AT5yyYoYJX5GXWbskpBBl1jXPK4B09vzc5vIha7Bhj87zg1stI kg2OOmY0ubmdbG5sk3377kaTQ1+AOOwe7OwmgFPPEdQg+27RrEa7B3LwNUwyY6XRpI83 /EaGZuk0BofnfQbe1hM0YrU6TPrCmhXeRabcP8zTp0jjzlmPZov1yPrnW3FJWbE58J5A 14YvBP0kop8/Wjq5XHGsW+WJzTkG/4jD/J7w7a00XeJW4SHa2r1I7l8vKhtnnf0QFo1E nUMixXlpdFfuFGEEphBLp+/UUQmU7YwjaKK8Qs94qtLODcvZ/iDS4IRPiZ0E+jniluw9 5LVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QCt8pTVN+MT/2bN+IBQXo1CPniEK7Nvddhv4dX0MfyE=; b=qbi5wCJHzVrOpjwTI0nymbGanHAKOgN1ZICs1UE6VQuch/X1QMtQ+Tp3DFHn2vpa/L jOa5b/n743aT9NSsvWvAcD497w9u4/mRAKiGxQ+ZIN2w3+dQv6Ua9b/QSWdm1L++ZyoB 2+gIYPOya2Ebg71JyxdLDOAOEJ1p2ZTjIVc/1e1VIZmpw1/pu+4Sb8x1SlKGX4FLAkQ5 +9fQOyaoRlfGzwTcEBfXboojpY12WG486n66kxQ4K7kI9QNcIywRpJUTAXqv3bKIo6Om emE7y7qjWCyVAeoOPLFioFcFEtwYhBtbkFrohBQ8k1V9yGoMncQd4w8e67b9hihCa0WO Tmhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="l/FHpZVH"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i8-20020aa79088000000b004fa3a8e008esi190389pfa.325.2022.05.10.16.12.21; Tue, 10 May 2022 16:12:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="l/FHpZVH"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237906AbiEJTGH (ORCPT + 99 others); Tue, 10 May 2022 15:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349122AbiEJTGE (ORCPT ); Tue, 10 May 2022 15:06:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 521B650B10; Tue, 10 May 2022 12:06:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CCC0D61143; Tue, 10 May 2022 19:06:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01DF3C385C8; Tue, 10 May 2022 19:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652209561; bh=IiUKjLjANHL8lDcaB4wju0pa98VTPo8stRQrGPhc1o4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=l/FHpZVH5hOhWmKLR2/VZgGM6j5VjLq3hNun/voFYgxNHlb7G2E8yPr1V8bRMXAIU wyg8Ku+8mWpfc1n6P0kQ4Ra29Q6JdJ/JDdlLWjaAk0iDKQ213szCieSjwnUMFU7W3z osczplpE+sJwMJYhffH7VUkMmNCsns4SAlrxL7QU5Q93Mye4BKnypqw5gIJNabu17x 1VGEcgyN535Ujn9sIK3vBRH0EirgraXQcKZDFOAVhwCIh7hAUW6vANMXbbSy60rZ4V AxQlC1/jzu1cf5YPTWW+rLcmVpxa8Jrpb+qohiNIzQNFqpJVU2z/wjCblv4tggTaWV O19YdD1oJh6SQ== Date: Tue, 10 May 2022 12:05:59 -0700 From: Eric Biggers To: Nathan Huckleberry Cc: linux-crypto@vger.kernel.org, linux-fscrypt@vger.kernel.org, Herbert Xu , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Paul Crowley , Sami Tolvanen , Ard Biesheuvel Subject: Re: [PATCH v8 0/9] crypto: HCTR2 support Message-ID: References: <20220510172359.3720527-1-nhuck@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220510172359.3720527-1-nhuck@google.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, May 10, 2022 at 05:23:50PM +0000, Nathan Huckleberry wrote: > HCTR2 is a length-preserving encryption mode that is efficient on > processors with instructions to accelerate AES and carryless > multiplication, e.g. x86 processors with AES-NI and CLMUL, and ARM > processors with the ARMv8 Crypto Extensions. > > HCTR2 is specified in https://ia.cr/2021/1441 "Length-preserving encryption > with HCTR2" which shows that if AES is secure and HCTR2 is instantiated > with AES, then HCTR2 is secure. Reference code and test vectors are at > https://github.com/google/hctr2. > > As a length-preserving encryption mode, HCTR2 is suitable for applications > such as storage encryption where ciphertext expansion is not possible, and > thus authenticated encryption cannot be used. Currently, such applications > usually use XTS, or in some cases Adiantum. XTS has the disadvantage that > it is a narrow-block mode: a bitflip will only change 16 bytes in the > resulting ciphertext or plaintext. This reveals more information to an > attacker than necessary. > > HCTR2 is a wide-block mode, so it provides a stronger security property: a > bitflip will change the entire message. HCTR2 is somewhat similar to > Adiantum, which is also a wide-block mode. However, HCTR2 is designed to > take advantage of existing crypto instructions, while Adiantum targets > devices without such hardware support. Adiantum is also designed with > longer messages in mind, while HCTR2 is designed to be efficient even on > short messages. > > The first intended use of this mode in the kernel is for the encryption of > filenames, where for efficiency reasons encryption must be fully > deterministic (only one ciphertext for each plaintext) and the existing CBC > solution leaks more information than necessary for filenames with common > prefixes. > > HCTR2 uses two passes of an ε-almost-∆-universal hash function called > POLYVAL and one pass of a block cipher mode called XCTR. POLYVAL is a > polynomial hash designed for efficiency on modern processors and was > originally specified for use in AES-GCM-SIV (RFC 8452). XCTR mode is a > variant of CTR mode that is more efficient on little-endian machines. > > This patchset adds HCTR2 to Linux's crypto API, including generic > implementations of XCTR and POLYVAL, hardware accelerated implementations > of XCTR and POLYVAL for both x86-64 and ARM64, a templated implementation > of HCTR2, and an fscrypt policy for using HCTR2 for filename encryption. > Thanks, this series looks good now. I've also tested it on x86_64 and arm64. Herbert, I think this series is ready to be applied, when you're ready for it. - Eric