aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ah4.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ah4.c')
-rw-r--r--net/ipv4/ah4.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index 67a5509e26fc..7194eb40b6d0 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -91,7 +91,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb)
91 top_iph->check = 0; 91 top_iph->check = 0;
92 92
93 ahp = x->data; 93 ahp = x->data;
94 ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + 94 ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ip_auth_hdr) +
95 ahp->icv_trunc_len) >> 2) - 2; 95 ahp->icv_trunc_len) >> 2) - 2;
96 96
97 ah->reserved = 0; 97 ah->reserved = 0;
@@ -135,9 +135,9 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
135 ah = (struct ip_auth_hdr*)skb->data; 135 ah = (struct ip_auth_hdr*)skb->data;
136 ahp = x->data; 136 ahp = x->data;
137 ah_hlen = (ah->hdrlen + 2) << 2; 137 ah_hlen = (ah->hdrlen + 2) << 2;
138 138
139 if (ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_full_len) && 139 if (ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_full_len) &&
140 ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len)) 140 ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len))
141 goto out; 141 goto out;
142 142
143 if (!pskb_may_pull(skb, ah_hlen)) 143 if (!pskb_may_pull(skb, ah_hlen))
@@ -166,9 +166,9 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
166 if (ip_clear_mutable_options(iph, &dummy)) 166 if (ip_clear_mutable_options(iph, &dummy))
167 goto out; 167 goto out;
168 } 168 }
169 { 169 {
170 u8 auth_data[MAX_AH_AUTH_LEN]; 170 u8 auth_data[MAX_AH_AUTH_LEN];
171 171
172 memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len); 172 memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len);
173 skb_push(skb, ihl); 173 skb_push(skb, ihl);
174 err = ah_mac_digest(ahp, skb, ah->auth_data); 174 err = ah_mac_digest(ahp, skb, ah->auth_data);
@@ -237,7 +237,7 @@ static int ah_init_state(struct xfrm_state *x)
237 ahp->tfm = tfm; 237 ahp->tfm = tfm;
238 if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len)) 238 if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len))
239 goto error; 239 goto error;
240 240
241 /* 241 /*
242 * Lookup the algorithm description maintained by xfrm_algo, 242 * Lookup the algorithm description maintained by xfrm_algo,
243 * verify crypto transform properties, and store information 243 * verify crypto transform properties, and store information
@@ -254,16 +254,16 @@ static int ah_init_state(struct xfrm_state *x)
254 aalg_desc->uinfo.auth.icv_fullbits/8); 254 aalg_desc->uinfo.auth.icv_fullbits/8);
255 goto error; 255 goto error;
256 } 256 }
257 257
258 ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; 258 ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
259 ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; 259 ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8;
260 260
261 BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); 261 BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);
262 262
263 ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL); 263 ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL);
264 if (!ahp->work_icv) 264 if (!ahp->work_icv)
265 goto error; 265 goto error;
266 266
267 x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len); 267 x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len);
268 if (x->props.mode == XFRM_MODE_TUNNEL) 268 if (x->props.mode == XFRM_MODE_TUNNEL)
269 x->props.header_len += sizeof(struct iphdr); 269 x->props.header_len += sizeof(struct iphdr);