forked from Anthony96922/mt7601u-ap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwapi.h
183 lines (152 loc) · 4.35 KB
/
wapi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
***************************************************************************
* Ralink Tech Inc.
* 4F, No. 2 Technology 5th Rd.
* Science-based Industrial Park
* Hsin-chu, Taiwan, R.O.C.
*
* (c) Copyright 2002-2005, Ralink Technology, Inc.
*
* All rights reserved. Ralink's source code is an unpublished work and the
* use of a copyright notice does not imply otherwise. This source code
* contains confidential trade secret material of Ralink Tech. Any attempt
* or participation in deciphering, decoding, reverse engineering or in any
* way altering the source code is stricitly prohibited, unless the prior
* written consent of Ralink Technology, Inc. is obtained.
***************************************************************************
Module Name:
wapi.h
Abstract:
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Albert 2008-4-3 Supoort WAPI protocol
*/
#ifndef __WAPI_H__
#define __WAPI_H__
#include "wpa_cmm.h"
/* Increase TxIV value for next transmission */
/* Todo - When overflow occurred, do re-key mechanism */
#define INC_TX_IV(_V, NUM) \
{ \
UCHAR cnt = LEN_WAPI_TSC; \
do \
{ \
cnt--; \
_V[cnt] = _V[cnt] + NUM; \
if (cnt == 0) \
{ \
DBGPRINT(RT_DEBUG_TRACE, ("PN overflow!!!!\n")); \
break; \
} \
}while (_V[cnt] == 0); \
}
#define IS_WAPI_CAPABILITY(a) (((a) >= Ndis802_11AuthModeWAICERT) && ((a) <= Ndis802_11AuthModeWAIPSK))
/* The underlying chip supports hardware-based WPI-SMS4 encryption and de-encryption. */
#define IS_HW_WAPI_SUPPORT(__pAd) (__pAd->chipCap.FlgIsHwWapiSup)
/*
=====================================
function prototype in wapi_crypt.c
=====================================
*/
int wpi_cbc_mac_engine(
unsigned char * maciv_in,
unsigned char * in_data1,
unsigned int in_data1_len,
unsigned char * in_data2,
unsigned int in_data2_len,
unsigned char * pkey,
unsigned char * mac_out);
int wpi_sms4_ofb_engine(
unsigned char * pofbiv_in,
unsigned char * pbw_in,
unsigned int plbw_in,
unsigned char * pkey,
unsigned char * pcw_out);
VOID RTMPInsertWapiIe(
IN UINT AuthMode,
IN UINT WepStatus,
OUT PUCHAR pWIe,
OUT UCHAR *w_len);
BOOLEAN RTMPCheckWAIframe(
IN PUCHAR pData,
IN ULONG DataByteCount);
VOID RTMPConstructWPIIVHdr(
IN UCHAR key_id,
IN UCHAR *tx_iv,
OUT UCHAR *iv_hdr);
extern INT RTMPSoftEncryptSMS4(
IN PUCHAR pHeader,
IN PUCHAR pData,
IN UINT32 data_len,
IN UCHAR key_id,
IN PUCHAR pKey,
IN PUCHAR pIv);
extern INT RTMPSoftDecryptSMS4(
IN PUCHAR pHdr,
IN BOOLEAN bSanityIV,
IN PCIPHER_KEY pKey,
INOUT PUCHAR pData,
INOUT UINT16 *DataByteCnt);
VOID RTMPDeriveWapiGTK(
IN PUCHAR nmk,
OUT PUCHAR gtk_ptr);
VOID RT_SMS4_TEST(
IN UINT8 test);
INT SMS4_TEST(void);
/*
=====================================
function prototype in wapi.c
=====================================
*/
BOOLEAN RTMPIsWapiCipher(
IN PRTMP_ADAPTER pAd,
IN UCHAR apidx);
VOID RTMPIoctlQueryWapiConf(
IN PRTMP_ADAPTER pAd,
IN RTMP_IOCTL_INPUT_STRUCT *wrq);
void rtmp_read_wapi_parms_from_file(
IN PRTMP_ADAPTER pAd,
char *tmpbuf,
char *buffer);
VOID RTMPWapiUskRekeyPeriodicExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
VOID RTMPWapiMskRekeyPeriodicExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
VOID RTMPInitWapiRekeyTimerAction(
IN PRTMP_ADAPTER pAd,
IN PMAC_TABLE_ENTRY pEntry);
VOID RTMPStartWapiRekeyTimerAction(
IN PRTMP_ADAPTER pAd,
IN PMAC_TABLE_ENTRY pEntry);
VOID RTMPCancelWapiRekeyTimerAction(
IN PRTMP_ADAPTER pAd,
IN PMAC_TABLE_ENTRY pEntry);
VOID RTMPGetWapiTxTscFromAsic(
IN PRTMP_ADAPTER pAd,
IN UINT Wcid,
OUT UCHAR *tx_tsc);
VOID WAPIInstallPairwiseKey(
PRTMP_ADAPTER pAd,
PMAC_TABLE_ENTRY pEntry,
BOOLEAN bAE);
VOID WAPIInstallSharedKey(
PRTMP_ADAPTER pAd,
UINT8 GroupCipher,
UINT8 BssIdx,
UINT8 KeyIdx,
UINT8 Wcid,
PUINT8 pGtk);
BOOLEAN WAPI_InternalCmdAction(
IN PRTMP_ADAPTER pAd,
IN UCHAR AuthMode,
IN UCHAR apidx,
IN PUCHAR pAddr,
IN UCHAR flag);
#endif /* __WAPI_H__ */