Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp317725rdb; Thu, 16 Nov 2023 22:31:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJ5KqM/opfx3G3/IpMLZXAOfBNc5hnmwZGS+ROLIbuyguUho+A/eNjiKisnHjEvpDI4/aw X-Received: by 2002:a05:6a00:b1d:b0:6c3:6cdc:a297 with SMTP id f29-20020a056a000b1d00b006c36cdca297mr14882521pfu.14.1700202665908; Thu, 16 Nov 2023 22:31:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700202665; cv=none; d=google.com; s=arc-20160816; b=jvzgyfYaBrKn9oou/YvHf6UVv2STxv7T/s1fLnZjK96Z9BjxYdR6XrAkMwXsbIFzqs kp/5reZAzmKGdhJDD0y13gONe2OPox/SaW5XQOHp8ndXJw5U27UQ+5cOt/I8FbSQltuf H0TBzwOeJIrNM6vZnsEL8y+2jQ7XI4rZo+0kyPTn74cNT+ORkAuMvXGRXMY62s7K0KGe QYQmbIsOKloIOba/1ps3DaHAvkse6bo/wNilLwJoSHPH3e0OaoqdEd+rLUhO93Ji4GpL KB2XbDAc6HcI6/m38AlzZnD3/JQPzT/B+lqECFTLc5YkINBhAC6+LoutL6PTq5ADM9aQ WzHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=HdaNEbcV3JzzsCzfIEN3Mn5GqWuq2FpR3TOLRsqukSc=; fh=gvAaTn7V2ako+socwadq3mowY+XpjEU7R+nroQHn0Qk=; b=GIalA+SdvBsZgUgSfr8zyEEXCyLEY+Bx1JyvZyeXl9eA8t0K8Apb0CFdpQIPhjTUul v93uWwsHCXf1Mbh3P1PWfGsC20QCKuZNznYN0FBe5/lbAnVndiYpjVAdiIwiZHhyL5cL 8IcReDz1y8qCeBPRQ91rBilQoHyhCqzJtQIjfm95GvjJnZb6r10nQaUhYvs4G1tJxMr6 8yue3Df8301kPfLB4+gTN0/bfg01n9X/niro1ghqpbnaQ4J0ZVL/EypdhxGtxgqs00q2 HKiEXAGTk96XwtaNDUD1Tl3+TlORCsLDva269QhRPSkrQtUIKPuDsUXh3KXZgc72863C fHOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto+bounces-142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-142-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s9-20020a656449000000b0057745d87b50si1189543pgv.139.2023.11.16.22.31.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 22:31:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto+bounces-142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-142-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D814CB20A32 for ; Fri, 17 Nov 2023 06:31:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B7D2DDB7 for ; Fri, 17 Nov 2023 06:31:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none X-Original-To: linux-crypto@vger.kernel.org Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57F50127 for ; Thu, 16 Nov 2023 21:19:44 -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 1r3rGU-000XOX-SS; Fri, 17 Nov 2023 13:19:39 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Fri, 17 Nov 2023 13:19:46 +0800 Date: Fri, 17 Nov 2023 13:19:46 +0800 From: Herbert Xu To: Eric Biggers Cc: Linux Crypto Mailing List , Ard Biesheuvel Subject: Re: [PATCH 4/8] crypto: skcipher - Add lskcipher Message-ID: References: <20230914082828.895403-1-herbert@gondor.apana.org.au> <20230914082828.895403-5-herbert@gondor.apana.org.au> <20230920062551.GB2739@sol.localdomain> <20230922031030.GB935@sol.localdomain> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230922031030.GB935@sol.localdomain> On Thu, Sep 21, 2023 at 08:10:30PM -0700, Eric Biggers wrote: > > Well, IV is *initialization vector*: a value that the algorithm uses as input. > It shouldn't be overloaded to represent some internal intermediate state. We > already made this mistake with the iv vs. iv_out thing, which only ever got > implemented by CBC and CTR, and people repeatedly get confused by. So we know > it technically works for those two algorithms, but not anything else. > > With ChaCha, for example, it makes more sense to use 16-word state matrix as the > intermediate state instead of the 4-word "IV". (See chacha_crypt().) > Especially for XChaCha, so that the HChaCha step doesn't need to be repeated. Fair enough, but what's the point of keeping the internal state across two lskcipher calls? The whole point of lskcipher is that the input is linear and can be processed in one go. With shash we must keep the internal state because the API operates on the update/final model so we need multiple suboperations to finish each hashing operation. With ciphers we haven't traditionally done it that way. Are you thinking of extending lskcipher so that it is more like hashing, with an explicit finalisation step? Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt