From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: linux-crypto@vger.kernel.org,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Eric Biggers <ebiggers@google.com>,
Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [PATCH v3 2/7] net/mac80211: move WEP handling to ARC4 library interface
Date: Tue, 11 Jun 2019 10:54:20 -0700 [thread overview]
Message-ID: <20190611175419.GB66728@gmail.com> (raw)
In-Reply-To: <20190611134750.2974-3-ard.biesheuvel@linaro.org>
On Tue, Jun 11, 2019 at 03:47:45PM +0200, Ard Biesheuvel wrote:
>
> -void ieee80211_wep_free(struct ieee80211_local *local)
> -{
> - if (!IS_ERR(local->wep_tx_tfm))
> - crypto_free_cipher(local->wep_tx_tfm);
> - if (!IS_ERR(local->wep_rx_tfm))
> - crypto_free_cipher(local->wep_rx_tfm);
> -}
> -
This function was removed, but its declaration in net/mac80211/wep.h was not.
> static inline bool ieee80211_wep_weak_iv(u32 iv, int keylen)
> {
> /*
> @@ -131,21 +110,16 @@ static void ieee80211_wep_remove_iv(struct ieee80211_local *local,
> /* Perform WEP encryption using given key. data buffer must have tailroom
> * for 4-byte ICV. data_len must not include this ICV. Note: this function
> * does _not_ add IV. data = RC4(data | CRC32(data)) */
> -int ieee80211_wep_encrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
> +int ieee80211_wep_encrypt_data(struct arc4_ctx *ctx, u8 *rc4key,
> size_t klen, u8 *data, size_t data_len)
> {
> __le32 icv;
> - int i;
> -
> - if (IS_ERR(tfm))
> - return -1;
>
> icv = cpu_to_le32(~crc32_le(~0, data, data_len));
> put_unaligned(icv, (__le32 *)(data + data_len));
>
> - crypto_cipher_setkey(tfm, rc4key, klen);
> - for (i = 0; i < data_len + IEEE80211_WEP_ICV_LEN; i++)
> - crypto_cipher_encrypt_one(tfm, data + i, data + i);
> + arc4_setkey(ctx, rc4key, klen);
> + arc4_crypt(ctx, data, data, data_len + IEEE80211_WEP_ICV_LEN);
How about adding:
memzero_explicit(ctx, sizeof(*ctx));
> -int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
> +int ieee80211_wep_decrypt_data(struct arc4_ctx *ctx, u8 *rc4key,
> size_t klen, u8 *data, size_t data_len)
> {
> __le32 crc;
> - int i;
> -
> - if (IS_ERR(tfm))
> - return -1;
>
> - crypto_cipher_setkey(tfm, rc4key, klen);
> - for (i = 0; i < data_len + IEEE80211_WEP_ICV_LEN; i++)
> - crypto_cipher_decrypt_one(tfm, data + i, data + i);
> + arc4_setkey(ctx, rc4key, klen);
> + arc4_crypt(ctx, data, data, data_len + IEEE80211_WEP_ICV_LEN);
Same here.
- Eric
next prev parent reply other threads:[~2019-06-11 17:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-11 13:47 [PATCH v3 0/7] crypto: rc4 cleanup Ard Biesheuvel
2019-06-11 13:47 ` [PATCH v3 1/7] crypto: arc4 - refactor arc4 core code into separate library Ard Biesheuvel
2019-06-11 13:47 ` [PATCH v3 2/7] net/mac80211: move WEP handling to ARC4 library interface Ard Biesheuvel
2019-06-11 13:51 ` Johannes Berg
2019-06-11 13:53 ` Ard Biesheuvel
2019-06-11 13:55 ` Johannes Berg
2019-06-11 13:56 ` Ard Biesheuvel
2019-06-11 13:58 ` Johannes Berg
2019-06-11 17:54 ` Eric Biggers [this message]
2019-06-11 13:47 ` [PATCH v3 3/7] net/lib80211: move WEP handling to ARC4 library code Ard Biesheuvel
2019-06-11 17:59 ` Eric Biggers
2019-06-11 13:47 ` [PATCH v3 4/7] net/lib80211: move TKIP " Ard Biesheuvel
2019-06-11 13:47 ` [PATCH v3 5/7] crypto: arc4 - remove cipher implementation Ard Biesheuvel
2019-06-11 17:39 ` Eric Biggers
2019-06-12 15:33 ` Eric Biggers
2019-06-12 15:39 ` Ard Biesheuvel
2019-06-11 13:47 ` [PATCH v3 6/7] ppp: mppe: switch to RC4 library interface Ard Biesheuvel
2019-06-11 13:47 ` Ard Biesheuvel
2019-06-11 18:08 ` Eric Biggers
2019-06-11 18:08 ` Eric Biggers
2019-06-11 13:47 ` [PATCH v3 7/7] fs: cifs: " Ard Biesheuvel
2019-06-11 18:17 ` Eric Biggers
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=20190611175419.GB66728@gmail.com \
--to=ebiggers@kernel.org \
--cc=ard.biesheuvel@linaro.org \
--cc=davem@davemloft.net \
--cc=ebiggers@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=johannes@sipsolutions.net \
--cc=linux-crypto@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.