1 /* Note : this particular snipset of code is available under
2 * the LGPL, MPL or BSD license (at your choice).
6 #define MAX_KEY_SIZE 16
11 char key_table[MAX_KEYS][MAX_KEY_SIZE];
12 int key_size[MAX_KEYS];
16 /* Basic checking... */
17 if(wrq->u.encoding.pointer != (caddr_t) 0)
19 int index = (wrq->u.encoding.flags & IW_ENCODE_INDEX) - 1;
21 /* Check the size of the key */
22 if(wrq->u.encoding.length > MAX_KEY_SIZE)
29 if((index < 0) || (index >= MAX_KEYS))
32 /* Copy the key in the driver */
33 if(copy_from_user(key_table[index], wrq->u.encoding.pointer,
34 wrq->u.encoding.length))
40 key_size[index] = wrq->u.encoding.length;
45 int index = (wrq->u.encoding.flags & IW_ENCODE_INDEX) - 1;
46 /* Do we want to just set the current key ? */
47 if((index >= 0) && (index < MAX_KEYS))
49 if(key_size[index] > 0)
60 if(wrq->u.encoding.flags & IW_ENCODE_DISABLED)
61 key_on = 0; /* disable encryption */
62 if(wrq->u.encoding.flags & IW_ENCODE_RESTRICTED)
63 key_open = 0; /* disable open mode */
64 if(wrq->u.encoding.flags & IW_ENCODE_OPEN)
65 key_open = 1; /* enable open mode */
70 /* only super-user can see encryption key */
77 /* Basic checking... */
78 if(wrq->u.encoding.pointer != (caddr_t) 0)
80 int index = (wrq->u.encoding.flags & IW_ENCODE_INDEX) - 1;
83 wrq->u.encoding.flags = 0;
85 wrq->u.encoding.flags |= IW_ENCODE_DISABLED;
87 wrq->u.encoding.flags |= IW_ENCODE_RESTRICTED;
89 wrq->u.encoding.flags |= IW_ENCODE_OPEN;
91 /* Which key do we want */
92 if((index < 0) || (index >= MAX_KEYS))
94 wrq->u.encoding.flags |= index + 1;
96 /* Copy the key to the user buffer */
97 wrq->u.encoding.length = key_size[index];
98 if(copy_to_user(wrq->u.encoding.pointer, key_table[index],
103 #endif /* WIRELESS_EXT > 8 */
106 range.encoding_size[0] = 8; /* DES = 64 bits key */
107 range.encoding_size[1] = 16;
108 range.num_encoding_sizes = 2;
109 range.max_encoding_tokens = 8;
110 #endif /* WIRELESS_EXT > 8 */