diff options
author | Eric Biggers <ebiggers@google.com> | 2023-10-29 08:03:00 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-05-25 17:22:41 +0300 |
commit | 69a1669a6ba1ca6c8f7b07a2b0303b1fcb6ca4c1 (patch) | |
tree | 40c429fa320db128ac98bd122edb72d7dac25e7c /fs/smb | |
parent | 5b3c76351b4937c074e242e294aaa4458832d1d6 (diff) | |
download | linux-69a1669a6ba1ca6c8f7b07a2b0303b1fcb6ca4c1.tar.xz |
smb: use crypto_shash_digest() in symlink_hash()
[ Upstream commit 783fa2c94f4150fe1b7f7d88b3baf6d98f82b41b ]
Simplify symlink_hash() by using crypto_shash_digest() instead of an
init+update+final sequence. This should also improve performance.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/smb')
-rw-r--r-- | fs/smb/client/link.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/fs/smb/client/link.c b/fs/smb/client/link.c index 6c4ae52ddc04..3ef34218a790 100644 --- a/fs/smb/client/link.c +++ b/fs/smb/client/link.c @@ -42,23 +42,11 @@ symlink_hash(unsigned int link_len, const char *link_str, u8 *md5_hash) rc = cifs_alloc_hash("md5", &md5); if (rc) - goto symlink_hash_err; + return rc; - rc = crypto_shash_init(md5); - if (rc) { - cifs_dbg(VFS, "%s: Could not init md5 shash\n", __func__); - goto symlink_hash_err; - } - rc = crypto_shash_update(md5, link_str, link_len); - if (rc) { - cifs_dbg(VFS, "%s: Could not update with link_str\n", __func__); - goto symlink_hash_err; - } - rc = crypto_shash_final(md5, md5_hash); + rc = crypto_shash_digest(md5, link_str, link_len, md5_hash); if (rc) cifs_dbg(VFS, "%s: Could not generate md5 hash\n", __func__); - -symlink_hash_err: cifs_free_hash(&md5); return rc; } |