aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2008-02-13 01:50:35 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-13 01:50:35 -0500
commitb318e0e4ef4e85812c25afa19f75addccc834cd4 (patch)
tree95d51df1aa01978a99e763cd92fd6f7f4647bf20 /net/ipv4
parent45b503548210fe6f23e92b856421c2a3f05fd034 (diff)
[IPSEC]: Fix bogus usage of u64 on input sequence number
Al Viro spotted a bogus use of u64 on the input sequence number which is big-endian. This patch fixes it by giving the input sequence number its own member in the xfrm_skb_cb structure. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ah4.c2
-rw-r--r--net/ipv4/esp4.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index 9d4555ec0b59..8219b7e0968d 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -96,7 +96,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb)
96 96
97 ah->reserved = 0; 97 ah->reserved = 0;
98 ah->spi = x->id.spi; 98 ah->spi = x->id.spi;
99 ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq); 99 ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output);
100 100
101 spin_lock_bh(&x->lock); 101 spin_lock_bh(&x->lock);
102 err = ah_mac_digest(ahp, skb, ah->auth_data); 102 err = ah_mac_digest(ahp, skb, ah->auth_data);
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 258d17631b4b..091e6709f831 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -199,7 +199,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
199 } 199 }
200 200
201 esph->spi = x->id.spi; 201 esph->spi = x->id.spi;
202 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq); 202 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output);
203 203
204 sg_init_table(sg, nfrags); 204 sg_init_table(sg, nfrags);
205 skb_to_sgvec(skb, sg, 205 skb_to_sgvec(skb, sg,
@@ -210,7 +210,8 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
210 aead_givcrypt_set_callback(req, 0, esp_output_done, skb); 210 aead_givcrypt_set_callback(req, 0, esp_output_done, skb);
211 aead_givcrypt_set_crypt(req, sg, sg, clen, iv); 211 aead_givcrypt_set_crypt(req, sg, sg, clen, iv);
212 aead_givcrypt_set_assoc(req, asg, sizeof(*esph)); 212 aead_givcrypt_set_assoc(req, asg, sizeof(*esph));
213 aead_givcrypt_set_giv(req, esph->enc_data, XFRM_SKB_CB(skb)->seq); 213 aead_givcrypt_set_giv(req, esph->enc_data,
214 XFRM_SKB_CB(skb)->seq.output);
214 215
215 ESP_SKB_CB(skb)->tmp = tmp; 216 ESP_SKB_CB(skb)->tmp = tmp;
216 err = crypto_aead_givencrypt(req); 217 err = crypto_aead_givencrypt(req);