Skip to content

Commit 12555a2

Browse files
Todd Malsbarydavem330
authored andcommitted
mptcp: use rightmost 64 bits in ADD_ADDR HMAC
This changes the HMAC used in the ADD_ADDR option from the leftmost 64 bits to the rightmost 64 bits as described in RFC 8684, section 3.4.1. This issue was discovered while adding support to packetdrill for the ADD_ADDR v1 option. Fixes: 3df523a ("mptcp: Add ADD_ADDR handling") Signed-off-by: Todd Malsbary <[email protected]> Acked-by: Christoph Paasch <[email protected]> Reviewed-by: Matthieu Baerts <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f25641c commit 12555a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/mptcp/options.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ static u64 add_addr_generate_hmac(u64 key1, u64 key2, u8 addr_id,
545545

546546
mptcp_crypto_hmac_sha(key1, key2, msg, 7, hmac);
547547

548-
return get_unaligned_be64(hmac);
548+
return get_unaligned_be64(&hmac[MPTCP_ADDR_HMAC_LEN - sizeof(u64)]);
549549
}
550550

551551
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
@@ -562,7 +562,7 @@ static u64 add_addr6_generate_hmac(u64 key1, u64 key2, u8 addr_id,
562562

563563
mptcp_crypto_hmac_sha(key1, key2, msg, 19, hmac);
564564

565-
return get_unaligned_be64(hmac);
565+
return get_unaligned_be64(&hmac[MPTCP_ADDR_HMAC_LEN - sizeof(u64)]);
566566
}
567567
#endif
568568

0 commit comments

Comments
 (0)