New upstream version 5.3.9~git20210504.6146193
This commit is contained in:
parent
322a5f0ea6
commit
e01e3993b3
17
Makefile
17
Makefile
|
@ -10,6 +10,11 @@ EXTRA_CFLAGS += -Wno-unused
|
||||||
EXTRA_CFLAGS += -Wno-vla
|
EXTRA_CFLAGS += -Wno-vla
|
||||||
EXTRA_CFLAGS += -Wno-date-time
|
EXTRA_CFLAGS += -Wno-date-time
|
||||||
|
|
||||||
|
REDHAT_VER := $(shell cut -f4 -d" " /etc/redhat-release |cut -d"." -f1,2 )
|
||||||
|
ifeq ($(REDHAT_VER), 7.9)
|
||||||
|
EXTRA_CFLAGS += -DRHEL79
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
|
GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
|
||||||
ifeq ($(GCC_VER_49),1)
|
ifeq ($(GCC_VER_49),1)
|
||||||
EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later
|
EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later
|
||||||
|
@ -159,8 +164,6 @@ CONFIG_PLATFORM_PPC64LE = n
|
||||||
|
|
||||||
CONFIG_DRVEXT_MODULE = n
|
CONFIG_DRVEXT_MODULE = n
|
||||||
|
|
||||||
export TopDIR ?= $(shell pwd)
|
|
||||||
|
|
||||||
########### COMMON #################################
|
########### COMMON #################################
|
||||||
ifeq ($(CONFIG_GSPI_HCI), y)
|
ifeq ($(CONFIG_GSPI_HCI), y)
|
||||||
HCI_NAME = gspi
|
HCI_NAME = gspi
|
||||||
|
@ -775,16 +778,16 @@ endif
|
||||||
ifeq ($(CONFIG_AUTOCFG_CP), y)
|
ifeq ($(CONFIG_AUTOCFG_CP), y)
|
||||||
|
|
||||||
ifeq ($(CONFIG_MULTIDRV), y)
|
ifeq ($(CONFIG_MULTIDRV), y)
|
||||||
$(shell cp $(TopDIR)/autoconf_multidrv_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
|
$(shell cp autoconf_multidrv_$(HCI_NAME)_linux.h include/autoconf.h)
|
||||||
else
|
else
|
||||||
ifeq ($(CONFIG_RTL8188E)$(CONFIG_SDIO_HCI),yy)
|
ifeq ($(CONFIG_RTL8188E)$(CONFIG_SDIO_HCI),yy)
|
||||||
$(shell cp $(TopDIR)/autoconf_rtl8189e_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
|
$(shell cp autoconf_rtl8189e_$(HCI_NAME)_linux.h include/autoconf.h)
|
||||||
else ifeq ($(CONFIG_RTL8188F)$(CONFIG_SDIO_HCI),yy)
|
else ifeq ($(CONFIG_RTL8188F)$(CONFIG_SDIO_HCI),yy)
|
||||||
$(shell cp $(TopDIR)/autoconf_rtl8189f_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
|
$(shell cp autoconf_rtl8189f_$(HCI_NAME)_linux.h include/autoconf.h)
|
||||||
else ifeq ($(CONFIG_RTL8723C),y)
|
else ifeq ($(CONFIG_RTL8723C),y)
|
||||||
$(shell cp $(TopDIR)/autoconf_rtl8723c_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
|
$(shell cp autoconf_rtl8723c_$(HCI_NAME)_linux.h include/autoconf.h)
|
||||||
else
|
else
|
||||||
$(shell cp $(TopDIR)/autoconf_$(RTL871X)_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
|
$(shell cp autoconf_$(RTL871X)_$(HCI_NAME)_linux.h include/autoconf.h)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
Like https://github.com/cccooo/rtl8812au-centos-7.6, forked from aircrack-ng/rtl8188eus and modified for CentOS 7.9
|
||||||
|
as CentOS Kernel 3.10 contains many code from 4.x
|
||||||
|
|
||||||
## rtl8188eus v5.3.9
|
## rtl8188eus v5.3.9
|
||||||
|
|
||||||
# Realtek rtl8188eus & rtl8188eu & rtl8188etv WiFi drivers
|
# Realtek rtl8188eus & rtl8188eu & rtl8188etv WiFi drivers
|
||||||
|
|
|
@ -2133,8 +2133,7 @@ BIP_exit:
|
||||||
#ifndef PLATFORM_FREEBSD
|
#ifndef PLATFORM_FREEBSD
|
||||||
#if defined(CONFIG_TDLS)
|
#if defined(CONFIG_TDLS)
|
||||||
/* compress 512-bits */
|
/* compress 512-bits */
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
|
static int rtw_sha256_compress(struct rtw_sha256_state *md, unsigned char *buf)
|
||||||
static int sha256_compress(struct sha256_state *md, unsigned char *buf)
|
|
||||||
{
|
{
|
||||||
u32 S[8], W[64], t0, t1;
|
u32 S[8], W[64], t0, t1;
|
||||||
u32 t;
|
u32 t;
|
||||||
|
@ -2180,11 +2179,9 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf)
|
||||||
md->state[i] = md->state[i] + S[i];
|
md->state[i] = md->state[i] + S[i];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Initialize the hash state */
|
/* Initialize the hash state */
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
|
static void rtw_sha256_init(struct rtw_sha256_state *md)
|
||||||
static void sha256_init(struct sha256_state *md)
|
|
||||||
{
|
{
|
||||||
md->curlen = 0;
|
md->curlen = 0;
|
||||||
md->length = 0;
|
md->length = 0;
|
||||||
|
@ -2197,7 +2194,6 @@ static void sha256_init(struct sha256_state *md)
|
||||||
md->state[6] = 0x1F83D9ABUL;
|
md->state[6] = 0x1F83D9ABUL;
|
||||||
md->state[7] = 0x5BE0CD19UL;
|
md->state[7] = 0x5BE0CD19UL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process a block of memory though the hash
|
Process a block of memory though the hash
|
||||||
|
@ -2206,9 +2202,7 @@ static void sha256_init(struct sha256_state *md)
|
||||||
@param inlen The length of the data (octets)
|
@param inlen The length of the data (octets)
|
||||||
@return CRYPT_OK if successful
|
@return CRYPT_OK if successful
|
||||||
*/
|
*/
|
||||||
|
static int rtw_sha256_process(struct rtw_sha256_state *md, unsigned char *in,
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
|
|
||||||
static int sha256_process(struct sha256_state *md, unsigned char *in,
|
|
||||||
unsigned long inlen)
|
unsigned long inlen)
|
||||||
{
|
{
|
||||||
unsigned long n;
|
unsigned long n;
|
||||||
|
@ -2219,7 +2213,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
|
||||||
|
|
||||||
while (inlen > 0) {
|
while (inlen > 0) {
|
||||||
if (md->curlen == 0 && inlen >= block_size) {
|
if (md->curlen == 0 && inlen >= block_size) {
|
||||||
if (sha256_compress(md, (unsigned char *) in) < 0)
|
if (rtw_sha256_compress(md, (unsigned char *) in) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
md->length += block_size * 8;
|
md->length += block_size * 8;
|
||||||
in += block_size;
|
in += block_size;
|
||||||
|
@ -2231,7 +2225,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
|
||||||
in += n;
|
in += n;
|
||||||
inlen -= n;
|
inlen -= n;
|
||||||
if (md->curlen == block_size) {
|
if (md->curlen == block_size) {
|
||||||
if (sha256_compress(md, md->buf) < 0)
|
if (rtw_sha256_compress(md, md->buf) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
md->length += 8 * block_size;
|
md->length += 8 * block_size;
|
||||||
md->curlen = 0;
|
md->curlen = 0;
|
||||||
|
@ -2241,7 +2235,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Terminate the hash to get the digest
|
Terminate the hash to get the digest
|
||||||
|
@ -2249,8 +2243,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
|
||||||
@param out [out] The destination of the hash (32 bytes)
|
@param out [out] The destination of the hash (32 bytes)
|
||||||
@return CRYPT_OK if successful
|
@return CRYPT_OK if successful
|
||||||
*/
|
*/
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
|
static int rtw_sha256_done(struct rtw_sha256_state *md, unsigned char *out)
|
||||||
static int sha256_done(struct sha256_state *md, unsigned char *out)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -2270,7 +2263,7 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
|
||||||
if (md->curlen > 56) {
|
if (md->curlen > 56) {
|
||||||
while (md->curlen < 64)
|
while (md->curlen < 64)
|
||||||
md->buf[md->curlen++] = (unsigned char) 0;
|
md->buf[md->curlen++] = (unsigned char) 0;
|
||||||
sha256_compress(md, md->buf);
|
rtw_sha256_compress(md, md->buf);
|
||||||
md->curlen = 0;
|
md->curlen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2280,7 +2273,7 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
|
||||||
|
|
||||||
/* store length */
|
/* store length */
|
||||||
WPA_PUT_BE64(md->buf + 56, md->length);
|
WPA_PUT_BE64(md->buf + 56, md->length);
|
||||||
sha256_compress(md, md->buf);
|
rtw_sha256_compress(md, md->buf);
|
||||||
|
|
||||||
/* copy output */
|
/* copy output */
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
|
@ -2288,7 +2281,6 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sha256_vector - SHA256 hash for data vector
|
* sha256_vector - SHA256 hash for data vector
|
||||||
|
@ -2298,23 +2290,20 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
|
||||||
* @mac: Buffer for the hash
|
* @mac: Buffer for the hash
|
||||||
* Returns: 0 on success, -1 of failure
|
* Returns: 0 on success, -1 of failure
|
||||||
*/
|
*/
|
||||||
|
static int rtw_sha256_vector(size_t num_elem, u8 *addr[], size_t *len,
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
|
|
||||||
static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len,
|
|
||||||
u8 *mac)
|
u8 *mac)
|
||||||
{
|
{
|
||||||
struct sha256_state ctx;
|
struct rtw_sha256_state ctx;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
sha256_init(&ctx);
|
rtw_sha256_init(&ctx);
|
||||||
for (i = 0; i < num_elem; i++)
|
for (i = 0; i < num_elem; i++)
|
||||||
if (sha256_process(&ctx, addr[i], len[i]))
|
if (rtw_sha256_process(&ctx, addr[i], len[i]))
|
||||||
return -1;
|
return -1;
|
||||||
if (sha256_done(&ctx, mac))
|
if (rtw_sha256_done(&ctx, mac))
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static u8 os_strlen(const char *s)
|
static u8 os_strlen(const char *s)
|
||||||
{
|
{
|
||||||
|
@ -2355,7 +2344,6 @@ static int os_memcmp(const void *s1, const void *s2, u8 n)
|
||||||
* @mac: Buffer for the hash (32 bytes)
|
* @mac: Buffer for the hash (32 bytes)
|
||||||
*/
|
*/
|
||||||
#if defined(CONFIG_TDLS)
|
#if defined(CONFIG_TDLS)
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
|
|
||||||
static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
|
static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
|
||||||
u8 *addr[], size_t *len, u8 *mac)
|
u8 *addr[], size_t *len, u8 *mac)
|
||||||
{
|
{
|
||||||
|
@ -2374,7 +2362,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
|
||||||
|
|
||||||
/* if key is longer than 64 bytes reset it to key = SHA256(key) */
|
/* if key is longer than 64 bytes reset it to key = SHA256(key) */
|
||||||
if (key_len > 64) {
|
if (key_len > 64) {
|
||||||
sha256_vector(1, &key, &key_len, tk);
|
rtw_sha256_vector(1, &key, &key_len, tk);
|
||||||
key = tk;
|
key = tk;
|
||||||
key_len = 32;
|
key_len = 32;
|
||||||
}
|
}
|
||||||
|
@ -2402,7 +2390,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
|
||||||
_addr[i + 1] = addr[i];
|
_addr[i + 1] = addr[i];
|
||||||
_len[i + 1] = len[i];
|
_len[i + 1] = len[i];
|
||||||
}
|
}
|
||||||
sha256_vector(1 + num_elem, _addr, _len, mac);
|
rtw_sha256_vector(1 + num_elem, _addr, _len, mac);
|
||||||
|
|
||||||
_rtw_memset(k_pad, 0, sizeof(k_pad));
|
_rtw_memset(k_pad, 0, sizeof(k_pad));
|
||||||
_rtw_memcpy(k_pad, key, key_len);
|
_rtw_memcpy(k_pad, key, key_len);
|
||||||
|
@ -2415,9 +2403,8 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
|
||||||
_len[0] = 64;
|
_len[0] = 64;
|
||||||
_addr[1] = mac;
|
_addr[1] = mac;
|
||||||
_len[1] = 32;
|
_len[1] = 32;
|
||||||
sha256_vector(2, _addr, _len, mac);
|
rtw_sha256_vector(2, _addr, _len, mac);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif /* CONFIG_TDLS */
|
#endif /* CONFIG_TDLS */
|
||||||
#endif /* PLATFORM_FREEBSD */
|
#endif /* PLATFORM_FREEBSD */
|
||||||
/**
|
/**
|
||||||
|
@ -2435,8 +2422,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
|
||||||
*/
|
*/
|
||||||
#ifndef PLATFORM_FREEBSD /* Baron */
|
#ifndef PLATFORM_FREEBSD /* Baron */
|
||||||
#if defined(CONFIG_TDLS)
|
#if defined(CONFIG_TDLS)
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
|
static void rtw_sha256_prf(u8 *key, size_t key_len, char *label,
|
||||||
static void sha256_prf(u8 *key, size_t key_len, char *label,
|
|
||||||
u8 *data, size_t data_len, u8 *buf, size_t buf_len)
|
u8 *data, size_t data_len, u8 *buf, size_t buf_len)
|
||||||
{
|
{
|
||||||
u16 counter = 1;
|
u16 counter = 1;
|
||||||
|
@ -2460,10 +2446,10 @@ static void sha256_prf(u8 *key, size_t key_len, char *label,
|
||||||
while (pos < buf_len) {
|
while (pos < buf_len) {
|
||||||
plen = buf_len - pos;
|
plen = buf_len - pos;
|
||||||
WPA_PUT_LE16(counter_le, counter);
|
WPA_PUT_LE16(counter_le, counter);
|
||||||
if (plen >= SHA256_MAC_LEN) {
|
if (plen >= RTW_SHA256_MAC_LEN) {
|
||||||
hmac_sha256_vector(key, key_len, 4, addr, len,
|
hmac_sha256_vector(key, key_len, 4, addr, len,
|
||||||
&buf[pos]);
|
&buf[pos]);
|
||||||
pos += SHA256_MAC_LEN;
|
pos += RTW_SHA256_MAC_LEN;
|
||||||
} else {
|
} else {
|
||||||
hmac_sha256_vector(key, key_len, 4, addr, len, hash);
|
hmac_sha256_vector(key, key_len, 4, addr, len, hash);
|
||||||
_rtw_memcpy(&buf[pos], hash, plen);
|
_rtw_memcpy(&buf[pos], hash, plen);
|
||||||
|
@ -2473,7 +2459,6 @@ static void sha256_prf(u8 *key, size_t key_len, char *label,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif /* PLATFORM_FREEBSD Baron */
|
#endif /* PLATFORM_FREEBSD Baron */
|
||||||
|
|
||||||
/* AES tables*/
|
/* AES tables*/
|
||||||
|
@ -3123,7 +3108,7 @@ void wpa_tdls_generate_tpk(_adapter *padapter, void *sta)
|
||||||
nonce[1] = SNonce;
|
nonce[1] = SNonce;
|
||||||
}
|
}
|
||||||
|
|
||||||
sha256_vector(2, nonce, len, key_input);
|
rtw_sha256_vector(2, nonce, len, key_input);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TPK-Key-Data = KDF-N_KEY(TPK-Key-Input, "TDLS PMK",
|
* TPK-Key-Data = KDF-N_KEY(TPK-Key-Input, "TDLS PMK",
|
||||||
|
@ -3142,7 +3127,7 @@ void wpa_tdls_generate_tpk(_adapter *padapter, void *sta)
|
||||||
}
|
}
|
||||||
_rtw_memcpy(data + 2 * ETH_ALEN, get_bssid(pmlmepriv), ETH_ALEN);
|
_rtw_memcpy(data + 2 * ETH_ALEN, get_bssid(pmlmepriv), ETH_ALEN);
|
||||||
|
|
||||||
sha256_prf(key_input, SHA256_MAC_LEN, "TDLS PMK", data, sizeof(data), (u8 *) &psta->tpk, sizeof(psta->tpk));
|
rtw_sha256_prf(key_input, RTW_SHA256_MAC_LEN, "TDLS PMK", data, sizeof(data), (u8 *) &psta->tpk, sizeof(psta->tpk));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ const char *security_type_str(u8 value);
|
||||||
#define _WPA_IE_ID_ 0xdd
|
#define _WPA_IE_ID_ 0xdd
|
||||||
#define _WPA2_IE_ID_ 0x30
|
#define _WPA2_IE_ID_ 0x30
|
||||||
|
|
||||||
#define SHA256_MAC_LEN 32
|
#define RTW_SHA256_MAC_LEN 32
|
||||||
#define AES_BLOCK_SIZE 16
|
#define AES_BLOCK_SIZE 16
|
||||||
#define AES_PRIV_SIZE (4 * 44)
|
#define AES_PRIV_SIZE (4 * 44)
|
||||||
|
|
||||||
|
@ -249,13 +249,11 @@ struct security_priv {
|
||||||
#define SEC_IS_BIP_KEY_INSTALLED(sec) _FALSE
|
#define SEC_IS_BIP_KEY_INSTALLED(sec) _FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
|
struct rtw_sha256_state {
|
||||||
struct sha256_state {
|
|
||||||
u64 length;
|
u64 length;
|
||||||
u32 state[8], curlen;
|
u32 state[8], curlen;
|
||||||
u8 buf[64];
|
u8 buf[64];
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#define GET_ENCRY_ALGO(psecuritypriv, psta, encry_algo, bmcst)\
|
#define GET_ENCRY_ALGO(psecuritypriv, psta, encry_algo, bmcst)\
|
||||||
do {\
|
do {\
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -27,7 +27,7 @@
|
||||||
#define DBG_RTW_CFG80211_MESH_CONF 0
|
#define DBG_RTW_CFG80211_MESH_CONF 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) || defined(RHEL79))
|
||||||
#define STATION_INFO_INACTIVE_TIME BIT(NL80211_STA_INFO_INACTIVE_TIME)
|
#define STATION_INFO_INACTIVE_TIME BIT(NL80211_STA_INFO_INACTIVE_TIME)
|
||||||
#define STATION_INFO_LLID BIT(NL80211_STA_INFO_LLID)
|
#define STATION_INFO_LLID BIT(NL80211_STA_INFO_LLID)
|
||||||
#define STATION_INFO_PLID BIT(NL80211_STA_INFO_PLID)
|
#define STATION_INFO_PLID BIT(NL80211_STA_INFO_PLID)
|
||||||
|
@ -289,7 +289,7 @@ static const char *nl80211_chan_width_str(enum nl80211_chan_width cwidth)
|
||||||
return "80+80";
|
return "80+80";
|
||||||
case NL80211_CHAN_WIDTH_160:
|
case NL80211_CHAN_WIDTH_160:
|
||||||
return "160";
|
return "160";
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) || defined(RHEL79))
|
||||||
case NL80211_CHAN_WIDTH_5:
|
case NL80211_CHAN_WIDTH_5:
|
||||||
return "5";
|
return "5";
|
||||||
case NL80211_CHAN_WIDTH_10:
|
case NL80211_CHAN_WIDTH_10:
|
||||||
|
@ -390,7 +390,7 @@ static void rtw_get_chbw_from_cfg80211_chan_def(struct cfg80211_chan_def *chdef,
|
||||||
*ch = chan->hw_value;
|
*ch = chan->hw_value;
|
||||||
break;
|
break;
|
||||||
case NL80211_CHAN_WIDTH_80P80:
|
case NL80211_CHAN_WIDTH_80P80:
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) || defined(RHEL79))
|
||||||
case NL80211_CHAN_WIDTH_5:
|
case NL80211_CHAN_WIDTH_5:
|
||||||
case NL80211_CHAN_WIDTH_10:
|
case NL80211_CHAN_WIDTH_10:
|
||||||
#endif
|
#endif
|
||||||
|
@ -944,7 +944,7 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter)
|
||||||
struct wlan_network *cur_network = &(pmlmepriv->cur_network);
|
struct wlan_network *cur_network = &(pmlmepriv->cur_network);
|
||||||
struct wireless_dev *pwdev = padapter->rtw_wdev;
|
struct wireless_dev *pwdev = padapter->rtw_wdev;
|
||||||
struct cfg80211_bss *bss = NULL;
|
struct cfg80211_bss *bss = NULL;
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL79))
|
||||||
struct wiphy *wiphy = pwdev->wiphy;
|
struct wiphy *wiphy = pwdev->wiphy;
|
||||||
int freq = 2412;
|
int freq = 2412;
|
||||||
struct ieee80211_channel *notify_channel;
|
struct ieee80211_channel *notify_channel;
|
||||||
|
@ -1002,7 +1002,7 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter)
|
||||||
RTW_PRINT(FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter));
|
RTW_PRINT(FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter));
|
||||||
}
|
}
|
||||||
/* notify cfg80211 that device joined an IBSS */
|
/* notify cfg80211 that device joined an IBSS */
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL79))
|
||||||
notify_channel = ieee80211_get_channel(wiphy, freq);
|
notify_channel = ieee80211_get_channel(wiphy, freq);
|
||||||
cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, notify_channel, GFP_ATOMIC);
|
cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, notify_channel, GFP_ATOMIC);
|
||||||
#else
|
#else
|
||||||
|
@ -1090,7 +1090,7 @@ check_bss:
|
||||||
struct ieee80211_channel *notify_channel;
|
struct ieee80211_channel *notify_channel;
|
||||||
u32 freq;
|
u32 freq;
|
||||||
u16 channel = cur_network->network.Configuration.DSConfig;
|
u16 channel = cur_network->network.Configuration.DSConfig;
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL79))
|
||||||
struct cfg80211_roam_info roam_info;
|
struct cfg80211_roam_info roam_info;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1098,7 +1098,7 @@ check_bss:
|
||||||
notify_channel = ieee80211_get_channel(wiphy, freq);
|
notify_channel = ieee80211_get_channel(wiphy, freq);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL79))
|
||||||
roam_info.bssid = cur_network->network.MacAddress;
|
roam_info.bssid = cur_network->network.MacAddress;
|
||||||
roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2;
|
roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2;
|
||||||
roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2;
|
roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2;
|
||||||
|
@ -1126,7 +1126,7 @@ check_bss:
|
||||||
rtw_ft_set_status(padapter, RTW_FT_ASSOCIATED_STA);
|
rtw_ft_set_status(padapter, RTW_FT_ASSOCIATED_STA);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)
|
#if !defined(RHEL79) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE))
|
||||||
RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
|
RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1137,7 +1137,7 @@ check_bss:
|
||||||
, pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6
|
, pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6
|
||||||
, pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6
|
, pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6
|
||||||
, WLAN_STATUS_SUCCESS, GFP_ATOMIC);
|
, WLAN_STATUS_SUCCESS, GFP_ATOMIC);
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)
|
#if defined(RHEL79) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE))
|
||||||
RTW_INFO("pwdev->sme_state(a)=%d\n", pwdev->sme_state);
|
RTW_INFO("pwdev->sme_state(a)=%d\n", pwdev->sme_state);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1193,7 +1193,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally
|
||||||
_enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL);
|
_enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL);
|
||||||
|
|
||||||
if (padapter->ndev_unregistering || !rtw_wdev_not_indic_disco(pwdev_priv)) {
|
if (padapter->ndev_unregistering || !rtw_wdev_not_indic_disco(pwdev_priv)) {
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)
|
#if (!defined(RHEL79) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)))
|
||||||
RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
|
RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
|
||||||
|
|
||||||
if (pwdev->sme_state == CFG80211_SME_CONNECTING) {
|
if (pwdev->sme_state == CFG80211_SME_CONNECTING) {
|
||||||
|
@ -2448,7 +2448,7 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted)
|
||||||
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
|
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
|
||||||
_irqL irqL;
|
_irqL irqL;
|
||||||
|
|
||||||
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE)
|
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79))
|
||||||
struct cfg80211_scan_info info;
|
struct cfg80211_scan_info info;
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
|
@ -2465,7 +2465,7 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted)
|
||||||
if (pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy)
|
if (pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy)
|
||||||
RTW_INFO("error wiphy compare\n");
|
RTW_INFO("error wiphy compare\n");
|
||||||
else
|
else
|
||||||
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE)
|
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79))
|
||||||
cfg80211_scan_done(pwdev_priv->scan_request, &info);
|
cfg80211_scan_done(pwdev_priv->scan_request, &info);
|
||||||
#else
|
#else
|
||||||
cfg80211_scan_done(pwdev_priv->scan_request, aborted);
|
cfg80211_scan_done(pwdev_priv->scan_request, aborted);
|
||||||
|
@ -3055,7 +3055,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
|
||||||
|
|
||||||
check_need_indicate_scan_done:
|
check_need_indicate_scan_done:
|
||||||
if (_TRUE == need_indicate_scan_done) {
|
if (_TRUE == need_indicate_scan_done) {
|
||||||
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE)
|
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79))
|
||||||
struct cfg80211_scan_info info;
|
struct cfg80211_scan_info info;
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
|
@ -3063,7 +3063,7 @@ check_need_indicate_scan_done:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_rtw_cfg80211_surveydone_event_callback(padapter, request);
|
_rtw_cfg80211_surveydone_event_callback(padapter, request);
|
||||||
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE)
|
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79))
|
||||||
cfg80211_scan_done(request, &info);
|
cfg80211_scan_done(request, &info);
|
||||||
#else
|
#else
|
||||||
cfg80211_scan_done(request, 0);
|
cfg80211_scan_done(request, 0);
|
||||||
|
@ -4460,6 +4460,12 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))
|
||||||
|
mon_ndev->min_mtu = WLAN_MIN_ETHFRM_LEN;
|
||||||
|
mon_ndev->mtu = WLAN_DATA_MAXLEN;
|
||||||
|
mon_ndev->max_mtu = WLAN_DATA_MAXLEN;
|
||||||
|
#endif
|
||||||
|
|
||||||
mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP;
|
mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP;
|
||||||
strncpy(mon_ndev->name, name, IFNAMSIZ);
|
strncpy(mon_ndev->name, name, IFNAMSIZ);
|
||||||
mon_ndev->name[IFNAMSIZ - 1] = 0;
|
mon_ndev->name[IFNAMSIZ - 1] = 0;
|
||||||
|
@ -7088,34 +7094,24 @@ exit:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
|
||||||
|
static void cfg80211_rtw_update_mgmt_frame_register(struct wiphy *wiphy,
|
||||||
|
struct wireless_dev *wdev,
|
||||||
|
struct mgmt_frame_regs *upd)
|
||||||
|
#else
|
||||||
static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
|
static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||||
struct wireless_dev *wdev,
|
struct wireless_dev *wdev,
|
||||||
#else
|
#else
|
||||||
struct net_device *ndev,
|
struct net_device *ndev,
|
||||||
#endif
|
#endif
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
|
|
||||||
struct mgmt_frame_regs *upd)
|
|
||||||
#else
|
|
||||||
u16 frame_type, bool reg)
|
u16 frame_type, bool reg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
|
|
||||||
u32 rtw_mask = BIT(IEEE80211_STYPE_PROBE_REQ >> 4);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||||
struct net_device *ndev = wdev_to_ndev(wdev);
|
struct net_device *ndev = wdev_to_ndev(wdev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* hardcoded always true, to make it pass compilation */
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
|
|
||||||
bool reg = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_adapter *adapter;
|
_adapter *adapter;
|
||||||
|
|
||||||
struct rtw_wdev_priv *pwdev_priv;
|
struct rtw_wdev_priv *pwdev_priv;
|
||||||
|
|
||||||
if (ndev == NULL)
|
if (ndev == NULL)
|
||||||
|
@ -7125,38 +7121,8 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
|
||||||
pwdev_priv = adapter_wdev_data(adapter);
|
pwdev_priv = adapter_wdev_data(adapter);
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_CFG80211
|
#ifdef CONFIG_DEBUG_CFG80211
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
|
|
||||||
RTW_INFO(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter),
|
RTW_INFO(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter),
|
||||||
frame_type, reg);
|
frame_type, reg);
|
||||||
#else
|
|
||||||
RTW_INFO(FUNC_ADPT_FMT " old_regs:%x new_regs:%x\n",
|
|
||||||
FUNC_ADPT_ARG(adapter), pwdev_priv->mgmt_mask, upd->interface_stypes);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Wait QC Verify */
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
|
|
||||||
switch (upd->interface_stypes) {
|
|
||||||
#else
|
|
||||||
switch (frame_type) {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case IEEE80211_STYPE_PROBE_REQ: /* 0x0040 */
|
|
||||||
SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_PROBE_REQ, reg);
|
|
||||||
break;
|
|
||||||
case IEEE80211_STYPE_ACTION: /* 0x00D0 */
|
|
||||||
SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_ACTION, reg);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if ((upd->interface_stypes & rtw_mask) == (pwdev_priv->mgmt_mask & rtw_mask))
|
|
||||||
return;
|
|
||||||
|
|
||||||
pwdev_priv->mgmt_mask = upd->interface_stypes;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -9146,7 +9112,8 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) && \
|
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) && \
|
||||||
LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0))
|
LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) && \
|
||||||
|
!defined(RHEL79))
|
||||||
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
|
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
|
||||||
#ifdef CONFIG_PNO_SUPPORT
|
#ifdef CONFIG_PNO_SUPPORT
|
||||||
wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT;
|
wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT;
|
||||||
|
@ -9157,7 +9124,7 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
|
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0))
|
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) && !defined(RHEL79))
|
||||||
wiphy->wowlan = wowlan_stub;
|
wiphy->wowlan = wowlan_stub;
|
||||||
#else
|
#else
|
||||||
wiphy->wowlan = &wowlan_stub;
|
wiphy->wowlan = &wowlan_stub;
|
||||||
|
@ -9464,7 +9431,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||||
.mgmt_tx = cfg80211_rtw_mgmt_tx,
|
.mgmt_tx = cfg80211_rtw_mgmt_tx,
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
|
||||||
.update_mgmt_frame_registrations = cfg80211_rtw_mgmt_frame_register,
|
.update_mgmt_frame_registrations = cfg80211_rtw_update_mgmt_frame_register,
|
||||||
#else
|
#else
|
||||||
.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
|
.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
|
||||||
#endif
|
#endif
|
||||||
|
@ -9801,3 +9768,5 @@ void rtw_cfg80211_dev_res_unregister(struct dvobj_priv *dvobj)
|
||||||
rtw_wiphy_unregister(dvobj_to_wiphy(dvobj));
|
rtw_wiphy_unregister(dvobj_to_wiphy(dvobj));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_IOCTL_CFG80211 */
|
||||||
|
|
|
@ -362,7 +362,7 @@ void rtw_cfg80211_deinit_rfkill(struct wiphy *wiphy);
|
||||||
|
|
||||||
#define rtw_cfg80211_connect_result(wdev, bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp) cfg80211_connect_result(wdev_to_ndev(wdev), bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp)
|
#define rtw_cfg80211_connect_result(wdev, bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp) cfg80211_connect_result(wdev_to_ndev(wdev), bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp)
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0))
|
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) && !defined(RHEL79))
|
||||||
#define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, gfp)
|
#define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, gfp)
|
||||||
#else
|
#else
|
||||||
#define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, locally_generated, gfp)
|
#define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, locally_generated, gfp)
|
||||||
|
@ -384,7 +384,7 @@ void rtw_cfg80211_deinit_rfkill(struct wiphy *wiphy);
|
||||||
u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 ht);
|
u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 ht);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) && !defined(RHEL79) )
|
||||||
#define NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
|
#define NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
|
||||||
#define NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
|
#define NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||||
|
|
|
@ -1513,6 +1513,12 @@ struct net_device *rtw_init_netdev(_adapter *old_padapter)
|
||||||
if (!pnetdev)
|
if (!pnetdev)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))
|
||||||
|
pnetdev->min_mtu = WLAN_MIN_ETHFRM_LEN;
|
||||||
|
pnetdev->mtu = WLAN_DATA_MAXLEN;
|
||||||
|
pnetdev->max_mtu = WLAN_DATA_MAXLEN;
|
||||||
|
#endif
|
||||||
|
|
||||||
padapter = rtw_netdev_priv(pnetdev);
|
padapter = rtw_netdev_priv(pnetdev);
|
||||||
padapter->pnetdev = pnetdev;
|
padapter->pnetdev = pnetdev;
|
||||||
|
|
||||||
|
|
|
@ -354,7 +354,11 @@ static int napi_recv(_adapter *padapter, int budget)
|
||||||
|
|
||||||
#ifdef CONFIG_RTW_GRO
|
#ifdef CONFIG_RTW_GRO
|
||||||
if (pregistrypriv->en_gro) {
|
if (pregistrypriv->en_gro) {
|
||||||
|
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0))
|
||||||
if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_DROP)
|
if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_DROP)
|
||||||
|
#else
|
||||||
|
if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_MERGED_FREE)
|
||||||
|
#endif
|
||||||
rx_ok = _TRUE;
|
rx_ok = _TRUE;
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ void rtw_regd_apply_flags(struct wiphy *wiphy)
|
||||||
&& rtw_odm_dfs_domain_unknown(padapter)
|
&& rtw_odm_dfs_domain_unknown(padapter)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
|
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL79))
|
||||||
ch->flags = (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN);
|
ch->flags = (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN);
|
||||||
#else
|
#else
|
||||||
ch->flags = IEEE80211_CHAN_NO_IR;
|
ch->flags = IEEE80211_CHAN_NO_IR;
|
||||||
|
@ -309,7 +309,7 @@ void rtw_regd_apply_flags(struct wiphy *wiphy)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
ch->flags |= IEEE80211_CHAN_RADAR;
|
ch->flags |= IEEE80211_CHAN_RADAR;
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
|
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL79))
|
||||||
ch->flags |= (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN);
|
ch->flags |= (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN);
|
||||||
#else
|
#else
|
||||||
ch->flags |= IEEE80211_CHAN_NO_IR;
|
ch->flags |= IEEE80211_CHAN_NO_IR;
|
||||||
|
@ -374,7 +374,7 @@ static void _rtw_regd_init_wiphy(struct rtw_regulatory *reg, struct wiphy *wiphy
|
||||||
wiphy->reg_notifier = rtw_reg_notifier;
|
wiphy->reg_notifier = rtw_reg_notifier;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))
|
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL79))
|
||||||
wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
|
wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
|
||||||
wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY;
|
wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY;
|
||||||
wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS;
|
wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS;
|
||||||
|
|
|
@ -2341,6 +2341,12 @@ struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_p
|
||||||
if (!pnetdev)
|
if (!pnetdev)
|
||||||
goto RETURN;
|
goto RETURN;
|
||||||
|
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))
|
||||||
|
pnetdev->min_mtu = WLAN_MIN_ETHFRM_LEN;
|
||||||
|
pnetdev->mtu = WLAN_MAX_ETHFRM_LEN;
|
||||||
|
pnetdev->max_mtu = WLAN_DATA_MAXLEN;
|
||||||
|
#endif
|
||||||
|
|
||||||
pnpi = netdev_priv(pnetdev);
|
pnpi = netdev_priv(pnetdev);
|
||||||
pnpi->priv = old_priv;
|
pnpi->priv = old_priv;
|
||||||
pnpi->sizeof_priv = sizeof_priv;
|
pnpi->sizeof_priv = sizeof_priv;
|
||||||
|
@ -2362,6 +2368,12 @@ struct net_device *rtw_alloc_etherdev(int sizeof_priv)
|
||||||
if (!pnetdev)
|
if (!pnetdev)
|
||||||
goto RETURN;
|
goto RETURN;
|
||||||
|
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))
|
||||||
|
pnetdev->min_mtu = WLAN_MIN_ETHFRM_LEN;
|
||||||
|
pnetdev->mtu = WLAN_MAX_ETHFRM_LEN;
|
||||||
|
pnetdev->max_mtu = WLAN_DATA_MAXLEN;
|
||||||
|
#endif
|
||||||
|
|
||||||
pnpi = netdev_priv(pnetdev);
|
pnpi = netdev_priv(pnetdev);
|
||||||
|
|
||||||
pnpi->priv = rtw_zvmalloc(sizeof_priv);
|
pnpi->priv = rtw_zvmalloc(sizeof_priv);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,497 @@
|
||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||||
|
*
|
||||||
|
* 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 the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
#ifndef __RTW_SECURITY_H_
|
||||||
|
#define __RTW_SECURITY_H_
|
||||||
|
|
||||||
|
|
||||||
|
#define _NO_PRIVACY_ 0x0
|
||||||
|
#define _WEP40_ 0x1
|
||||||
|
#define _TKIP_ 0x2
|
||||||
|
#define _TKIP_WTMIC_ 0x3
|
||||||
|
#define _AES_ 0x4
|
||||||
|
#define _WEP104_ 0x5
|
||||||
|
#define _SMS4_ 0x06
|
||||||
|
#define _WEP_WPA_MIXED_ 0x07 /* WEP + WPA */
|
||||||
|
#define _BIP_ 0x8
|
||||||
|
|
||||||
|
/* 802.11W use wrong key */
|
||||||
|
#define IEEE80211W_RIGHT_KEY 0x0
|
||||||
|
#define IEEE80211W_WRONG_KEY 0x1
|
||||||
|
#define IEEE80211W_NO_KEY 0x2
|
||||||
|
|
||||||
|
#define CCMPH_2_PN(ch) ((ch) & 0x000000000000ffff) \
|
||||||
|
| (((ch) & 0xffffffff00000000) >> 16)
|
||||||
|
|
||||||
|
#define is_wep_enc(alg) (((alg) == _WEP40_) || ((alg) == _WEP104_))
|
||||||
|
|
||||||
|
const char *security_type_str(u8 value);
|
||||||
|
|
||||||
|
#define _WPA_IE_ID_ 0xdd
|
||||||
|
#define _WPA2_IE_ID_ 0x30
|
||||||
|
|
||||||
|
#define RTW_SHA256_MAC_LEN 32
|
||||||
|
#define AES_BLOCK_SIZE 16
|
||||||
|
#define AES_PRIV_SIZE (4 * 44)
|
||||||
|
|
||||||
|
#define RTW_KEK_LEN 16
|
||||||
|
#define RTW_KCK_LEN 16
|
||||||
|
#define RTW_TKIP_MIC_LEN 8
|
||||||
|
#define RTW_REPLAY_CTR_LEN 8
|
||||||
|
|
||||||
|
#define INVALID_SEC_MAC_CAM_ID 0xFF
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ENCRYP_PROTOCOL_OPENSYS, /* open system */
|
||||||
|
ENCRYP_PROTOCOL_WEP, /* WEP */
|
||||||
|
ENCRYP_PROTOCOL_WPA, /* WPA */
|
||||||
|
ENCRYP_PROTOCOL_WPA2, /* WPA2 */
|
||||||
|
ENCRYP_PROTOCOL_WAPI, /* WAPI: Not support in this version */
|
||||||
|
ENCRYP_PROTOCOL_MAX
|
||||||
|
} ENCRYP_PROTOCOL_E;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef Ndis802_11AuthModeWPA2
|
||||||
|
#define Ndis802_11AuthModeWPA2 (Ndis802_11AuthModeWPANone + 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Ndis802_11AuthModeWPA2PSK
|
||||||
|
#define Ndis802_11AuthModeWPA2PSK (Ndis802_11AuthModeWPANone + 2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
union pn48 {
|
||||||
|
|
||||||
|
u64 val;
|
||||||
|
|
||||||
|
#ifdef CONFIG_LITTLE_ENDIAN
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u8 TSC0;
|
||||||
|
u8 TSC1;
|
||||||
|
u8 TSC2;
|
||||||
|
u8 TSC3;
|
||||||
|
u8 TSC4;
|
||||||
|
u8 TSC5;
|
||||||
|
u8 TSC6;
|
||||||
|
u8 TSC7;
|
||||||
|
} _byte_;
|
||||||
|
|
||||||
|
#elif defined(CONFIG_BIG_ENDIAN)
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u8 TSC7;
|
||||||
|
u8 TSC6;
|
||||||
|
u8 TSC5;
|
||||||
|
u8 TSC4;
|
||||||
|
u8 TSC3;
|
||||||
|
u8 TSC2;
|
||||||
|
u8 TSC1;
|
||||||
|
u8 TSC0;
|
||||||
|
} _byte_;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
union Keytype {
|
||||||
|
u8 skey[16];
|
||||||
|
u32 lkey[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _RT_PMKID_LIST {
|
||||||
|
u8 bUsed;
|
||||||
|
u8 Bssid[6];
|
||||||
|
u8 PMKID[16];
|
||||||
|
u8 SsidBuf[33];
|
||||||
|
u8 *ssid_octet;
|
||||||
|
u16 ssid_length;
|
||||||
|
} RT_PMKID_LIST, *PRT_PMKID_LIST;
|
||||||
|
|
||||||
|
|
||||||
|
struct security_priv {
|
||||||
|
u32 dot11AuthAlgrthm; /* 802.11 auth, could be open, shared, 8021x and authswitch */
|
||||||
|
u32 dot11PrivacyAlgrthm; /* This specify the privacy for shared auth. algorithm. */
|
||||||
|
|
||||||
|
/* WEP */
|
||||||
|
u32 dot11PrivacyKeyIndex; /* this is only valid for legendary wep, 0~3 for key id. (tx key index) */
|
||||||
|
union Keytype dot11DefKey[6]; /* this is only valid for def. key */
|
||||||
|
u32 dot11DefKeylen[6];
|
||||||
|
u8 dot11Def_camid[6];
|
||||||
|
u8 key_mask; /* use to restore wep key after hal_init */
|
||||||
|
|
||||||
|
u32 dot118021XGrpPrivacy; /* This specify the privacy algthm. used for Grp key */
|
||||||
|
u32 dot118021XGrpKeyid; /* key id used for Grp Key ( tx key index) */
|
||||||
|
union Keytype dot118021XGrpKey[6]; /* 802.1x Group Key, for inx0 and inx1 */
|
||||||
|
union Keytype dot118021XGrptxmickey[6];
|
||||||
|
union Keytype dot118021XGrprxmickey[6];
|
||||||
|
union pn48 dot11Grptxpn; /* PN48 used for Grp Key xmit. */
|
||||||
|
union pn48 dot11Grprxpn; /* PN48 used for Grp Key recv. */
|
||||||
|
u8 iv_seq[4][8];
|
||||||
|
#ifdef CONFIG_IEEE80211W
|
||||||
|
u32 dot11wBIPKeyid; /* key id used for BIP Key ( tx key index) */
|
||||||
|
union Keytype dot11wBIPKey[6]; /* BIP Key, for index4 and index5 */
|
||||||
|
union pn48 dot11wBIPtxpn; /* PN48 used for BIP xmit. */
|
||||||
|
union pn48 dot11wBIPrxpn; /* PN48 used for BIP recv. */
|
||||||
|
#endif /* CONFIG_IEEE80211W */
|
||||||
|
#ifdef CONFIG_AP_MODE
|
||||||
|
/* extend security capabilities for AP_MODE */
|
||||||
|
unsigned int dot8021xalg;/* 0:disable, 1:psk, 2:802.1x */
|
||||||
|
unsigned int wpa_psk;/* 0:disable, bit(0): WPA, bit(1):WPA2 */
|
||||||
|
unsigned int wpa_group_cipher;
|
||||||
|
unsigned int wpa2_group_cipher;
|
||||||
|
unsigned int wpa_pairwise_cipher;
|
||||||
|
unsigned int wpa2_pairwise_cipher;
|
||||||
|
u8 mfp_opt;
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_CONCURRENT_MODE
|
||||||
|
u8 dot118021x_bmc_cam_id;
|
||||||
|
#endif
|
||||||
|
/*IEEE802.11-2012 Std. Table 8-101 AKM Suite Selectors*/
|
||||||
|
u32 rsn_akm_suite_type;
|
||||||
|
|
||||||
|
u8 wps_ie[MAX_WPS_IE_LEN];/* added in assoc req */
|
||||||
|
int wps_ie_len;
|
||||||
|
|
||||||
|
|
||||||
|
u8 binstallGrpkey;
|
||||||
|
#ifdef CONFIG_GTK_OL
|
||||||
|
u8 binstallKCK_KEK;
|
||||||
|
#endif /* CONFIG_GTK_OL */
|
||||||
|
#ifdef CONFIG_IEEE80211W
|
||||||
|
u8 binstallBIPkey;
|
||||||
|
#endif /* CONFIG_IEEE80211W */
|
||||||
|
u8 busetkipkey;
|
||||||
|
u8 bcheck_grpkey;
|
||||||
|
u8 bgrpkey_handshake;
|
||||||
|
|
||||||
|
/* u8 packet_cnt; */ /* unused, removed */
|
||||||
|
|
||||||
|
s32 sw_encrypt;/* from registry_priv */
|
||||||
|
s32 sw_decrypt;/* from registry_priv */
|
||||||
|
|
||||||
|
s32 hw_decrypted;/* if the rx packets is hw_decrypted==_FALSE, it means the hw has not been ready. */
|
||||||
|
|
||||||
|
|
||||||
|
/* keeps the auth_type & enc_status from upper layer ioctl(wpa_supplicant or wzc) */
|
||||||
|
u32 ndisauthtype; /* NDIS_802_11_AUTHENTICATION_MODE */
|
||||||
|
u32 ndisencryptstatus; /* NDIS_802_11_ENCRYPTION_STATUS */
|
||||||
|
|
||||||
|
NDIS_802_11_WEP ndiswep;
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
u8 KeyMaterial[16];/* variable length depending on above field. */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
u8 assoc_info[600];
|
||||||
|
u8 szofcapability[256]; /* for wpa2 usage */
|
||||||
|
u8 oidassociation[512]; /* for wpa/wpa2 usage */
|
||||||
|
u8 authenticator_ie[256]; /* store ap security information element */
|
||||||
|
u8 supplicant_ie[256]; /* store sta security information element */
|
||||||
|
|
||||||
|
|
||||||
|
/* for tkip countermeasure */
|
||||||
|
systime last_mic_err_time;
|
||||||
|
u8 btkip_countermeasure;
|
||||||
|
u8 btkip_wait_report;
|
||||||
|
systime btkip_countermeasure_time;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------- */
|
||||||
|
/* For WPA2 Pre-Authentication. */
|
||||||
|
/* --------------------------------------------------------------------------- */
|
||||||
|
/* u8 RegEnablePreAuth; */ /* Default value: Pre-Authentication enabled or not, from registry "EnablePreAuth". Added by Annie, 2005-11-01. */
|
||||||
|
/* u8 EnablePreAuthentication; */ /* Current Value: Pre-Authentication enabled or not. */
|
||||||
|
RT_PMKID_LIST PMKIDList[NUM_PMKID_CACHE]; /* Renamed from PreAuthKey[NUM_PRE_AUTH_KEY]. Annie, 2006-10-13. */
|
||||||
|
u8 PMKIDIndex;
|
||||||
|
/* u32 PMKIDCount; */ /* Added by Annie, 2006-10-13. */
|
||||||
|
/* u8 szCapability[256]; */ /* For WPA2-PSK using zero-config, by Annie, 2005-09-20. */
|
||||||
|
|
||||||
|
u8 bWepDefaultKeyIdxSet;
|
||||||
|
|
||||||
|
#define DBG_SW_SEC_CNT
|
||||||
|
#ifdef DBG_SW_SEC_CNT
|
||||||
|
u64 wep_sw_enc_cnt_bc;
|
||||||
|
u64 wep_sw_enc_cnt_mc;
|
||||||
|
u64 wep_sw_enc_cnt_uc;
|
||||||
|
u64 wep_sw_dec_cnt_bc;
|
||||||
|
u64 wep_sw_dec_cnt_mc;
|
||||||
|
u64 wep_sw_dec_cnt_uc;
|
||||||
|
|
||||||
|
u64 tkip_sw_enc_cnt_bc;
|
||||||
|
u64 tkip_sw_enc_cnt_mc;
|
||||||
|
u64 tkip_sw_enc_cnt_uc;
|
||||||
|
u64 tkip_sw_dec_cnt_bc;
|
||||||
|
u64 tkip_sw_dec_cnt_mc;
|
||||||
|
u64 tkip_sw_dec_cnt_uc;
|
||||||
|
|
||||||
|
u64 aes_sw_enc_cnt_bc;
|
||||||
|
u64 aes_sw_enc_cnt_mc;
|
||||||
|
u64 aes_sw_enc_cnt_uc;
|
||||||
|
u64 aes_sw_dec_cnt_bc;
|
||||||
|
u64 aes_sw_dec_cnt_mc;
|
||||||
|
u64 aes_sw_dec_cnt_uc;
|
||||||
|
#endif /* DBG_SW_SEC_CNT */
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_IEEE80211W
|
||||||
|
#define SEC_IS_BIP_KEY_INSTALLED(sec) ((sec)->binstallBIPkey)
|
||||||
|
#else
|
||||||
|
#define SEC_IS_BIP_KEY_INSTALLED(sec) _FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct rtw_sha256_state {
|
||||||
|
u64 length;
|
||||||
|
u32 state[8], curlen;
|
||||||
|
u8 buf[64];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define GET_ENCRY_ALGO(psecuritypriv, psta, encry_algo, bmcst)\
|
||||||
|
do {\
|
||||||
|
switch (psecuritypriv->dot11AuthAlgrthm) {\
|
||||||
|
case dot11AuthAlgrthm_Open:\
|
||||||
|
case dot11AuthAlgrthm_Shared:\
|
||||||
|
case dot11AuthAlgrthm_Auto:\
|
||||||
|
encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\
|
||||||
|
break;\
|
||||||
|
case dot11AuthAlgrthm_8021X:\
|
||||||
|
if (bmcst)\
|
||||||
|
encry_algo = (u8)psecuritypriv->dot118021XGrpPrivacy;\
|
||||||
|
else\
|
||||||
|
encry_algo = (u8) psta->dot118021XPrivacy;\
|
||||||
|
break;\
|
||||||
|
case dot11AuthAlgrthm_WAPI:\
|
||||||
|
encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\
|
||||||
|
break;\
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define _AES_IV_LEN_ 8
|
||||||
|
|
||||||
|
#define SET_ICE_IV_LEN(iv_len, icv_len, encrypt)\
|
||||||
|
do {\
|
||||||
|
switch (encrypt) {\
|
||||||
|
case _WEP40_:\
|
||||||
|
case _WEP104_:\
|
||||||
|
iv_len = 4;\
|
||||||
|
icv_len = 4;\
|
||||||
|
break;\
|
||||||
|
case _TKIP_:\
|
||||||
|
iv_len = 8;\
|
||||||
|
icv_len = 4;\
|
||||||
|
break;\
|
||||||
|
case _AES_:\
|
||||||
|
iv_len = 8;\
|
||||||
|
icv_len = 8;\
|
||||||
|
break;\
|
||||||
|
case _SMS4_:\
|
||||||
|
iv_len = 18;\
|
||||||
|
icv_len = 16;\
|
||||||
|
break;\
|
||||||
|
default:\
|
||||||
|
iv_len = 0;\
|
||||||
|
icv_len = 0;\
|
||||||
|
break;\
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
#define GET_TKIP_PN(iv, dot11txpn)\
|
||||||
|
do {\
|
||||||
|
dot11txpn._byte_.TSC0 = iv[2];\
|
||||||
|
dot11txpn._byte_.TSC1 = iv[0];\
|
||||||
|
dot11txpn._byte_.TSC2 = iv[4];\
|
||||||
|
dot11txpn._byte_.TSC3 = iv[5];\
|
||||||
|
dot11txpn._byte_.TSC4 = iv[6];\
|
||||||
|
dot11txpn._byte_.TSC5 = iv[7];\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
#define ROL32(A, n) (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1)))
|
||||||
|
#define ROR32(A, n) ROL32((A), 32-(n))
|
||||||
|
|
||||||
|
struct mic_data {
|
||||||
|
u32 K0, K1; /* Key */
|
||||||
|
u32 L, R; /* Current state */
|
||||||
|
u32 M; /* Message accumulator (single word) */
|
||||||
|
u32 nBytesInM; /* # bytes in M */
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const u32 Te0[256];
|
||||||
|
extern const u32 Te1[256];
|
||||||
|
extern const u32 Te2[256];
|
||||||
|
extern const u32 Te3[256];
|
||||||
|
extern const u32 Te4[256];
|
||||||
|
extern const u32 Td0[256];
|
||||||
|
extern const u32 Td1[256];
|
||||||
|
extern const u32 Td2[256];
|
||||||
|
extern const u32 Td3[256];
|
||||||
|
extern const u32 Td4[256];
|
||||||
|
extern const u32 rcon[10];
|
||||||
|
extern const u8 Td4s[256];
|
||||||
|
extern const u8 rcons[10];
|
||||||
|
|
||||||
|
#define RCON(i) (rcons[(i)] << 24)
|
||||||
|
|
||||||
|
static inline u32 rotr(u32 val, int bits)
|
||||||
|
{
|
||||||
|
return (val >> bits) | (val << (32 - bits));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TE0(i) Te0[((i) >> 24) & 0xff]
|
||||||
|
#define TE1(i) rotr(Te0[((i) >> 16) & 0xff], 8)
|
||||||
|
#define TE2(i) rotr(Te0[((i) >> 8) & 0xff], 16)
|
||||||
|
#define TE3(i) rotr(Te0[(i) & 0xff], 24)
|
||||||
|
#define TE41(i) ((Te0[((i) >> 24) & 0xff] << 8) & 0xff000000)
|
||||||
|
#define TE42(i) (Te0[((i) >> 16) & 0xff] & 0x00ff0000)
|
||||||
|
#define TE43(i) (Te0[((i) >> 8) & 0xff] & 0x0000ff00)
|
||||||
|
#define TE44(i) ((Te0[(i) & 0xff] >> 8) & 0x000000ff)
|
||||||
|
#define TE421(i) ((Te0[((i) >> 16) & 0xff] << 8) & 0xff000000)
|
||||||
|
#define TE432(i) (Te0[((i) >> 8) & 0xff] & 0x00ff0000)
|
||||||
|
#define TE443(i) (Te0[(i) & 0xff] & 0x0000ff00)
|
||||||
|
#define TE414(i) ((Te0[((i) >> 24) & 0xff] >> 8) & 0x000000ff)
|
||||||
|
#define TE4(i) ((Te0[(i)] >> 8) & 0x000000ff)
|
||||||
|
|
||||||
|
#define TD0(i) Td0[((i) >> 24) & 0xff]
|
||||||
|
#define TD1(i) rotr(Td0[((i) >> 16) & 0xff], 8)
|
||||||
|
#define TD2(i) rotr(Td0[((i) >> 8) & 0xff], 16)
|
||||||
|
#define TD3(i) rotr(Td0[(i) & 0xff], 24)
|
||||||
|
#define TD41(i) (Td4s[((i) >> 24) & 0xff] << 24)
|
||||||
|
#define TD42(i) (Td4s[((i) >> 16) & 0xff] << 16)
|
||||||
|
#define TD43(i) (Td4s[((i) >> 8) & 0xff] << 8)
|
||||||
|
#define TD44(i) (Td4s[(i) & 0xff])
|
||||||
|
#define TD0_(i) Td0[(i) & 0xff]
|
||||||
|
#define TD1_(i) rotr(Td0[(i) & 0xff], 8)
|
||||||
|
#define TD2_(i) rotr(Td0[(i) & 0xff], 16)
|
||||||
|
#define TD3_(i) rotr(Td0[(i) & 0xff], 24)
|
||||||
|
|
||||||
|
#define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ \
|
||||||
|
((u32)(pt)[2] << 8) ^ ((u32)(pt)[3]))
|
||||||
|
|
||||||
|
#define PUTU32(ct, st) { \
|
||||||
|
(ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); \
|
||||||
|
(ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); }
|
||||||
|
|
||||||
|
#define WPA_GET_BE32(a) ((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \
|
||||||
|
(((u32) (a)[2]) << 8) | ((u32) (a)[3]))
|
||||||
|
|
||||||
|
#define WPA_PUT_LE16(a, val) \
|
||||||
|
do { \
|
||||||
|
(a)[1] = ((u16) (val)) >> 8; \
|
||||||
|
(a)[0] = ((u16) (val)) & 0xff; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define WPA_PUT_BE32(a, val) \
|
||||||
|
do { \
|
||||||
|
(a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \
|
||||||
|
(a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \
|
||||||
|
(a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \
|
||||||
|
(a)[3] = (u8) (((u32) (val)) & 0xff); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define WPA_PUT_BE64(a, val) \
|
||||||
|
do { \
|
||||||
|
(a)[0] = (u8) (((u64) (val)) >> 56); \
|
||||||
|
(a)[1] = (u8) (((u64) (val)) >> 48); \
|
||||||
|
(a)[2] = (u8) (((u64) (val)) >> 40); \
|
||||||
|
(a)[3] = (u8) (((u64) (val)) >> 32); \
|
||||||
|
(a)[4] = (u8) (((u64) (val)) >> 24); \
|
||||||
|
(a)[5] = (u8) (((u64) (val)) >> 16); \
|
||||||
|
(a)[6] = (u8) (((u64) (val)) >> 8); \
|
||||||
|
(a)[7] = (u8) (((u64) (val)) & 0xff); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* the K array */
|
||||||
|
static const unsigned long K[64] = {
|
||||||
|
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL,
|
||||||
|
0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL,
|
||||||
|
0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL,
|
||||||
|
0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
|
||||||
|
0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL,
|
||||||
|
0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL,
|
||||||
|
0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL,
|
||||||
|
0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
|
||||||
|
0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL,
|
||||||
|
0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL,
|
||||||
|
0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL,
|
||||||
|
0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
|
||||||
|
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Various logical functions */
|
||||||
|
#define RORc(x, y) \
|
||||||
|
(((((unsigned long) (x) & 0xFFFFFFFFUL) >> (unsigned long) ((y) & 31)) | \
|
||||||
|
((unsigned long) (x) << (unsigned long) (32 - ((y) & 31)))) & 0xFFFFFFFFUL)
|
||||||
|
#define Ch(x, y, z) (z ^ (x & (y ^ z)))
|
||||||
|
#define Maj(x, y, z) (((x | y) & z) | (x & y))
|
||||||
|
#define S(x, n) RORc((x), (n))
|
||||||
|
#define R(x, n) (((x) & 0xFFFFFFFFUL)>>(n))
|
||||||
|
#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22))
|
||||||
|
#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25))
|
||||||
|
#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3))
|
||||||
|
#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10))
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_IEEE80211W
|
||||||
|
int omac1_aes_128(const u8 *key, const u8 *data, size_t data_len, u8 *mac);
|
||||||
|
#endif /* CONFIG_IEEE80211W */
|
||||||
|
#ifdef CONFIG_RTW_MESH_AEK
|
||||||
|
int aes_siv_encrypt(const u8 *key, const u8 *pw, size_t pwlen
|
||||||
|
, size_t num_elem, const u8 *addr[], const size_t *len, u8 *out);
|
||||||
|
int aes_siv_decrypt(const u8 *key, const u8 *iv_crypt, size_t iv_c_len
|
||||||
|
, size_t num_elem, const u8 *addr[], const size_t *len, u8 *out);
|
||||||
|
#endif
|
||||||
|
void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key);
|
||||||
|
void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b);
|
||||||
|
void rtw_secmicappend(struct mic_data *pmicdata, u8 *src, u32 nBytes);
|
||||||
|
void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst);
|
||||||
|
|
||||||
|
void rtw_seccalctkipmic(
|
||||||
|
u8 *key,
|
||||||
|
u8 *header,
|
||||||
|
u8 *data,
|
||||||
|
u32 data_len,
|
||||||
|
u8 *Miccode,
|
||||||
|
u8 priority);
|
||||||
|
|
||||||
|
u32 rtw_aes_encrypt(_adapter *padapter, u8 *pxmitframe);
|
||||||
|
u32 rtw_tkip_encrypt(_adapter *padapter, u8 *pxmitframe);
|
||||||
|
void rtw_wep_encrypt(_adapter *padapter, u8 *pxmitframe);
|
||||||
|
|
||||||
|
u32 rtw_aes_decrypt(_adapter *padapter, u8 *precvframe);
|
||||||
|
u32 rtw_tkip_decrypt(_adapter *padapter, u8 *precvframe);
|
||||||
|
void rtw_wep_decrypt(_adapter *padapter, u8 *precvframe);
|
||||||
|
#ifdef CONFIG_IEEE80211W
|
||||||
|
u32 rtw_BIP_verify(_adapter *padapter, u8 *whdr_pos, sint flen
|
||||||
|
, const u8 *key, u16 id, u64* ipn);
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_TDLS
|
||||||
|
void wpa_tdls_generate_tpk(_adapter *padapter, PVOID sta);
|
||||||
|
int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq,
|
||||||
|
u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie,
|
||||||
|
u8 *mic);
|
||||||
|
int wpa_tdls_teardown_ftie_mic(u8 *kck, u8 *lnkid, u16 reason,
|
||||||
|
u8 dialog_token, u8 trans_seq, u8 *ftie, u8 *mic);
|
||||||
|
int tdls_verify_mic(u8 *kck, u8 trans_seq,
|
||||||
|
u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie);
|
||||||
|
#endif /* CONFIG_TDLS */
|
||||||
|
|
||||||
|
void rtw_sec_restore_wep_key(_adapter *adapter);
|
||||||
|
u8 rtw_handle_tkip_countermeasure(_adapter *adapter, const char *caller);
|
||||||
|
|
||||||
|
#ifdef CONFIG_WOWLAN
|
||||||
|
u16 rtw_calc_crc(u8 *pdata, int length);
|
||||||
|
#endif /*CONFIG_WOWLAN*/
|
||||||
|
|
||||||
|
#endif /* __RTL871X_SECURITY_H_ */
|
Loading…
Reference in New Issue