• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef WAPI_ASUE_I_H_
17 #define WAPI_ASUE_I_H_
18 
19 #include "wpa_supplicant_i.h"
20 
21 #if defined(__cplusplus)
22 extern "C" {
23 #endif
24 
25 #define MAX_WAPI_SSID_LEN 64
26 #define BK_LEN 16
27 
28 typedef enum {
29 	/* No WAPI */
30 	AUTH_TYPE_NONE_WAPI = 0,
31 	/* Certificate */
32 	AUTH_TYPE_WAPI_CERT,
33 	/* Pre-PSK */
34 	AUTH_TYPE_WAPI_PSK,
35 } AUTH_TYPE;
36 
37 typedef enum {
38 	/* ascii */
39 	KEY_TYPE_ASCII = 0,
40 	/* HEX */
41 	KEY_TYPE_HEX,
42 } KEY_TYPE;
43 
44 enum wapi_event_type {
45 	WAPI_EVENT_ASSOC = 0,
46 	WAPI_EVENT_DISASSOC,
47 };
48 
49 struct wapi_config {
50 	u8 *ssid;
51 	size_t ssid_len;
52 
53 	u8 *psk;
54 	size_t psk_len;
55 	u8 psk_bk[BK_LEN];
56 	int psk_set;
57 
58 	int wapi_policy;
59 
60 	unsigned int pairwise_cipher;
61 	unsigned int group_cipher;
62 
63 	int key_mgmt;
64 
65 	int proto;
66 	int auth_alg;
67 	char *cert_name;
68 	int disabled;
69 };
70 
71 void wapi_config_free(struct wapi_config *config);
72 
73 struct wapi_config *wapi_config_init(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
74 
75 int wapi_asue_init();
76 
77 int wapi_asue_deinit();
78 
79 int wapi_asue_update_iface(void *iface);
80 
81 void wapi_asue_event(enum wapi_event_type action, const u8 *pBSSID, const u8 *pLocalMAC,
82 				unsigned char *assoc_ie, unsigned char assoc_ie_len);
83 
84 void wapi_asue_rx_wai(void *ctx, const u8 *src_addr, const u8 *buf, size_t len);
85 
86 #if defined(__cplusplus)
87 }
88 #endif
89 
90 #endif /* WAPI_ASUE_I_H_ */
91