diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 5f7a324d48..b71bc01fcf 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -6952,222 +6952,6 @@ static int iw_set_encode(struct net_device *dev, struct iw_request_info *info, return ret; } -/** - * __iw_set_encodeext() - SIOCSIWENCODEEXT ioctl handler - * @dev: device upon which the ioctl was received - * @info: ioctl request information - * @wrqu: ioctl request data - * @extra: ioctl extra data - * - * Return: 0 on success, non-zero on error - */ -static int __iw_set_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); - struct hdd_station_ctx *sta_ctx = - WLAN_HDD_GET_STATION_CTX_PTR(adapter); - struct hdd_wext_state *pWextState = - WLAN_HDD_GET_WEXT_STATE_PTR(adapter); - struct hdd_context *hdd_ctx; - QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; - tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; - int ret; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int key_index; - struct iw_point *encoding = &wrqu->encoding; - tCsrRoamSetKey setKey; - uint32_t roamId = INVALID_ROAM_ID; - - ENTER_DEV(dev); - - hdd_ctx = WLAN_HDD_GET_CTX(adapter); - ret = wlan_hdd_validate_context(hdd_ctx); - if (0 != ret) - return ret; - - ret = hdd_check_standard_wext_control(hdd_ctx, info); - if (0 != ret) - return ret; - - key_index = encoding->flags & IW_ENCODE_INDEX; - - if (key_index > 0) { - - /*Convert from 1-based to 0-based keying */ - key_index--; - } - if (!ext->key_len) { - - /*Set the encrytion type to NONE */ - pRoamProfile->EncryptionType.encryptionType[0] = - eCSR_ENCRYPT_TYPE_NONE; - return ret; - } - - if (eConnectionState_NotConnected == sta_ctx->conn_info.connState && - (IW_ENCODE_ALG_WEP == ext->alg)) { - if (IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) { - - hdd_err("Invalid Configuration"); - return -EINVAL; - } - - /*Static wep, update the roam profile with the keys */ - if (ext->key_len && - (ext->key_len <= eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES) && - key_index < CSR_MAX_NUM_KEY) { - qdf_mem_copy(&pRoamProfile->Keys. - KeyMaterial[key_index][0], - ext->key, ext->key_len); - pRoamProfile->Keys.KeyLength[key_index] = - (uint8_t) ext->key_len; - - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) - pRoamProfile->Keys.defaultIndex = - (uint8_t) key_index; - } - return ret; - } - - qdf_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); - - setKey.keyId = key_index; - setKey.keyLength = ext->key_len; - - if (ext->key_len <= CSR_MAX_KEY_LEN) - qdf_mem_copy(&setKey.Key[0], ext->key, ext->key_len); - - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - /*Key direction for group is RX only */ - setKey.keyDirection = eSIR_RX_ONLY; - qdf_set_macaddr_broadcast(&setKey.peerMac); - } else { - setKey.keyDirection = eSIR_TX_RX; - qdf_mem_copy(setKey.peerMac.bytes, ext->addr.sa_data, - QDF_MAC_ADDR_SIZE); - } - - /*For supplicant pae role is zero */ - setKey.paeRole = 0; - - switch (ext->alg) { - case IW_ENCODE_ALG_NONE: - setKey.encType = eCSR_ENCRYPT_TYPE_NONE; - break; - - case IW_ENCODE_ALG_WEP: - setKey.encType = - (ext->key_len == 5) ? eCSR_ENCRYPT_TYPE_WEP40 : - eCSR_ENCRYPT_TYPE_WEP104; - break; - - case IW_ENCODE_ALG_TKIP: - { - uint8_t *pKey = &setKey.Key[0]; - - setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; - - qdf_mem_zero(pKey, CSR_MAX_KEY_LEN); - - /* Supplicant sends the 32bytes key in this order - * |--------------|----------|----------| - * | Tk1 | TX MIC | RX MIC | - * |--------------|----------|----------| - * <---16bytes---><--8bytes--><--8bytes--> - * - * - * Sme expects the 32 bytes key to be in the below order - * |--------------|----------|----------| - * | Tk1 | RX MIC | TX MIC | - * |--------------|----------|----------| - * <---16bytes---><--8bytes--><--8bytes--> - */ - - /* Copy the Temporal Key 1 (TK1) */ - qdf_mem_copy(pKey, ext->key, 16); - - /* Copy the rx mic first */ - qdf_mem_copy(&pKey[16], &ext->key[24], 8); - - /* Copy the tx mic */ - qdf_mem_copy(&pKey[24], &ext->key[16], 8); - - } - break; - - case IW_ENCODE_ALG_CCMP: - setKey.encType = eCSR_ENCRYPT_TYPE_AES; - break; - -#ifdef FEATURE_WLAN_ESE -#define IW_ENCODE_ALG_KRK 6 - case IW_ENCODE_ALG_KRK: - setKey.encType = eCSR_ENCRYPT_TYPE_KRK; - break; -#endif /* FEATURE_WLAN_ESE */ - - default: - setKey.encType = eCSR_ENCRYPT_TYPE_NONE; - break; - } - - hdd_debug("cipher_alg:%d key_len:%d EncryptionType:%d", - (int)ext->alg, (int)ext->key_len, setKey.encType); - - /* The supplicant may attempt to set the PTK once - * pre-authentication is done. Save the key in the UMAC and - * include it in the ADD BSS request - */ - qdf_ret_status = sme_ft_update_key(WLAN_HDD_GET_HAL_CTX(adapter), - adapter->sessionId, &setKey); - if (qdf_ret_status == QDF_STATUS_FT_PREAUTH_KEY_SUCCESS) { - hdd_debug("Update PreAuth Key success"); - return 0; - } else if (qdf_ret_status == QDF_STATUS_FT_PREAUTH_KEY_FAILED) { - hdd_err("Update PreAuth Key failed"); - return -EINVAL; - } - - sta_ctx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; - - qdf_ret_status = sme_roam_set_key(WLAN_HDD_GET_HAL_CTX(adapter), - adapter->sessionId, - &setKey, &roamId); - - if (qdf_ret_status != QDF_STATUS_SUCCESS) { - hdd_err("[%4d] sme_roam_set_key returned ERROR status= %d", - __LINE__, qdf_ret_status); - - sta_ctx->roam_info.roamingState = HDD_ROAM_STATE_NONE; - } - - return qdf_ret_status; -} - -/** - * iw_set_encodeext() - SSR wrapper for __iw_set_encodeext() - * @dev: pointer to net_device - * @info: pointer to iw_request_info - * @wrqu: pointer to iwreq_data - * @extra: pointer to extra ioctl payload - * - * Return: 0 on success, error number otherwise - */ -static int iw_set_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - int ret; - - cds_ssr_protect(__func__); - ret = __iw_set_encodeext(dev, info, wrqu, extra); - cds_ssr_unprotect(__func__); - - return ret; -} - /** * __iw_set_retry() - SIOCSIWRETRY ioctl handler * @dev: device upon which the ioctl was received @@ -13196,7 +12980,7 @@ static const iw_handler we_handler[] = { (iw_handler) iw_get_genie, /* SIOCGIWGENIE */ (iw_handler) iw_set_auth, /* SIOCSIWAUTH */ (iw_handler) iw_get_auth, /* SIOCGIWAUTH */ - (iw_handler) iw_set_encodeext, /* SIOCSIWENCODEEXT */ + (iw_handler) NULL, /* SIOCSIWENCODEEXT */ (iw_handler) NULL, /* SIOCGIWENCODEEXT */ (iw_handler) NULL, /* SIOCSIWPMKSA */ };