~ubuntu-branches/ubuntu/hardy/linux-backports-modules-2.6.24/hardy-security

« back to all changes in this revision

Viewing changes to updates/wireless/iwlwifi/mac80211/patches/block-cipher.patch

  • Committer: Bazaar Package Importer
  • Author(s): , Ben Collins
  • Date: 2008-04-02 06:59:04 UTC
  • Revision ID: james.westby@ubuntu.com-20080402065904-e5knh2gn2hms3xbb
Tags: 2.6.24-14.11
[Ben Collins]

* iwlwifi: Update to iwlwifi-1.2.25 and mac80211-10.0.4
  - LP: #200950
* ubuntu: Slight cleanups to module hiearchy and Makefiles
* mac80211: Enable LED triggers
* iwlwifi: Add LED trigger support (rx and tx only)
  - LP: #176090

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Switch crypto system to older non-block cipher algorithms.
 
2
-----
 
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
 
6
@@ -9,7 +9,6 @@
 
7
 
 
8
 #include <linux/types.h>
 
9
 #include <linux/crypto.h>
 
10
-#include <linux/err.h>
 
11
 #include <asm/scatterlist.h>
 
12
 
 
13
 #include <net/mac80211.h>
 
14
@@ -17,14 +16,24 @@
 
15
 #include "aes_ccm.h"
 
16
 
 
17
 
 
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])
 
21
 {
 
22
-       crypto_cipher_encrypt_one(tfm, ct, pt);
 
23
+       struct scatterlist src, dst;
 
24
+
 
25
+       src.page = virt_to_page(pt);
 
26
+       src.offset = offset_in_page(pt);
 
27
+       src.length = AES_BLOCK_LEN;
 
28
+
 
29
+       dst.page = virt_to_page(ct);
 
30
+       dst.offset = offset_in_page(ct);
 
31
+       dst.length = AES_BLOCK_LEN;
 
32
+
 
33
+       crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
 
34
 }
 
35
 
 
36
 
 
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)
 
40
 {
 
41
        int i;
 
42
@@ -52,7 +61,7 @@ static inline void aes_ccm_prepare(struc
 
43
 }
 
44
 
 
45
 
 
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,
 
49
                               u8 *cdata, u8 *mic)
 
50
 {
 
51
@@ -91,7 +100,7 @@ void ieee80211_aes_ccm_encrypt(struct cr
 
52
 }
 
53
 
 
54
 
 
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,
 
58
                              u8 *mic, u8 *data)
 
59
 {
 
60
@@ -134,12 +143,12 @@ int ieee80211_aes_ccm_decrypt(struct cry
 
61
 }
 
62
 
 
63
 
 
64
-struct crypto_cipher * ieee80211_aes_key_setup_encrypt(const u8 key[])
 
65
+struct crypto_tfm * ieee80211_aes_key_setup_encrypt(const u8 key[])
 
66
 {
 
67
-       struct crypto_cipher *tfm;
 
68
+       struct crypto_tfm *tfm;
 
69
 
 
70
-       tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
 
71
-       if (IS_ERR(tfm))
 
72
+       tfm = crypto_alloc_tfm("aes", 0);
 
73
+       if (!tfm)
 
74
                return NULL;
 
75
 
 
76
        crypto_cipher_setkey(tfm, key, ALG_CCMP_KEY_LEN);
 
77
@@ -148,8 +157,8 @@ struct crypto_cipher * ieee80211_aes_key
 
78
 }
 
79
 
 
80
 
 
81
-void ieee80211_aes_key_free(struct crypto_cipher *tfm)
 
82
+void ieee80211_aes_key_free(struct crypto_tfm *tfm)
 
83
 {
 
84
        if (tfm)
 
85
-               crypto_free_cipher(tfm);
 
86
+               crypto_free_tfm(tfm);
 
87
 }
 
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
 
91
@@ -14,13 +14,13 @@
 
92
 
 
93
 #define AES_BLOCK_LEN 16
 
94
 
 
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,
 
100
                               u8 *cdata, u8 *mic);
 
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,
 
104
                              u8 *mic, u8 *data);
 
105
-void ieee80211_aes_key_free(struct crypto_cipher *tfm);
 
106
+void ieee80211_aes_key_free(struct crypto_tfm *tfm);
 
107
 
 
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 */
 
115
 
 
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;
 
120
        u32 wep_iv;
 
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
 
126
@@ -12,7 +12,6 @@
 
127
 
 
128
 #include <linux/types.h>
 
129
 #include <linux/kref.h>
 
130
-#include <linux/crypto.h>
 
131
 #include <net/mac80211.h>
 
132
 
 
133
 /* ALG_TKIP
 
134
@@ -63,7 +62,7 @@ struct ieee80211_key {
 
135
                struct {
 
136
                        u8 tx_pn[6];
 
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)
 
154
 {
 
155
        u8 rc4key[16];
 
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)
 
165
 {
 
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
 
170
                                  u16 *phase1key);
 
171
 void ieee80211_tkip_gen_rc4key(struct ieee80211_key *key, u8 *ta,
 
172
                               u8 *rc4key);
 
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);
 
177
 enum {
 
178
@@ -28,8 +28,7 @@ enum {
 
179
        TKIP_DECRYPT_INVALID_KEYIDX = -2,
 
180
        TKIP_DECRYPT_REPLAY = -3,
 
181
 };
 
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);
 
187
 
 
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
 
191
@@ -14,8 +14,6 @@
 
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>
 
198
 
 
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);
 
203
 
 
204
-       local->wep_tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
 
205
-                                               CRYPTO_ALG_ASYNC);
 
206
-       if (IS_ERR(local->wep_tx_tfm))
 
207
+       local->wep_tx_tfm = crypto_alloc_tfm("arc4", 0);
 
208
+       if (!local->wep_tx_tfm)
 
209
                return -ENOMEM;
 
210
 
 
211
-       local->wep_rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
 
212
-                                               CRYPTO_ALG_ASYNC);
 
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);
 
218
                return -ENOMEM;
 
219
        }
 
220
 
 
221
@@ -45,8 +41,8 @@ int ieee80211_wep_init(struct ieee80211_
 
222
 
 
223
 void ieee80211_wep_free(struct ieee80211_local *local)
 
224
 {
 
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);
 
229
 }
 
230
 
 
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)
 
239
 {
 
240
-       struct blkcipher_desc desc = { .tfm = tfm };
 
241
        struct scatterlist sg;
 
242
        __le32 *icv;
 
243
 
 
244
        icv = (__le32 *)(data + data_len);
 
245
        *icv = cpu_to_le32(~crc32_le(~0, data, data_len));
 
246
 
 
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);
 
254
 }
 
255
 
 
256
 
 
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)
 
264
 {
 
265
-       struct blkcipher_desc desc = { .tfm = tfm };
 
266
        struct scatterlist sg;
 
267
        __le32 crc;
 
268
 
 
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);
 
276
 
 
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,
 
284
                             struct sk_buff *skb,
 
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,