1 Star 0 Fork 12

renbo02/kmod

forked from src-anolis-os/kmod 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1000-libkmod-Support-SM3-hash-algorithm.patch 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
Tianjia Zhang 提交于 2023-05-25 11:33 . Support SM3 hash algorithm
From f609cb5185acb0955d66795cb297e9fe9d83405a Mon Sep 17 00:00:00 2001
From: HuaxinLu <luhuaxin1@huawei.com>
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 <luhuaxin1@huawei.com>
---
libkmod/libkmod-signature.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
index 4e8748c26c1c..4ae5af63ac22 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.24.3 (Apple Git-128)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/renbo02/kmod.git
git@gitee.com:renbo02/kmod.git
renbo02
kmod
kmod
a8

搜索帮助