diff options
Diffstat (limited to 'include/net/xfrm.h')
| -rw-r--r-- | include/net/xfrm.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index afa5730fb3bd..fb5654a8ca3c 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -1648,6 +1648,11 @@ static inline int xfrm_aevent_is_on(struct net *net) | |||
| 1648 | } | 1648 | } |
| 1649 | #endif | 1649 | #endif |
| 1650 | 1650 | ||
| 1651 | static inline int aead_len(struct xfrm_algo_aead *alg) | ||
| 1652 | { | ||
| 1653 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | ||
| 1654 | } | ||
| 1655 | |||
| 1651 | static inline int xfrm_alg_len(const struct xfrm_algo *alg) | 1656 | static inline int xfrm_alg_len(const struct xfrm_algo *alg) |
| 1652 | { | 1657 | { |
| 1653 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | 1658 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); |
| @@ -1686,6 +1691,12 @@ static inline int xfrm_replay_clone(struct xfrm_state *x, | |||
| 1686 | return 0; | 1691 | return 0; |
| 1687 | } | 1692 | } |
| 1688 | 1693 | ||
| 1694 | static inline struct xfrm_algo_aead *xfrm_algo_aead_clone(struct xfrm_algo_aead *orig) | ||
| 1695 | { | ||
| 1696 | return kmemdup(orig, aead_len(orig), GFP_KERNEL); | ||
| 1697 | } | ||
| 1698 | |||
| 1699 | |||
| 1689 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) | 1700 | static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) |
| 1690 | { | 1701 | { |
| 1691 | return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); | 1702 | return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); |
