diff options
Diffstat (limited to 'net/ieee80211/ieee80211_crypt_wep.c')
-rw-r--r-- | net/ieee80211/ieee80211_crypt_wep.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c index bec1d3470d39..b4d2514a0902 100644 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | #include <net/ieee80211.h> | 21 | #include <net/ieee80211.h> |
22 | 22 | ||
23 | |||
24 | #include <linux/crypto.h> | 23 | #include <linux/crypto.h> |
25 | #include <asm/scatterlist.h> | 24 | #include <asm/scatterlist.h> |
26 | #include <linux/crc32.h> | 25 | #include <linux/crc32.h> |
@@ -29,7 +28,6 @@ MODULE_AUTHOR("Jouni Malinen"); | |||
29 | MODULE_DESCRIPTION("Host AP crypt: WEP"); | 28 | MODULE_DESCRIPTION("Host AP crypt: WEP"); |
30 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
31 | 30 | ||
32 | |||
33 | struct prism2_wep_data { | 31 | struct prism2_wep_data { |
34 | u32 iv; | 32 | u32 iv; |
35 | #define WEP_KEY_LEN 13 | 33 | #define WEP_KEY_LEN 13 |
@@ -39,8 +37,7 @@ struct prism2_wep_data { | |||
39 | struct crypto_tfm *tfm; | 37 | struct crypto_tfm *tfm; |
40 | }; | 38 | }; |
41 | 39 | ||
42 | 40 | static void *prism2_wep_init(int keyidx) | |
43 | static void * prism2_wep_init(int keyidx) | ||
44 | { | 41 | { |
45 | struct prism2_wep_data *priv; | 42 | struct prism2_wep_data *priv; |
46 | 43 | ||
@@ -62,7 +59,7 @@ static void * prism2_wep_init(int keyidx) | |||
62 | 59 | ||
63 | return priv; | 60 | return priv; |
64 | 61 | ||
65 | fail: | 62 | fail: |
66 | if (priv) { | 63 | if (priv) { |
67 | if (priv->tfm) | 64 | if (priv->tfm) |
68 | crypto_free_tfm(priv->tfm); | 65 | crypto_free_tfm(priv->tfm); |
@@ -71,7 +68,6 @@ fail: | |||
71 | return NULL; | 68 | return NULL; |
72 | } | 69 | } |
73 | 70 | ||
74 | |||
75 | static void prism2_wep_deinit(void *priv) | 71 | static void prism2_wep_deinit(void *priv) |
76 | { | 72 | { |
77 | struct prism2_wep_data *_priv = priv; | 73 | struct prism2_wep_data *_priv = priv; |
@@ -80,7 +76,6 @@ static void prism2_wep_deinit(void *priv) | |||
80 | kfree(priv); | 76 | kfree(priv); |
81 | } | 77 | } |
82 | 78 | ||
83 | |||
84 | /* Perform WEP encryption on given skb that has at least 4 bytes of headroom | 79 | /* Perform WEP encryption on given skb that has at least 4 bytes of headroom |
85 | * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, | 80 | * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, |
86 | * so the payload length increases with 8 bytes. | 81 | * so the payload length increases with 8 bytes. |
@@ -143,7 +138,6 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
143 | return 0; | 138 | return 0; |
144 | } | 139 | } |
145 | 140 | ||
146 | |||
147 | /* Perform WEP decryption on given buffer. Buffer includes whole WEP part of | 141 | /* Perform WEP decryption on given buffer. Buffer includes whole WEP part of |
148 | * the frame: IV (4 bytes), encrypted payload (including SNAP header), | 142 | * the frame: IV (4 bytes), encrypted payload (including SNAP header), |
149 | * ICV (4 bytes). len includes both IV and ICV. | 143 | * ICV (4 bytes). len includes both IV and ICV. |
@@ -202,8 +196,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
202 | return 0; | 196 | return 0; |
203 | } | 197 | } |
204 | 198 | ||
205 | 199 | static int prism2_wep_set_key(void *key, int len, u8 * seq, void *priv) | |
206 | static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) | ||
207 | { | 200 | { |
208 | struct prism2_wep_data *wep = priv; | 201 | struct prism2_wep_data *wep = priv; |
209 | 202 | ||
@@ -216,8 +209,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) | |||
216 | return 0; | 209 | return 0; |
217 | } | 210 | } |
218 | 211 | ||
219 | 212 | static int prism2_wep_get_key(void *key, int len, u8 * seq, void *priv) | |
220 | static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) | ||
221 | { | 213 | { |
222 | struct prism2_wep_data *wep = priv; | 214 | struct prism2_wep_data *wep = priv; |
223 | 215 | ||
@@ -229,16 +221,13 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) | |||
229 | return wep->key_len; | 221 | return wep->key_len; |
230 | } | 222 | } |
231 | 223 | ||
232 | 224 | static char *prism2_wep_print_stats(char *p, void *priv) | |
233 | static char * prism2_wep_print_stats(char *p, void *priv) | ||
234 | { | 225 | { |
235 | struct prism2_wep_data *wep = priv; | 226 | struct prism2_wep_data *wep = priv; |
236 | p += sprintf(p, "key[%d] alg=WEP len=%d\n", | 227 | p += sprintf(p, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len); |
237 | wep->key_idx, wep->key_len); | ||
238 | return p; | 228 | return p; |
239 | } | 229 | } |
240 | 230 | ||
241 | |||
242 | static struct ieee80211_crypto_ops ieee80211_crypt_wep = { | 231 | static struct ieee80211_crypto_ops ieee80211_crypt_wep = { |
243 | .name = "WEP", | 232 | .name = "WEP", |
244 | .init = prism2_wep_init, | 233 | .init = prism2_wep_init, |
@@ -250,23 +239,20 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = { | |||
250 | .set_key = prism2_wep_set_key, | 239 | .set_key = prism2_wep_set_key, |
251 | .get_key = prism2_wep_get_key, | 240 | .get_key = prism2_wep_get_key, |
252 | .print_stats = prism2_wep_print_stats, | 241 | .print_stats = prism2_wep_print_stats, |
253 | .extra_prefix_len = 4, /* IV */ | 242 | .extra_prefix_len = 4, /* IV */ |
254 | .extra_postfix_len = 4, /* ICV */ | 243 | .extra_postfix_len = 4, /* ICV */ |
255 | .owner = THIS_MODULE, | 244 | .owner = THIS_MODULE, |
256 | }; | 245 | }; |
257 | 246 | ||
258 | |||
259 | static int __init ieee80211_crypto_wep_init(void) | 247 | static int __init ieee80211_crypto_wep_init(void) |
260 | { | 248 | { |
261 | return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); | 249 | return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); |
262 | } | 250 | } |
263 | 251 | ||
264 | |||
265 | static void __exit ieee80211_crypto_wep_exit(void) | 252 | static void __exit ieee80211_crypto_wep_exit(void) |
266 | { | 253 | { |
267 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); | 254 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); |
268 | } | 255 | } |
269 | 256 | ||
270 | |||
271 | module_init(ieee80211_crypto_wep_init); | 257 | module_init(ieee80211_crypto_wep_init); |
272 | module_exit(ieee80211_crypto_wep_exit); | 258 | module_exit(ieee80211_crypto_wep_exit); |