• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2012, Jouni Malinen <j@w1.fi>
3  *
4  * This software may be distributed under the terms of the BSD license.
5  * See README for more details.
6  */
7 
8 #ifndef RTW_CRYTO_WRAP_H
9 #define RTW_CRYTO_WRAP_H
10 
11 #include <drv_types.h>
12 
13 #define TEST_FAIL() 0
14 
15 #define os_memset _rtw_memset
16 #define os_memcpy _rtw_memcpy
17 #define os_malloc rtw_malloc
18 
19 #define le_to_host16 le16_to_cpu
20 #define host_to_le16 cpu_to_le16
21 
22 #define WPA_PUT_LE16 RTW_PUT_LE16
23 #define WPA_GET_LE16 RTW_GET_LE16
24 #define WPA_PUT_LE32 RTW_PUT_LE32
25 #define WPA_GET_LE32 RTW_GET_LE32
26 #define WPA_PUT_LE64 RTW_PUT_LE64
27 #define WPA_GET_LE64 RTW_GET_LE64
28 #define WPA_PUT_BE16 RTW_PUT_BE16
29 #define WPA_GET_BE16 RTW_GET_BE16
30 #define WPA_PUT_BE32 RTW_PUT_BE32
31 #define WPA_GET_BE32 RTW_GET_BE32
32 #define WPA_PUT_BE64 RTW_PUT_BE64
33 #define WPA_GET_BE64 RTW_GET_BE64
34 
35 #ifndef MAC2STR
36 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
37 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
38 #endif
39 
40 #define WLAN_FC_PVER		0x0003
41 #define WLAN_FC_TODS		0x0100
42 #define WLAN_FC_FROMDS		0x0200
43 #define WLAN_FC_MOREFRAG	0x0400
44 #define WLAN_FC_RETRY		0x0800
45 #define WLAN_FC_PWRMGT		0x1000
46 #define WLAN_FC_MOREDATA	0x2000
47 #define WLAN_FC_ISWEP		0x4000
48 #define WLAN_FC_ORDER		0x8000
49 
50 #define WLAN_FC_TYPE_DATA RTW_IEEE80211_FTYPE_DATA
51 #define WLAN_FC_TYPE_MGMT RTW_IEEE80211_FTYPE_MGMT
52 
53 #define WLAN_FC_STYPE_QOS_DATA RTW_IEEE80211_STYPE_QOS_DATA
54 
55 enum {
56 	_MSG_EXCESSIVE_, _MSG_MSGDUMP_, _MSG_DEBUG_, _MSG_INFO_, _MSG_WARNING_, _MSG_ERROR_
57 };
58 
59 int os_memcmp(const void *s1, const void *s2, size_t n);
60 int os_memcmp_const(const void *a, const void *b, size_t len);
61 void* os_memdup(const void *src, u32 sz);
62 size_t os_strlen(const char *s);
63 
64 void forced_memzero(void *ptr, size_t len);
65 void bin_clear_free(void *bin, size_t len);
66 
67 void wpa_printf(int level, const char *fmt, ...);
68 void wpa_hexdump(int level, const char *title, const void *buf, size_t len);
69 void wpa_hexdump_key(int level, const char *title, const void *buf, size_t len);
70 
71 #endif /* RTW_CRYTO_WRAP_H */
72