Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B90F6C636CD for ; Fri, 10 Feb 2023 09:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231867AbjBJJqi (ORCPT ); Fri, 10 Feb 2023 04:46:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231379AbjBJJqg (ORCPT ); Fri, 10 Feb 2023 04:46:36 -0500 Received: from formenos.hmeau.com (167-179-156-38.a7b39c.syd.nbn.aussiebb.net [167.179.156.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA9D57166A; Fri, 10 Feb 2023 01:46:34 -0800 (PST) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1pQPyy-009c1K-HI; Fri, 10 Feb 2023 17:46:17 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Fri, 10 Feb 2023 17:46:16 +0800 Date: Fri, 10 Feb 2023 17:46:16 +0800 From: Herbert Xu To: Tianjia Zhang Cc: "David S. Miller" , Catalin Marinas , Will Deacon , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] crypto: arm64/sm4-ccm - Rewrite skcipher walker loop Message-ID: References: <20230201123207.99858-1-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230201123207.99858-1-tianjia.zhang@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 01, 2023 at 08:32:07PM +0800, Tianjia Zhang wrote: > The fact that an error in the skcipher walker API are indicated > not only by a non-zero return value, but also by the fact that > walk->nbytes is zero, causes the layout of the skcipher walker > loop to be sufficiently different from the usual layout, which > is not a problem in itself, but it is likely to cause reading > confusion and difficulty in code maintenance. > > This patch rewrites skcipher walker loop, and separates the > last chunk cryption from the loop to avoid wrong calls to the > skcipher walker API. In addition to following the usual convention > of checking walk->nbytes, it also makes the loop execute logic > clearer and easier to understand. > > Signed-off-by: Tianjia Zhang > --- > arch/arm64/crypto/sm4-ce-ccm-glue.c | 44 ++++++++++++++++------------- > 1 file changed, 24 insertions(+), 20 deletions(-) Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt