• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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 WPA_COMMON_FUZZER_H
17 #define WPA_COMMON_FUZZER_H
18 #include "hdf_log.h"
19 #include "v1_0/iwpa_callback.h"
20 #include "v1_0/iwpa_interface.h"
21 #include "securec.h"
22 #include <osal_mem.h>
23 
24 #define HDF_LOG_TAG
25 #define IFNAMSIZ 16
26 constexpr int32_t OFFSET = 4;
27 
28 uint32_t SetWpaDataSize(const uint32_t *dataSize);
29 uint32_t GetWpaDataSize(uint32_t *dataSize);
30 uint32_t Convert2Uint32(const uint8_t *ptr);
31 bool PreProcessRawData(const uint8_t *rawData, size_t size, uint8_t *tmpRawData, size_t tmpRawDataSize);
32 
33 /* **********Wpa Interface********** */
34 void FuzzWpaInterfaceStart(struct IWpaInterface *interface, const uint8_t *rawData);
35 void FuzzWpaInterfaceStop(struct IWpaInterface *interface, const uint8_t *rawData);
36 void FuzzWpaInterfaceScan(struct IWpaInterface *interface, const uint8_t *rawData);
37 void FuzzWpaInterfaceScanResult(struct IWpaInterface *interface, const uint8_t *rawData);
38 void FuzzWpaInterfaceAddNetwork(struct IWpaInterface *interface, const uint8_t *rawData);
39 void FuzzWpaInterfaceRemoveNetwork(struct IWpaInterface *interface, const uint8_t *rawData);
40 void FuzzWpaInterfaceDisableNetwork(struct IWpaInterface *interface, const uint8_t *rawData);
41 void FuzzWpaInterfaceSetNetwork(struct IWpaInterface *interface, const uint8_t *rawData);
42 void FuzzWpaInterfaceReconnect(struct IWpaInterface *interface, const uint8_t *rawData);
43 void FuzzWpaInterfaceDisconnect(struct IWpaInterface *interface, const uint8_t *rawData);
44 void FuzzWpaInterfaceSelectNetwork(struct IWpaInterface *interface, const uint8_t *rawData);
45 void FuzzWpaInterfaceEnableNetwork(struct IWpaInterface *interface, const uint8_t *rawData);
46 void FuzzWpaInterfaceSetPowerSave(struct IWpaInterface *interface, const uint8_t *rawData);
47 void FuzzWpaInterfaceAutoConnect(struct IWpaInterface *interface, const uint8_t *rawData);
48 void FuzzWpaInterfaceSaveConfig(struct IWpaInterface *interface, const uint8_t *rawData);
49 void FuzzWpaInterfaceWpsCancel(struct IWpaInterface *interface, const uint8_t *rawData);
50 void FuzzWpaInterfaceGetCountryCode(struct IWpaInterface *interface, const uint8_t *rawData);
51 void FuzzWpaInterfaceGetNetwork(struct IWpaInterface *interface, const uint8_t *rawData);
52 void FuzzWpaInterfaceBlocklistClear(struct IWpaInterface *interface, const uint8_t *rawData);
53 void FuzzWpaInterfaceSetSuspendMode(struct IWpaInterface *interface, const uint8_t *rawData);
54 void FuzzWpaInterfaceGetScanSsid(struct IWpaInterface *interface, const uint8_t *rawData);
55 void FuzzWpaInterfaceGetPskPassphrase(struct IWpaInterface *interface, const uint8_t *rawData);
56 void FuzzWpaInterfaceGetPsk(struct IWpaInterface *interface, const uint8_t *rawData);
57 void FuzzWpaInterfaceGetWepKey(struct IWpaInterface *interface, const uint8_t *rawData);
58 void FuzzWpaInterfaceGetWepTxKeyIdx(struct IWpaInterface *interface, const uint8_t *rawData);
59 void FuzzWpaInterfaceGetRequirePmf(struct IWpaInterface *interface, const uint8_t *rawData);
60 void FuzzWpaInterfaceSetCountryCode(struct IWpaInterface *interface, const uint8_t *rawData);
61 void FuzzWpaInterfaceListNetworks(struct IWpaInterface *interface, const uint8_t *rawData);
62 void FuzzWpaInterfaceWifiStatus(struct IWpaInterface *interface, const uint8_t *rawData);
63 void FuzzWpaInterfaceWpsPbcMode(struct IWpaInterface *interface, const uint8_t *rawData);
64 void FuzzWpaInterfaceWpsPinMode(struct IWpaInterface *interface, const uint8_t *rawData);
65 void FuzzWpaInterfaceRegisterEventCallback(struct IWpaInterface *interface, const uint8_t *rawData);
66 void FuzzWpaInterfaceUnregisterEventCallback(struct IWpaInterface *interface, const uint8_t *rawData);
67 void FuzzWpaInterfaceGetConnectionCapabilities(struct IWpaInterface *interface, const uint8_t *rawData);
68 void FuzzWpaInterfaceAddWpaIface(struct IWpaInterface *interface, const uint8_t *rawData);
69 void FuzzWpaInterfaceRemoveWpaIface(struct IWpaInterface *interface, const uint8_t *rawData);
70 void FuzzWpaInterfaceReassociate(struct IWpaInterface *interface, const uint8_t *rawData);
71 void FuzzWpaInterfaceStaShellCmd(struct IWpaInterface *interface, const uint8_t *rawData);
72 
73 
74 /* **********P2p Interface********** */
75 void FuzzWpaInterfaceP2pSetSsidPostfixName(struct IWpaInterface *interface, const uint8_t *rawData);
76 void FuzzWpaInterfaceP2pSetWpsDeviceType(struct IWpaInterface *interface, const uint8_t *rawData);
77 void FuzzWpaInterfaceP2pSetWpsConfigMethods(struct IWpaInterface *interface, const uint8_t *rawData);
78 void FuzzWpaInterfaceP2pSetGroupMaxIdle(struct IWpaInterface *interface, const uint8_t *rawData);
79 void FuzzWpaInterfaceP2pSetWfdEnable(struct IWpaInterface *interface, const uint8_t *rawData);
80 void FuzzWpaInterfaceP2pSetPersistentReconnect(struct IWpaInterface *interface, const uint8_t *rawData);
81 void FuzzWpaInterfaceP2pSetWpsSecondaryDeviceType(struct IWpaInterface *interface, const uint8_t *rawData);
82 void FuzzWpaInterfaceP2pSetupWpsPbc(struct IWpaInterface *interface, const uint8_t *rawData);
83 void FuzzWpaInterfaceP2pSetupWpsPin(struct IWpaInterface *interface, const uint8_t *rawData);
84 void FuzzWpaInterfaceP2pSetPowerSave(struct IWpaInterface *interface, const uint8_t *rawData);
85 void FuzzWpaInterfaceP2pSetDeviceName(struct IWpaInterface *interface, const uint8_t *rawData);
86 void FuzzWpaInterfaceP2pSetWfdDeviceConfig(struct IWpaInterface *interface, const uint8_t *rawData);
87 void FuzzWpaInterfaceP2pSetRandomMac(struct IWpaInterface *interface, const uint8_t *rawData);
88 void FuzzWpaInterfaceP2pStartFind(struct IWpaInterface *interface, const uint8_t *rawData);
89 void FuzzWpaInterfaceP2pSetExtListen(struct IWpaInterface *interface, const uint8_t *rawData);
90 void FuzzWpaInterfaceP2pSetListenChannel(struct IWpaInterface *interface, const uint8_t *rawData);
91 void FuzzWpaInterfaceP2pProvisionDiscovery(struct IWpaInterface *interface, const uint8_t *rawData);
92 void FuzzWpaInterfaceP2pAddGroup(struct IWpaInterface *interface, const uint8_t *rawData);
93 void FuzzWpaInterfaceP2pAddService(struct IWpaInterface *interface, const uint8_t *rawData);
94 void FuzzWpaInterfaceP2pRemoveService(struct IWpaInterface *interface, const uint8_t *rawData);
95 void FuzzWpaInterfaceP2pStopFind(struct IWpaInterface *interface, const uint8_t *rawData);
96 void FuzzWpaInterfaceP2pFlush(struct IWpaInterface *interface, const uint8_t *rawData);
97 void FuzzWpaInterfaceP2pFlushService(struct IWpaInterface *interface, const uint8_t *rawData);
98 void FuzzWpaInterfaceP2pRemoveNetwork(struct IWpaInterface *interface, const uint8_t *rawData);
99 void FuzzWpaInterfaceP2pSetGroupConfig(struct IWpaInterface *interface, const uint8_t *rawData);
100 void FuzzWpaInterfaceP2pInvite(struct IWpaInterface *interface, const uint8_t *rawData);
101 void FuzzWpaInterfaceP2pReinvoke(struct IWpaInterface *interface, const uint8_t *rawData);
102 void FuzzWpaInterfaceP2pGetDeviceAddress(struct IWpaInterface *interface, const uint8_t *rawData);
103 void FuzzWpaInterfaceP2pReqServiceDiscovery(struct IWpaInterface *interface, const uint8_t *rawData);
104 void FuzzWpaInterfaceP2pCancelServiceDiscovery(struct IWpaInterface *interface, const uint8_t *rawData);
105 void FuzzWpaInterfaceP2pRespServerDiscovery(struct IWpaInterface *interface, const uint8_t *rawData);
106 void FuzzWpaInterfaceP2pConnect(struct IWpaInterface *interface, const uint8_t *rawData);
107 void FuzzWpaInterfaceP2pHid2dConnect(struct IWpaInterface *interface, const uint8_t *rawData);
108 void FuzzWpaInterfaceP2pSetServDiscExternal(struct IWpaInterface *interface, const uint8_t *rawData);
109 void FuzzWpaInterfaceP2pRemoveGroup(struct IWpaInterface *interface, const uint8_t *rawData);
110 void FuzzWpaInterfaceP2pCancelConnect(struct IWpaInterface *interface, const uint8_t *rawData);
111 void FuzzWpaInterfaceP2pGetGroupConfig(struct IWpaInterface *interface, const uint8_t *rawData);
112 void FuzzWpaInterfaceP2pAddNetwork(struct IWpaInterface *interface, const uint8_t *rawData);
113 void FuzzWpaInterfaceP2pGetPeer(struct IWpaInterface *interface, const uint8_t *rawData);
114 void FuzzWpaInterfaceP2pGetGroupCapability(struct IWpaInterface *interface, const uint8_t *rawData);
115 void FuzzWpaInterfaceP2pListNetworks(struct IWpaInterface *interface, const uint8_t *rawData);
116 void FuzzWpaInterfaceP2pSaveConfig(struct IWpaInterface *interface, const uint8_t *rawData);
117 
118 #endif // WPA_COMMON_FUZZER_H