diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 5cda8bdf77..4d8c0a0842 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -4851,175 +4851,6 @@ int iw_get_wpspbc_probe_req_ies(struct net_device *dev, return ret; } -/** - * __iw_set_ap_encodeext() - set ap encode - * - * @dev - Pointer to the net device. - * @info - Pointer to the iw_request_info. - * @wrqu - Pointer to the iwreq_data. - * @extra - Pointer to the data. - * - * Return: 0 for success, non zero for failure. - */ -static int __iw_set_ap_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct hdd_adapter *pHostapdAdapter = (netdev_priv(dev)); - struct hdd_ap_ctx *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter); - struct hdd_context *hdd_ctx; - int ret; - QDF_STATUS vstatus; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int key_index; - struct iw_point *encoding = &wrqu->encoding; - tCsrRoamSetKey setKey; - int i; - - ENTER_DEV(dev); - - hdd_ctx = WLAN_HDD_GET_CTX(pHostapdAdapter); - 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) - 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); - } - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - setKey.keyDirection = eSIR_TX_DEFAULT; - 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; - pHddApCtx->uPrivacy = 1; - hdd_debug("uPrivacy=%d", pHddApCtx->uPrivacy); - 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 32 byte key in this order - * - * |--------------|----------|----------| - * | Tk1 |TX-MIC | RX Mic | - * |--------------|----------|----------| - * <---16bytes---><--8bytes--><--8bytes--> - * - * Sme expects the 32 byte 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; - - default: - setKey.encType = eCSR_ENCRYPT_TYPE_NONE; - break; - } - - hdd_debug(":EncryptionType:%d key_len:%d, KeyId:%d", - setKey.encType, setKey.keyLength, setKey.keyId); - for (i = 0; i < ext->key_len; i++) - hdd_debug("%02x", setKey.Key[i]); - - vstatus = wlansap_set_key_sta( - WLAN_HDD_GET_SAP_CTX_PTR(pHostapdAdapter), &setKey); - - if (vstatus != QDF_STATUS_SUCCESS) { - hdd_err("wlansap_set_key_sta failed, status: %d", - vstatus); - ret = -EINVAL; - } - EXIT(); - return ret; -} - -/** - * iw_set_ap_encodeext() - Wrapper function to protect __iw_set_ap_encodeext - * from the SSR. - * - * @dev - Pointer to the net device. - * @info - Pointer to the iw_request_info. - * @wrqu - Pointer to the iwreq_data. - * @extra - Pointer to the data. - * - * Return: 0 for success, non zero for failure. - */ -static int iw_set_ap_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_ap_encodeext(dev, info, wrqu, extra); - cds_ssr_unprotect(__func__); - - return ret; -} - /** * __iw_set_ap_mlme() - set ap mlme * @dev: pointer to net_device @@ -5673,7 +5504,7 @@ static const iw_handler hostapd_handler[] = { (iw_handler) NULL, /* SIOCGIWGENIE */ (iw_handler) NULL, /* SIOCSIWAUTH */ (iw_handler) NULL, /* SIOCGIWAUTH */ - (iw_handler) iw_set_ap_encodeext, /* SIOCSIWENCODEEXT */ + (iw_handler) NULL, /* SIOCSIWENCODEEXT */ (iw_handler) NULL, /* SIOCGIWENCODEEXT */ (iw_handler) NULL, /* SIOCSIWPMKSA */ };