From 0f3ea6b3a8ad8b9ad8cd8a2fc7a216d45c441c4e Mon Sep 17 00:00:00 2001 From: Huaxin Lu Date: Fri, 11 Nov 2022 17:35:13 +0800 Subject: [PATCH] add support for sm3 hash algorithm (cherry picked from commit 7797be8e858f98ce3ddfdb2f1b4266ac45320d70) --- ...t-libkmod-Support-SM3-hash-algorithm.patch | 48 +++++++++++++++++++ kmod.spec | 6 ++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 backport-libkmod-Support-SM3-hash-algorithm.patch diff --git a/backport-libkmod-Support-SM3-hash-algorithm.patch b/backport-libkmod-Support-SM3-hash-algorithm.patch new file mode 100644 index 0000000..d391c67 --- /dev/null +++ b/backport-libkmod-Support-SM3-hash-algorithm.patch @@ -0,0 +1,48 @@ +From f609cb5185acb0955d66795cb297e9fe9d83405a Mon Sep 17 00:00:00 2001 +From: HuaxinLu +Date: Thu, 30 Jun 2022 14:36:05 +0800 +Subject: [PATCH] libkmod: Support SM3 hash algorithm + +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 +Signed-off-by: HuaxinLu +--- + 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 + diff --git a/kmod.spec b/kmod.spec index 91c5838..d1be53f 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 29 -Release: 4 +Release: 5 Summary: Kernel module management # GPLv2+ is used by programs, LGPLv2+ is used for libraries. License: GPLv2+ and LGPLv2+ @@ -13,6 +13,7 @@ Patch1: 0001-libkmod-module-check-new_from_name-return-value-in-g.patch Patch2: 0002-Module-replace-the-module-with-new-module.patch Patch3: 0003-Module-suspend-the-module-by-rmmod-r-option.patch Patch4: 0004-don-t-check-module-s-refcnt-when-rmmod-with-r.patch +Patch5: backport-libkmod-Support-SM3-hash-algorithm.patch BuildRequires: gcc chrpath zlib-devel xz-devel libxslt openssl-devel @@ -120,6 +121,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %doc TODO NEWS README %changelog +* Fri Nov 18 2022 luhuaxin - 29-5 +- add support for sm3 hash algorithm. + * Thu Feb 24 2022 Yang Yanchao - 29-4 - add package python3-kmod. -- Gitee