| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* Glue code for SHA256 hashing optimized for sparc64 crypto opcodes. |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * This is based largely upon crypto/sha256_generic.c |
|---|
| .. | .. |
|---|
| 14 | 15 | #include <linux/init.h> |
|---|
| 15 | 16 | #include <linux/module.h> |
|---|
| 16 | 17 | #include <linux/mm.h> |
|---|
| 17 | | -#include <linux/cryptohash.h> |
|---|
| 18 | 18 | #include <linux/types.h> |
|---|
| 19 | 19 | #include <crypto/sha.h> |
|---|
| 20 | 20 | |
|---|
| .. | .. |
|---|
| 156 | 156 | return 0; |
|---|
| 157 | 157 | } |
|---|
| 158 | 158 | |
|---|
| 159 | | -static struct shash_alg sha256 = { |
|---|
| 159 | +static struct shash_alg sha256_alg = { |
|---|
| 160 | 160 | .digestsize = SHA256_DIGEST_SIZE, |
|---|
| 161 | 161 | .init = sha256_sparc64_init, |
|---|
| 162 | 162 | .update = sha256_sparc64_update, |
|---|
| .. | .. |
|---|
| 174 | 174 | } |
|---|
| 175 | 175 | }; |
|---|
| 176 | 176 | |
|---|
| 177 | | -static struct shash_alg sha224 = { |
|---|
| 177 | +static struct shash_alg sha224_alg = { |
|---|
| 178 | 178 | .digestsize = SHA224_DIGEST_SIZE, |
|---|
| 179 | 179 | .init = sha224_sparc64_init, |
|---|
| 180 | 180 | .update = sha256_sparc64_update, |
|---|
| .. | .. |
|---|
| 206 | 206 | static int __init sha256_sparc64_mod_init(void) |
|---|
| 207 | 207 | { |
|---|
| 208 | 208 | if (sparc64_has_sha256_opcode()) { |
|---|
| 209 | | - int ret = crypto_register_shash(&sha224); |
|---|
| 209 | + int ret = crypto_register_shash(&sha224_alg); |
|---|
| 210 | 210 | if (ret < 0) |
|---|
| 211 | 211 | return ret; |
|---|
| 212 | 212 | |
|---|
| 213 | | - ret = crypto_register_shash(&sha256); |
|---|
| 213 | + ret = crypto_register_shash(&sha256_alg); |
|---|
| 214 | 214 | if (ret < 0) { |
|---|
| 215 | | - crypto_unregister_shash(&sha224); |
|---|
| 215 | + crypto_unregister_shash(&sha224_alg); |
|---|
| 216 | 216 | return ret; |
|---|
| 217 | 217 | } |
|---|
| 218 | 218 | |
|---|
| .. | .. |
|---|
| 225 | 225 | |
|---|
| 226 | 226 | static void __exit sha256_sparc64_mod_fini(void) |
|---|
| 227 | 227 | { |
|---|
| 228 | | - crypto_unregister_shash(&sha224); |
|---|
| 229 | | - crypto_unregister_shash(&sha256); |
|---|
| 228 | + crypto_unregister_shash(&sha224_alg); |
|---|
| 229 | + crypto_unregister_shash(&sha256_alg); |
|---|
| 230 | 230 | } |
|---|
| 231 | 231 | |
|---|
| 232 | 232 | module_init(sha256_sparc64_mod_init); |
|---|