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