CapabilityRid cap_rid; /* Card capability info */
int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 );
u16 currentAuthType = local->config.authType;
- int idx, key_len, alg = ext->alg; /* Check encryption mode */
+ int idx, key_len, alg = ext->alg, set_key = 1;
wep_key_t key;
/* Is WEP supported ? */
if (encoding->flags & IW_ENCODE_DISABLED)
alg = IW_ENCODE_ALG_NONE;
- /* Just setting the transmit key? */
if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
+ /* Only set transmit key index here, actual
+ * key is set below if needed.
+ */
set_wep_key(local, idx, NULL, 0, perm, 1);
- } else {
+ set_key = ext->key_len > 0 ? 1 : 0;
+ }
+
+ if (set_key) {
/* Set the requested key first */
memset(key.key, 0, MAX_KEY_SIZE);
switch (alg) {