Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: sm3,sm4 - move into crypto directory

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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Jason A. Donenfeld and committed by
Herbert Xu
d2825fa9 31231092

+18 -22
+2 -2
arch/arm64/crypto/Kconfig
··· 45 45 tristate "SM3 digest algorithm (ARMv8.2 Crypto Extensions)" 46 46 depends on KERNEL_MODE_NEON 47 47 select CRYPTO_HASH 48 - select CRYPTO_LIB_SM3 48 + select CRYPTO_SM3 49 49 50 50 config CRYPTO_SM4_ARM64_CE 51 51 tristate "SM4 symmetric cipher (ARMv8.2 Crypto Extensions)" 52 52 depends on KERNEL_MODE_NEON 53 53 select CRYPTO_ALGAPI 54 - select CRYPTO_LIB_SM4 54 + select CRYPTO_SM4 55 55 56 56 config CRYPTO_GHASH_ARM64_CE 57 57 tristate "GHASH/AES-GCM using ARMv8 Crypto Extensions"
+12 -6
crypto/Kconfig
··· 274 274 275 275 config CRYPTO_SM2 276 276 tristate "SM2 algorithm" 277 - select CRYPTO_LIB_SM3 277 + select CRYPTO_SM3 278 278 select CRYPTO_AKCIPHER 279 279 select CRYPTO_MANAGER 280 280 select MPILIB ··· 1010 1010 http://keccak.noekeon.org/ 1011 1011 1012 1012 config CRYPTO_SM3 1013 + tristate 1014 + 1015 + config CRYPTO_SM3_GENERIC 1013 1016 tristate "SM3 digest algorithm" 1014 1017 select CRYPTO_HASH 1015 - select CRYPTO_LIB_SM3 1018 + select CRYPTO_SM3 1016 1019 help 1017 1020 SM3 secure hash function as defined by OSCCA GM/T 0004-2012 SM3). 1018 1021 It is part of the Chinese Commercial Cryptography suite. ··· 1028 1025 tristate "SM3 digest algorithm (x86_64/AVX)" 1029 1026 depends on X86 && 64BIT 1030 1027 select CRYPTO_HASH 1031 - select CRYPTO_LIB_SM3 1028 + select CRYPTO_SM3 1032 1029 help 1033 1030 SM3 secure hash function as defined by OSCCA GM/T 0004-2012 SM3). 1034 1031 It is part of the Chinese Commercial Cryptography suite. This is ··· 1575 1572 <https://www.cl.cam.ac.uk/~rja14/serpent.html> 1576 1573 1577 1574 config CRYPTO_SM4 1575 + tristate 1576 + 1577 + config CRYPTO_SM4_GENERIC 1578 1578 tristate "SM4 cipher algorithm" 1579 1579 select CRYPTO_ALGAPI 1580 - select CRYPTO_LIB_SM4 1580 + select CRYPTO_SM4 1581 1581 help 1582 1582 SM4 cipher algorithms (OSCCA GB/T 32907-2016). 1583 1583 ··· 1609 1603 select CRYPTO_SKCIPHER 1610 1604 select CRYPTO_SIMD 1611 1605 select CRYPTO_ALGAPI 1612 - select CRYPTO_LIB_SM4 1606 + select CRYPTO_SM4 1613 1607 help 1614 1608 SM4 cipher algorithms (OSCCA GB/T 32907-2016) (x86_64/AES-NI/AVX). 1615 1609 ··· 1630 1624 select CRYPTO_SKCIPHER 1631 1625 select CRYPTO_SIMD 1632 1626 select CRYPTO_ALGAPI 1633 - select CRYPTO_LIB_SM4 1627 + select CRYPTO_SM4 1634 1628 select CRYPTO_SM4_AESNI_AVX_X86_64 1635 1629 help 1636 1630 SM4 cipher algorithms (OSCCA GB/T 32907-2016) (x86_64/AES-NI/AVX2).
+4 -2
crypto/Makefile
··· 78 78 obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o 79 79 obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o 80 80 obj-$(CONFIG_CRYPTO_SHA3) += sha3_generic.o 81 - obj-$(CONFIG_CRYPTO_SM3) += sm3_generic.o 81 + obj-$(CONFIG_CRYPTO_SM3) += sm3.o 82 + obj-$(CONFIG_CRYPTO_SM3_GENERIC) += sm3_generic.o 82 83 obj-$(CONFIG_CRYPTO_STREEBOG) += streebog_generic.o 83 84 obj-$(CONFIG_CRYPTO_WP512) += wp512.o 84 85 CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149 ··· 135 134 CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149 136 135 obj-$(CONFIG_CRYPTO_AES) += aes_generic.o 137 136 CFLAGS_aes_generic.o := $(call cc-option,-fno-code-hoisting) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356 138 - obj-$(CONFIG_CRYPTO_SM4) += sm4_generic.o 137 + obj-$(CONFIG_CRYPTO_SM4) += sm4.o 138 + obj-$(CONFIG_CRYPTO_SM4_GENERIC) += sm4_generic.o 139 139 obj-$(CONFIG_CRYPTO_AES_TI) += aes_ti.o 140 140 obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o 141 141 obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o
-6
lib/crypto/Kconfig
··· 123 123 config CRYPTO_LIB_SHA256 124 124 tristate 125 125 126 - config CRYPTO_LIB_SM3 127 - tristate 128 - 129 - config CRYPTO_LIB_SM4 130 - tristate 131 - 132 126 endmenu
-6
lib/crypto/Makefile
··· 37 37 obj-$(CONFIG_CRYPTO_LIB_SHA256) += libsha256.o 38 38 libsha256-y := sha256.o 39 39 40 - obj-$(CONFIG_CRYPTO_LIB_SM3) += libsm3.o 41 - libsm3-y := sm3.o 42 - 43 - obj-$(CONFIG_CRYPTO_LIB_SM4) += libsm4.o 44 - libsm4-y := sm4.o 45 - 46 40 ifneq ($(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS),y) 47 41 libblake2s-y += blake2s-selftest.o 48 42 libchacha20poly1305-y += chacha20poly1305-selftest.o
lib/crypto/sm3.c crypto/sm3.c
lib/crypto/sm4.c crypto/sm4.c