xfrm: Store aalg in xfrm_state with a user specified truncation length
Adding a xfrm_state requires an authentication algorithm specified either as xfrm_algo or as xfrm_algo_auth with a specific truncation length. For compatibility, both attributes are dumped to userspace, and we also accept both attributes, but prefer the new syntax. If no truncation length is specified, or the authentication algorithm is specified using xfrm_algo, the truncation length from the algorithm description in the kernel is used. Signed-off-by: Martin Willi <martin@strongswan.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
4e242d1616
commit
4447bb33f0
@@ -162,7 +162,7 @@ struct xfrm_state {
|
||||
struct xfrm_lifetime_cfg lft;
|
||||
|
||||
/* Data for transformer */
|
||||
struct xfrm_algo *aalg;
|
||||
struct xfrm_algo_auth *aalg;
|
||||
struct xfrm_algo *ealg;
|
||||
struct xfrm_algo *calg;
|
||||
struct xfrm_algo_aead *aead;
|
||||
@@ -1532,12 +1532,22 @@ static inline int xfrm_alg_len(struct xfrm_algo *alg)
|
||||
return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
|
||||
}
|
||||
|
||||
static inline int xfrm_alg_auth_len(struct xfrm_algo_auth *alg)
|
||||
{
|
||||
return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_XFRM_MIGRATE
|
||||
static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
|
||||
{
|
||||
return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL);
|
||||
}
|
||||
|
||||
static inline struct xfrm_algo_auth *xfrm_algo_auth_clone(struct xfrm_algo_auth *orig)
|
||||
{
|
||||
return kmemdup(orig, xfrm_alg_auth_len(orig), GFP_KERNEL);
|
||||
}
|
||||
|
||||
static inline void xfrm_states_put(struct xfrm_state **states, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
Reference in New Issue
Block a user