Commit b0381d10 authored by Yabin Li's avatar Yabin Li Committed by yangdepei
Browse files

crypto: ccp: Support SM2 algorithm for hygon ccp.

hygon inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I99ZNA



--------------------------------

In order to add SM2 driver for hygon ccp, relating to
SM2_sign, SM2_verify, SM2_encrypt and SM2_decrypt.

Signed-off-by: default avatarYabin Li <liyabin@hygon.cn>
Signed-off-by: default avataryangdepei <yangdepei@hygon.cn>
parent d72f206b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8810,6 +8810,7 @@ CONFIG_CRYPTO_DEV_ZHAOXIN_AES=m
CONFIG_CRYPTO_DEV_ZHAOXIN_SHA=m
# CONFIG_CRYPTO_DEV_ATMEL_ECC is not set
# CONFIG_CRYPTO_DEV_ATMEL_SHA204A is not set
CONFIG_HYGON_GM=y
CONFIG_CRYPTO_DEV_CCP=y
CONFIG_CRYPTO_DEV_CCP_DD=m
CONFIG_CRYPTO_DEV_SP_CCP=y
+7 −0
Original line number Diff line number Diff line
@@ -46,6 +46,13 @@ config CRYPTO_DEV_SP_PSP
	 along with software-based Trusted Execution Environment (TEE) to
	 enable third-party trusted applications.

config HYGON_GM
	bool "Hygon GM (sm2/sm3/sm4) Interface"
	default y
	depends on CRYPTO_DEV_CCP_CRYPTO && X86_64
	help
	  Hygon GM ccp driver

config CRYPTO_DEV_CCP_DEBUGFS
	bool "Enable CCP Internals in DebugFS"
	default n
+3 −0
Original line number Diff line number Diff line
@@ -30,4 +30,7 @@ ccp-crypto-objs := ccp-crypto-main.o \
		   ccp-crypto-des3.o \
		   ccp-crypto-rsa.o \
		   ccp-crypto-sha.o

obj-$(CONFIG_TDM_KERNEL_GUARD) += hygon/tdm-kernel-guard.o

ccp-crypto-$(CONFIG_HYGON_GM) += ccp-crypto-sm2-hygon.o
+15 −0
Original line number Diff line number Diff line
@@ -39,6 +39,10 @@ static unsigned int rsa_disable;
module_param(rsa_disable, uint, 0444);
MODULE_PARM_DESC(rsa_disable, "Disable use of RSA - any non-zero value");

static unsigned int sm_disable;
module_param(sm_disable, uint, 0444);
MODULE_PARM_DESC(sm_disable, "Disable use of SM2/SM3/SM4 - any non-zero value");

/* List heads for the supported algorithms */
static LIST_HEAD(hash_algs);
static LIST_HEAD(skcipher_algs);
@@ -322,6 +326,17 @@ static int ccp_register_algs(void)
{
	int ret;

#ifdef CONFIG_HYGON_GM
	if (!sm_disable && boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
		ret = ccp_register_sm2_hygon_algs(&akcipher_algs);
		if (ret)
			return ret;

		/* Return on hygon platform */
		return 0;
	}
#endif

	if (!aes_disable) {
		ret = ccp_register_aes_algs(&skcipher_algs);
		if (ret)
+1054 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading