From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org, linux-wireless@vger.kernel.org,
Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Subject: [PATCH 6/7] net/mac80211: convert wep from arc4 to arc4blk
Date: Sat, 3 Apr 2010 09:49:28 +0200 [thread overview]
Message-ID: <1270280969-11357-7-git-send-email-sebastian@breakpoint.cc> (raw)
In-Reply-To: <1270280969-11357-1-git-send-email-sebastian@breakpoint.cc>
ecb(arc4) is getting replaced by arc4 which is a blkcipher by itself.
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
---
net/mac80211/Kconfig | 3 +--
net/mac80211/wep.c | 11 +++++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index a10d508..d14fe06 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -2,8 +2,7 @@ config MAC80211
tristate "Generic IEEE 802.11 Networking Stack (mac80211)"
depends on CFG80211
select CRYPTO
- select CRYPTO_ECB
- select CRYPTO_ARC4
+ select CRYPTO_ARC4BLK
select CRYPTO_AES
select CRC32
---help---
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 247123f..4314b50 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -17,6 +17,7 @@
#include <linux/err.h>
#include <linux/mm.h>
#include <linux/scatterlist.h>
+#include <crypto/arc4.h>
#include <asm/unaligned.h>
#include <net/mac80211.h>
@@ -29,12 +30,12 @@ int ieee80211_wep_init(struct ieee80211_local *local)
/* start WEP IV from a random value */
get_random_bytes(&local->wep_iv, WEP_IV_LEN);
- local->wep_tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
+ local->wep_tx_tfm = crypto_alloc_blkcipher("arc4", 0,
CRYPTO_ALG_ASYNC);
if (IS_ERR(local->wep_tx_tfm))
return PTR_ERR(local->wep_tx_tfm);
- local->wep_rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
+ local->wep_rx_tfm = crypto_alloc_blkcipher("arc4", 0,
CRYPTO_ALG_ASYNC);
if (IS_ERR(local->wep_rx_tfm)) {
crypto_free_blkcipher(local->wep_tx_tfm);
@@ -125,13 +126,14 @@ void ieee80211_wep_encrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
size_t klen, u8 *data, size_t data_len)
{
struct blkcipher_desc desc = { .tfm = tfm };
+ struct arc4_iv *iv = crypto_blkcipher_crt(tfm)->iv;
struct scatterlist sg;
__le32 icv;
icv = cpu_to_le32(~crc32_le(~0, data, data_len));
put_unaligned(icv, (__le32 *)(data + data_len));
- crypto_blkcipher_setkey(tfm, rc4key, klen);
+ arc4_setup_iv(iv, rc4key, klen);
sg_init_one(&sg, data, data_len + WEP_ICV_LEN);
crypto_blkcipher_encrypt(&desc, &sg, &sg, sg.length);
}
@@ -181,10 +183,11 @@ int ieee80211_wep_decrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
size_t klen, u8 *data, size_t data_len)
{
struct blkcipher_desc desc = { .tfm = tfm };
+ struct arc4_iv *iv = crypto_blkcipher_crt(tfm)->iv;
struct scatterlist sg;
__le32 crc;
- crypto_blkcipher_setkey(tfm, rc4key, klen);
+ arc4_setup_iv(iv, rc4key, klen);
sg_init_one(&sg, data, data_len + WEP_ICV_LEN);
crypto_blkcipher_decrypt(&desc, &sg, &sg, sg.length);
--
1.6.6
next prev parent reply other threads:[~2010-04-03 7:49 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-03 7:49 Convert arc4 from a cipher into a block cipher Sebastian Andrzej Siewior
2010-04-03 7:49 ` [PATCH 1/7] crypto: rename arc4 Sebastian Andrzej Siewior
[not found] ` <1270280969-11357-1-git-send-email-sebastian-E0PNVn5OA6ohrxcnuTQ+TQ@public.gmane.org>
2010-04-03 7:49 ` [PATCH 2/7] crypto: add blkcipher implementation of ARC4 Sebastian Andrzej Siewior
2010-04-05 8:42 ` Herbert Xu
2010-04-05 17:04 ` [PATCH v2] " Sebastian Andrzej Siewior
2010-04-06 12:44 ` Herbert Xu
2010-04-06 20:30 ` Sebastian Andrzej Siewior
2010-04-07 0:31 ` Herbert Xu
2010-04-07 8:23 ` Sebastian Andrzej Siewior
2010-04-07 9:25 ` Herbert Xu
2010-04-07 6:19 ` Pavel Roskin
2010-04-07 8:29 ` Sebastian Andrzej Siewior
2010-04-07 16:31 ` Pavel Roskin
2010-04-05 20:33 ` Convert arc4 from a cipher into a block cipher Pavel Roskin
2010-04-06 0:39 ` Herbert Xu
2010-04-03 7:49 ` [PATCH 3/7] crypto/testmgr: add testing for arc4 based on ecb(arc4) Sebastian Andrzej Siewior
2010-04-07 6:29 ` Pavel Roskin
2010-04-07 9:29 ` Herbert Xu
[not found] ` <20100407092907.GB29993-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2010-04-08 7:58 ` Sebastian Andrzej Siewior
2010-04-03 7:49 ` [PATCH 4/7] net/wireless: switch lib80211_crypt_tkip from arc4 to arc4blk Sebastian Andrzej Siewior
[not found] ` <1270280969-11357-5-git-send-email-sebastian-E0PNVn5OA6ohrxcnuTQ+TQ@public.gmane.org>
2010-04-05 17:13 ` John W. Linville
2010-04-03 7:49 ` [PATCH 5/7] net/wireless: switch lib80211_crypt_wep " Sebastian Andrzej Siewior
2010-04-05 17:13 ` John W. Linville
2010-04-03 7:49 ` Sebastian Andrzej Siewior [this message]
2010-04-05 17:15 ` [PATCH 6/7] net/mac80211: convert wep " John W. Linville
2010-04-03 7:49 ` [PATCH 7/7] net/ppp_mppe: convert " Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1270280969-11357-7-git-send-email-sebastian@breakpoint.cc \
--to=sebastian@breakpoint.cc \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).