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 3B6E7C38142 for ; Wed, 1 Feb 2023 08:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbjBAIzw (ORCPT ); Wed, 1 Feb 2023 03:55:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbjBAIzv (ORCPT ); Wed, 1 Feb 2023 03:55:51 -0500 Received: from formenos.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8850F38EB8 for ; Wed, 1 Feb 2023 00:55:50 -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 1pN8uB-006IpM-Nd; Wed, 01 Feb 2023 16:55:48 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Wed, 01 Feb 2023 16:55:47 +0800 Date: Wed, 1 Feb 2023 16:55:47 +0800 From: Herbert Xu To: Tianjia Zhang Cc: Linux Crypto Mailing List , Ard Biesheuvel Subject: Re: [PATCH] crypto: arm64/aes-ccm - Rewrite skcipher walker loop Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Feb 01, 2023 at 10:53:37AM +0800, Tianjia Zhang wrote: > > while (walk.nbytes != walk.total) { This is still buggy, because we can have walk.nbytes == 0 and walk.nbytes != walk.total. You will enter the loop and call skcipher_walk_done which is not allowed. That is why you should follow the standard calling convention for skcipher walks, always check for walk.nbytes != 0 and not whether the walk returns an error. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt