dim/backport-Add-sm3-compile-macro-and-set-the-algo-name.patch
gengqihu aa8b95bbc3 fix some bugs and enabled DIM_HASH_SUPPORT_SM3
(cherry picked from commit 0a495bbcfd0310783f15faeacbdb655cff3d54de)
2024-08-19 16:04:32 +08:00

42 lines
975 B
Diff

From db470817655f80d63592c6550bdaca875dd42120 Mon Sep 17 00:00:00 2001
From: Huaxin Lu <luhuaxin1@huawei.com>
Date: Mon, 29 Apr 2024 23:10:50 +0800
Subject: [PATCH 05/28] Add sm3 compile macro and set the algo name
---
src/common/dim_hash.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/common/dim_hash.c b/src/common/dim_hash.c
index 9f73320..3f6ecb7 100644
--- a/src/common/dim_hash.c
+++ b/src/common/dim_hash.c
@@ -9,7 +9,9 @@
static const char *allow_hash[] = {
"sha256",
+#ifdef DIM_HASH_SUPPORT_SM3
"sm3",
+#endif
};
int dim_hash_init(const char *algo_name, struct dim_hash *hash)
@@ -30,6 +32,7 @@ int dim_hash_init(const char *algo_name, struct dim_hash *hash)
hash->tfm = NULL;
}
+ hash->name = algo_name;
return ret;
}
@@ -63,4 +66,4 @@ int dim_hash_calculate(const void *data, unsigned int len,
return ret;
return crypto_shash_final(shash, digest->data);
-}
\ No newline at end of file
+}
--
2.33.0