aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/esp4.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/esp4.c')
-rw-r--r--net/ipv4/esp4.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 93153d105619..66eb4968b910 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -60,7 +60,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
60 60
61 skb_push(skb, -skb_network_offset(skb)); 61 skb_push(skb, -skb_network_offset(skb));
62 top_iph = ip_hdr(skb); 62 top_iph = ip_hdr(skb);
63 esph = (struct ip_esp_hdr *)skb_transport_header(skb); 63 esph = ip_esp_hdr(skb);
64 top_iph->tot_len = htons(skb->len + alen); 64 top_iph->tot_len = htons(skb->len + alen);
65 *(skb_tail_pointer(trailer) - 1) = *skb_mac_header(skb); 65 *(skb_tail_pointer(trailer) - 1) = *skb_mac_header(skb);
66 *skb_mac_header(skb) = IPPROTO_ESP; 66 *skb_mac_header(skb) = IPPROTO_ESP;
@@ -157,7 +157,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
157 struct sk_buff *trailer; 157 struct sk_buff *trailer;
158 int blksize = ALIGN(crypto_blkcipher_blocksize(tfm), 4); 158 int blksize = ALIGN(crypto_blkcipher_blocksize(tfm), 4);
159 int alen = esp->auth.icv_trunc_len; 159 int alen = esp->auth.icv_trunc_len;
160 int elen = skb->len - sizeof(struct ip_esp_hdr) - esp->conf.ivlen - alen; 160 int elen = skb->len - sizeof(*esph) - esp->conf.ivlen - alen;
161 int nfrags; 161 int nfrags;
162 int ihl; 162 int ihl;
163 u8 nexthdr[2]; 163 u8 nexthdr[2];
@@ -165,7 +165,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
165 int padlen; 165 int padlen;
166 int err; 166 int err;
167 167
168 if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr))) 168 if (!pskb_may_pull(skb, sizeof(*esph)))
169 goto out; 169 goto out;
170 170
171 if (elen <= 0 || (elen & (blksize-1))) 171 if (elen <= 0 || (elen & (blksize-1)))
@@ -193,7 +193,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
193 193
194 skb->ip_summed = CHECKSUM_NONE; 194 skb->ip_summed = CHECKSUM_NONE;
195 195
196 esph = (struct ip_esp_hdr*)skb->data; 196 esph = (struct ip_esp_hdr *)skb->data;
197 197
198 /* Get ivec. This can be wrong, check against another impls. */ 198 /* Get ivec. This can be wrong, check against another impls. */
199 if (esp->conf.ivlen) 199 if (esp->conf.ivlen)
@@ -206,7 +206,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
206 if (!sg) 206 if (!sg)
207 goto out; 207 goto out;
208 } 208 }
209 skb_to_sgvec(skb, sg, sizeof(struct ip_esp_hdr) + esp->conf.ivlen, elen); 209 skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, elen);
210 err = crypto_blkcipher_decrypt(&desc, sg, sg, elen); 210 err = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
211 if (unlikely(sg != &esp->sgbuf[0])) 211 if (unlikely(sg != &esp->sgbuf[0]))
212 kfree(sg); 212 kfree(sg);