1
Switch crypto system to older non-block cipher algorithms.
3
diff -upr pre/net/mac80211/aes_ccm.c post/net/mac80211/aes_ccm.c
4
--- pre/net/mac80211/aes_ccm.c 2007-03-30 11:18:33.000000000 -0700
5
+++ post/net/mac80211/aes_ccm.c 2007-03-30 11:18:33.000000000 -0700
8
#include <linux/types.h>
9
#include <linux/crypto.h>
10
-#include <linux/err.h>
11
#include <asm/scatterlist.h>
13
#include <net/mac80211.h>
18
-static void ieee80211_aes_encrypt(struct crypto_cipher *tfm,
19
+static void ieee80211_aes_encrypt(struct crypto_tfm *tfm,
20
const u8 pt[16], u8 ct[16])
22
- crypto_cipher_encrypt_one(tfm, ct, pt);
23
+ struct scatterlist src, dst;
25
+ src.page = virt_to_page(pt);
26
+ src.offset = offset_in_page(pt);
27
+ src.length = AES_BLOCK_LEN;
29
+ dst.page = virt_to_page(ct);
30
+ dst.offset = offset_in_page(ct);
31
+ dst.length = AES_BLOCK_LEN;
33
+ crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
37
-static inline void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
38
+static inline void aes_ccm_prepare(struct crypto_tfm *tfm, u8 *b_0, u8 *aad,
39
u8 *b, u8 *s_0, u8 *a)
42
@@ -52,7 +61,7 @@ static inline void aes_ccm_prepare(struc
46
-void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
47
+void ieee80211_aes_ccm_encrypt(struct crypto_tfm *tfm, u8 *scratch,
48
u8 *b_0, u8 *aad, u8 *data, size_t data_len,
51
@@ -91,7 +100,7 @@ void ieee80211_aes_ccm_encrypt(struct cr
55
-int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
56
+int ieee80211_aes_ccm_decrypt(struct crypto_tfm *tfm, u8 *scratch,
57
u8 *b_0, u8 *aad, u8 *cdata, size_t data_len,
60
@@ -134,12 +143,12 @@ int ieee80211_aes_ccm_decrypt(struct cry
64
-struct crypto_cipher * ieee80211_aes_key_setup_encrypt(const u8 key[])
65
+struct crypto_tfm * ieee80211_aes_key_setup_encrypt(const u8 key[])
67
- struct crypto_cipher *tfm;
68
+ struct crypto_tfm *tfm;
70
- tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
72
+ tfm = crypto_alloc_tfm("aes", 0);
76
crypto_cipher_setkey(tfm, key, ALG_CCMP_KEY_LEN);
77
@@ -148,8 +157,8 @@ struct crypto_cipher * ieee80211_aes_key
81
-void ieee80211_aes_key_free(struct crypto_cipher *tfm)
82
+void ieee80211_aes_key_free(struct crypto_tfm *tfm)
85
- crypto_free_cipher(tfm);
86
+ crypto_free_tfm(tfm);
88
diff -upr pre/net/mac80211/aes_ccm.h post/net/mac80211/aes_ccm.h
89
--- pre/net/mac80211/aes_ccm.h 2007-03-30 11:18:33.000000000 -0700
90
+++ post/net/mac80211/aes_ccm.h 2007-03-30 11:18:33.000000000 -0700
93
#define AES_BLOCK_LEN 16
95
-struct crypto_cipher * ieee80211_aes_key_setup_encrypt(const u8 key[]);
96
-void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
97
+struct crypto_tfm * ieee80211_aes_key_setup_encrypt(const u8 key[]);
98
+void ieee80211_aes_ccm_encrypt(struct crypto_tfm *tfm, u8 *scratch,
99
u8 *b_0, u8 *aad, u8 *data, size_t data_len,
101
-int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
102
+int ieee80211_aes_ccm_decrypt(struct crypto_tfm *tfm, u8 *scratch,
103
u8 *b_0, u8 *aad, u8 *cdata, size_t data_len,
105
-void ieee80211_aes_key_free(struct crypto_cipher *tfm);
106
+void ieee80211_aes_key_free(struct crypto_tfm *tfm);
108
#endif /* AES_CCM_H */
109
diff -upr pre/net/mac80211/ieee80211_i.h post/net/mac80211/ieee80211_i.h
110
--- pre/net/mac80211/ieee80211_i.h 2007-03-30 11:18:33.000000000 -0700
111
+++ post/net/mac80211/ieee80211_i.h 2007-03-30 11:18:33.000000000 -0700
112
@@ -479,8 +479,8 @@ struct ieee80211_local {
113
int long_retry_limit; /* dot11LongRetryLimit */
114
int short_preamble; /* use short preamble with IEEE 802.11b */
116
- struct crypto_blkcipher *wep_tx_tfm;
117
- struct crypto_blkcipher *wep_rx_tfm;
118
+ struct crypto_tfm *wep_tx_tfm;
119
+ struct crypto_tfm *wep_rx_tfm;
121
int key_tx_rx_threshold; /* number of times any key can be used in TX
122
* or RX before generating a rekey
123
diff -upr pre/net/mac80211/ieee80211_key.h post/net/mac80211/ieee80211_key.h
124
--- pre/net/mac80211/ieee80211_key.h 2007-03-30 11:18:33.000000000 -0700
125
+++ post/net/mac80211/ieee80211_key.h 2007-03-30 11:19:08.000000000 -0700
128
#include <linux/types.h>
129
#include <linux/kref.h>
130
-#include <linux/crypto.h>
131
#include <net/mac80211.h>
134
@@ -63,7 +62,7 @@ struct ieee80211_key {
137
u8 rx_pn[NUM_RX_DATA_QUEUES][6];
138
- struct crypto_cipher *tfm;
139
+ struct crypto_tfm *tfm;
140
u32 replays; /* dot11RSNAStatsCCMPReplays */
141
/* scratch buffers for virt_to_page() (crypto API) */
142
#ifndef AES_BLOCK_LEN
143
diff -upr pre/net/mac80211/tkip.c post/net/mac80211/tkip.c
144
--- pre/net/mac80211/tkip.c 2007-03-30 11:18:33.000000000 -0700
145
+++ post/net/mac80211/tkip.c 2007-03-30 11:18:33.000000000 -0700
146
@@ -218,8 +218,7 @@ void ieee80211_tkip_gen_rc4key(struct ie
147
* headroom of eight octets for IV and Ext. IV and taildroom of four octets
148
* for ICV. @payload_len is the length of payload (_not_ including extra
149
* headroom and tailroom). @ta is the transmitter addresses. */
150
-void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
151
- struct ieee80211_key *key,
152
+void ieee80211_tkip_encrypt_data(struct crypto_tfm *tfm, struct ieee80211_key *key,
153
u8 *pos, size_t payload_len, u8 *ta)
156
@@ -234,8 +233,7 @@ void ieee80211_tkip_encrypt_data(struct
157
* beginning of the buffer containing IEEE 802.11 header payload, i.e.,
158
* including IV, Ext. IV, real data, Michael MIC, ICV. @payload_len is the
159
* length of payload, including IV, Ext. IV, MIC, ICV. */
160
-int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
161
- struct ieee80211_key *key,
162
+int ieee80211_tkip_decrypt_data(struct crypto_tfm *tfm, struct ieee80211_key *key,
163
u8 *payload, size_t payload_len, u8 *ta,
164
int only_iv, int queue)
166
diff -upr pre/net/mac80211/tkip.h post/net/mac80211/tkip.h
167
--- pre/net/mac80211/tkip.h 2007-03-30 11:18:33.000000000 -0700
168
+++ post/net/mac80211/tkip.h 2007-03-30 11:18:33.000000000 -0700
169
@@ -19,7 +19,7 @@ void ieee80211_tkip_gen_phase1key(struct
171
void ieee80211_tkip_gen_rc4key(struct ieee80211_key *key, u8 *ta,
173
-void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
174
+void ieee80211_tkip_encrypt_data(struct crypto_tfm *tfm,
175
struct ieee80211_key *key,
176
u8 *pos, size_t payload_len, u8 *ta);
178
@@ -28,8 +28,7 @@ enum {
179
TKIP_DECRYPT_INVALID_KEYIDX = -2,
180
TKIP_DECRYPT_REPLAY = -3,
182
-int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
183
- struct ieee80211_key *key,
184
+int ieee80211_tkip_decrypt_data(struct crypto_tfm *tfm, struct ieee80211_key *key,
185
u8 *payload, size_t payload_len, u8 *ta,
186
int only_iv, int queue);
188
diff -upr pre/net/mac80211/wep.c post/net/mac80211/wep.c
189
--- pre/net/mac80211/wep.c 2007-03-30 11:18:33.000000000 -0700
190
+++ post/net/mac80211/wep.c 2007-03-30 11:18:33.000000000 -0700
192
#include <linux/compiler.h>
193
#include <linux/crc32.h>
194
#include <linux/crypto.h>
195
-#include <linux/err.h>
196
-#include <linux/mm.h>
197
#include <asm/scatterlist.h>
199
#include <net/mac80211.h>
200
@@ -28,15 +26,13 @@ int ieee80211_wep_init(struct ieee80211_
201
/* start WEP IV from a random value */
202
get_random_bytes(&local->wep_iv, WEP_IV_LEN);
204
- local->wep_tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
206
- if (IS_ERR(local->wep_tx_tfm))
207
+ local->wep_tx_tfm = crypto_alloc_tfm("arc4", 0);
208
+ if (!local->wep_tx_tfm)
211
- local->wep_rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
213
- if (IS_ERR(local->wep_rx_tfm)) {
214
- crypto_free_blkcipher(local->wep_tx_tfm);
215
+ local->wep_rx_tfm = crypto_alloc_tfm("arc4", 0);
216
+ if (!local->wep_rx_tfm) {
217
+ crypto_free_tfm(local->wep_tx_tfm);
221
@@ -45,8 +41,8 @@ int ieee80211_wep_init(struct ieee80211_
223
void ieee80211_wep_free(struct ieee80211_local *local)
225
- crypto_free_blkcipher(local->wep_tx_tfm);
226
- crypto_free_blkcipher(local->wep_rx_tfm);
227
+ crypto_free_tfm(local->wep_tx_tfm);
228
+ crypto_free_tfm(local->wep_rx_tfm);
231
static inline int ieee80211_wep_weak_iv(u32 iv, int keylen)
232
@@ -127,21 +123,20 @@ void ieee80211_wep_remove_iv(struct ieee
233
/* Perform WEP encryption using given key. data buffer must have tailroom
234
* for 4-byte ICV. data_len must not include this ICV. Note: this function
235
* does _not_ add IV. data = RC4(data | CRC32(data)) */
236
-void ieee80211_wep_encrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
237
+void ieee80211_wep_encrypt_data(struct crypto_tfm *tfm, u8 *rc4key,
238
size_t klen, u8 *data, size_t data_len)
240
- struct blkcipher_desc desc = { .tfm = tfm };
241
struct scatterlist sg;
244
icv = (__le32 *)(data + data_len);
245
*icv = cpu_to_le32(~crc32_le(~0, data, data_len));
247
- crypto_blkcipher_setkey(tfm, rc4key, klen);
248
+ crypto_cipher_setkey(tfm, rc4key, klen);
249
sg.page = virt_to_page(data);
250
sg.offset = offset_in_page(data);
251
sg.length = data_len + WEP_ICV_LEN;
252
- crypto_blkcipher_encrypt(&desc, &sg, &sg, sg.length);
253
+ crypto_cipher_encrypt(tfm, &sg, &sg, sg.length);
257
@@ -196,18 +191,17 @@ int ieee80211_wep_encrypt(struct ieee802
258
/* Perform WEP decryption using given key. data buffer includes encrypted
259
* payload, including 4-byte ICV, but _not_ IV. data_len must not include ICV.
260
* Return 0 on success and -1 on ICV mismatch. */
261
-int ieee80211_wep_decrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
262
+int ieee80211_wep_decrypt_data(struct crypto_tfm *tfm, u8 *rc4key,
263
size_t klen, u8 *data, size_t data_len)
265
- struct blkcipher_desc desc = { .tfm = tfm };
266
struct scatterlist sg;
269
- crypto_blkcipher_setkey(tfm, rc4key, klen);
270
+ crypto_cipher_setkey(tfm, rc4key, klen);
271
sg.page = virt_to_page(data);
272
sg.offset = offset_in_page(data);
273
sg.length = data_len + WEP_ICV_LEN;
274
- crypto_blkcipher_decrypt(&desc, &sg, &sg, sg.length);
275
+ crypto_cipher_decrypt(tfm, &sg, &sg, sg.length);
277
crc = cpu_to_le32(~crc32_le(~0, data, data_len));
278
if (memcmp(&crc, data + data_len, WEP_ICV_LEN) != 0)
279
diff -upr pre/net/mac80211/wep.h post/net/mac80211/wep.h
280
--- pre/net/mac80211/wep.h 2007-03-30 11:18:33.000000000 -0700
281
+++ post/net/mac80211/wep.h 2007-03-30 11:18:33.000000000 -0700
282
@@ -26,10 +26,10 @@ u8 * ieee80211_wep_add_iv(struct ieee802
283
void ieee80211_wep_remove_iv(struct ieee80211_local *local,
285
struct ieee80211_key *key);
286
-void ieee80211_wep_encrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
287
- size_t klen, u8 *data, size_t data_len);
288
-int ieee80211_wep_decrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
289
- size_t klen, u8 *data, size_t data_len);
290
+void ieee80211_wep_encrypt_data(struct crypto_tfm *tfm, u8 *rc4key, size_t klen,
291
+ u8 *data, size_t data_len);
292
+int ieee80211_wep_decrypt_data(struct crypto_tfm *tfm, u8 *rc4key, size_t klen,
293
+ u8 *data, size_t data_len);
294
int ieee80211_wep_encrypt(struct ieee80211_local *local, struct sk_buff *skb,
295
struct ieee80211_key *key);
296
int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,