Re: [PATCH] libkmod: Support SM3 hash algorithm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 30, 2022 at 02:36:05PM +0800, luhuaxin1@xxxxxxxxxx wrote:
From: HuaxinLu <luhuaxin1@xxxxxxxxxx>

SM3 has been supported in kernel and cryptographic libraries like openssl.
This patch adds support for the SM3 algorithm of kmod.

Signed-off-by: HuaxinLu <luhuaxin1@xxxxxxxxxx>

applied, thanks.

Lucas De Marchi

---
libkmod/libkmod-signature.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
index 4e8748c..4ae5af6 100644
--- a/libkmod/libkmod-signature.c
+++ b/libkmod/libkmod-signature.c
@@ -56,6 +56,7 @@ enum pkey_hash_algo {
	PKEY_HASH_SHA384,
	PKEY_HASH_SHA512,
	PKEY_HASH_SHA224,
+	PKEY_HASH_SM3,
	PKEY_HASH__LAST
};

@@ -68,6 +69,7 @@ const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
	[PKEY_HASH_SHA384]	= "sha384",
	[PKEY_HASH_SHA512]	= "sha512",
	[PKEY_HASH_SHA224]	= "sha224",
+	[PKEY_HASH_SM3]		= "sm3",
};

enum pkey_id_type {
@@ -161,6 +163,10 @@ static int obj_to_hash_algo(const ASN1_OBJECT *o)
		return PKEY_HASH_SHA512;
	case NID_sha224:
		return PKEY_HASH_SHA224;
+# ifndef OPENSSL_NO_SM3
+	case NID_sm3:
+		return PKEY_HASH_SM3;
+# endif
	default:
		return -1;
	}
--
2.33.0




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux