Skip to contentSkip to conversation

crypto: chelsio: Use library to prepare HMAC keys

PATCH Superseded Eric Biggers 1 participant 1 message Aug 31, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: chelsio: Use library to prepare HMAC keys

Reimplementing the sha1, sha256, and sha512 crypto_shash algorithms on top of the library APIs caused the recently-added function crypto_shash_export_core() to no longer be supported. Meanwhile, the chelsio driver was updated to use crypto_shash_export_core(). But it's not actually necessary. Instead, just do the HMAC key preparation using the library functions instead of crypto_shash. This fixes the chelsio driver and greatly simplifies the code. Additional benefits include stronger typing, and improved performance due to reduced overhead.

Fixes d9408b8eea6d ("crypto: chelsio - Use crypto_shash_export_core")
Fixes 8bc79ab67d78 ("crypto: sha1 - Wrap library and add HMAC support")
Fixes e0cd37169103 ("crypto: sha256 - Wrap library and add HMAC support")
Fixes 469acaa12502 ("crypto: sha512 - Replace sha512_generic with wrapper around SHA-512 library")

---

This patch is targeting libcrypto-fixes.

 drivers/crypto/chelsio/Kconfig       |   6 +-
 drivers/crypto/chelsio/chcr_algo.c   | 259 +++++++--------------------
 drivers/crypto/chelsio/chcr_crypto.h |   1 -
 3 files changed, 63 insertions(+), 203 deletions(-)
drivers/crypto/chelsio/Kconfig +3 -3
index 5dd3f6a4781a2..37294bb740031 100644
@@ -2,13 +2,13 @@
 config CRYPTO_DEV_CHELSIO
 	tristate "Chelsio Crypto Co-processor Driver"
 	depends on CHELSIO_T4
 	select CRYPTO_LIB_AES
 	select CRYPTO_LIB_GF128MUL
-	select CRYPTO_SHA1
-	select CRYPTO_SHA256
-	select CRYPTO_SHA512
+	select CRYPTO_LIB_SHA1
+	select CRYPTO_LIB_SHA256
+	select CRYPTO_LIB_SHA512
 	select CRYPTO_AUTHENC
 	help
 	  The Chelsio Crypto Co-processor driver for T6 adapters.
 
 	  For general information about Chelsio and our products, visit
drivers/crypto/chelsio/chcr_algo.c +60 -199

371 lines not on this page · raw message

drivers/crypto/chelsio/chcr_crypto.h +0 -1
index 1d693b8436e6f..e1e79e5f01e75 100644
@@ -239,11 +239,10 @@ struct chcr_aead_ctx {
 	u16 mayverify;
 	struct	__aead_ctx ctx[];
 };
 
 struct hmac_ctx {
-	struct crypto_shash *base_hash;
 	u8 ipad[CHCR_HASH_MAX_BLOCK_SIZE_128];
 	u8 opad[CHCR_HASH_MAX_BLOCK_SIZE_128];
 };
 
 struct __crypto_ctx {

base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00

Signature · 1 line
2.50.1