nfc: s3fwrn5: Use SHA-1 library instead of crypto_shash
Subsystems (5)
PATCH 1/1 nfc: s3fwrn5: Use SHA-1 library instead of crypto_shash
Now that a SHA-1 library API is available, use it instead of crypto_shash. This is simpler and faster.
Signed-off-by Eric Biggers <[email protected]>
--- drivers/nfc/s3fwrn5/Kconfig | 3 +-- drivers/nfc/s3fwrn5/firmware.c | 17 +---------------- 2 files changed, 2 insertions(+), 18 deletions(-)
drivers/nfc/s3fwrn5/Kconfig +1 -2
@@ -1,10 +1,9 @@ # SPDX-License-Identifier: GPL-2.0-only config NFC_S3FWRN5 tristate - select CRYPTO - select CRYPTO_HASH + select CRYPTO_LIB_SHA1 help Core driver for Samsung S3FWRN5 NFC chip. Contains core utilities of chip. It's intended to be used by PHYs to avoid duplicating lots of common code.
drivers/nfc/s3fwrn5/firmware.c +1 -16
@@ -6,11 +6,10 @@* Robert Baldyga <[email protected]> */ #include <linux/completion.h> #include <linux/firmware.h> -#include <crypto/hash.h> #include <crypto/sha1.h> #include "s3fwrn5.h" #include "firmware.h"
@@ -409,31 +408,17 @@ bool s3fwrn5_fw_check_version(const struct s3fwrn5_fw_info *fw_info, u32 versionint s3fwrn5_fw_download (struct s3fwrn5_fw_info *fw_info) {struct device *dev = &fw_info->ndev->nfc_dev->dev;struct s3fwrn5_fw_image *fw = &fw_info->fw;u8 hash_data[SHA1_DIGEST_SIZE ]; -struct crypto_shash *tfm;u32 image_size, off;int ret; image_size = fw_info->sector_size * fw->image_sectors;/* Compute SHA of firmware data */ - - tfm =crypto_alloc_shash ("sha1" ,0 ,0 ); -if (IS_ERR (tfm)) { -dev_err (dev,"Cannot allocate shash (code=%pe)\n" , tfm); -return PTR_ERR (tfm); - } - - ret =crypto_shash_tfm_digest (tfm, fw->image, image_size, hash_data); - -crypto_free_shash (tfm); -if (ret) { -dev_err (dev,"Cannot compute hash (code=%d)\n" , ret); -return ret; - } +sha1 (fw->image, image_size, hash_data);/* Firmware update process */ dev_info (dev,"Firmware update: %s\n" , fw_info->fw_name);
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
Signature · 1 line
2.50.1
Quoted 9 lines · Eric Biggers
Now that a SHA-1 library API is available, use it instead of
crypto_shash. This is simpler and faster.Signed-off-by Eric Biggers <[email protected]>--- drivers/nfc/s3fwrn5/Kconfig | 3 +-- drivers/nfc/s3fwrn5/firmware.c | 17 +---------------- 2 files changed, 2 insertions(+), 18 deletions(-)
Reviewed-by Krzysztof Kozlowski <[email protected]>
Best regards,
Krzysztof
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Thu, 14 Aug 2025 19:23:29 -0700 you wrote:
Now that a SHA-1 library API is available, use it instead of
crypto_shash. This is simpler and faster.Signed-off-by Eric Biggers <[email protected]>--- drivers/nfc/s3fwrn5/Kconfig | 3 +-- drivers/nfc/s3fwrn5/firmware.c | 17 +---------------- 2 files changed, 2 insertions(+), 18 deletions(-)[...]
Here is the summary with links:
- [net-next] nfc: s3fwrn5: Use SHA-1 library instead of crypto_shash
https://git.kernel.org/netdev/net-next/c/661bfb4699f8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html