aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/ah.h29
1 files changed, 3 insertions, 26 deletions
diff --git a/include/net/ah.h b/include/net/ah.h
index 7ac52214ba0f..7573a7152a72 100644
--- a/include/net/ah.h
+++ b/include/net/ah.h
@@ -1,44 +1,21 @@
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
9struct crypto_ahash;
10
10struct ah_data 11struct ah_data
11{ 12{
12 u8 *work_icv;
13 int icv_full_len; 13 int icv_full_len;
14 int icv_trunc_len; 14 int icv_trunc_len;
15 15
16 struct crypto_hash *tfm;
17 struct crypto_ahash *ahash; 16 struct crypto_ahash *ahash;
18}; 17};
19 18
20static inline int ah_mac_digest(struct ah_data *ahp, struct sk_buff *skb,
21 u8 *auth_data)
22{
23 struct hash_desc desc;
24 int err;
25
26 desc.tfm = ahp->tfm;
27 desc.flags = 0;
28
29 memset(auth_data, 0, ahp->icv_trunc_len);
30 err = crypto_hash_init(&desc);
31 if (unlikely(err))
32 goto out;
33 err = skb_icv_walk(skb, &desc, 0, skb->len, crypto_hash_update);
34 if (unlikely(err))
35 goto out;
36 err = crypto_hash_final(&desc, ahp->work_icv);
37
38out:
39 return err;
40}
41
42struct ip_auth_hdr; 19struct ip_auth_hdr;
43 20
44static inline struct ip_auth_hdr *ip_auth_hdr(const struct sk_buff *skb) 21static inline struct ip_auth_hdr *ip_auth_hdr(const struct sk_buff *skb)