40#define ENOTSUP_WEP __einfo_error ( EINFO_ENOTSUP_WEP )
41#define EINFO_ENOTSUP_WEP __einfo_uniqify ( EINFO_ENOTSUP, \
42 ( 0x10 | NET80211_CRYPT_WEP ), "WEP not supported" )
43#define ENOTSUP_TKIP __einfo_error ( EINFO_ENOTSUP_TKIP )
44#define EINFO_ENOTSUP_TKIP __einfo_uniqify ( EINFO_ENOTSUP, \
45 ( 0x10 | NET80211_CRYPT_TKIP ), "TKIP not supported" )
46#define ENOTSUP_CCMP __einfo_error ( EINFO_ENOTSUP_CCMP )
47#define EINFO_ENOTSUP_CCMP __einfo_uniqify ( EINFO_ENOTSUP, \
48 ( 0x10 | NET80211_CRYPT_CCMP ), "CCMP not supported" )
49#define ENOTSUP_CRYPT( crypt ) \
50 EUNIQ ( EINFO_ENOTSUP, ( 0x10 | (crypt) ), \
51 ENOTSUP_WEP, ENOTSUP_TKIP, ENOTSUP_CCMP )
63#define END_MAGIC 0xFFFFFFFF
116 const void *
key,
int len,
const void *
rsc )
126 DBG (
"802.11-Sec not installing null cryptography\n" );
133 crypto =
zalloc (
sizeof ( *crypto ) +
136 DBG (
"802.11-Sec out of memory\n" );
140 memcpy ( crypto, tbl_crypto,
sizeof ( *crypto ) );
141 crypto->
priv = ( (
void * ) crypto +
142 sizeof ( *crypto ) );
148 DBG (
"802.11-Sec no support for cryptosystem %d\n", crypt );
154 DBG (
"802.11-Sec installing cryptosystem %d as %p with key of "
155 "length %d\n", crypt, crypto,
len );
189 void *tbl_start,
void *tbl_end )
198 sizeof ( struct net80211_handshaker ) );
200 if ( map != rsn_cipher_map && map != rsn_akm_map )
204 for ( tblp = tbl_start; tblp < tbl_end; tblp += tbl_stride ) {
205 struct net80211_crypto *crypto = tblp;
206 struct net80211_handshaker *hs = tblp;
208 if ( map == rsn_cipher_map )
209 ok |= ( 1 << crypto->algorithm );
211 ok |= ( 1 << hs->protocol );
215 if ( rsn + 2 > rsn_end ) {
216 DBG ( "RSN detect: malformed descriptor count\n" );
220 ndesc = *( u16 * ) rsn;
224 DBG ( "RSN detect: no descriptors\n" );
232 if ( rsn + 4 > rsn_end ) {
233 DBG ( "RSN detect: malformed descriptor (%d left)\n",
238 desc = *( u32 * ) rsn;
241 for ( map_ent = map; map_ent->oui_type != END_MAGIC; map_ent++ )
242 if ( map_ent->
oui_type == ( desc & OUI_TYPE_MASK ) )
250 if ( ok & ( 1 << map_ent->net80211_type ) ) {
285 int *is_rsn, u8 **end )
295 DBG (
"RSN detect: old-style WPA IE found\n" );
296 rsn = &ie->vendor.data[0];
297 *
end = rsn + ie->len - 4;
300 DBG (
"RSN detect: 802.11i RSN IE found\n" );
301 rsn = (
u8 * ) &ie->rsn.version;
302 *
end = rsn + ie->len;
306 if ( rsn && ( *
end > (
u8 * ) ie_end || rsn >= *
end ||
308 DBG (
"RSN detect: malformed RSN IE or unknown "
309 "version, keep trying\n" );
320 DBG (
"RSN detect: no RSN IE found\n" );
367 cr =
map->net80211_type;
379 sp =
map->net80211_type;
382 DBG (
"RSN detect: OK, crypto type %d, secprot type %d\n",
cr,
sp );
388 DBG (
"RSN detect: invalid RSN IE\n" );
422 &is_rsn, &rsn_end ) ) ) {
443 DBG (
"Failed to handle RSN IE:\n" );
444 DBG_HD ( rsn, rsn_end - rsn );
465 if (
map->net80211_type ==
id )
518 return map->net80211_type;
#define NULL
NULL pointer (VOID *)
union @162305117151260234136356364136041353210355154177 key
Sense key.
struct golan_inbox_hdr hdr
Message header.
struct arbelprm_rc_send_wqe rc
struct bofm_section_header done
static unsigned short vendor
struct ena_llq_option desc
Descriptor counts.
#define DBG(...)
Print a debugging message.
#define IEEE80211_CAPAB_PRIVACY
Set if the network is encrypted (by any method)
#define IEEE80211_RSN_CTYPE_WEP104
802.11 RSN IE: cipher type for 104-bit WEP
#define IEEE80211_RSN_ATYPE_PSK
802.11 RSN IE: auth method type for using a pre-shared key
static int ieee80211_ie_bound(union ieee80211_ie *ie, void *end)
Check that 802.11 information element is bounded by buffer.
#define IEEE80211_WPA_OUI
Organization part for OUIs in old WPA IE.
#define IEEE80211_RSN_CTYPE_TKIP
802.11 RSN IE: cipher type for TKIP ("WPA")
#define IEEE80211_WPA_OUI_VEN
Old vendor-type WPA IE OUI type + subtype.
#define IEEE80211_RSN_CTYPE_CCMP
802.11 RSN IE: cipher type for CCMP ("WPA2")
#define IEEE80211_IE_VENDOR
Information element ID for Vendor Specific information element.
#define IEEE80211_RSN_ATYPE_8021X
802.11 RSN IE: auth method type for using an 802.1X server
#define IEEE80211_RSN_VERSION
802.11 RSN IE: expected version number
static union ieee80211_ie * ieee80211_next_ie(union ieee80211_ie *ie, void *end)
Advance to next 802.11 information element.
#define IEEE80211_RSN_CTYPE_WEP40
802.11 RSN IE: cipher type for 40-bit WEP
#define IEEE80211_RSN_OUI
Organization part for OUIs in standard RSN IE.
#define IEEE80211_IE_RSN
Information element ID for Robust Security Network information element.
uint32_t start
Starting offset.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define EINVAL
Invalid argument.
#define ENOMEM
Not enough space.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Constants and data structures defined in IEEE 802.11, subsetted according to what iPXE knows how to u...
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static __always_inline int struct dma_mapping * map
void * zalloc(size_t size)
Allocate cleared memory.
if(natsemi->flags &NATSEMI_64BIT) return 1
The iPXE 802.11 MAC layer.
net80211_security_proto
An 802.11 security handshaking protocol.
@ NET80211_SECPROT_UNKNOWN
Dummy value used when the handshaking type can't be detected.
@ NET80211_SECPROT_NONE
No security handshaking.
@ NET80211_SECPROT_PSK
Pre-shared key handshaking.
@ NET80211_SECPROT_EAP
Full EAP 802.1X handshaking.
net80211_crypto_alg
An 802.11 data encryption algorithm.
@ NET80211_CRYPT_NONE
No security, an "Open" network.
@ NET80211_CRYPT_CCMP
Network protected with CCMP (AES-based system)
@ NET80211_CRYPT_TKIP
Network protected with TKIP (better RC4-based system)
@ NET80211_CRYPT_UNKNOWN
Dummy value used when the cryptosystem can't be detected.
@ NET80211_CRYPT_WEP
Network protected with WEP (awful RC4-based system)
#define NET80211_HANDSHAKERS
uint32_t end
Ending offset.
static void(* free)(struct refcnt *refcnt))
u8 * sec80211_find_rsn(union ieee80211_ie *ie, void *ie_end, int *is_rsn, u8 **end)
Find the RSN or WPA information element in the provided beacon frame.
enum net80211_crypto_alg sec80211_rsn_get_net80211_crypt(u32 desc)
Determine net80211 cryptosystem number from RSN descriptor.
#define END_MAGIC
Magic number in oui_type showing end of list.
int sec80211_install(struct net80211_crypto **which, enum net80211_crypto_alg crypt, const void *key, int len, const void *rsc)
Install 802.11 cryptosystem.
static struct descriptor_map rsn_akm_map[]
Mapping between net80211 handshakers and 802.11i AKM IDs.
static struct descriptor_map rsn_cipher_map[]
Mapping between net80211 cryptosystems and 802.11i cipher IDs.
static struct descriptor_map * rsn_pick_desc(u8 **rsnp, u8 *rsn_end, struct descriptor_map *map, void *tbl_start, void *tbl_end)
Determine net80211 crypto or handshaking type value to return for RSN info.
static u32 rsn_get_desc(unsigned id, int rsnie, struct descriptor_map *map)
Determine RSN descriptor for specified net80211 ID.
int sec80211_detect(struct io_buffer *iob, enum net80211_security_proto *secprot, enum net80211_crypto_alg *crypt)
Detect the cryptosystem and handshaking protocol used by an 802.11 network.
int sec80211_detect_ie(int is_rsn, u8 *start, u8 *end, enum net80211_security_proto *secprot, enum net80211_crypto_alg *crypt)
Detect crypto and AKM types from RSN information element.
#define ENOTSUP_CRYPT(crypt)
u32 sec80211_rsn_get_crypto_desc(enum net80211_crypto_alg crypt, int rsnie)
Determine RSN descriptor for specified net80211 cryptosystem number.
u32 sec80211_rsn_get_akm_desc(enum net80211_security_proto secprot, int rsnie)
Determine RSN descriptor for specified net80211 handshaker number.
Definitions for general secured-network routines.
Mapping from net80211 crypto/secprot types to RSN OUI descriptors.
u32 oui_type
OUI+type in appropriate byte order, masked to exclude vendor.
u32 net80211_type
Value of net80211_crypto_alg or net80211_security_proto.
An 802.11 data or management frame without QoS or WDS header fields.
void * data
Start of data.
Interface to an 802.11 cryptosystem.
void * priv
Private data for the algorithm to store key and state info.
enum net80211_crypto_alg algorithm
The cryptographic algorithm implemented.
int(* init)(struct net80211_crypto *crypto, const void *key, int keylen, const void *rsc)
Initialize cryptosystem using a given key.
int priv_len
Length of private data requested to be allocated.
#define table_end(table)
Get end of linker table.
#define table_start(table)
Get start of linker table.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
u8 rsc[8]
Receive sequence counter for GTK.
u32 oui_type
OUI + type byte.