diff options
Diffstat (limited to 'include/net/ah.h')
| -rw-r--r-- | include/net/ah.h | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/include/net/ah.h b/include/net/ah.h index ae1c322f4242..f0129f79a31a 100644 --- a/include/net/ah.h +++ b/include/net/ah.h | |||
| @@ -1,43 +1,20 @@ | |||
| 1 | #ifndef _NET_AH_H | 1 | #ifndef _NET_AH_H |
| 2 | #define _NET_AH_H | 2 | #define _NET_AH_H |
| 3 | 3 | ||
| 4 | #include <linux/crypto.h> | 4 | #include <linux/skbuff.h> |
| 5 | #include <net/xfrm.h> | ||
| 6 | 5 | ||
| 7 | /* This is the maximum truncated ICV length that we know of. */ | 6 | /* This is the maximum truncated ICV length that we know of. */ |
| 8 | #define MAX_AH_AUTH_LEN 12 | 7 | #define MAX_AH_AUTH_LEN 12 |
| 9 | 8 | ||
| 10 | struct ah_data | 9 | struct crypto_ahash; |
| 11 | { | 10 | |
| 12 | u8 *work_icv; | 11 | struct ah_data { |
| 13 | int icv_full_len; | 12 | int icv_full_len; |
| 14 | int icv_trunc_len; | 13 | int icv_trunc_len; |
| 15 | 14 | ||
| 16 | struct crypto_hash *tfm; | 15 | struct crypto_ahash *ahash; |
| 17 | }; | 16 | }; |
| 18 | 17 | ||
| 19 | static inline int ah_mac_digest(struct ah_data *ahp, struct sk_buff *skb, | ||
| 20 | u8 *auth_data) | ||
| 21 | { | ||
| 22 | struct hash_desc desc; | ||
| 23 | int err; | ||
| 24 | |||
| 25 | desc.tfm = ahp->tfm; | ||
| 26 | desc.flags = 0; | ||
| 27 | |||
| 28 | memset(auth_data, 0, ahp->icv_trunc_len); | ||
| 29 | err = crypto_hash_init(&desc); | ||
| 30 | if (unlikely(err)) | ||
| 31 | goto out; | ||
| 32 | err = skb_icv_walk(skb, &desc, 0, skb->len, crypto_hash_update); | ||
| 33 | if (unlikely(err)) | ||
| 34 | goto out; | ||
| 35 | err = crypto_hash_final(&desc, ahp->work_icv); | ||
| 36 | |||
| 37 | out: | ||
| 38 | return err; | ||
| 39 | } | ||
| 40 | |||
| 41 | struct ip_auth_hdr; | 18 | struct ip_auth_hdr; |
| 42 | 19 | ||
| 43 | static inline struct ip_auth_hdr *ip_auth_hdr(const struct sk_buff *skb) | 20 | static inline struct ip_auth_hdr *ip_auth_hdr(const struct sk_buff *skb) |
