mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-07-15 08:32:42 +08:00
feat(wpa_supplicant): remove unused file
This commit is contained in:
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Base64 encoding/decoding (RFC1341)
|
||||
* Copyright (c) 2005, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Alternatively, this software may be distributed under the terms of BSD
|
||||
* license.
|
||||
*
|
||||
* See README and COPYING for more details.
|
||||
*/
|
||||
|
||||
#ifndef BASE64_H
|
||||
#define BASE64_H
|
||||
|
||||
unsigned char * base64_encode(const unsigned char *src, size_t len,
|
||||
size_t *out_len);
|
||||
unsigned char * base64_decode(const unsigned char *src, size_t len,
|
||||
size_t *out_len);
|
||||
|
||||
#endif /* BASE64_H */
|
@ -1,481 +0,0 @@
|
||||
/*
|
||||
* wpa_supplicant/hostapd / common helper functions, etc.
|
||||
* Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Alternatively, this software may be distributed under the terms of BSD
|
||||
* license.
|
||||
*
|
||||
* See README and COPYING for more details.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#if defined(__XTENSA__)
|
||||
#include <machine/endian.h>
|
||||
#define __BYTE_ORDER BYTE_ORDER
|
||||
#define __LITTLE_ENDIAN LITTLE_ENDIAN
|
||||
#define __BIG_ENDIAN BIG_ENDIAN
|
||||
#endif /*__XTENSA__*/
|
||||
|
||||
#if defined(__linux__) || defined(__GLIBC__)
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
#endif /* __linux__ */
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
|
||||
defined(__OpenBSD__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/endian.h>
|
||||
#define __BYTE_ORDER _BYTE_ORDER
|
||||
#define __LITTLE_ENDIAN _LITTLE_ENDIAN
|
||||
#define __BIG_ENDIAN _BIG_ENDIAN
|
||||
#ifdef __OpenBSD__
|
||||
#define bswap_16 swap16
|
||||
#define bswap_32 swap32
|
||||
#define bswap_64 swap64
|
||||
#else /* __OpenBSD__ */
|
||||
#define bswap_16 bswap16
|
||||
#define bswap_32 bswap32
|
||||
#define bswap_64 bswap64
|
||||
#endif /* __OpenBSD__ */
|
||||
#endif /* defined(__FreeBSD__) || defined(__NetBSD__) ||
|
||||
* defined(__DragonFly__) || defined(__OpenBSD__) */
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <sys/types.h>
|
||||
#include <machine/endian.h>
|
||||
#define __BYTE_ORDER _BYTE_ORDER
|
||||
#define __LITTLE_ENDIAN _LITTLE_ENDIAN
|
||||
#define __BIG_ENDIAN _BIG_ENDIAN
|
||||
static inline unsigned short bswap_16(unsigned short v)
|
||||
{
|
||||
return ((v & 0xff) << 8) | (v >> 8);
|
||||
}
|
||||
|
||||
static inline unsigned int bswap_32(unsigned int v)
|
||||
{
|
||||
return ((v & 0xff) << 24) | ((v & 0xff00) << 8) |
|
||||
((v & 0xff0000) >> 8) | (v >> 24);
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#ifdef CONFIG_TI_COMPILER
|
||||
#define __BIG_ENDIAN 4321
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#ifdef __big_endian__
|
||||
#define __BYTE_ORDER __BIG_ENDIAN
|
||||
#else
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif /* CONFIG_TI_COMPILER */
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#define __BIG_ENDIAN 4321
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
#endif /* __SYMBIAN32__ */
|
||||
|
||||
#ifdef CONFIG_NATIVE_WINDOWS
|
||||
#include <winsock.h>
|
||||
|
||||
typedef int socklen_t;
|
||||
|
||||
#ifndef MSG_DONTWAIT
|
||||
#define MSG_DONTWAIT 0 /* not supported */
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define inline __inline
|
||||
|
||||
#undef vsnprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#undef close
|
||||
#define close closesocket
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
|
||||
/* Define platform specific integer types */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef UINT64 u64;
|
||||
typedef UINT32 u32;
|
||||
typedef UINT16 u16;
|
||||
typedef UINT8 u8;
|
||||
typedef INT64 s64;
|
||||
typedef INT32 s32;
|
||||
typedef INT16 s16;
|
||||
typedef INT8 s8;
|
||||
#define WPA_TYPES_DEFINED
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#ifdef __vxworks
|
||||
typedef unsigned long long u64;
|
||||
typedef UINT32 u32;
|
||||
typedef UINT16 u16;
|
||||
typedef UINT8 u8;
|
||||
typedef long long s64;
|
||||
typedef INT32 s32;
|
||||
typedef INT16 s16;
|
||||
typedef INT8 s8;
|
||||
#define WPA_TYPES_DEFINED
|
||||
#endif /* __vxworks */
|
||||
|
||||
#ifdef CONFIG_TI_COMPILER
|
||||
#ifdef _LLONG_AVAILABLE
|
||||
typedef unsigned long long u64;
|
||||
#else
|
||||
/*
|
||||
* TODO: 64-bit variable not available. Using long as a workaround to test the
|
||||
* build, but this will likely not work for all operations.
|
||||
*/
|
||||
typedef unsigned long u64;
|
||||
#endif
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned char u8;
|
||||
#define WPA_TYPES_DEFINED
|
||||
#endif /* CONFIG_TI_COMPILER */
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#define __REMOVE_PLATSEC_DIAGNOSTICS__
|
||||
#include <e32def.h>
|
||||
typedef TUint64 u64;
|
||||
typedef TUint32 u32;
|
||||
typedef TUint16 u16;
|
||||
typedef TUint8 u8;
|
||||
#define WPA_TYPES_DEFINED
|
||||
#endif /* __SYMBIAN32__ */
|
||||
|
||||
#ifndef WPA_TYPES_DEFINED
|
||||
#ifdef CONFIG_USE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
typedef uint64_t u64;
|
||||
typedef uint32_t u32;
|
||||
typedef uint16_t u16;
|
||||
typedef uint8_t u8;
|
||||
typedef int64_t s64;
|
||||
typedef int32_t s32;
|
||||
typedef int16_t s16;
|
||||
typedef int8_t s8;
|
||||
#define WPA_TYPES_DEFINED
|
||||
#endif /* !WPA_TYPES_DEFINED */
|
||||
|
||||
|
||||
/* Define platform specific byte swapping macros */
|
||||
|
||||
#if defined(__CYGWIN__) || defined(CONFIG_NATIVE_WINDOWS)
|
||||
|
||||
static inline unsigned short wpa_swap_16(unsigned short v)
|
||||
{
|
||||
return ((v & 0xff) << 8) | (v >> 8);
|
||||
}
|
||||
|
||||
static inline unsigned int wpa_swap_32(unsigned int v)
|
||||
{
|
||||
return ((v & 0xff) << 24) | ((v & 0xff00) << 8) |
|
||||
((v & 0xff0000) >> 8) | (v >> 24);
|
||||
}
|
||||
|
||||
#define le_to_host16(n) (n)
|
||||
#define host_to_le16(n) (n)
|
||||
#define be_to_host16(n) wpa_swap_16(n)
|
||||
#define host_to_be16(n) wpa_swap_16(n)
|
||||
#define le_to_host32(n) (n)
|
||||
#define be_to_host32(n) wpa_swap_32(n)
|
||||
#define host_to_be32(n) wpa_swap_32(n)
|
||||
|
||||
#define WPA_BYTE_SWAP_DEFINED
|
||||
|
||||
#endif /* __CYGWIN__ || CONFIG_NATIVE_WINDOWS */
|
||||
|
||||
|
||||
#ifndef WPA_BYTE_SWAP_DEFINED
|
||||
|
||||
#ifndef __BYTE_ORDER
|
||||
#ifndef __LITTLE_ENDIAN
|
||||
#ifndef __BIG_ENDIAN
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#define __BIG_ENDIAN 4321
|
||||
#if defined(sparc)
|
||||
#define __BYTE_ORDER __BIG_ENDIAN
|
||||
#endif
|
||||
#endif /* __BIG_ENDIAN */
|
||||
#endif /* __LITTLE_ENDIAN */
|
||||
#endif /* __BYTE_ORDER */
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define le_to_host16(n) ((__force u16) (le16) (n))
|
||||
#define host_to_le16(n) ((__force le16) (u16) (n))
|
||||
#define be_to_host16(n) bswap_16((__force u16) (be16) (n))
|
||||
#define host_to_be16(n) ((__force be16) bswap_16((n)))
|
||||
#define le_to_host32(n) ((__force u32) (le32) (n))
|
||||
#define host_to_le32(n) ((__force le32) (u32) (n))
|
||||
#define be_to_host32(n) bswap_32((__force u32) (be32) (n))
|
||||
#define host_to_be32(n) ((__force be32) bswap_32((n)))
|
||||
#define le_to_host64(n) ((__force u64) (le64) (n))
|
||||
#define host_to_le64(n) ((__force le64) (u64) (n))
|
||||
#define be_to_host64(n) bswap_64((__force u64) (be64) (n))
|
||||
#define host_to_be64(n) ((__force be64) bswap_64((n)))
|
||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define le_to_host16(n) bswap_16(n)
|
||||
#define host_to_le16(n) bswap_16(n)
|
||||
#define be_to_host16(n) (n)
|
||||
#define host_to_be16(n) (n)
|
||||
#define le_to_host32(n) bswap_32(n)
|
||||
#define be_to_host32(n) (n)
|
||||
#define host_to_be32(n) (n)
|
||||
#define le_to_host64(n) bswap_64(n)
|
||||
#define host_to_le64(n) bswap_64(n)
|
||||
#define be_to_host64(n) (n)
|
||||
#define host_to_be64(n) (n)
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
#define WORDS_BIGENDIAN
|
||||
#endif
|
||||
#else
|
||||
#error Could not determine CPU byte order
|
||||
#endif
|
||||
|
||||
#define WPA_BYTE_SWAP_DEFINED
|
||||
#endif /* !WPA_BYTE_SWAP_DEFINED */
|
||||
|
||||
|
||||
/* Macros for handling unaligned memory accesses */
|
||||
|
||||
#define WPA_GET_BE16(a) ((u16) (((a)[0] << 8) | (a)[1]))
|
||||
#define WPA_PUT_BE16(a, val) \
|
||||
do { \
|
||||
(a)[0] = ((u16) (val)) >> 8; \
|
||||
(a)[1] = ((u16) (val)) & 0xff; \
|
||||
} while (0)
|
||||
|
||||
#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
|
||||
#define WPA_PUT_LE16(a, val) \
|
||||
do { \
|
||||
(a)[1] = ((u16) (val)) >> 8; \
|
||||
(a)[0] = ((u16) (val)) & 0xff; \
|
||||
} while (0)
|
||||
|
||||
#define WPA_GET_BE24(a) ((((u32) (a)[0]) << 16) | (((u32) (a)[1]) << 8) | \
|
||||
((u32) (a)[2]))
|
||||
#define WPA_PUT_BE24(a, val) \
|
||||
do { \
|
||||
(a)[0] = (u8) ((((u32) (val)) >> 16) & 0xff); \
|
||||
(a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \
|
||||
(a)[2] = (u8) (((u32) (val)) & 0xff); \
|
||||
} while (0)
|
||||
|
||||
#define WPA_GET_BE32(a) ((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \
|
||||
(((u32) (a)[2]) << 8) | ((u32) (a)[3]))
|
||||
#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_GET_LE32(a) ((((u32) (a)[3]) << 24) | (((u32) (a)[2]) << 16) | \
|
||||
(((u32) (a)[1]) << 8) | ((u32) (a)[0]))
|
||||
#define WPA_PUT_LE32(a, val) \
|
||||
do { \
|
||||
(a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \
|
||||
(a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \
|
||||
(a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \
|
||||
(a)[0] = (u8) (((u32) (val)) & 0xff); \
|
||||
} while (0)
|
||||
|
||||
#define WPA_GET_BE64(a) ((((u64) (a)[0]) << 56) | (((u64) (a)[1]) << 48) | \
|
||||
(((u64) (a)[2]) << 40) | (((u64) (a)[3]) << 32) | \
|
||||
(((u64) (a)[4]) << 24) | (((u64) (a)[5]) << 16) | \
|
||||
(((u64) (a)[6]) << 8) | ((u64) (a)[7]))
|
||||
#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)
|
||||
|
||||
#define WPA_GET_LE64(a) ((((u64) (a)[7]) << 56) | (((u64) (a)[6]) << 48) | \
|
||||
(((u64) (a)[5]) << 40) | (((u64) (a)[4]) << 32) | \
|
||||
(((u64) (a)[3]) << 24) | (((u64) (a)[2]) << 16) | \
|
||||
(((u64) (a)[1]) << 8) | ((u64) (a)[0]))
|
||||
|
||||
|
||||
#ifndef ETH_ALEN
|
||||
#define ETH_ALEN 6
|
||||
#endif
|
||||
#ifndef IFNAMSIZ
|
||||
#define IFNAMSIZ 16
|
||||
#endif
|
||||
#ifndef ETH_P_ALL
|
||||
#define ETH_P_ALL 0x0003
|
||||
#endif
|
||||
#ifndef ETH_P_PAE
|
||||
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
|
||||
#endif /* ETH_P_PAE */
|
||||
#ifndef ETH_P_EAPOL
|
||||
#define ETH_P_EAPOL ETH_P_PAE
|
||||
#endif /* ETH_P_EAPOL */
|
||||
#ifndef ETH_P_RSN_PREAUTH
|
||||
#define ETH_P_RSN_PREAUTH 0x88c7
|
||||
#endif /* ETH_P_RSN_PREAUTH */
|
||||
#ifndef ETH_P_RRB
|
||||
#define ETH_P_RRB 0x890D
|
||||
#endif /* ETH_P_RRB */
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define PRINTF_FORMAT(a,b) __attribute__ ((format (printf, (a), (b))))
|
||||
#define STRUCT_PACKED __attribute__ ((packed))
|
||||
#else
|
||||
#define PRINTF_FORMAT(a,b)
|
||||
#define STRUCT_PACKED
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ANSI_C_EXTRA
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER < 1400
|
||||
/* snprintf - used in number of places; sprintf() is _not_ a good replacement
|
||||
* due to possible buffer overflow; see, e.g.,
|
||||
* http://www.ijs.si/software/snprintf/ for portable implementation of
|
||||
* snprintf. */
|
||||
int snprintf(char *str, size_t size, const char *format, ...);
|
||||
|
||||
/* vsnprintf - only used for wpa_msg() in wpa_supplicant.c */
|
||||
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
||||
#endif /* !defined(_MSC_VER) || _MSC_VER < 1400 */
|
||||
|
||||
/* getopt - only used in main.c */
|
||||
int getopt(int argc, char *const argv[], const char *optstring);
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
#ifndef CONFIG_NO_SOCKLEN_T_TYPEDEF
|
||||
#ifndef __socklen_t_defined
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* inline - define as __inline or just define it to be empty, if needed */
|
||||
#ifdef CONFIG_NO_INLINE
|
||||
#define inline
|
||||
#else
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
#ifndef __func__
|
||||
#define __func__ "__func__ not defined"
|
||||
#endif
|
||||
|
||||
#ifndef bswap_16
|
||||
#define bswap_16(a) ((((u16) (a) << 8) & 0xff00) | (((u16) (a) >> 8) & 0xff))
|
||||
#endif
|
||||
|
||||
#ifndef bswap_32
|
||||
#define bswap_32(a) ((((u32) (a) << 24) & 0xff000000) | \
|
||||
(((u32) (a) << 8) & 0xff0000) | \
|
||||
(((u32) (a) >> 8) & 0xff00) | \
|
||||
(((u32) (a) >> 24) & 0xff))
|
||||
#endif
|
||||
|
||||
#ifndef MSG_DONTWAIT
|
||||
#define MSG_DONTWAIT 0
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
void perror(const char *s);
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
#endif /* CONFIG_ANSI_C_EXTRA */
|
||||
|
||||
#ifndef MAC2STR
|
||||
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
|
||||
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
#endif
|
||||
|
||||
#ifndef BIT
|
||||
#define BIT(x) (1 << (x))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definitions for sparse validation
|
||||
* (http://kernel.org/pub/linux/kernel/people/josh/sparse/)
|
||||
*/
|
||||
#ifdef __CHECKER__
|
||||
#define __force __attribute__((force))
|
||||
#define __bitwise __attribute__((bitwise))
|
||||
#else
|
||||
#define __force
|
||||
#define __bitwise
|
||||
#endif
|
||||
|
||||
typedef u16 __bitwise be16;
|
||||
typedef u16 __bitwise le16;
|
||||
typedef u32 __bitwise be32;
|
||||
typedef u32 __bitwise le32;
|
||||
typedef u64 __bitwise be64;
|
||||
typedef u64 __bitwise le64;
|
||||
|
||||
#ifndef __must_check
|
||||
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
#define __must_check __attribute__((__warn_unused_result__))
|
||||
#else
|
||||
#define __must_check
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* __must_check */
|
||||
|
||||
int hwaddr_aton(const char *txt, u8 *addr);
|
||||
int hwaddr_aton2(const char *txt, u8 *addr);
|
||||
int hexstr2bin(const char *hex, u8 *buf, size_t len);
|
||||
void inc_byte_array(u8 *counter, size_t len);
|
||||
void wpa_get_ntp_timestamp(u8 *buf);
|
||||
int wpa_snprintf_hex(char *buf, size_t buf_size, const u8 *data, size_t len);
|
||||
int wpa_snprintf_hex_uppercase(char *buf, size_t buf_size, const u8 *data,
|
||||
size_t len);
|
||||
|
||||
#ifdef CONFIG_NATIVE_WINDOWS
|
||||
void wpa_unicode2ascii_inplace(TCHAR *str);
|
||||
TCHAR * wpa_strdup_tchar(const char *str);
|
||||
#else /* CONFIG_NATIVE_WINDOWS */
|
||||
#define wpa_unicode2ascii_inplace(s) do { } while (0)
|
||||
#define wpa_strdup_tchar(s) strdup((s))
|
||||
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||
|
||||
const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len);
|
||||
|
||||
static inline int is_zero_ether_addr(const u8 *a)
|
||||
{
|
||||
return !(a[0] | a[1] | a[2] | a[3] | a[4] | a[5]);
|
||||
}
|
||||
|
||||
/*
|
||||
* gcc 4.4 ends up generating strict-aliasing warnings about some very common
|
||||
* networking socket uses that do not really result in a real problem and
|
||||
* cannot be easily avoided with union-based type-punning due to struct
|
||||
* definitions including another struct in system header files. To avoid having
|
||||
* to fully disable strict-aliasing warnings, provide a mechanism to hide the
|
||||
* typecast from aliasing for now. A cleaner solution will hopefully be found
|
||||
* in the future to handle these cases.
|
||||
*/
|
||||
void * __hide_aliasing_typecast(void *foo);
|
||||
#define aliasing_hide_typecast(a,t) (t *) __hide_aliasing_typecast((a))
|
||||
|
||||
#endif /* COMMON_H */
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* wepkey.h - Generate WEP keys from a passphrase
|
||||
*
|
||||
* Copyright (C) 2008 by OpenMoko, Inc.
|
||||
* Written by Werner Almesberger <werner@openmoko.org>
|
||||
* All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
/*
|
||||
* wpkey_64 and wepkey_128 implement the keyphrase hash algorithm found in many
|
||||
* (but not all) common access points, including the Linksys WRT54G series.
|
||||
*/
|
||||
|
||||
#ifndef WEPKEY_H
|
||||
#define WEPKEY_H
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
|
||||
#define WEPKEY_64_BYTES 5
|
||||
#define WEPKEY_128_BYTES 13
|
||||
|
||||
|
||||
/*
|
||||
* "size" is the size of the buffer at "out", in bytes. It has to be at least 5
|
||||
* or 13 bytes, respectively. "n" is the key index, in the range 0...3.
|
||||
*/
|
||||
|
||||
size_t wepkey_64(uint8_t *out, size_t size, const char *in, int n);
|
||||
size_t wepkey_128(uint8_t *out, size_t size, const char *in, int n);
|
||||
|
||||
#endif /* !WEPKEY_H */
|
@ -1,226 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* copyright (c) 2010-2011 Espressif System
|
||||
*/
|
||||
#ifndef _NET80211_IEEE80211_CRYPTO_H_
|
||||
#define _NET80211_IEEE80211_CRYPTO_H_
|
||||
|
||||
//#include "pp/esf_buf.h"
|
||||
|
||||
/*
|
||||
* 802.11 protocol crypto-related definitions.
|
||||
*/
|
||||
#define IEEE80211_KEYBUF_SIZE 16
|
||||
#define IEEE80211_MICBUF_SIZE (8+8) /* space for both tx+rx keys */
|
||||
|
||||
/*
|
||||
* Old WEP-style key. Deprecated.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
struct ieee80211_rsnparms {
|
||||
uint8_t rsn_mcastcipher; /* mcast/group cipher */
|
||||
uint8_t rsn_mcastkeylen; /* mcast key length */
|
||||
uint8_t rsn_ucastcipher; /* selected unicast cipher */
|
||||
uint8_t rsn_ucastkeylen; /* unicast key length */
|
||||
uint8_t rsn_keymgmt; /* selected key mgmt algo */
|
||||
uint16_t rsn_caps; /* capabilities */
|
||||
};
|
||||
#endif //0000
|
||||
|
||||
/*
|
||||
* Template for a supported cipher. Ciphers register with the
|
||||
* crypto code and are typically loaded as separate modules
|
||||
* (the null cipher is always present).
|
||||
* XXX may need refcnts
|
||||
*/
|
||||
|
||||
/*
|
||||
* Crypto key state. There is sufficient room for all supported
|
||||
* ciphers (see below). The underlying ciphers are handled
|
||||
* separately through loadable cipher modules that register with
|
||||
* the generic crypto support. A key has a reference to an instance
|
||||
* of the cipher; any per-key state is hung off wk_private by the
|
||||
* cipher when it is attached. Ciphers are automatically called
|
||||
* to detach and cleanup any such state when the key is deleted.
|
||||
*
|
||||
* The generic crypto support handles encap/decap of cipher-related
|
||||
* frame contents for both hardware- and software-based implementations.
|
||||
* A key requiring software crypto support is automatically flagged and
|
||||
* the cipher is expected to honor this and do the necessary work.
|
||||
* Ciphers such as TKIP may also support mixed hardware/software
|
||||
* encrypt/decrypt and MIC processing.
|
||||
*/
|
||||
typedef uint16_t ieee80211_keyix; /* h/w key index */
|
||||
|
||||
struct ieee80211_key {
|
||||
uint8_t wk_keylen; /* key length in bytes */
|
||||
uint8_t wk_pad;
|
||||
uint16_t wk_flags;
|
||||
#define IEEE80211_KEY_XMIT 0x0001 /* key used for xmit */
|
||||
#define IEEE80211_KEY_RECV 0x0002 /* key used for recv */
|
||||
#define IEEE80211_KEY_GROUP 0x0004 /* key used for WPA group operation */
|
||||
#define IEEE80211_KEY_SWENCRYPT 0x0010 /* host-based encrypt */
|
||||
#define IEEE80211_KEY_SWDECRYPT 0x0020 /* host-based decrypt */
|
||||
#define IEEE80211_KEY_SWENMIC 0x0040 /* host-based enmic */
|
||||
#define IEEE80211_KEY_SWDEMIC 0x0080 /* host-based demic */
|
||||
#define IEEE80211_KEY_DEVKEY 0x0100 /* device key request completed */
|
||||
#define IEEE80211_KEY_CIPHER0 0x1000 /* cipher-specific action 0 */
|
||||
#define IEEE80211_KEY_CIPHER1 0x2000 /* cipher-specific action 1 */
|
||||
#define IEEE80211_KEY_EMPTY 0x0000
|
||||
ieee80211_keyix wk_keyix; /* h/w key index */
|
||||
ieee80211_keyix wk_rxkeyix; /* optional h/w rx key index */
|
||||
uint8_t wk_key[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
|
||||
#define wk_txmic wk_key+IEEE80211_KEYBUF_SIZE+0 /* XXX can't () right */
|
||||
#define wk_rxmic wk_key+IEEE80211_KEYBUF_SIZE+8 /* XXX can't () right */
|
||||
/* key receive sequence counter */
|
||||
uint64_t wk_keyrsc[IEEE80211_TID_SIZE];
|
||||
uint64_t wk_keytsc; /* key transmit sequence counter */
|
||||
const struct ieee80211_cipher *wk_cipher;
|
||||
//void *wk_private; /* private cipher state */
|
||||
//uint8_t wk_macaddr[IEEE80211_ADDR_LEN]; //JLU: no need ...
|
||||
};
|
||||
#define IEEE80211_KEY_COMMON /* common flags passed in by apps */\
|
||||
(IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV | IEEE80211_KEY_GROUP)
|
||||
#define IEEE80211_KEY_DEVICE /* flags owned by device driver */\
|
||||
(IEEE80211_KEY_DEVKEY|IEEE80211_KEY_CIPHER0|IEEE80211_KEY_CIPHER1)
|
||||
|
||||
#define IEEE80211_KEY_SWCRYPT \
|
||||
(IEEE80211_KEY_SWENCRYPT | IEEE80211_KEY_SWDECRYPT)
|
||||
#define IEEE80211_KEY_SWMIC (IEEE80211_KEY_SWENMIC | IEEE80211_KEY_SWDEMIC)
|
||||
|
||||
//#define IEEE80211_KEYIX_NONE ((ieee80211_keyix) -1)
|
||||
|
||||
/*
|
||||
* NB: these values are ordered carefully; there are lots of
|
||||
* of implications in any reordering. Beware that 4 is used
|
||||
* only to indicate h/w TKIP MIC support in driver capabilities;
|
||||
* there is no separate cipher support (it's rolled into the
|
||||
* TKIP cipher support).
|
||||
*/
|
||||
#define IEEE80211_CIPHER_NONE 0 /* pseudo value */
|
||||
#define IEEE80211_CIPHER_TKIP 1
|
||||
#define IEEE80211_CIPHER_AES_OCB 2
|
||||
#define IEEE80211_CIPHER_AES_CCM 3
|
||||
#define IEEE80211_CIPHER_TKIPMIC 4 /* TKIP MIC capability */
|
||||
#define IEEE80211_CIPHER_CKIP 5
|
||||
#define IEEE80211_CIPHER_WEP 6
|
||||
#define IEEE80211_CIPHER_WEP40 7
|
||||
#define IEEE80211_CIPHER_WEP104 8
|
||||
|
||||
|
||||
#define IEEE80211_CIPHER_MAX (IEEE80211_CIPHER_NONE+2)
|
||||
|
||||
/* capability bits in ic_cryptocaps/iv_cryptocaps */
|
||||
#define IEEE80211_CRYPTO_NONE (1<<IEEE80211_CIPHER_NONE)
|
||||
#define IEEE80211_CRYPTO_WEP (1<<IEEE80211_CIPHER_WEP)
|
||||
#define IEEE80211_CRYPTO_WEP40 (1<<IEEE80211_CIPHER_WEP40)
|
||||
#define IEEE80211_CRYPTO_WEP104 (1<<IEEE80211_CIPHER_WEP104)
|
||||
#define IEEE80211_CRYPTO_TKIP (1<<IEEE80211_CIPHER_TKIP)
|
||||
#define IEEE80211_CRYPTO_AES_OCB (1<<IEEE80211_CIPHER_AES_OCB)
|
||||
#define IEEE80211_CRYPTO_AES_CCM (1<<IEEE80211_CIPHER_AES_CCM)
|
||||
#define IEEE80211_CRYPTO_TKIPMIC (1<<IEEE80211_CIPHER_TKIPMIC)
|
||||
#define IEEE80211_CRYPTO_CKIP (1<<IEEE80211_CIPHER_CKIP)
|
||||
|
||||
struct ieee80211_cipher {
|
||||
u_int ic_cipher; /* IEEE80211_CIPHER_* */
|
||||
u_int ic_header; /* size of privacy header (bytes) */
|
||||
u_int ic_trailer; /* size of privacy trailer (bytes) */
|
||||
u_int ic_miclen; /* size of mic trailer (bytes) */
|
||||
// int (*ic_setkey)(struct ieee80211_key *);
|
||||
int (*ic_encap)(struct ieee80211_key *, esf_buf_t *, uint8_t);
|
||||
int (*ic_decap)(struct ieee80211_key *, esf_buf_t *, int);
|
||||
#ifdef EAGLE_SW_MIC
|
||||
int (*ic_enmic)(struct ieee80211_key *, esf_buf_t *, int);
|
||||
int (*ic_demic)(struct ieee80211_key *, esf_buf_t *, int);
|
||||
#endif /* EAGLE_SW_CRYPTO */
|
||||
};
|
||||
|
||||
struct ieee80211com;
|
||||
struct ieee80211_conn;
|
||||
|
||||
#define IEEE80211_KEY_UNDEFINED(k) \
|
||||
((k)->wk_cipher == &ieee80211_cipher_none)
|
||||
|
||||
struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211_conn *,
|
||||
esf_buf *);
|
||||
|
||||
struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211_conn *,
|
||||
esf_buf *, int);
|
||||
|
||||
#if 0 //H/W MIC
|
||||
/*
|
||||
* Check and remove any MIC.
|
||||
*/
|
||||
static INLINE int
|
||||
ieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k,
|
||||
esf_buf *m, int force)
|
||||
{
|
||||
const struct ieee80211_cipher *cip = k->wk_cipher;
|
||||
return (cip->ic_miclen > 0 ? cip->ic_demic(k, m, force) : 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add any MIC.
|
||||
*/
|
||||
static INLINE int
|
||||
ieee80211_crypto_enmic(struct ieee80211vap *vap,
|
||||
struct ieee80211_key *k, esf_buf *m, int force)
|
||||
{
|
||||
const struct ieee80211_cipher *cip = k->wk_cipher;
|
||||
return (cip->ic_miclen > 0 ? cip->ic_enmic(k, m, force) : 1);
|
||||
}
|
||||
#endif //0000
|
||||
|
||||
/*
|
||||
* Setup crypto support for a device/shared instance.
|
||||
*/
|
||||
void ieee80211_crypto_attach(struct ieee80211com *ic);
|
||||
|
||||
/*
|
||||
* Reset key state to an unused state. The crypto
|
||||
* key allocation mechanism insures other state (e.g.
|
||||
* key data) is properly setup before a key is used.
|
||||
*/
|
||||
static inline void
|
||||
ieee80211_crypto_resetkey(struct ieee80211_key *k)
|
||||
{
|
||||
k->wk_cipher = NULL;
|
||||
k->wk_flags = IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV;
|
||||
}
|
||||
|
||||
/*
|
||||
* Crypt-related notification methods.
|
||||
*/
|
||||
//void ieee80211_notify_replay_failure(const struct ieee80211_frame *, const struct ieee80211_key *,
|
||||
// uint64_t rsc, int tid);
|
||||
//void ieee80211_notify_michael_failure(const struct ieee80211_frame *, u_int keyix);
|
||||
|
||||
#endif /* _NET80211_IEEE80211_CRYPTO_H_ */
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* wpa_supplicant/hostapd - Default include files
|
||||
* Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Alternatively, this software may be distributed under the terms of BSD
|
||||
* license.
|
||||
*
|
||||
* See README and COPYING for more details.
|
||||
*
|
||||
* This header file is included into all C files so that commonly used header
|
||||
* files can be selected with OS specific ifdef blocks in one place instead of
|
||||
* having to have OS/C library specific selection in many files.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDES_H
|
||||
#define INCLUDES_H
|
||||
|
||||
/* Include possible build time configuration before including anything else */
|
||||
//#include "build_config.h" //don't need anymore
|
||||
|
||||
//#include <stdlib.h>
|
||||
//#include <stdio.h>
|
||||
//#include <string.h>
|
||||
//#include <ctype.h>
|
||||
//#include <time.h>
|
||||
|
||||
#endif /* INCLUDES_H */
|
@ -1,203 +0,0 @@
|
||||
/*
|
||||
* wpa_supplicant/hostapd / Debug prints
|
||||
* Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Alternatively, this software may be distributed under the terms of BSD
|
||||
* license.
|
||||
*
|
||||
* See README and COPYING for more details.
|
||||
*/
|
||||
|
||||
#ifndef WPA_DEBUG_H
|
||||
#define WPA_DEBUG_H
|
||||
|
||||
|
||||
enum { MSG_MSGDUMP, MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR };
|
||||
|
||||
/** EAP authentication completed successfully */
|
||||
#define WPA_EVENT_EAP_SUCCESS "CTRL-EVENT-EAP-SUCCESS "
|
||||
|
||||
int wpa_debug_open_file(const char *path);
|
||||
void wpa_debug_close_file(void);
|
||||
|
||||
/**
|
||||
* wpa_debug_printf_timestamp - Print timestamp for debug output
|
||||
*
|
||||
* This function prints a timestamp in seconds_from_1970.microsoconds
|
||||
* format if debug output has been configured to include timestamps in debug
|
||||
* messages.
|
||||
*/
|
||||
void wpa_debug_print_timestamp(void);
|
||||
|
||||
/**
|
||||
* wpa_printf - conditional printf
|
||||
* @level: priority level (MSG_*) of the message
|
||||
* @fmt: printf format string, followed by optional arguments
|
||||
*
|
||||
* This function is used to print conditional debugging and error messages. The
|
||||
* output may be directed to stdout, stderr, and/or syslog based on
|
||||
* configuration.
|
||||
*
|
||||
* Note: New line '\n' is added to the end of the text when printing to stdout.
|
||||
*/
|
||||
#define DEBUG_PRINT
|
||||
//#define MSG_PRINT
|
||||
|
||||
/**
|
||||
* wpa_hexdump - conditional hex dump
|
||||
* @level: priority level (MSG_*) of the message
|
||||
* @title: title of for the message
|
||||
* @buf: data buffer to be dumped
|
||||
* @len: length of the buf
|
||||
*
|
||||
* This function is used to print conditional debugging and error messages. The
|
||||
* output may be directed to stdout, stderr, and/or syslog based on
|
||||
* configuration. The contents of buf is printed out has hex dump.
|
||||
*/
|
||||
#include "log.h"
|
||||
#if 0
|
||||
#ifdef DEBUG_PRINT
|
||||
#define wpa_printf(level,fmt, args...) ets_printf(fmt,## args)
|
||||
|
||||
static inline void wpa_hexdump_ascii(int level, const char *title, const u8 *buf, size_t len)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, size_t len)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len);
|
||||
|
||||
static inline void wpa_hexdump_buf(int level, const char *title,
|
||||
const struct wpabuf *buf)
|
||||
{
|
||||
wpa_hexdump(level, title, wpabuf_head(buf), wpabuf_len(buf));
|
||||
}
|
||||
|
||||
/**
|
||||
* wpa_hexdump_key - conditional hex dump, hide keys
|
||||
* @level: priority level (MSG_*) of the message
|
||||
* @title: title of for the message
|
||||
* @buf: data buffer to be dumped
|
||||
* @len: length of the buf
|
||||
*
|
||||
* This function is used to print conditional debugging and error messages. The
|
||||
* output may be directed to stdout, stderr, and/or syslog based on
|
||||
* configuration. The contents of buf is printed out has hex dump. This works
|
||||
* like wpa_hexdump(), but by default, does not include secret keys (passwords,
|
||||
* etc.) in debug output.
|
||||
*/
|
||||
void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len);
|
||||
|
||||
|
||||
static inline void wpa_hexdump_buf_key(int level, const char *title,
|
||||
const struct wpabuf *buf)
|
||||
{
|
||||
wpa_hexdump_key(level, title, wpabuf_head(buf), wpabuf_len(buf));
|
||||
}
|
||||
|
||||
/**
|
||||
* wpa_hexdump_ascii - conditional hex dump
|
||||
* @level: priority level (MSG_*) of the message
|
||||
* @title: title of for the message
|
||||
* @buf: data buffer to be dumped
|
||||
* @len: length of the buf
|
||||
*
|
||||
* This function is used to print conditional debugging and error messages. The
|
||||
* output may be directed to stdout, stderr, and/or syslog based on
|
||||
* configuration. The contents of buf is printed out has hex dump with both
|
||||
* the hex numbers and ASCII characters (for printable range) are shown. 16
|
||||
* bytes per line will be shown.
|
||||
*/
|
||||
void wpa_hexdump_ascii(int level, const char *title, const u8 *buf,
|
||||
size_t len);
|
||||
|
||||
/**
|
||||
* wpa_hexdump_ascii_key - conditional hex dump, hide keys
|
||||
* @level: priority level (MSG_*) of the message
|
||||
* @title: title of for the message
|
||||
* @buf: data buffer to be dumped
|
||||
* @len: length of the buf
|
||||
*
|
||||
* This function is used to print conditional debugging and error messages. The
|
||||
* output may be directed to stdout, stderr, and/or syslog based on
|
||||
* configuration. The contents of buf is printed out has hex dump with both
|
||||
* the hex numbers and ASCII characters (for printable range) are shown. 16
|
||||
* bytes per line will be shown. This works like wpa_hexdump_ascii(), but by
|
||||
* default, does not include secret keys (passwords, etc.) in debug output.
|
||||
*/
|
||||
void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf,
|
||||
size_t len);
|
||||
#else
|
||||
#define wpa_printf(level, ...)
|
||||
#define wpa_hexdump
|
||||
#define wpa_hexdump_buf
|
||||
#define wpa_hexdump_key
|
||||
#define wpa_hexdump_buf_key
|
||||
#define wpa_hexdump_ascii
|
||||
#define wpa_hexdump_ascii_key
|
||||
#endif
|
||||
#else
|
||||
#define wpa_printf(level, ...) WLOGD(MWIFI, SWPA, ##__VA_ARGS__)
|
||||
#define wpa_hexdump
|
||||
#define wpa_hexdump_buf
|
||||
#define wpa_hexdump_key
|
||||
#define wpa_hexdump_buf_key
|
||||
#define wpa_hexdump_ascii
|
||||
#define wpa_hexdump_ascii_key
|
||||
#endif
|
||||
#define wpa_auth_logger
|
||||
#define wpa_auth_vlogger
|
||||
|
||||
/**
|
||||
* wpa_msg - Conditional printf for default target and ctrl_iface monitors
|
||||
* @ctx: Pointer to context data; this is the ctx variable registered
|
||||
* with struct wpa_driver_ops::init()
|
||||
* @level: priority level (MSG_*) of the message
|
||||
* @fmt: printf format string, followed by optional arguments
|
||||
*
|
||||
* This function is used to print conditional debugging and error messages. The
|
||||
* output may be directed to stdout, stderr, and/or syslog based on
|
||||
* configuration. This function is like wpa_printf(), but it also sends the
|
||||
* same message to all attached ctrl_iface monitors.
|
||||
*
|
||||
* Note: New line '\n' is added to the end of the text when printing to stdout.
|
||||
*/
|
||||
void wpa_msg(void *ctx, int level, const char *fmt, ...) PRINTF_FORMAT(3, 4);
|
||||
|
||||
/**
|
||||
* wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
|
||||
* @ctx: Pointer to context data; this is the ctx variable registered
|
||||
* with struct wpa_driver_ops::init()
|
||||
* @level: priority level (MSG_*) of the message
|
||||
* @fmt: printf format string, followed by optional arguments
|
||||
*
|
||||
* This function is used to print conditional debugging and error messages.
|
||||
* This function is like wpa_msg(), but it sends the output only to the
|
||||
* attached ctrl_iface monitors. In other words, it can be used for frequent
|
||||
* events that do not need to be sent to syslog.
|
||||
*/
|
||||
void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
|
||||
PRINTF_FORMAT(3, 4);
|
||||
|
||||
typedef void (*wpa_msg_cb_func)(void *ctx, int level, const char *txt,
|
||||
size_t len);
|
||||
|
||||
typedef void (*eloop_timeout_handler)(void *eloop_data, void *user_ctx);
|
||||
|
||||
int eloop_cancel_timeout(eloop_timeout_handler handler,
|
||||
void *eloop_data, void *user_data);
|
||||
|
||||
int eloop_register_timeout(unsigned int secs, unsigned int usecs,
|
||||
eloop_timeout_handler handler,
|
||||
void *eloop_data, void *user_data);
|
||||
|
||||
|
||||
#endif /* WPA_DEBUG_H */
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* EAP common peer/server definitions
|
||||
* Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef EAP_COMMON_H
|
||||
#define EAP_COMMON_H
|
||||
|
||||
#include "wpa/wpabuf.h"
|
||||
|
||||
int eap_hdr_len_valid(const struct wpabuf *msg, size_t min_payload);
|
||||
const u8 * eap_hdr_validate(int vendor, EapType eap_type,
|
||||
const struct wpabuf *msg, size_t *plen);
|
||||
struct wpabuf * eap_msg_alloc(int vendor, EapType type, size_t payload_len,
|
||||
u8 code, u8 identifier);
|
||||
void eap_update_len(struct wpabuf *msg);
|
||||
u8 eap_get_id(const struct wpabuf *msg);
|
||||
EapType eap_get_type(const struct wpabuf *msg);
|
||||
|
||||
#endif /* EAP_COMMON_H */
|
@ -1,92 +0,0 @@
|
||||
/*
|
||||
* EAP server/peer: Shared EAP definitions
|
||||
* Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef EAP_DEFS_H
|
||||
#define EAP_DEFS_H
|
||||
|
||||
/* RFC 3748 - Extensible Authentication Protocol (EAP) */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(push, 1)
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
struct eap_hdr {
|
||||
u8 code;
|
||||
u8 identifier;
|
||||
be16 length; /* including code and identifier; network byte order */
|
||||
/* followed by length-4 octets of data */
|
||||
} STRUCT_PACKED;
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(pop)
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
enum { EAP_CODE_REQUEST = 1, EAP_CODE_RESPONSE = 2, EAP_CODE_SUCCESS = 3,
|
||||
EAP_CODE_FAILURE = 4 };
|
||||
|
||||
/* EAP Request and Response data begins with one octet Type. Success and
|
||||
* Failure do not have additional data. */
|
||||
|
||||
/*
|
||||
* EAP Method Types as allocated by IANA:
|
||||
* http://www.iana.org/assignments/eap-numbers
|
||||
*/
|
||||
typedef enum {
|
||||
EAP_TYPE_NONE = 0,
|
||||
EAP_TYPE_IDENTITY = 1 /* RFC 3748 */,
|
||||
EAP_TYPE_NOTIFICATION = 2 /* RFC 3748 */,
|
||||
EAP_TYPE_NAK = 3 /* Response only, RFC 3748 */,
|
||||
EAP_TYPE_MD5 = 4, /* RFC 3748 */
|
||||
EAP_TYPE_OTP = 5 /* RFC 3748 */,
|
||||
EAP_TYPE_GTC = 6, /* RFC 3748 */
|
||||
EAP_TYPE_TLS = 13 /* RFC 2716 */,
|
||||
EAP_TYPE_LEAP = 17 /* Cisco proprietary */,
|
||||
EAP_TYPE_SIM = 18 /* RFC 4186 */,
|
||||
EAP_TYPE_TTLS = 21 /* RFC 5281 */,
|
||||
EAP_TYPE_AKA = 23 /* RFC 4187 */,
|
||||
EAP_TYPE_PEAP = 25 /* draft-josefsson-pppext-eap-tls-eap-06.txt */,
|
||||
EAP_TYPE_MSCHAPV2 = 26 /* draft-kamath-pppext-eap-mschapv2-00.txt */,
|
||||
EAP_TYPE_TLV = 33 /* draft-josefsson-pppext-eap-tls-eap-07.txt */,
|
||||
EAP_TYPE_TNC = 38 /* TNC IF-T v1.0-r3; note: tentative assignment;
|
||||
* type 38 has previously been allocated for
|
||||
* EAP-HTTP Digest, (funk.com) */,
|
||||
EAP_TYPE_FAST = 43 /* RFC 4851 */,
|
||||
EAP_TYPE_PAX = 46 /* RFC 4746 */,
|
||||
EAP_TYPE_PSK = 47 /* RFC 4764 */,
|
||||
EAP_TYPE_SAKE = 48 /* RFC 4763 */,
|
||||
EAP_TYPE_IKEV2 = 49 /* RFC 5106 */,
|
||||
EAP_TYPE_AKA_PRIME = 50 /* RFC 5448 */,
|
||||
EAP_TYPE_GPSK = 51 /* RFC 5433 */,
|
||||
EAP_TYPE_PWD = 52 /* RFC 5931 */,
|
||||
EAP_TYPE_EKE = 53 /* RFC 6124 */,
|
||||
EAP_TYPE_EXPANDED = 254 /* RFC 3748 */
|
||||
} EapType;
|
||||
|
||||
|
||||
/* SMI Network Management Private Enterprise Code for vendor specific types */
|
||||
enum {
|
||||
EAP_VENDOR_IETF = 0,
|
||||
EAP_VENDOR_MICROSOFT = 0x000137 /* Microsoft */,
|
||||
EAP_VENDOR_WFA = 0x00372A /* Wi-Fi Alliance */,
|
||||
EAP_VENDOR_HOSTAP = 39068 /* hostapd/wpa_supplicant project */
|
||||
};
|
||||
|
||||
struct eap_expand {
|
||||
u8 vendor_id[3];
|
||||
be32 vendor_type;
|
||||
u8 opcode;
|
||||
} STRUCT_PACKED;
|
||||
|
||||
#define EAP_VENDOR_UNAUTH_TLS EAP_VENDOR_HOSTAP
|
||||
#define EAP_VENDOR_TYPE_UNAUTH_TLS 1
|
||||
|
||||
#define EAP_MSK_LEN 64
|
||||
#define EAP_EMSK_LEN 64
|
||||
|
||||
#endif /* EAP_DEFS_H */
|
@ -1,60 +0,0 @@
|
||||
|
||||
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _IRQFLAGS_H
|
||||
#define _IRQFLAGS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IDF_TARGET_ESP8266
|
||||
/**
|
||||
* @brief save IRQ state and disable IRQ
|
||||
*
|
||||
* @return saved IRQ state
|
||||
*/
|
||||
static inline uint32_t arch_local_irq_save(void)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
__asm__ __volatile__ ("rsil %0, 3" : "=a" (tmp) :: "memory");
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief restore IRQ state
|
||||
*
|
||||
* @param tmp saved IRQ state
|
||||
*/
|
||||
static inline void arch_local_irq_restore(uint32_t tmp)
|
||||
{
|
||||
__asm__ __volatile__ ("wsr %0, ps" :: "a" (tmp) : "memory");
|
||||
}
|
||||
|
||||
#define local_irq_declare(_t) uint32_t (_t)
|
||||
#define local_irq_save(_t) (_t) = arch_local_irq_save()
|
||||
#define local_irq_restore(_t) arch_local_irq_restore(_t)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _IRQFLAGS_H */
|
Reference in New Issue
Block a user