sec80211.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009 Joshua Oreman <oremanj@rwcr.net>.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00018 
00019 #ifndef _GPXE_SEC80211_H
00020 #define _GPXE_SEC80211_H
00021 
00022 FILE_LICENCE ( GPL2_OR_LATER );
00023 
00024 #include <gpxe/net80211.h>
00025 #include <errno.h>
00026 
00027 /** @file
00028  *
00029  * Definitions for general secured-network routines.
00030  *
00031  * Any function in this file which may be referenced by code which is
00032  * not exclusive to encryption-enabled builds (e.g. sec80211_detect(),
00033  * which is called by net80211_probe_step() to fill the net80211_wlan
00034  * structure's security fields) must be declared as a weak symbol,
00035  * using an inline interface similar to that used for
00036  * sec80211_detect() below. This prevents secure network support from
00037  * bloating general builds by any more than a few tiny hooks to call
00038  * crypto functions when crypto structures are non-NULL.
00039  */
00040 
00041 int _sec80211_detect ( struct io_buffer *iob,
00042                        enum net80211_security_proto *secprot,
00043                        enum net80211_crypto_alg *crypt )
00044         __attribute__ (( weak ));
00045 
00046 
00047 /**
00048  * Inline safety wrapper for _sec80211_detect()
00049  *
00050  * @v iob       I/O buffer containing beacon frame
00051  * @ret secprot Security handshaking protocol used by network
00052  * @ret crypt   Cryptosystem used by network
00053  * @ret rc      Return status code
00054  *
00055  * This function transparently calls _sec80211_detect() if the file
00056  * containing it was compiled in, or returns an error indication of
00057  * @c -ENOTSUP if not.
00058  */
00059 static inline int sec80211_detect ( struct io_buffer *iob,
00060                                     enum net80211_security_proto *secprot,
00061                                     enum net80211_crypto_alg *crypt ) {
00062         if ( _sec80211_detect )
00063                 return _sec80211_detect ( iob, secprot, crypt );
00064         return -ENOTSUP;
00065 }
00066 
00067 int sec80211_detect_ie ( int is_rsn, u8 *start, u8 *end,
00068                          enum net80211_security_proto *secprot,
00069                          enum net80211_crypto_alg *crypt );
00070 u8 * sec80211_find_rsn ( union ieee80211_ie *ie, void *ie_end,
00071                          int *is_rsn, u8 **end );
00072 
00073 int sec80211_install ( struct net80211_crypto **which,
00074                        enum net80211_crypto_alg crypt,
00075                        const void *key, int len, const void *rsc );
00076 
00077 u32 sec80211_rsn_get_crypto_desc ( enum net80211_crypto_alg crypt, int rsnie );
00078 u32 sec80211_rsn_get_akm_desc ( enum net80211_security_proto secprot,
00079                                 int rsnie );
00080 enum net80211_crypto_alg sec80211_rsn_get_net80211_crypt ( u32 desc );
00081 
00082 #endif /* _GPXE_SEC80211_H */
00083 

Generated on Tue Apr 6 20:01:08 2010 for gPXE by  doxygen 1.5.7.1