From a41894683710b00d67015cd1683eef6de0ffd89b Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 17 Mar 2021 10:57:36 +0100 Subject: tcp: Add siphash implementation for initial sequence numbers Implement siphash routines for initial TCP sequence numbers (12 bytes input for IPv4, 36 bytes input for IPv6), and while at it, also functions we'll use later on for hash table indices and TCP timestamp offsets (with 8, 20, 32 bytes of input). Use these to set the initial sequence number, according to RFC 6528, for connections originating either from the tap device or from sockets. Signed-off-by: Stefano Brivio --- siphash.h | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 siphash.h (limited to 'siphash.h') diff --git a/siphash.h b/siphash.h new file mode 100644 index 0000000..694fdc3 --- /dev/null +++ b/siphash.h @@ -0,0 +1,5 @@ +uint64_t siphash_8b(const uint8_t *in, const uint64_t *k); +uint32_t siphash_12b(const uint8_t *in, const uint64_t *k); +uint64_t siphash_20b(const uint8_t *in, const uint64_t *k); +uint32_t siphash_32b(const uint8_t *in, const uint64_t *k); +uint32_t siphash_36b(const uint8_t *in, const uint64_t *k); -- cgit v1.2.3