Skip to content

Commit 783fa2c

Browse files
ebiggersSteve French
authored andcommitted
smb: use crypto_shash_digest() in symlink_hash()
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 <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent d328c09 commit 783fa2c

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

fs/smb/client/link.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,11 @@ symlink_hash(unsigned int link_len, const char *link_str, u8 *md5_hash)
4242

4343
rc = cifs_alloc_hash("md5", &md5);
4444
if (rc)
45-
goto symlink_hash_err;
45+
return rc;
4646

47-
rc = crypto_shash_init(md5);
48-
if (rc) {
49-
cifs_dbg(VFS, "%s: Could not init md5 shash\n", __func__);
50-
goto symlink_hash_err;
51-
}
52-
rc = crypto_shash_update(md5, link_str, link_len);
53-
if (rc) {
54-
cifs_dbg(VFS, "%s: Could not update with link_str\n", __func__);
55-
goto symlink_hash_err;
56-
}
57-
rc = crypto_shash_final(md5, md5_hash);
47+
rc = crypto_shash_digest(md5, link_str, link_len, md5_hash);
5848
if (rc)
5949
cifs_dbg(VFS, "%s: Could not generate md5 hash\n", __func__);
60-
61-
symlink_hash_err:
6250
cifs_free_hash(&md5);
6351
return rc;
6452
}

0 commit comments

Comments
 (0)