Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp964688pxj; Fri, 21 May 2021 03:21:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzBcYv6bIY1qJrbxxlNCgZOWXf5hBlqG+52y7U+fQYu+MBGFmZ/7MZ8uVbu1Yp9oEVV0tZ X-Received: by 2002:aa7:de19:: with SMTP id h25mr10493141edv.84.1621592504029; Fri, 21 May 2021 03:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621592504; cv=none; d=google.com; s=arc-20160816; b=EweDsb93efVdiSudprz25101SUS2xF5gRAgJoshHJ6eVJ/d6p83mvKLNQX4Bbb0edM Z42x1w9vrdo7cFONaLF13gmt7QVuhwLpfbZEhRFrMzDY2vJZyjjMP2pk3Ftwna7/hUf6 B2QRy91My/L8JgH/BM6/BpYqkvPIY04p7KK3CP7pdgKwfxAzG5S+hGZU8DQ29MjB7EGu cDgk6k0Bej1QKUFZEmnWvt2jm46Sn6MIVxsikLGTOtC3Px5SasAzOQ79P0WBFUnoVRzp DLTZMfHfn7btchOx8Prc4BPfHcapW3Q724hTp2q8UVCPmQM3kbnPbK9fG+JG2AprRY9s X4Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=kqDK15rc+u+68Ye5ezOSZJKqTbbkjSxOKE1TSfTL1gw=; b=DEUZKlxQYg9rdCaZk54Xqvk4BBYeUWLhq1m86Hw8EznIbGKny40bCM+2wd8WDy+Ahz x/59kAKTIGLPg5YdWWZfovGMKecrTSTwhvzkwDYRoIvMx69HagBr1/kWX9tFhepf6kPJ HOhHsB3O1I0GUlpjZ0/FNYbB7CiPIo87uscsrp8uI5JqC+aBEg8X4IfYwaio30foeCiE 5z6SNCx9m/IZTVetwS68f339q5v21tEQWAuiLPLCgoPVTA3Z8TOpyZPwwvLDnXHFqGDs iWVfyRo7hsiQVkq54w+7+/fVay3lQAYjkKoVfz1T10cdqA816WcN4fogsuqhT2OjeXm0 IqZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b14si4708122edx.131.2021.05.21.03.21.13; Fri, 21 May 2021 03:21:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234811AbhEUH5M (ORCPT + 99 others); Fri, 21 May 2021 03:57:12 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:55850 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231301AbhEUH5L (ORCPT ); Fri, 21 May 2021 03:57:11 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtp (Exim 4.92 #5 (Debian)) id 1lk00a-0004WP-00; Fri, 21 May 2021 15:55:48 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1lk00W-0005qv-MY; Fri, 21 May 2021 15:55:44 +0800 Date: Fri, 21 May 2021 15:55:44 +0800 From: Herbert Xu To: Ard Biesheuvel Cc: Eric Biggers , Linux Crypto Mailing List , Linux ARM , Will Deacon , Android Kernel Team Subject: Re: [PATCH v3 1/7] crypto: handle zero sized AEAD inputs correctly Message-ID: <20210521075544.kywxswbfyoauvhmg@gondor.apana.org.au> References: <20210512184439.8778-1-ardb@kernel.org> <20210512184439.8778-2-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, May 12, 2021 at 11:24:09PM +0200, Ard Biesheuvel wrote: > > The difference is that zero sized inputs never make sense for > skciphers, but for AEADs, they could occur, even if they are uncommon > (the AEAD could have associated data only, and no plain/ciphertext) I don't see what a zero-sized input has to do with this though. When the walk->nbytes is zero, that means that you must never call the done function, because the walk state could be in error in which case everything would have been freed already and calling the done function may potentially cause a double-free. I don't understand why in the case of AEAD you cannot structure your code such that the done function is not called when nbytes is zero. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt