Commit Graph

78 Commits

Author SHA1 Message Date
Andrew Zaborowski 89c2f14683 eapol: Add eapol_append_key_data utility
Add a utility to append a KDE to the key_data field in an EAPoL frame.
The KDE types enum is actually added to handshake.h because we've got
the utilities for finding those KDEs in a buffer there.  The new
function is specific to EAPoL-Key frames though and perhaps to simple to
be split across handshake.c and eapol.c.  Also it didn't seem useful to
use the ie_tlv_builder here.
2017-09-22 12:38:42 -05:00
Andrew Zaborowski 275cc2789d eapol: Make eapol_find_rsne non-static
EAPoL server can reuse this function.
2017-09-12 14:29:25 -05:00
Andrew Zaborowski 6be08a3604 eapol: Add eapol_tx_frame
Allow other files to send EAPoL frames.
2017-09-07 16:16:45 -05:00
Andrew Zaborowski f05c3c30d1 eapol: Add eapol_frame_watch_add / remove
Allow other files to receive EAPoL frames on specified interfaces.
2017-09-07 16:16:42 -05:00
Andrew Zaborowski 66325e8c9b eapol: Implement eapol_encrypt_key_data
Add a function to do the inverse of eapol_decrypt_key_data to be used in
eapol server.  Only AES-based versions supported.
2017-08-31 13:21:05 -05:00
Andrew Zaborowski 23af935e7b eapol: Add eapol_sm_set_require_handshake
Function to allow netdev.c to explicitly tell eapol.c whether to expect
EAP / 4-Way handshake.  This is to potentially make the code more
descriptive, until now we'd look at sm->handshake->ptk_complete to see
if a new PTK was needed.

A 4-Way handshake is required on  association to an AP except after FT.
2017-08-21 18:35:00 -05:00
Andrew Zaborowski b910784e83 eapol: Add preauth_sm class, drop eapol_sm.preauth
Remove the preauthentication support code from the normal eapol_sm
methods and add a separate simplified class that only handles EAP
packets.
2017-05-01 11:13:32 -05:00
Andrew Zaborowski c0ae9e3577 eapol: Receive frames with the Preauthentication ethertype
Modify the packet filter to also accept frames with ethertype of 0x88c7
and pass the ethertype value to __eapol_rx_packet so it can filter out
the frames where this value doesn't match the sm->preauth flag.
2017-04-18 11:42:45 -05:00
Andrew Zaborowski 4e9ed2d686 eapol: Add eapol_start_preauthentication
Add a wrapper for eapol_start that sets the sm->preauth flag and sends
the EAPOL-Start frame immediately to skip the timeout since we know
that the supplicant has to initiate the authentication.
2017-04-18 11:09:26 -05:00
Andrew Zaborowski e32ffc4d98 eapol: Use handshake_state to store state
Remove the keys and other data from struct eapol_sm, update device.c,
netdev.c and wsc.c to use the handshake_state object instead of
eapol_sm.  This also gets rid of eapol_cancel and the ifindex parameter
in some of the eapol functions where sm->handshake->ifindex can be
used instead.
2016-11-03 10:23:58 -05:00
Andrew Zaborowski 0d2e5b9849 eapol: Add setters for the FT handshake input data
Add space in the eapol_sm struct for the pieces of information required
for the FT 4-Way Handshake and add setters for device.c and netdev.c to
be able to provide the data.
2016-11-03 10:01:41 -05:00
Andrew Zaborowski 424ceb58a3 eapol: Drop len parameter to eapol_sm_set_rsn/wpa
The len parameter was only used so it could be validated against ie[1],
but since it was not checked to be > 2, it must have been validated
already, the check was redundant.  In any case all users directly
passed ie[1] as len anyway.  This makes it consistent with the ie
parsers and builders which didn't require a length.
2016-10-29 23:09:10 -05:00
Rahul Rahul c16ae02056 eapol: refactor eapol_find_kde and add install_igtk 2016-10-26 16:34:52 -05:00
Andrew Zaborowski c548898635 eapol: Cache early EAPoL frames until ready to process
Split eapol_start into two calls, one to register the state machine so
that the PAE read handler knows not to discard frames for that ifindex,
and eapol_start to actually start processing the frames.  This is needed
because, as per the comment in netdev.c, due to scheduling the PAE
socket read handler may trigger before the CMD_CONNECT event handler,
which needs to parse the FTE from the Associate Response frame and
supply it to the eapol SM before it can do anything with the message 1
of 4 of the FT handshake.

Another issue is that depending on the driver or timing, the underlying
link might not be marked as 'ready' by the kernel.  In this case, our
response to Message 1 of the 4-way Handshake is written and accepted by
the kernel, but gets dropped on the floor internally.  Which leads to
timeouts if the AP doesn't retransmit.
2016-10-15 16:25:37 -05:00
Denis Kenzior 91d35987fd eapol: Add provision to use EAPOL-Start 2016-10-11 01:36:48 -05:00
Denis Kenzior db8794460f eapol: Remove io argument from eapol_start 2016-09-13 17:37:13 -05:00
Denis Kenzior 9fde037b8f eapol: Add eapol_sm_set_event_func 2016-09-13 13:30:54 -05:00
Denis Kenzior baf72d7f86 eapol: Move to a single PAE socket
We used to open a socket for each wireless interface.  This patch uses a
single socket with an attached BPF to handle all EAPoL traffic via a
single file descriptor.
2016-09-12 10:02:04 -05:00
Denis Kenzior 34a537652a eapol: Store protocol version in eapol_sm
Instead of one global protocol_version, we now store it inside eapol_sm.
This allows us to use the same protocol version for our response as the
request from the authenticator.

