summaryrefslogtreecommitdiff
path: root/net/mptcp
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-05-02 11:24:21 -0700
committerHerbert Xu <herbert@gondor.apana.org.au>2020-05-08 15:32:16 +1000
commitac0ad93df7136e27d2a9c5ec554547695f581d0e (patch)
tree315b2ec5ba6d42a94649271d3831a014f2eb9b28 /net/mptcp
parent85fc78b80f15d723db3aa8f368b414ee70a1937c (diff)
mptcp: use SHA256_BLOCK_SIZE, not SHA_MESSAGE_BYTES
In preparation for naming the SHA-1 stuff in <linux/cryptohash.h> properly and moving it to a more appropriate header, fix the HMAC-SHA256 code in mptcp_crypto_hmac_sha() to use SHA256_BLOCK_SIZE instead of "SHA_MESSAGE_BYTES" which is actually the SHA-1 block size. (Fortunately these are both 64 bytes, so this wasn't a "real" bug...) Cc: Paolo Abeni <pabeni@redhat.com> Cc: mptcp@lists.01.org Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'net/mptcp')
-rw-r--r--net/mptcp/crypto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/mptcp/crypto.c b/net/mptcp/crypto.c
index c151628bd416..81b06d875f92 100644
--- a/net/mptcp/crypto.c
+++ b/net/mptcp/crypto.c
@@ -61,7 +61,7 @@ void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac)
put_unaligned_be64(key2, key2be);
/* Generate key xored with ipad */
- memset(input, 0x36, SHA_MESSAGE_BYTES);
+ memset(input, 0x36, SHA256_BLOCK_SIZE);
for (i = 0; i < 8; i++)
input[i] ^= key1be[i];
for (i = 0; i < 8; i++)
@@ -78,7 +78,7 @@ void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac)
sha256_final(&state, &input[SHA256_BLOCK_SIZE]);
/* Prepare second part of hmac */
- memset(input, 0x5C, SHA_MESSAGE_BYTES);
+ memset(input, 0x5C, SHA256_BLOCK_SIZE);
for (i = 0; i < 8; i++)
input[i] ^= key1be[i];
for (i = 0; i < 8; i++)