Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3471942pxb; Tue, 19 Apr 2022 03:24:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsFwpU5El87smOrrj3zEf1S+L6RI/p38SKe8llgVQOQTmNRcJNylpooNGql5CM49pkmVhJ X-Received: by 2002:a63:cd4c:0:b0:3a8:c685:92e8 with SMTP id a12-20020a63cd4c000000b003a8c68592e8mr11107479pgj.63.1650363896274; Tue, 19 Apr 2022 03:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650363896; cv=none; d=google.com; s=arc-20160816; b=jrlHN9N7eI+B6YU5DZot7L0gGA3zzSShSZxXX64y67UMCvp0WzeVTKuaUNvWBkfEW+ 2Rz5YHjymI/PDTXktl1nfBGuAvTz7+wPSy2mEGFh1SfZseqpzTsQmjd3dEboUxPJK+KC DcvLqQ8vq5dOrVkX/mymyw8G+KGXVuonXk1JOs89SHu8x0YRMaLsO9N/ehGLy8TophYa yY2gWOYWWeB3tq/lgaPzPoleORNPJq6AcmHAPJDbhPuwv5ALjdvL+Qy6C/tMM/5Feb/a 6vomJr8CzLaeJGO8HuiQlvDGjEi1AzXxcjCazJ90nXaJEa7pD0gAgFAEauPJacV94cPB NZUw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fHRsB9ouwTFWhkNufrOFk7IXk7AHxqlUlGZyoaNwZCw=; b=deAA9P/58mn+m2zveDUt9Voo/mr/g4E8UXFdKLH3VWZhEy0DEQoYXXLVE9SWl5EZnp YjaTwlc8+l/uP61PvLskK0BpgHQLQ6U2lkBxo/My7V4CJOnIzRxn5AZnoQpu/NaPxEVZ WdJ0Ms3kuxgVNEtFlT2RtJzy4zAMadcefcv2fo14aepqBOdDH+Ak/tsAAxh+dsSKOSrr x9BW7RRfv/1RiNN4uzerUFC52SgIiOu3Q3gMhKGj8h6PNk6vXe7aAtrD8dUn/zGk7XIB lZ/kuXM3pdGzVNrHzbf0u2Wil67BfxnOv0WRVogHNbiYFlAXuIlxYZTao7PnPYHT8i0W fgOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=byYpAVVO; 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 19-20020a17090a01d300b001cd5ffccabbsi1656014pjd.148.2022.04.19.03.24.30; Tue, 19 Apr 2022 03:24:56 -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=byYpAVVO; 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 S230031AbiDRVjm (ORCPT + 99 others); Mon, 18 Apr 2022 17:39:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230011AbiDRVjm (ORCPT ); Mon, 18 Apr 2022 17:39:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D8682E9FB for ; Mon, 18 Apr 2022 14:37: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 sin.source.kernel.org (Postfix) with ESMTPS id 71C3BCE126E for ; Mon, 18 Apr 2022 21:37:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49577C385A1; Mon, 18 Apr 2022 21:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650317818; bh=0esn0ZH9jB3UkEnwylL/XnIYQGl+ogu9/kfSDs3o3eM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=byYpAVVOjxv+V5btrjCBxU52fJE5kp6fjOhg6cTgLyFuU8k1+Q8EckIdcdEUIX4Kp 6tMevuZ6lyCDJ7teGYTdPquoraepyHDwQg/5ke9qVD1D6wkbKvWeaonG9ngt+DJjCh 7Po370AuSB3zEkfcvSAZLAFWF3wdSWQpySVIe648FjT+lSc9lDqQYlwPESFhHMT+iK cLEVtF4OI7pXAf8YMdge1gL0UvSrT2iPpM53bwekFjh0oPSJ76tW0+K5HLtdKdm0Jk IT0jyuYECLc7GE7CE17rRfTo6W5k8Q4jvPGLcAtFzBwnU1l+wi18rBmnId1LUquCWN 0u0AKlkgR02gw== Date: Mon, 18 Apr 2022 14:36:56 -0700 From: Eric Biggers To: Nathan Huckleberry Cc: linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Paul Crowley , Sami Tolvanen , Ard Biesheuvel Subject: Re: [PATCH v4 6/8] crypto: x86/polyval: Add PCLMULQDQ accelerated implementation of POLYVAL Message-ID: References: <20220412172816.917723-1-nhuck@google.com> <20220412172816.917723-7-nhuck@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220412172816.917723-7-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 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 A few more comments: On Tue, Apr 12, 2022 at 05:28:14PM +0000, Nathan Huckleberry wrote: > +/* > + * Computes the 256-bit polynomial represented by LO, HI, MI. Stores > + * the result in PL, PH. > + * [PH :: PL] = [HI_1 : HI_0 + MI_1 :: LO_1 + MI_0 : LO_0] > + */ It is unclear what the double colon means. Maybe you meant for it to indicate 128-bit boundaries, as opposed to 64-bit boundaries? It is not used consistently, though. > +/* > + * Computes the 128-bit reduction of PL : PH. Stores the result in dest. This should use the order "PH : PL", to be consistent with the notation elsewhere. > diff --git a/arch/x86/crypto/polyval-clmulni_glue.c b/arch/x86/crypto/polyval-clmulni_glue.c [...] > +struct polyval_ctx { > + /* > + * These powers must be in the order h^8, ..., h^1. > + */ > + u8 key_powers[NUM_PRECOMPUTE_POWERS][POLYVAL_BLOCK_SIZE]; > +}; > + > +struct polyval_desc_ctx { > + u8 buffer[POLYVAL_BLOCK_SIZE]; > + u32 bytes; > +}; As I've mentioned elsewhere, it is confusing to have both ctx and desc_ctx. The former should be called polyval_tfm_ctx, like it is in polyval-generic.c. > +asmlinkage void clmul_polyval_update(const u8 *in, struct polyval_ctx *keys, > + size_t nblocks, u8 *accumulator); The argument order here is a bit weird. It would be more logical to have it be (keys, in, nblocks, accumulator), similar to crypto_shash_digest(). Also, 'keys' should be const. - Eric