summaryrefslogtreecommitdiff
path: root/net/mptcp/token.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2020-07-21 21:08:54 +0200
committerDavid S. Miller <davem@davemloft.net>2020-07-21 16:22:18 -0700
commitc1d069e3bfc9e4021f087016578fbff209f493fd (patch)
tree5922e2a78ec3f7280423f7ef3119e73d7e77a608 /net/mptcp/token.c
parent1fe4085f90bca7001f3713c651b4c7368cac779a (diff)
mptcp: move helper to where its used
Only used in token.c. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp/token.c')
-rw-r--r--net/mptcp/token.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/mptcp/token.c b/net/mptcp/token.c
index 7d8106026081..b25b390dbbff 100644
--- a/net/mptcp/token.c
+++ b/net/mptcp/token.c
@@ -83,6 +83,18 @@ static bool __token_bucket_busy(struct token_bucket *t, u32 token)
__token_lookup_req(t, token) || __token_lookup_msk(t, token);
}
+static void mptcp_crypto_key_gen_sha(u64 *key, u32 *token, u64 *idsn)
+{
+ /* we might consider a faster version that computes the key as a
+ * hash of some information available in the MPTCP socket. Use
+ * random data at the moment, as it's probably the safest option
+ * in case multiple sockets are opened in different namespaces at
+ * the same time.
+ */
+ get_random_bytes(key, sizeof(u64));
+ mptcp_crypto_key_sha(*key, token, idsn);
+}
+
/**
* mptcp_token_new_request - create new key/idsn/token for subflow_request
* @req: the request socket