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>
This commit is contained in:
Родитель
1fe4085f90
Коммит
c1d069e3bf
|
@ -396,17 +396,6 @@ struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot,
|
||||||
void mptcp_token_destroy(struct mptcp_sock *msk);
|
void mptcp_token_destroy(struct mptcp_sock *msk);
|
||||||
|
|
||||||
void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn);
|
void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn);
|
||||||
static inline 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac);
|
void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac);
|
||||||
|
|
||||||
|
|
|
@ -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);
|
__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
|
* mptcp_token_new_request - create new key/idsn/token for subflow_request
|
||||||
* @req: the request socket
|
* @req: the request socket
|
||||||
|
|
Загрузка…
Ссылка в новой задаче