blob: 3f08c367b1ca0fa06cf04bf5db5d45598fb96d6d [file] [log] [blame]
/******************************************************************************
*
* This file is provided under a dual license. When you use or
* distribute this software, you may choose to be licensed under
* version 2 of the GNU General Public License ("GPLv2 License")
* or BSD License.
*
* GPLv2 License
*
* Copyright(C) 2016 MediaTek Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See http://www.gnu.org/licenses/gpl-2.0.html for more details.
*
* BSD LICENSE
*
* Copyright(C) 2016 MediaTek Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
/*
** Id: include/mgmt/rsn.h#1
*/
/*! \file rsn.h
* \brief The wpa/rsn related define, macro and structure are described here.
*/
#ifndef _RSN_H
#define _RSN_H
/*******************************************************************************
* C O M P I L E R F L A G S
********************************************************************************
*/
/*******************************************************************************
* E X T E R N A L R E F E R E N C E S
********************************************************************************
*/
/*******************************************************************************
* C O N S T A N T S
********************************************************************************
*/
/* ----- Definitions for Cipher Suite Selectors ----- */
#define RSN_CIPHER_SUITE_USE_GROUP_KEY 0x00AC0F00
#define RSN_CIPHER_SUITE_WEP40 0x01AC0F00
#define RSN_CIPHER_SUITE_TKIP 0x02AC0F00
#define RSN_CIPHER_SUITE_CCMP 0x04AC0F00
#define RSN_CIPHER_SUITE_WEP104 0x05AC0F00
#if CFG_SUPPORT_802_11W
#define RSN_CIPHER_SUITE_AES_128_CMAC 0x06AC0F00
#endif
#define WPA_CIPHER_SUITE_NONE 0x00F25000
#define WPA_CIPHER_SUITE_WEP40 0x01F25000
#define WPA_CIPHER_SUITE_TKIP 0x02F25000
#define WPA_CIPHER_SUITE_CCMP 0x04F25000
#define WPA_CIPHER_SUITE_WEP104 0x05F25000
/* ----- Definitions for Authentication and Key Management Suite Selectors ----- */
#define RSN_AKM_SUITE_NONE 0x00AC0F00
#define RSN_AKM_SUITE_802_1X 0x01AC0F00
#define RSN_AKM_SUITE_PSK 0x02AC0F00
#if CFG_SUPPORT_802_11W
#define RSN_AKM_SUITE_802_1X_SHA256 0x05AC0F00
#define RSN_AKM_SUITE_PSK_SHA256 0x06AC0F00
#endif
#define WPA_AKM_SUITE_NONE 0x00F25000
#define WPA_AKM_SUITE_802_1X 0x01F25000
#define WPA_AKM_SUITE_PSK 0x02F25000
#define ELEM_ID_RSN_LEN_FIXED 20 /* The RSN IE len for associate request */
#define ELEM_ID_WPA_LEN_FIXED 22 /* The RSN IE len for associate request */
#define MASK_RSNIE_CAP_PREAUTH BIT(0)
#define GET_SELECTOR_TYPE(x) ((UINT_8)(((x) >> 24) & 0x000000FF))
#define SET_SELECTOR_TYPE(x, y) (x = (((x) & 0x00FFFFFF) | (((UINT_32)(y) << 24) & 0xFF000000)))
#define AUTH_CIPHER_CCMP 0x00000008
/* Cihpher suite flags */
#define CIPHER_FLAG_NONE 0x00000000
#define CIPHER_FLAG_WEP40 0x00000001 /* BIT 1 */
#define CIPHER_FLAG_TKIP 0x00000002 /* BIT 2 */
#define CIPHER_FLAG_CCMP 0x00000008 /* BIT 4 */
#define CIPHER_FLAG_WEP104 0x00000010 /* BIT 5 */
#define CIPHER_FLAG_WEP128 0x00000020 /* BIT 6 */
#define WAIT_TIME_IND_PMKID_CANDICATE_SEC 6 /* seconds */
#define TKIP_COUNTERMEASURE_SEC 60 /* seconds */
#if CFG_SUPPORT_802_11W
#define RSN_AUTH_MFP_DISABLED 0 /* MFP disabled */
#define RSN_AUTH_MFP_OPTIONAL 1 /* MFP optional */
#define RSN_AUTH_MFP_REQUIRED 2 /* MFP required */
#endif
#define GTK_REKEY_CMD_MODE_OFFLOAD_ON 0
#define GTK_REKEY_CMD_MODE_OFLOAD_OFF 1
#define GTK_REKEY_CMD_MODE_SET_BCMC_PN 2
#define GTK_REKEY_CMD_MODE_GET_BCMC_PN 3
#define GTK_REKEY_CMD_MODE_RPY_OFFLOAD_ON 4
#define GTK_REKEY_CMD_MODE_RPY_OFFLOAD_OFF 5
/*******************************************************************************
* D A T A T Y P E S
********************************************************************************
*/
/* Flags for PMKID Candidate list structure */
#define EVENT_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
#define CONTROL_FLAG_UC_MGMT_NO_ENC BIT(5)
/*******************************************************************************
* P U B L I C D A T A
********************************************************************************
*/
/*******************************************************************************
* P R I V A T E D A T A
********************************************************************************
*/
/*******************************************************************************
* M A C R O S
********************************************************************************
*/
#define RSN_IE(fp) ((P_RSN_INFO_ELEM_T) fp)
#define WPA_IE(fp) ((P_WPA_INFO_ELEM_T) fp)
#define ELEM_MAX_LEN_ASSOC_RSP_WSC_IE (32 - ELEM_HDR_LEN)
#define ELEM_MAX_LEN_TIMEOUT_IE (5)
/*******************************************************************************
* F U N C T I O N D E C L A R A T I O N S
********************************************************************************
*/
BOOLEAN rsnParseRsnIE(IN P_ADAPTER_T prAdapter, IN P_RSN_INFO_ELEM_T prInfoElem, OUT P_RSN_INFO_T prRsnInfo);
BOOLEAN rsnParseWpaIE(IN P_ADAPTER_T prAdapter, IN P_WPA_INFO_ELEM_T prInfoElem, OUT P_RSN_INFO_T prWpaInfo);
BOOLEAN rsnSearchSupportedCipher(IN P_ADAPTER_T prAdapter, IN UINT_32 u4Cipher, OUT PUINT_32 pu4Index);
BOOLEAN rsnIsSuitableBSS(IN P_ADAPTER_T prAdapter, IN P_RSN_INFO_T prBssRsnInfo);
BOOLEAN rsnSearchAKMSuite(IN P_ADAPTER_T prAdapter, IN UINT_32 u4AkmSuite, OUT PUINT_32 pu4Index);
BOOLEAN rsnPerformPolicySelection(IN P_ADAPTER_T prAdapter, IN P_BSS_DESC_T prBss);
VOID rsnGenerateWpaNoneIE(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo);
VOID rsnGenerateWPAIE(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo);
VOID rsnGenerateRSNIE(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo);
BOOLEAN
rsnParseCheckForWFAInfoElem(IN P_ADAPTER_T prAdapter,
IN PUINT_8 pucBuf, OUT PUINT_8 pucOuiType, OUT PUINT_16 pu2SubTypeVersion);
#if CFG_SUPPORT_AAA
void rsnParserCheckForRSNCCMPPSK(P_ADAPTER_T prAdapter, P_RSN_INFO_ELEM_T prIe, P_STA_RECORD_T prStaRec,
PUINT_16 pu2StatusCode);
#endif
VOID rsnTkipHandleMICFailure(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prSta, IN BOOLEAN fgErrorKeyType);
VOID rsnSelectPmkidCandidateList(IN P_ADAPTER_T prAdapter, IN P_BSS_DESC_T prBssDesc);
VOID rsnUpdatePmkidCandidateList(IN P_ADAPTER_T prAdapter, IN P_BSS_DESC_T prBssDesc);
BOOLEAN rsnSearchPmkidEntry(IN P_ADAPTER_T prAdapter, IN PUINT_8 pucBssid, OUT PUINT_32 pu4EntryIndex);
BOOLEAN rsnCheckPmkidCandicate(IN P_ADAPTER_T prAdapter);
VOID rsnCheckPmkidCache(IN P_ADAPTER_T prAdapter, IN P_BSS_DESC_T prBss);
VOID rsnGeneratePmkidIndication(IN P_ADAPTER_T prAdapter);
VOID rsnIndicatePmkidCand(IN P_ADAPTER_T prAdapter, IN ULONG ulParamPtr);
#if CFG_SUPPORT_WPS2
VOID rsnGenerateWSCIE(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo);
#endif
#if CFG_SUPPORT_802_11W
UINT_32 rsnCheckBipKeyInstalled(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prStaRec);
UINT_8 rsnCheckSaQueryTimeout(IN P_ADAPTER_T prAdapter);
void rsnStartSaQueryTimer(IN P_ADAPTER_T prAdapter, IN ULONG ulParamPtr);
void rsnStartSaQuery(IN P_ADAPTER_T prAdapter);
void rsnStopSaQuery(IN P_ADAPTER_T prAdapter);
void rsnSaQueryRequest(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb);
void rsnSaQueryAction(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb);
UINT_16 rsnPmfCapableValidation(IN P_ADAPTER_T prAdapter, IN P_BSS_INFO_T prBssInfo, IN P_STA_RECORD_T prStaRec);
VOID rsnPmfGenerateTimeoutIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
void rsnApStartSaQuery(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prStaRec);
void rsnApSaQueryAction(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb);
#endif /* CFG_SUPPORT_802_11W */
#if CFG_SUPPORT_AAA
VOID rsnGenerateWSCIEForAssocRsp(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
#endif
/*******************************************************************************
* F U N C T I O N S
********************************************************************************
*/
#endif /* _RSN_H */