Skip to contentSkip to conversation

crypto: qat: Use library to prepare HMAC keys

PATCH In review Eric Biggers 2 participants 2 messages Aug 31, 2025 – Sep 1, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: qat: 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 QAT 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 QAT driver and greatly simplifies the code. Additional benefits include stronger typing, and improved performance due to reduced overhead.

Fixes ccafe2821cfa ("crypto: qat - 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.

I'll send a similar one for the cheslio driver too.

 drivers/crypto/intel/qat/Kconfig              |   7 +-
 .../crypto/intel/qat/qat_common/qat_algs.c    | 191 ++++++------------
 2 files changed, 61 insertions(+), 137 deletions(-)
drivers/crypto/intel/qat/Kconfig +3 -4
index 359c61f0c8a13..4b4861460dd4e 100644
@@ -4,16 +4,15 @@ config CRYPTO_DEV_QAT
 	select CRYPTO_AEAD
 	select CRYPTO_AUTHENC
 	select CRYPTO_SKCIPHER
 	select CRYPTO_AKCIPHER
 	select CRYPTO_DH
-	select CRYPTO_HMAC
 	select CRYPTO_RSA
-	select CRYPTO_SHA1
-	select CRYPTO_SHA256
-	select CRYPTO_SHA512
 	select CRYPTO_LIB_AES
+	select CRYPTO_LIB_SHA1
+	select CRYPTO_LIB_SHA256
+	select CRYPTO_LIB_SHA512
 	select FW_LOADER
 	select CRC8
 
 config CRYPTO_DEV_QAT_DH895xCC
 	tristate "Support for Intel(R) DH895xCC"
drivers/crypto/intel/qat/qat_common/qat_algs.c +58 -133

313 lines not on this page · raw message

base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00

Signature · 1 line
2.50.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eric Biggers

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 QAT 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 QAT driver and greatly simplifies the code. Additional benefits include stronger typing, and improved performance due to reduced overhead.

Quoted 8 lines
Fixes ccafe2821cfa ("crypto: qat - 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")

---

Thanks.

One NIT on the headline, for consistency with the other patches:
"crypto: qat -".

Regards,

Signature · 1 line
Giovanni