| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * SM3 secure hash, as specified by OSCCA GM/T 0004-2012 SM3 and |
|---|
| 3 | 4 | * described at https://tools.ietf.org/html/draft-shen-sm3-hash-01 |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (C) 2017 ARM Limited or its affiliates. |
|---|
| 6 | 7 | * 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/>. |
|---|
| 19 | 8 | */ |
|---|
| 20 | 9 | |
|---|
| 21 | 10 | #include <crypto/internal/hash.h> |
|---|
| .. | .. |
|---|
| 160 | 149 | } |
|---|
| 161 | 150 | EXPORT_SYMBOL(crypto_sm3_update); |
|---|
| 162 | 151 | |
|---|
| 163 | | -static int sm3_final(struct shash_desc *desc, u8 *out) |
|---|
| 152 | +int crypto_sm3_final(struct shash_desc *desc, u8 *out) |
|---|
| 164 | 153 | { |
|---|
| 165 | 154 | sm3_base_do_finalize(desc, sm3_generic_block_fn); |
|---|
| 166 | 155 | return sm3_base_finish(desc, out); |
|---|
| 167 | 156 | } |
|---|
| 157 | +EXPORT_SYMBOL(crypto_sm3_final); |
|---|
| 168 | 158 | |
|---|
| 169 | 159 | int crypto_sm3_finup(struct shash_desc *desc, const u8 *data, |
|---|
| 170 | 160 | unsigned int len, u8 *hash) |
|---|
| 171 | 161 | { |
|---|
| 172 | 162 | sm3_base_do_update(desc, data, len, sm3_generic_block_fn); |
|---|
| 173 | | - return sm3_final(desc, hash); |
|---|
| 163 | + return crypto_sm3_final(desc, hash); |
|---|
| 174 | 164 | } |
|---|
| 175 | 165 | EXPORT_SYMBOL(crypto_sm3_finup); |
|---|
| 176 | 166 | |
|---|
| .. | .. |
|---|
| 178 | 168 | .digestsize = SM3_DIGEST_SIZE, |
|---|
| 179 | 169 | .init = sm3_base_init, |
|---|
| 180 | 170 | .update = crypto_sm3_update, |
|---|
| 181 | | - .final = sm3_final, |
|---|
| 171 | + .final = crypto_sm3_final, |
|---|
| 182 | 172 | .finup = crypto_sm3_finup, |
|---|
| 183 | 173 | .descsize = sizeof(struct sm3_state), |
|---|
| 184 | 174 | .base = { |
|---|
| .. | .. |
|---|
| 199 | 189 | crypto_unregister_shash(&sm3_alg); |
|---|
| 200 | 190 | } |
|---|
| 201 | 191 | |
|---|
| 202 | | -module_init(sm3_generic_mod_init); |
|---|
| 192 | +subsys_initcall(sm3_generic_mod_init); |
|---|
| 203 | 193 | module_exit(sm3_generic_mod_fini); |
|---|
| 204 | 194 | |
|---|
| 205 | 195 | MODULE_LICENSE("GPL v2"); |
|---|