diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2021-08-20 02:32:56 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-08-25 23:48:00 +0300 |
commit | 42c21973fa3c0f4898330fa30d327fbab67b5460 (patch) | |
tree | c6a5eae0b05084eaa6773b3cb69405f39f7bbe1f /fs/cifs/smbencrypt.c | |
parent | 71c02863246167b3d1639b8278681ca8ebedcb4e (diff) | |
download | linux-42c21973fa3c0f4898330fa30d327fbab67b5460.tar.xz |
cifs: create a MD4 module and switch cifs.ko to use it
MD4 support will likely be removed from the crypto directory, but
is needed for compression of NTLMSSP in SMB3 mounts.
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smbencrypt.c')
-rw-r--r-- | fs/cifs/smbencrypt.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c index 5da7eea3323f..10047cc55286 100644 --- a/fs/cifs/smbencrypt.c +++ b/fs/cifs/smbencrypt.c @@ -24,6 +24,7 @@ #include "cifsglob.h" #include "cifs_debug.h" #include "cifsproto.h" +#include "../cifs_common/md4.h" #ifndef false #define false 0 @@ -42,29 +43,24 @@ static int mdfour(unsigned char *md4_hash, unsigned char *link_str, int link_len) { int rc; - struct crypto_shash *md4 = NULL; - struct sdesc *sdescmd4 = NULL; + struct md4_ctx mctx; - rc = cifs_alloc_hash("md4", &md4, &sdescmd4); - if (rc) - goto mdfour_err; - - rc = crypto_shash_init(&sdescmd4->shash); + rc = cifs_md4_init(&mctx); if (rc) { - cifs_dbg(VFS, "%s: Could not init md4 shash\n", __func__); + cifs_dbg(VFS, "%s: Could not init MD4\n", __func__); goto mdfour_err; } - rc = crypto_shash_update(&sdescmd4->shash, link_str, link_len); + rc = cifs_md4_update(&mctx, link_str, link_len); if (rc) { - cifs_dbg(VFS, "%s: Could not update with link_str\n", __func__); + cifs_dbg(VFS, "%s: Could not update MD4\n", __func__); goto mdfour_err; } - rc = crypto_shash_final(&sdescmd4->shash, md4_hash); + rc = cifs_md4_final(&mctx, md4_hash); if (rc) - cifs_dbg(VFS, "%s: Could not generate md4 hash\n", __func__); + cifs_dbg(VFS, "%s: Could not finalize MD4\n", __func__); + mdfour_err: - cifs_free_hash(&md4, &sdescmd4); return rc; } |