hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/crypto/sm3_generic.c
....@@ -1,21 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * SM3 secure hash, as specified by OSCCA GM/T 0004-2012 SM3 and
34 * described at https://tools.ietf.org/html/draft-shen-sm3-hash-01
45 *
56 * Copyright (C) 2017 ARM Limited or its affiliates.
67 * Written by Gilad Ben-Yossef <gilad@benyossef.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
198 */
209
2110 #include <crypto/internal/hash.h>
....@@ -160,17 +149,18 @@
160149 }
161150 EXPORT_SYMBOL(crypto_sm3_update);
162151
163
-static int sm3_final(struct shash_desc *desc, u8 *out)
152
+int crypto_sm3_final(struct shash_desc *desc, u8 *out)
164153 {
165154 sm3_base_do_finalize(desc, sm3_generic_block_fn);
166155 return sm3_base_finish(desc, out);
167156 }
157
+EXPORT_SYMBOL(crypto_sm3_final);
168158
169159 int crypto_sm3_finup(struct shash_desc *desc, const u8 *data,
170160 unsigned int len, u8 *hash)
171161 {
172162 sm3_base_do_update(desc, data, len, sm3_generic_block_fn);
173
- return sm3_final(desc, hash);
163
+ return crypto_sm3_final(desc, hash);
174164 }
175165 EXPORT_SYMBOL(crypto_sm3_finup);
176166
....@@ -178,7 +168,7 @@
178168 .digestsize = SM3_DIGEST_SIZE,
179169 .init = sm3_base_init,
180170 .update = crypto_sm3_update,
181
- .final = sm3_final,
171
+ .final = crypto_sm3_final,
182172 .finup = crypto_sm3_finup,
183173 .descsize = sizeof(struct sm3_state),
184174 .base = {
....@@ -199,7 +189,7 @@
199189 crypto_unregister_shash(&sm3_alg);
200190 }
201191
202
-module_init(sm3_generic_mod_init);
192
+subsys_initcall(sm3_generic_mod_init);
203193 module_exit(sm3_generic_mod_fini);
204194
205195 MODULE_LICENSE("GPL v2");