diff options
| author | Eric Biggers <ebiggers@kernel.org> | 2026-03-10 12:50:20 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-03-19 16:08:50 +0100 |
| commit | 4af5dfb8dca3a6ad18feb6b2adcfffb4dc874e50 (patch) | |
| tree | ca31c3179574ecb6fb8ed0cf908965adde245d75 /fs/smb/client/cifsencrypt.c | |
| parent | 97ea8f3bbdaef375aa371b305ba8f1cd80835257 (diff) | |
smb: client: Compare MACs in constant time
commit 26bc83b88bbbf054f0980a4a42047a8d1e210e4c upstream.
To prevent timing attacks, MAC comparisons need to be constant-time.
Replace the memcmp() with the correct function, crypto_memneq().
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/smb/client/cifsencrypt.c')
| -rw-r--r-- | fs/smb/client/cifsencrypt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/smb/client/cifsencrypt.c b/fs/smb/client/cifsencrypt.c index 801824825ecf..b9e20bcaa8b5 100644 --- a/fs/smb/client/cifsencrypt.c +++ b/fs/smb/client/cifsencrypt.c @@ -26,6 +26,7 @@ #include <crypto/arc4.h> #include <crypto/md5.h> #include <crypto/sha2.h> +#include <crypto/utils.h> static int cifs_sig_update(struct cifs_calc_sig_ctx *ctx, const u8 *data, size_t len) @@ -277,7 +278,7 @@ int cifs_verify_signature(struct smb_rqst *rqst, /* cifs_dump_mem("what we think it should be: ", what_we_think_sig_should_be, 16); */ - if (memcmp(server_response_sig, what_we_think_sig_should_be, 8)) + if (crypto_memneq(server_response_sig, what_we_think_sig_should_be, 8)) return -EACCES; else return 0; |
