linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] nfc: s3fwrn5: Use SHA-1 library instead of crypto_shash
@ 2025-08-15  2:23 Eric Biggers
  2025-08-17  8:12 ` Krzysztof Kozlowski
  2025-08-19  0:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Biggers @ 2025-08-15  2:23 UTC (permalink / raw)
  To: Krzysztof Kozlowski, netdev; +Cc: linux-crypto, linux-kernel, 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 <ebiggers@kernel.org>
---
 drivers/nfc/s3fwrn5/Kconfig    |  3 +--
 drivers/nfc/s3fwrn5/firmware.c | 17 +----------------
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/nfc/s3fwrn5/Kconfig b/drivers/nfc/s3fwrn5/Kconfig
index 8a6b1a79de253..96386b73fa2b6 100644
--- a/drivers/nfc/s3fwrn5/Kconfig
+++ b/drivers/nfc/s3fwrn5/Kconfig
@@ -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.
 
diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c
index 781cdbcac104c..64d61b2a715ae 100644
--- a/drivers/nfc/s3fwrn5/firmware.c
+++ b/drivers/nfc/s3fwrn5/firmware.c
@@ -6,11 +6,10 @@
  * Robert Baldyga <r.baldyga@samsung.com>
  */
 
 #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 version
 int 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
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] nfc: s3fwrn5: Use SHA-1 library instead of crypto_shash
  2025-08-15  2:23 [PATCH net-next] nfc: s3fwrn5: Use SHA-1 library instead of crypto_shash Eric Biggers
@ 2025-08-17  8:12 ` Krzysztof Kozlowski
  2025-08-19  0:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-17  8:12 UTC (permalink / raw)
  To: Eric Biggers, netdev; +Cc: linux-crypto, linux-kernel

On 15/08/2025 04:23, Eric Biggers 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 <ebiggers@kernel.org>
> ---
>  drivers/nfc/s3fwrn5/Kconfig    |  3 +--
>  drivers/nfc/s3fwrn5/firmware.c | 17 +----------------
>  2 files changed, 2 insertions(+), 18 deletions(-)
> 

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] nfc: s3fwrn5: Use SHA-1 library instead of crypto_shash
  2025-08-15  2:23 [PATCH net-next] nfc: s3fwrn5: Use SHA-1 library instead of crypto_shash Eric Biggers
  2025-08-17  8:12 ` Krzysztof Kozlowski
@ 2025-08-19  0:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-19  0:40 UTC (permalink / raw)
  To: Eric Biggers; +Cc: krzk, netdev, linux-crypto, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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 <ebiggers@kernel.org>
> ---
>  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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-19  0:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-15  2:23 [PATCH net-next] nfc: s3fwrn5: Use SHA-1 library instead of crypto_shash Eric Biggers
2025-08-17  8:12 ` Krzysztof Kozlowski
2025-08-19  0:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).