For unit tests where we had protocol version mismatches, a new method is
introduced to explicitly set the protocol version to use.
2016-08-10 16:32:45 -05:00
Denis Kenzior efe5bed7c5 netdev: Move eapol_read to eapol.c 2016-06-28 18:18:47 -05:00
Rahul Rahul fb339bcc76 eapol: helper functions for REKEY_OFFLOAD 2016-06-22 18:44:17 -05:00
Denis Kenzior b93ae37325 eapol: Add eapol_sm_get_own_ie 2016-06-14 19:57:21 -05:00
Denis Kenzior 6d81e0a172 eapol: Add eapol_sm_get_group_cipher 2016-06-14 19:57:21 -05:00
Denis Kenzior c1ff686ed6 eapol: Add eapol_sm_get_pairwise_cipher 2016-06-14 19:57:21 -05:00
Andrew Zaborowski 14020b2aa6 eapol: Handle EAPoL-EAP packets 2015-11-02 21:45:43 -06:00
Andrew Zaborowski 2bccb7e7dc eapol: Remove user_data from __eapol_rx_packet args
Instead of passing the user_data parameter in every __eapol_rx_packet
call to be used by EAPOL in all tx_packet calls, add
eapol_sm_set_tx_user_data function that sets the value of user_data for
all subsequent tx_packet calls.  This way tx_packet can be called from
places that are not necessarily inside an __eapol_rx_packet call.
2015-11-02 21:40:21 -06:00
Andrew Zaborowski ef9b6f41ce eapol: Separate EAPOL header from struct eapol_key
This is needed so we can better handle sending and receiving EAPoL
packets other than EAPoL-Key.
2015-11-02 21:40:21 -06:00
Denis Kenzior 99cdb860c0 eapol: Simplify install_tk callback 2015-05-21 21:10:21 -05:00
Denis Kenzior e93dd44607 eapol: Simplify GTK install callback
Instead of passing in the RSN/WPA elements, simply pass in the
configured cipher.  This will make the implementation of the install_gtk
callback much simpler.
2015-05-21 21:08:47 -05:00
Denis Kenzior 9992d3aeda eapol: Extract & keep track of desired ciphers
When our own WPA IE or RSN IE are set, extract group and pairwise
ciphers.  These ciphers are the ones we desire to use for the secure
connection.
2015-05-19 00:05:53 -05:00
Denis Kenzior 8593ebaad4 eapol: Set wpa_key_id in WPA1 Step 2 of 2 2015-05-18 14:45:09 -05:00
Denis Kenzior 8f3fd6e47d eapol: Add eapol_verify_gtk_2_of_2 2015-05-05 22:04:21 -05:00
Andrew Zaborowski a7846aee85 eapol: WPA-specific handshake quirks
To support WPA allow the legacy EAPOL-Key frame formats.
2015-05-05 21:22:31 -05:00
Andrew Zaborowski a8c0f20510 eapol: Handle the Group Key Handshake 2015-05-05 21:10:07 -05:00
Denis Kenzior bc98bc9ecb eapol: Add functions to set own/ap WPA IEs
If EAPoL is being run for in WPA mode, then instead of RSN elements, the
WPA elements are required.
2015-04-10 23:46:58 -05:00
Denis Kenzior 9f17b71375 eapol: Add eapol_cancel 2015-03-29 20:58:40 -05:00
Denis Kenzior f31407dd46 eapol: Add deauthenticate callback 2015-03-29 20:30:14 -05:00
Denis Kenzior 6ec364cb86 eapol: Add __eapol_set_gtk_install_func 2015-03-25 23:28:22 -05:00
Denis Kenzior bf5a6a3999 eapol: Add __eapol_set_install_tk_func 2015-03-25 22:35:12 -05:00
Denis Kenzior ddcbb3f2a8 eapol: Add eapol_sm_set_user_data 2015-03-25 22:34:05 -05:00
Denis Kenzior 656318ed0c eapol: Update eapol_tx_packet_func_t declaration
Use aa and spa instead of aa_addr and sta_addr
2015-03-20 11:43:42 -05:00
Denis Kenzior 19c67c3b3a eapol: Add user_data argument
To __eapol_rx_packet.  The same argument is passed to tx_packet
function.
2015-03-19 23:57:37 -05:00
Denis Kenzior b526df19d6 eapol: Fix __eapol_rx_packet declaration 2015-03-19 23:57:36 -05:00
Denis Kenzior 6b84e0da1f eapol: Rename aa_addr
The use of aa_addr was redundant.  Use 'AA' instead.  802.11 defines
'AA' as 'Authenticator Address'.
2015-03-19 23:57:36 -05:00
Denis Kenzior b871d904d5 eapol: Rename sta_addr
The use of sta_addr made no sense.  Instead, use the terminology from
802.11: 'Supplicant Address (SPA)'
2015-03-19 23:57:36 -05:00
Jukka Rissanen acce7c9034 eapol: Change the interface index data type
The ifindex should be uint32_t instead of int.
2015-03-19 20:18:05 -05:00
Ravi kumar Veeramally db45cd8dbf eapol: Provide utility to open raw socket
Opens a raw socket to filter ETH_P_PAE based packets. Binds to specific
interface index to read/write eapol frames.
2015-02-26 10:54:05 -06:00
Denis Kenzior c71bfcbb7c eapol: Decryption of packets changes affects size 2015-02-24 15:59:36 -06:00
Denis Kenzior 9e6cbc5b60 eapol: Add __eapol_rx_packet 2015-02-24 11:13:19 -06:00
Denis Kenzior 4a540526fe eapol: Add eapol_start 2015-02-24 11:12:22 -06:00