diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-10-22 13:44:26 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-10-22 15:19:56 -0400 |
commit | fa05f1286be25a8ce915c5dd492aea61126b3f33 (patch) | |
tree | 07d6d32733f3272d588410a64c0cfa25d794e3be /net/ieee80211 | |
parent | 60c74f81933635bb4ccb4ee6f31909c51f5cd230 (diff) |
Update net/ to use sg helpers
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'net/ieee80211')
-rw-r--r-- | net/ieee80211/ieee80211_crypt_tkip.c | 13 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_wep.c | 8 |
2 files changed, 7 insertions, 14 deletions
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c index 72e6ab66834f..c796661a021b 100644 --- a/net/ieee80211/ieee80211_crypt_tkip.c +++ b/net/ieee80211/ieee80211_crypt_tkip.c | |||
@@ -390,9 +390,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
390 | icv[3] = crc >> 24; | 390 | icv[3] = crc >> 24; |
391 | 391 | ||
392 | crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); | 392 | crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); |
393 | sg.page = virt_to_page(pos); | 393 | sg_init_one(&sg, pos, len + 4); |
394 | sg.offset = offset_in_page(pos); | ||
395 | sg.length = len + 4; | ||
396 | return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); | 394 | return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); |
397 | } | 395 | } |
398 | 396 | ||
@@ -485,9 +483,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
485 | plen = skb->len - hdr_len - 12; | 483 | plen = skb->len - hdr_len - 12; |
486 | 484 | ||
487 | crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); | 485 | crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); |
488 | sg.page = virt_to_page(pos); | 486 | sg_init_one(&sg, pos, plen + 4); |
489 | sg.offset = offset_in_page(pos); | ||
490 | sg.length = plen + 4; | ||
491 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { | 487 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { |
492 | if (net_ratelimit()) { | 488 | if (net_ratelimit()) { |
493 | printk(KERN_DEBUG ": TKIP: failed to decrypt " | 489 | printk(KERN_DEBUG ": TKIP: failed to decrypt " |
@@ -539,11 +535,12 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, | |||
539 | printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); | 535 | printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); |
540 | return -1; | 536 | return -1; |
541 | } | 537 | } |
542 | sg[0].page = virt_to_page(hdr); | 538 | sg_init_table(sg, 2); |
539 | sg_set_page(&sg[0], virt_to_page(hdr)); | ||
543 | sg[0].offset = offset_in_page(hdr); | 540 | sg[0].offset = offset_in_page(hdr); |
544 | sg[0].length = 16; | 541 | sg[0].length = 16; |
545 | 542 | ||
546 | sg[1].page = virt_to_page(data); | 543 | sg_set_page(&sg[1], virt_to_page(data)); |
547 | sg[1].offset = offset_in_page(data); | 544 | sg[1].offset = offset_in_page(data); |
548 | sg[1].length = data_len; | 545 | sg[1].length = data_len; |
549 | 546 | ||
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c index 8d182459344e..0af6103d715c 100644 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c | |||
@@ -170,9 +170,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
170 | icv[3] = crc >> 24; | 170 | icv[3] = crc >> 24; |
171 | 171 | ||
172 | crypto_blkcipher_setkey(wep->tx_tfm, key, klen); | 172 | crypto_blkcipher_setkey(wep->tx_tfm, key, klen); |
173 | sg.page = virt_to_page(pos); | 173 | sg_init_one(&sg, pos, len + 4); |
174 | sg.offset = offset_in_page(pos); | ||
175 | sg.length = len + 4; | ||
176 | return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); | 174 | return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); |
177 | } | 175 | } |
178 | 176 | ||
@@ -212,9 +210,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
212 | plen = skb->len - hdr_len - 8; | 210 | plen = skb->len - hdr_len - 8; |
213 | 211 | ||
214 | crypto_blkcipher_setkey(wep->rx_tfm, key, klen); | 212 | crypto_blkcipher_setkey(wep->rx_tfm, key, klen); |
215 | sg.page = virt_to_page(pos); | 213 | sg_init_one(&sg, pos, plen + 4); |
216 | sg.offset = offset_in_page(pos); | ||
217 | sg.length = plen + 4; | ||
218 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) | 214 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) |
219 | return -7; | 215 | return -7; |
220 | 216 | ||