From: Eric Biggers <ebiggers@kernel.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au,
tianjia.zhang@linux.alibaba.com
Subject: Re: [PATCH] crypto: move sm3 and sm4 into crypto directory
Date: Wed, 16 Mar 2022 17:16:57 +0000 [thread overview]
Message-ID: <YjIbiX5swxfO6B43@gmail.com> (raw)
In-Reply-To: <20220314031101.663883-1-Jason@zx2c4.com>
On Sun, Mar 13, 2022 at 09:11:01PM -0600, Jason A. Donenfeld wrote:
> The lib/crypto libraries live in lib because they are used by various
> drivers of the kernel. In contrast, the various helper functions in
> crypto are there because they're used exclusively by the crypto API. The
> SM3 and SM4 helper functions were erroniously moved into lib/crypto/
> instead of crypto/, even though there are no in-kernel users outside of
> the crypto API of those functions. This commit moves them into crypto/.
>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> Cc: Eric Biggers <ebiggers@kernel.org>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> arch/arm64/crypto/Kconfig | 4 ++--
> crypto/Kconfig | 18 ++++++++++++------
> crypto/Makefile | 6 ++++--
> {lib/crypto => crypto}/sm3.c | 0
> {lib/crypto => crypto}/sm4.c | 0
> lib/crypto/Kconfig | 6 ------
> lib/crypto/Makefile | 6 ------
> 7 files changed, 18 insertions(+), 22 deletions(-)
> rename {lib/crypto => crypto}/sm3.c (100%)
> rename {lib/crypto => crypto}/sm4.c (100%)
>
> diff --git a/arch/arm64/crypto/Kconfig b/arch/arm64/crypto/Kconfig
> index 2a965aa0188d..454621a20eaa 100644
> --- a/arch/arm64/crypto/Kconfig
> +++ b/arch/arm64/crypto/Kconfig
> @@ -45,13 +45,13 @@ config CRYPTO_SM3_ARM64_CE
> tristate "SM3 digest algorithm (ARMv8.2 Crypto Extensions)"
> depends on KERNEL_MODE_NEON
> select CRYPTO_HASH
> - select CRYPTO_LIB_SM3
> + select CRYPTO_SM3
>
> config CRYPTO_SM4_ARM64_CE
> tristate "SM4 symmetric cipher (ARMv8.2 Crypto Extensions)"
> depends on KERNEL_MODE_NEON
> select CRYPTO_ALGAPI
> - select CRYPTO_LIB_SM4
> + select CRYPTO_SM4
>
> config CRYPTO_GHASH_ARM64_CE
> tristate "GHASH/AES-GCM using ARMv8 Crypto Extensions"
> diff --git a/crypto/Kconfig b/crypto/Kconfig
> index d6d7e84bb7f8..517525d7d12e 100644
> --- a/crypto/Kconfig
> +++ b/crypto/Kconfig
> @@ -274,7 +274,7 @@ config CRYPTO_ECRDSA
>
> config CRYPTO_SM2
> tristate "SM2 algorithm"
> - select CRYPTO_LIB_SM3
> + select CRYPTO_SM3
> select CRYPTO_AKCIPHER
> select CRYPTO_MANAGER
> select MPILIB
> @@ -1005,9 +1005,12 @@ config CRYPTO_SHA3
> http://keccak.noekeon.org/
>
> config CRYPTO_SM3
> + tristate
> +
> +config CRYPTO_SM3_GENERIC
> tristate "SM3 digest algorithm"
> select CRYPTO_HASH
> - select CRYPTO_LIB_SM3
> + select CRYPTO_SM3
> help
> SM3 secure hash function as defined by OSCCA GM/T 0004-2012 SM3).
> It is part of the Chinese Commercial Cryptography suite.
This patch generally looks good, but perhaps CRYPTO_SM3 and CRYPTO_SM3_GENERIC
should be merged? Having separate options provides the ability to enable the
architecture implementation without the generic implementation, so arguably it's
the right thing to do; however, that's not what the other algorithms in crypto/
do. For example, if you enable CONFIG_CRYPTO_SHA3, you get the generic SHA-3
algorithms as well as the SHA-3 library functions. I.e., there's no
CONFIG_CRYPTO_SHA3_GENERIC.
IMO, being consistent is more important than providing the ability to omit the
generic implementation.
- Eric
next prev parent reply other threads:[~2022-03-16 17:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-14 3:11 [PATCH] crypto: move sm3 and sm4 into crypto directory Jason A. Donenfeld
2022-03-16 17:16 ` Eric Biggers [this message]
2022-03-16 22:18 ` Jason A. Donenfeld
2022-04-08 8:30 ` Herbert Xu
-- strict thread matches above, loose matches on Subject: below --
2022-03-14 9:07 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YjIbiX5swxfO6B43@gmail.com \
--to=ebiggers@kernel.org \
--cc=Jason@zx2c4.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=tianjia.zhang@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.