Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7847181rdb; Thu, 4 Jan 2024 09:24:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcY8UiZ51NHFdsRD5Ui7d/5LYYCkUnmkM+p/FH4T+WYaCW2OVKZ/vjWSl/eDNS5sHboFIi X-Received: by 2002:a05:6a20:6a9e:b0:195:8499:ba65 with SMTP id bi30-20020a056a206a9e00b001958499ba65mr655111pzb.107.1704389056298; Thu, 04 Jan 2024 09:24:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704389056; cv=none; d=google.com; s=arc-20160816; b=M8wW+Ln9+l08cvKIU0gwcTXGsWUYQ7JEJ0Gx5CM3fztvpsdHcRZLH8Pds6AcntE7Z1 M88Y4nGPUhWAZXOhUTSCyIIUsX8VRl+hgyT8zPtzH67YMVdMv2LaDtMkwi5emdsFdaNB hKN1y6w4hc9ltlIWYB3Ps8WFsOf5KfruGV5UmhZdiVrkCWNY7yEnNN1jLB2mw5YdBZj7 KlPdUJ15Ks0Zlm5CMPlMQMPHLX/zx9iwvODbZvSsRUEAVzYzR+6PFfrGljcTXlpN/MQr e32gZbjWXXdZi4kNLw2jBtM7y7oNvWdp1PO961ckAVML6jkC2aYDPBfHdc2D3Dtp6CHT 6Xng== 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:dkim-signature; bh=EtNfbD0FtbvDtIT0WSLm1xDIIFxI4CPZQH9zB663SWI=; fh=1CNmkgT5e+9ZswBAeIQsd01gcRByvXt/DoKcQOTr0uA=; b=VsnmK9c42cXLsCm60zhHvoEBZIzOehmQhjfnuwLM8XUqPU49a1i/1YJUp2gA9d2kBZ lXovcC8MXN556U8IrasbY41mstwOqh+/n8UuMEl2pOGLYnyS8QiyZojkMBkNlqbwxaP1 Li7fUBfWcB0A/Oo1t6WZwsiXefCMLY4wufsC7ovxlNBuhyi2Oo1boLJUcx4AMQYTn9Ce G87RcNqvGEPSUNO79OWJqV/PMPw6gIgr1UJX0sRERBqC8Rav2mSOSZ9mpfW0fBw5kvir zrq/1WoOQJJrENyFnQVvVTdcuF+9cm8JGEgD/TLKyB3e3pHMCzlIF8ZTUnPbhQP3C1KP QqIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ozARAWKf; spf=pass (google.com: domain of linux-crypto+bounces-1235-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-1235-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p39-20020a056a000a2700b006d9a49535f1si20127092pfh.290.2024.01.04.09.24.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:24:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-1235-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ozARAWKf; spf=pass (google.com: domain of linux-crypto+bounces-1235-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-1235-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F1F0E285DC3 for ; Thu, 4 Jan 2024 17:24:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D0FC28E1D; Thu, 4 Jan 2024 17:18:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ozARAWKf" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31E8828E30; Thu, 4 Jan 2024 17:18:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 434EFC433C7; Thu, 4 Jan 2024 17:18:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704388703; bh=4BDLtWSfYGZgp3W2cYGuKr7Sby6Scya/xnEGeEw71bw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ozARAWKfOoTssT2qAByVR5pY7jB4Pp03cp1083vFpdHUP35jsbwxqDl3iMoG3KCZb LMCQKOLqm5+KgucXw/zwgDVs0VGEgDcqjZqyL8XO78G9PbeUFGkrDhcTPu5LkGgkQl efQ9E9kziOE/XPVH4aJvMosk/kPflkT59rOMsPwUgOuy5S3mjX5EVnpSMankwqAJ5p HOVQXl1ew0mB8BMuPkiZjM2WcVVdyABubVwgeaVJp3rLwi3DVDAsw0Z+miz1gHs6jW DqgGFZNJNtHXPf2rFzV3wtmx6brI/uK3J9AmFh6sRPYrdNcAFe/ur3SmZ2fswTsmSm LImliq38trvHA== Date: Thu, 4 Jan 2024 09:18:21 -0800 From: Eric Biggers To: Jerry Shih Cc: linux-crypto@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Ard Biesheuvel , Heiko Stuebner , Phoebe Chen , hongrong.hsu@sifive.com, Paul Walmsley , Palmer Dabbelt , Albert Ou , Andy Chiu Subject: Re: [RFC PATCH 07/13] crypto: riscv - add vector crypto accelerated AES-{ECB,CBC,CTR,XTS} Message-ID: <20240104171821.GA1127@sol.localdomain> References: <20240102064743.220490-1-ebiggers@kernel.org> <20240102064743.220490-8-ebiggers@kernel.org> <20240103145043.GB773@quark.localdomain> <905D43CF-B01A-49DE-9046-51A370B6F680@sifive.com> 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: <905D43CF-B01A-49DE-9046-51A370B6F680@sifive.com> On Thu, Jan 04, 2024 at 04:47:16PM +0800, Jerry Shih wrote: > On Jan 3, 2024, at 22:50, Eric Biggers wrote: > > On Tue, Jan 02, 2024 at 12:47:33AM -0600, Eric Biggers wrote: > >> diff --git a/arch/riscv/crypto/Makefile b/arch/riscv/crypto/Makefile > >> index dca698c5cba3e..5dd91f34f0d52 100644 > >> --- a/arch/riscv/crypto/Makefile > >> +++ b/arch/riscv/crypto/Makefile > >> @@ -1,7 +1,10 @@ > >> # SPDX-License-Identifier: GPL-2.0-only > >> # > >> # linux/arch/riscv/crypto/Makefile > >> # > >> > >> obj-$(CONFIG_CRYPTO_AES_RISCV64) += aes-riscv64.o > >> aes-riscv64-y := aes-riscv64-glue.o aes-riscv64-zvkned.o > >> + > >> +obj-$(CONFIG_CRYPTO_AES_BLOCK_RISCV64) += aes-block-riscv64.o > >> +aes-block-riscv64-y := aes-riscv64-block-mode-glue.o aes-riscv64-zvkned-zvbb-zvkg.o aes-riscv64-zvkned-zvkb.o > > > > A bug I noticed (which is also present in Jerry's patchset) is that some of the > > code of the aes-block-riscv64 module is located in aes-riscv64-zvkned.S, which > > isn't built into that module but rather into aes-riscv64. This causes a build > > error when both CONFIG_CRYPTO_AES_RISCV64 and CONFIG_CRYPTO_AES_BLOCK_RISCV64 > > are set to 'm': > > > > ERROR: modpost: "aes_cbc_decrypt_zvkned" [arch/riscv/crypto/aes-block-riscv64.ko] undefined! > > ERROR: modpost: "aes_ecb_decrypt_zvkned" [arch/riscv/crypto/aes-block-riscv64.ko] undefined! > > ERROR: modpost: "aes_cbc_encrypt_zvkned" [arch/riscv/crypto/aes-block-riscv64.ko] undefined! > > ERROR: modpost: "aes_ecb_encrypt_zvkned" [arch/riscv/crypto/aes-block-riscv64.ko] undefined! > > > > To fix this, I think we should just merge the two modules and kconfig options > > together so that there is one module that provides both the AES modes and the > > AES single-block cipher. That's how x86's aesni-intel works, for example. > > > > - Eric > > That's a bug in my patchset. > I don't test with all options with `M` settings since I can't boot to qemu with all `M` settings. > > Could we move the cbc and ecb from `aes-riscv64-zvkned` to `aes-block-riscv64` instead of merging > these two modules? > Thus, we could still enable the single aes block cipher without other extensions(e.g. zvbb or zvkg). My proposal to merge the two modules still results in the single-block AES cipher being registered when zvkned alone is present. It just won't be selectable separately via kconfig. I think that's fine. - Eric