Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: sha256 - Wrap library and add HMAC support

Like I did for crypto/sha512.c, rework crypto/sha256.c to simply wrap
the normal library functions instead of accessing the low-level arch-
optimized and generic block functions directly. Also add support for
HMAC-SHA224 and HMAC-SHA256, again just wrapping the library functions.

Since the replacement crypto_shash algorithms are implemented using the
(potentially arch-optimized) library functions, give them driver names
ending with "-lib" rather than "-generic". Update crypto/testmgr.c and
a couple odd drivers to take this change in driver name into account.

Besides the above cases which are accounted for, there are no known
cases where the driver names were being depended on. There is
potential for confusion for people manually checking /proc/crypto (e.g.
https://lore.kernel.org/r/9e33c893-2466-4d4e-afb1-966334e451a2@linux.ibm.com/),
but really people just need to get used to the driver name not being
meaningful for the software algorithms. Historically, the optimized
code was disabled by default, so there was some purpose to checking
whether it was enabled or not. However, this is now fixed for all SHA-2
algorithms, and the library code just always does the right thing. E.g.
if the CPU supports SHA-256 instructions, they are used.

This change does also mean that the generic partial block handling code
in crypto/shash.c, which got added in 6.16, no longer gets used. But
that's fine; the library has to implement the partial block handling
anyway, and it's better to do it in the library since the block size and
other properties of the algorithm are all fixed at compile time there,
resulting in more streamlined code.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20250630160645.3198-10-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+166 -185
+2 -2
crypto/Kconfig
··· 992 992 tristate "SHA-224 and SHA-256" 993 993 select CRYPTO_HASH 994 994 select CRYPTO_LIB_SHA256 995 - select CRYPTO_LIB_SHA256_GENERIC 996 995 help 997 - SHA-224 and SHA-256 secure hash algorithms (FIPS 180, ISO/IEC 10118-3) 996 + SHA-224 and SHA-256 secure hash algorithms (FIPS 180, ISO/IEC 997 + 10118-3), including HMAC support. 998 998 999 999 This is required for IPsec AH (XFRM_AH) and IPsec ESP (XFRM_ESP). 1000 1000 Used by the btrfs filesystem, Ceph, NFS, and SMB.
-1
crypto/Makefile
··· 77 77 obj-$(CONFIG_CRYPTO_RMD160) += rmd160.o 78 78 obj-$(CONFIG_CRYPTO_SHA1) += sha1_generic.o 79 79 obj-$(CONFIG_CRYPTO_SHA256) += sha256.o 80 - CFLAGS_sha256.o += -DARCH=$(ARCH) 81 80 obj-$(CONFIG_CRYPTO_SHA512) += sha512.o 82 81 obj-$(CONFIG_CRYPTO_SHA3) += sha3_generic.o 83 82 obj-$(CONFIG_CRYPTO_SM3_GENERIC) += sm3_generic.o
+146 -176
crypto/sha256.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 - * Crypto API wrapper for the SHA-256 and SHA-224 library functions 3 + * Crypto API support for SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 4 4 * 5 5 * Copyright (c) Jean-Luc Cooke <jlcooke@certainkey.com> 6 6 * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk> 7 7 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> 8 8 * SHA224 Support Copyright 2007 Intel Corporation <jonathan.lynch@intel.com> 9 + * Copyright 2025 Google LLC 9 10 */ 10 11 #include <crypto/internal/hash.h> 11 - #include <crypto/internal/sha2.h> 12 + #include <crypto/sha2.h> 12 13 #include <linux/kernel.h> 13 14 #include <linux/module.h> 15 + 16 + /* SHA-224 */ 14 17 15 18 const u8 sha224_zero_message_hash[SHA224_DIGEST_SIZE] = { 16 19 0xd1, 0x4a, 0x02, 0x8c, 0x2a, 0x3a, 0x2b, 0xc9, 0x47, ··· 23 20 }; 24 21 EXPORT_SYMBOL_GPL(sha224_zero_message_hash); 25 22 23 + #define SHA224_CTX(desc) ((struct sha224_ctx *)shash_desc_ctx(desc)) 24 + 25 + static int crypto_sha224_init(struct shash_desc *desc) 26 + { 27 + sha224_init(SHA224_CTX(desc)); 28 + return 0; 29 + } 30 + 31 + static int crypto_sha224_update(struct shash_desc *desc, 32 + const u8 *data, unsigned int len) 33 + { 34 + sha224_update(SHA224_CTX(desc), data, len); 35 + return 0; 36 + } 37 + 38 + static int crypto_sha224_final(struct shash_desc *desc, u8 *out) 39 + { 40 + sha224_final(SHA224_CTX(desc), out); 41 + return 0; 42 + } 43 + 44 + static int crypto_sha224_digest(struct shash_desc *desc, 45 + const u8 *data, unsigned int len, u8 *out) 46 + { 47 + sha224(data, len, out); 48 + return 0; 49 + } 50 + 51 + /* SHA-256 */ 52 + 26 53 const u8 sha256_zero_message_hash[SHA256_DIGEST_SIZE] = { 27 54 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 28 55 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, ··· 61 28 }; 62 29 EXPORT_SYMBOL_GPL(sha256_zero_message_hash); 63 30 31 + #define SHA256_CTX(desc) ((struct sha256_ctx *)shash_desc_ctx(desc)) 32 + 64 33 static int crypto_sha256_init(struct shash_desc *desc) 65 34 { 66 - sha256_block_init(shash_desc_ctx(desc)); 35 + sha256_init(SHA256_CTX(desc)); 67 36 return 0; 68 37 } 69 38 70 - static inline int crypto_sha256_update(struct shash_desc *desc, const u8 *data, 71 - unsigned int len, bool force_generic) 39 + static int crypto_sha256_update(struct shash_desc *desc, 40 + const u8 *data, unsigned int len) 72 41 { 73 - struct crypto_sha256_state *sctx = shash_desc_ctx(desc); 74 - int remain = len % SHA256_BLOCK_SIZE; 75 - 76 - sctx->count += len - remain; 77 - sha256_choose_blocks(sctx->state, data, len / SHA256_BLOCK_SIZE, 78 - force_generic, !force_generic); 79 - return remain; 80 - } 81 - 82 - static int crypto_sha256_update_generic(struct shash_desc *desc, const u8 *data, 83 - unsigned int len) 84 - { 85 - return crypto_sha256_update(desc, data, len, true); 86 - } 87 - 88 - static int crypto_sha256_update_lib(struct shash_desc *desc, const u8 *data, 89 - unsigned int len) 90 - { 91 - sha256_update(shash_desc_ctx(desc), data, len); 42 + sha256_update(SHA256_CTX(desc), data, len); 92 43 return 0; 93 44 } 94 45 95 - static int crypto_sha256_update_arch(struct shash_desc *desc, const u8 *data, 96 - unsigned int len) 46 + static int crypto_sha256_final(struct shash_desc *desc, u8 *out) 97 47 { 98 - return crypto_sha256_update(desc, data, len, false); 99 - } 100 - 101 - static int crypto_sha256_final_lib(struct shash_desc *desc, u8 *out) 102 - { 103 - sha256_final(shash_desc_ctx(desc), out); 48 + sha256_final(SHA256_CTX(desc), out); 104 49 return 0; 105 50 } 106 51 107 - static __always_inline int crypto_sha256_finup(struct shash_desc *desc, 108 - const u8 *data, 109 - unsigned int len, u8 *out, 110 - bool force_generic) 111 - { 112 - struct crypto_sha256_state *sctx = shash_desc_ctx(desc); 113 - unsigned int remain = len; 114 - u8 *buf; 115 - 116 - if (len >= SHA256_BLOCK_SIZE) 117 - remain = crypto_sha256_update(desc, data, len, force_generic); 118 - sctx->count += remain; 119 - buf = memcpy(sctx + 1, data + len - remain, remain); 120 - sha256_finup(sctx, buf, remain, out, 121 - crypto_shash_digestsize(desc->tfm), force_generic, 122 - !force_generic); 123 - return 0; 124 - } 125 - 126 - static int crypto_sha256_finup_generic(struct shash_desc *desc, const u8 *data, 127 - unsigned int len, u8 *out) 128 - { 129 - return crypto_sha256_finup(desc, data, len, out, true); 130 - } 131 - 132 - static int crypto_sha256_finup_arch(struct shash_desc *desc, const u8 *data, 133 - unsigned int len, u8 *out) 134 - { 135 - return crypto_sha256_finup(desc, data, len, out, false); 136 - } 137 - 138 - static int crypto_sha256_digest_generic(struct shash_desc *desc, const u8 *data, 139 - unsigned int len, u8 *out) 140 - { 141 - crypto_sha256_init(desc); 142 - return crypto_sha256_finup_generic(desc, data, len, out); 143 - } 144 - 145 - static int crypto_sha256_digest_lib(struct shash_desc *desc, const u8 *data, 146 - unsigned int len, u8 *out) 52 + static int crypto_sha256_digest(struct shash_desc *desc, 53 + const u8 *data, unsigned int len, u8 *out) 147 54 { 148 55 sha256(data, len, out); 149 56 return 0; 150 57 } 151 58 152 - static int crypto_sha256_digest_arch(struct shash_desc *desc, const u8 *data, 153 - unsigned int len, u8 *out) 154 - { 155 - crypto_sha256_init(desc); 156 - return crypto_sha256_finup_arch(desc, data, len, out); 157 - } 59 + /* HMAC-SHA224 */ 158 60 159 - static int crypto_sha224_init(struct shash_desc *desc) 61 + #define HMAC_SHA224_KEY(tfm) ((struct hmac_sha224_key *)crypto_shash_ctx(tfm)) 62 + #define HMAC_SHA224_CTX(desc) ((struct hmac_sha224_ctx *)shash_desc_ctx(desc)) 63 + 64 + static int crypto_hmac_sha224_setkey(struct crypto_shash *tfm, 65 + const u8 *raw_key, unsigned int keylen) 160 66 { 161 - sha224_block_init(shash_desc_ctx(desc)); 67 + hmac_sha224_preparekey(HMAC_SHA224_KEY(tfm), raw_key, keylen); 162 68 return 0; 163 69 } 164 70 165 - static int crypto_sha224_final_lib(struct shash_desc *desc, u8 *out) 71 + static int crypto_hmac_sha224_init(struct shash_desc *desc) 166 72 { 167 - sha224_final(shash_desc_ctx(desc), out); 73 + hmac_sha224_init(HMAC_SHA224_CTX(desc), HMAC_SHA224_KEY(desc->tfm)); 168 74 return 0; 169 75 } 170 76 171 - static int crypto_sha256_import_lib(struct shash_desc *desc, const void *in) 77 + static int crypto_hmac_sha224_update(struct shash_desc *desc, 78 + const u8 *data, unsigned int len) 172 79 { 173 - struct __sha256_ctx *sctx = shash_desc_ctx(desc); 174 - const u8 *p = in; 175 - 176 - memcpy(sctx, p, sizeof(*sctx)); 177 - p += sizeof(*sctx); 178 - sctx->bytecount += *p; 80 + hmac_sha224_update(HMAC_SHA224_CTX(desc), data, len); 179 81 return 0; 180 82 } 181 83 182 - static int crypto_sha256_export_lib(struct shash_desc *desc, void *out) 84 + static int crypto_hmac_sha224_final(struct shash_desc *desc, u8 *out) 183 85 { 184 - struct __sha256_ctx *sctx0 = shash_desc_ctx(desc); 185 - struct __sha256_ctx sctx = *sctx0; 186 - unsigned int partial; 187 - u8 *p = out; 188 - 189 - partial = sctx.bytecount % SHA256_BLOCK_SIZE; 190 - sctx.bytecount -= partial; 191 - memcpy(p, &sctx, sizeof(sctx)); 192 - p += sizeof(sctx); 193 - *p = partial; 86 + hmac_sha224_final(HMAC_SHA224_CTX(desc), out); 194 87 return 0; 195 88 } 89 + 90 + static int crypto_hmac_sha224_digest(struct shash_desc *desc, 91 + const u8 *data, unsigned int len, 92 + u8 *out) 93 + { 94 + hmac_sha224(HMAC_SHA224_KEY(desc->tfm), data, len, out); 95 + return 0; 96 + } 97 + 98 + /* HMAC-SHA256 */ 99 + 100 + #define HMAC_SHA256_KEY(tfm) ((struct hmac_sha256_key *)crypto_shash_ctx(tfm)) 101 + #define HMAC_SHA256_CTX(desc) ((struct hmac_sha256_ctx *)shash_desc_ctx(desc)) 102 + 103 + static int crypto_hmac_sha256_setkey(struct crypto_shash *tfm, 104 + const u8 *raw_key, unsigned int keylen) 105 + { 106 + hmac_sha256_preparekey(HMAC_SHA256_KEY(tfm), raw_key, keylen); 107 + return 0; 108 + } 109 + 110 + static int crypto_hmac_sha256_init(struct shash_desc *desc) 111 + { 112 + hmac_sha256_init(HMAC_SHA256_CTX(desc), HMAC_SHA256_KEY(desc->tfm)); 113 + return 0; 114 + } 115 + 116 + static int crypto_hmac_sha256_update(struct shash_desc *desc, 117 + const u8 *data, unsigned int len) 118 + { 119 + hmac_sha256_update(HMAC_SHA256_CTX(desc), data, len); 120 + return 0; 121 + } 122 + 123 + static int crypto_hmac_sha256_final(struct shash_desc *desc, u8 *out) 124 + { 125 + hmac_sha256_final(HMAC_SHA256_CTX(desc), out); 126 + return 0; 127 + } 128 + 129 + static int crypto_hmac_sha256_digest(struct shash_desc *desc, 130 + const u8 *data, unsigned int len, 131 + u8 *out) 132 + { 133 + hmac_sha256(HMAC_SHA256_KEY(desc->tfm), data, len, out); 134 + return 0; 135 + } 136 + 137 + /* Algorithm definitions */ 196 138 197 139 static struct shash_alg algs[] = { 198 140 { 199 - .base.cra_name = "sha256", 200 - .base.cra_driver_name = "sha256-generic", 201 - .base.cra_priority = 100, 202 - .base.cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY | 203 - CRYPTO_AHASH_ALG_FINUP_MAX, 204 - .base.cra_blocksize = SHA256_BLOCK_SIZE, 205 - .base.cra_module = THIS_MODULE, 206 - .digestsize = SHA256_DIGEST_SIZE, 207 - .init = crypto_sha256_init, 208 - .update = crypto_sha256_update_generic, 209 - .finup = crypto_sha256_finup_generic, 210 - .digest = crypto_sha256_digest_generic, 211 - .descsize = sizeof(struct crypto_sha256_state), 212 - }, 213 - { 214 141 .base.cra_name = "sha224", 215 - .base.cra_driver_name = "sha224-generic", 216 - .base.cra_priority = 100, 217 - .base.cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY | 218 - CRYPTO_AHASH_ALG_FINUP_MAX, 142 + .base.cra_driver_name = "sha224-lib", 143 + .base.cra_priority = 300, 219 144 .base.cra_blocksize = SHA224_BLOCK_SIZE, 220 145 .base.cra_module = THIS_MODULE, 221 146 .digestsize = SHA224_DIGEST_SIZE, 222 147 .init = crypto_sha224_init, 223 - .update = crypto_sha256_update_generic, 224 - .finup = crypto_sha256_finup_generic, 225 - .descsize = sizeof(struct crypto_sha256_state), 148 + .update = crypto_sha224_update, 149 + .final = crypto_sha224_final, 150 + .digest = crypto_sha224_digest, 151 + .descsize = sizeof(struct sha224_ctx), 226 152 }, 227 153 { 228 154 .base.cra_name = "sha256", 229 155 .base.cra_driver_name = "sha256-lib", 156 + .base.cra_priority = 300, 230 157 .base.cra_blocksize = SHA256_BLOCK_SIZE, 231 158 .base.cra_module = THIS_MODULE, 232 159 .digestsize = SHA256_DIGEST_SIZE, 233 160 .init = crypto_sha256_init, 234 - .update = crypto_sha256_update_lib, 235 - .final = crypto_sha256_final_lib, 236 - .digest = crypto_sha256_digest_lib, 161 + .update = crypto_sha256_update, 162 + .final = crypto_sha256_final, 163 + .digest = crypto_sha256_digest, 237 164 .descsize = sizeof(struct sha256_ctx), 238 - .statesize = sizeof(struct crypto_sha256_state) + 239 - SHA256_BLOCK_SIZE + 1, 240 - .import = crypto_sha256_import_lib, 241 - .export = crypto_sha256_export_lib, 242 165 }, 243 166 { 244 - .base.cra_name = "sha224", 245 - .base.cra_driver_name = "sha224-lib", 167 + .base.cra_name = "hmac(sha224)", 168 + .base.cra_driver_name = "hmac-sha224-lib", 169 + .base.cra_priority = 300, 246 170 .base.cra_blocksize = SHA224_BLOCK_SIZE, 171 + .base.cra_ctxsize = sizeof(struct hmac_sha224_key), 247 172 .base.cra_module = THIS_MODULE, 248 173 .digestsize = SHA224_DIGEST_SIZE, 249 - .init = crypto_sha224_init, 250 - .update = crypto_sha256_update_lib, 251 - .final = crypto_sha224_final_lib, 252 - .descsize = sizeof(struct sha224_ctx), 253 - .statesize = sizeof(struct crypto_sha256_state) + 254 - SHA256_BLOCK_SIZE + 1, 255 - .import = crypto_sha256_import_lib, 256 - .export = crypto_sha256_export_lib, 174 + .setkey = crypto_hmac_sha224_setkey, 175 + .init = crypto_hmac_sha224_init, 176 + .update = crypto_hmac_sha224_update, 177 + .final = crypto_hmac_sha224_final, 178 + .digest = crypto_hmac_sha224_digest, 179 + .descsize = sizeof(struct hmac_sha224_ctx), 257 180 }, 258 181 { 259 - .base.cra_name = "sha256", 260 - .base.cra_driver_name = "sha256-" __stringify(ARCH), 182 + .base.cra_name = "hmac(sha256)", 183 + .base.cra_driver_name = "hmac-sha256-lib", 261 184 .base.cra_priority = 300, 262 - .base.cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY | 263 - CRYPTO_AHASH_ALG_FINUP_MAX, 264 185 .base.cra_blocksize = SHA256_BLOCK_SIZE, 186 + .base.cra_ctxsize = sizeof(struct hmac_sha256_key), 265 187 .base.cra_module = THIS_MODULE, 266 188 .digestsize = SHA256_DIGEST_SIZE, 267 - .init = crypto_sha256_init, 268 - .update = crypto_sha256_update_arch, 269 - .finup = crypto_sha256_finup_arch, 270 - .digest = crypto_sha256_digest_arch, 271 - .descsize = sizeof(struct crypto_sha256_state), 272 - }, 273 - { 274 - .base.cra_name = "sha224", 275 - .base.cra_driver_name = "sha224-" __stringify(ARCH), 276 - .base.cra_priority = 300, 277 - .base.cra_flags = CRYPTO_AHASH_ALG_BLOCK_ONLY | 278 - CRYPTO_AHASH_ALG_FINUP_MAX, 279 - .base.cra_blocksize = SHA224_BLOCK_SIZE, 280 - .base.cra_module = THIS_MODULE, 281 - .digestsize = SHA224_DIGEST_SIZE, 282 - .init = crypto_sha224_init, 283 - .update = crypto_sha256_update_arch, 284 - .finup = crypto_sha256_finup_arch, 285 - .descsize = sizeof(struct crypto_sha256_state), 189 + .setkey = crypto_hmac_sha256_setkey, 190 + .init = crypto_hmac_sha256_init, 191 + .update = crypto_hmac_sha256_update, 192 + .final = crypto_hmac_sha256_final, 193 + .digest = crypto_hmac_sha256_digest, 194 + .descsize = sizeof(struct hmac_sha256_ctx), 286 195 }, 287 196 }; 288 197 289 - static unsigned int num_algs; 290 - 291 198 static int __init crypto_sha256_mod_init(void) 292 199 { 293 - /* register the arch flavours only if they differ from generic */ 294 - num_algs = ARRAY_SIZE(algs); 295 - BUILD_BUG_ON(ARRAY_SIZE(algs) <= 2); 296 - if (!sha256_is_arch_optimized()) 297 - num_algs -= 2; 298 200 return crypto_register_shashes(algs, ARRAY_SIZE(algs)); 299 201 } 300 202 module_init(crypto_sha256_mod_init); 301 203 302 204 static void __exit crypto_sha256_mod_exit(void) 303 205 { 304 - crypto_unregister_shashes(algs, num_algs); 206 + crypto_unregister_shashes(algs, ARRAY_SIZE(algs)); 305 207 } 306 208 module_exit(crypto_sha256_mod_exit); 307 209 308 210 MODULE_LICENSE("GPL"); 309 - MODULE_DESCRIPTION("Crypto API wrapper for the SHA-256 and SHA-224 library functions"); 211 + MODULE_DESCRIPTION("Crypto API support for SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256"); 310 212 311 - MODULE_ALIAS_CRYPTO("sha256"); 312 - MODULE_ALIAS_CRYPTO("sha256-generic"); 313 - MODULE_ALIAS_CRYPTO("sha256-" __stringify(ARCH)); 314 213 MODULE_ALIAS_CRYPTO("sha224"); 315 - MODULE_ALIAS_CRYPTO("sha224-generic"); 316 - MODULE_ALIAS_CRYPTO("sha224-" __stringify(ARCH)); 214 + MODULE_ALIAS_CRYPTO("sha224-lib"); 215 + MODULE_ALIAS_CRYPTO("sha256"); 216 + MODULE_ALIAS_CRYPTO("sha256-lib"); 217 + MODULE_ALIAS_CRYPTO("hmac(sha224)"); 218 + MODULE_ALIAS_CRYPTO("hmac-sha224-lib"); 219 + MODULE_ALIAS_CRYPTO("hmac(sha256)"); 220 + MODULE_ALIAS_CRYPTO("hmac-sha256-lib");
+12
crypto/testmgr.c
··· 4270 4270 .fips_allowed = 1, 4271 4271 }, { 4272 4272 .alg = "authenc(hmac(sha224),cbc(des))", 4273 + .generic_driver = "authenc(hmac-sha224-lib,cbc(des-generic))", 4273 4274 .test = alg_test_aead, 4274 4275 .suite = { 4275 4276 .aead = __VECS(hmac_sha224_des_cbc_tv_temp) 4276 4277 } 4277 4278 }, { 4278 4279 .alg = "authenc(hmac(sha224),cbc(des3_ede))", 4280 + .generic_driver = "authenc(hmac-sha224-lib,cbc(des3_ede-generic))", 4279 4281 .test = alg_test_aead, 4280 4282 .suite = { 4281 4283 .aead = __VECS(hmac_sha224_des3_ede_cbc_tv_temp) 4282 4284 } 4283 4285 }, { 4284 4286 .alg = "authenc(hmac(sha256),cbc(aes))", 4287 + .generic_driver = "authenc(hmac-sha256-lib,cbc(aes-generic))", 4285 4288 .test = alg_test_aead, 4286 4289 .fips_allowed = 1, 4287 4290 .suite = { ··· 4292 4289 } 4293 4290 }, { 4294 4291 .alg = "authenc(hmac(sha256),cbc(des))", 4292 + .generic_driver = "authenc(hmac-sha256-lib,cbc(des-generic))", 4295 4293 .test = alg_test_aead, 4296 4294 .suite = { 4297 4295 .aead = __VECS(hmac_sha256_des_cbc_tv_temp) 4298 4296 } 4299 4297 }, { 4300 4298 .alg = "authenc(hmac(sha256),cbc(des3_ede))", 4299 + .generic_driver = "authenc(hmac-sha256-lib,cbc(des3_ede-generic))", 4301 4300 .test = alg_test_aead, 4302 4301 .suite = { 4303 4302 .aead = __VECS(hmac_sha256_des3_ede_cbc_tv_temp) ··· 4310 4305 .fips_allowed = 1, 4311 4306 }, { 4312 4307 .alg = "authenc(hmac(sha256),cts(cbc(aes)))", 4308 + .generic_driver = "authenc(hmac-sha256-lib,cts(cbc(aes-generic)))", 4313 4309 .test = alg_test_aead, 4314 4310 .suite = { 4315 4311 .aead = __VECS(krb5_test_aes128_cts_hmac_sha256_128) ··· 5021 5015 } 5022 5016 }, { 5023 5017 .alg = "essiv(authenc(hmac(sha256),cbc(aes)),sha256)", 5018 + .generic_driver = "essiv(authenc(hmac-sha256-lib,cbc(aes-generic)),sha256-lib)", 5024 5019 .test = alg_test_aead, 5025 5020 .fips_allowed = 1, 5026 5021 .suite = { ··· 5029 5022 } 5030 5023 }, { 5031 5024 .alg = "essiv(cbc(aes),sha256)", 5025 + .generic_driver = "essiv(cbc(aes-generic),sha256-lib)", 5032 5026 .test = alg_test_skcipher, 5033 5027 .fips_allowed = 1, 5034 5028 .suite = { ··· 5129 5121 } 5130 5122 }, { 5131 5123 .alg = "hmac(sha224)", 5124 + .generic_driver = "hmac-sha224-lib", 5132 5125 .test = alg_test_hash, 5133 5126 .fips_allowed = 1, 5134 5127 .suite = { ··· 5137 5128 } 5138 5129 }, { 5139 5130 .alg = "hmac(sha256)", 5131 + .generic_driver = "hmac-sha256-lib", 5140 5132 .test = alg_test_hash, 5141 5133 .fips_allowed = 1, 5142 5134 .suite = { ··· 5469 5459 } 5470 5460 }, { 5471 5461 .alg = "sha224", 5462 + .generic_driver = "sha224-lib", 5472 5463 .test = alg_test_hash, 5473 5464 .fips_allowed = 1, 5474 5465 .suite = { ··· 5477 5466 } 5478 5467 }, { 5479 5468 .alg = "sha256", 5469 + .generic_driver = "sha256-lib", 5480 5470 .test = alg_test_hash, 5481 5471 .fips_allowed = 1, 5482 5472 .suite = {
+2 -2
drivers/crypto/img-hash.c
··· 710 710 711 711 static int img_hash_cra_sha224_init(struct crypto_tfm *tfm) 712 712 { 713 - return img_hash_cra_init(tfm, "sha224-generic"); 713 + return img_hash_cra_init(tfm, "sha224-lib"); 714 714 } 715 715 716 716 static int img_hash_cra_sha256_init(struct crypto_tfm *tfm) 717 717 { 718 - return img_hash_cra_init(tfm, "sha256-generic"); 718 + return img_hash_cra_init(tfm, "sha256-lib"); 719 719 } 720 720 721 721 static void img_hash_cra_exit(struct crypto_tfm *tfm)
+4 -4
drivers/crypto/starfive/jh7110-hash.c
··· 493 493 494 494 static int starfive_sha224_init_tfm(struct crypto_ahash *hash) 495 495 { 496 - return starfive_hash_init_tfm(hash, "sha224-generic", 496 + return starfive_hash_init_tfm(hash, "sha224-lib", 497 497 STARFIVE_HASH_SHA224, 0); 498 498 } 499 499 500 500 static int starfive_sha256_init_tfm(struct crypto_ahash *hash) 501 501 { 502 - return starfive_hash_init_tfm(hash, "sha256-generic", 502 + return starfive_hash_init_tfm(hash, "sha256-lib", 503 503 STARFIVE_HASH_SHA256, 0); 504 504 } 505 505 ··· 523 523 524 524 static int starfive_hmac_sha224_init_tfm(struct crypto_ahash *hash) 525 525 { 526 - return starfive_hash_init_tfm(hash, "hmac(sha224-generic)", 526 + return starfive_hash_init_tfm(hash, "hmac-sha224-lib", 527 527 STARFIVE_HASH_SHA224, 1); 528 528 } 529 529 530 530 static int starfive_hmac_sha256_init_tfm(struct crypto_ahash *hash) 531 531 { 532 - return starfive_hash_init_tfm(hash, "hmac(sha256-generic)", 532 + return starfive_hash_init_tfm(hash, "hmac-sha256-lib", 533 533 STARFIVE_HASH_SHA256, 1); 534 534 } 535 535