eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

wpa-auth.txt (5458B)


      1 Introduction
      2 ============
      3 
      4 This document describes the various stages of the authentication / association
      5 process for WPA/WPA2 Networks.  It is intended to give the reader a 'map' of
      6 what pieces come into play and when.
      7 
      8 For a more broad overview of authentication procedures, refer to Section
      9 4.10.3 of 802.11.
     10 
     11 WPA is an earlier stop-gap solution to WEP security vulnerabilities.
     12 Essentially it is a subset of draft 802.11i.  WPA2 refers to the released
     13 802.11i specification.  WPA2 is more of a marketing term; term used inside
     14 802.11 is RSN (Robust Security Network).  Typically WPA uses TKIP with RC4
     15 (also known as ARC4) stream cipher.  WPA2 uses CCMP with AES stream cipher
     16 which must always be supported.  TKIP with ARC4 is also a supported mode of
     17 operation.
     18 
     19 
     20 Overview of Getting Connected
     21 =============================
     22 
     23 To get connected to a typical WPA2 network the user must first know the
     24 Pre-Shared-Key or PSK.  This key can be generated based on a passphrase
     25 instead of being entered in hex form by the user.  The passphrase generation
     26 is specified in 802.11, Annex M.4.  Since the PSK should be long-lived, it
     27 should not be exposed over-the-air.  For this purpose the PSK is not used
     28 directly; instead a session key is derived.  The process for derivation of
     29 this key is called the 4-Way Handshake.
     30 
     31 For the purposes of the 4-Way Handshake below, PSK becomes the PMK (Pairwise
     32 Master Key).  The PMK is also obtained from an EAP exchange, but that is a
     33 different topic.
     34 
     35 4-Way Handshake generates a key referred to as the PTK (Pairwise Transient
     36 Key).  PTK is generated by feeding the PMK, AP Nonce (ANonce), STA Nonce
     37 (SNonce), AP MAC Address and the STA MAC Address through a hashing function.
     38 The SNonce and ANonce are randomly generated numbers and are exchanged by the
     39 STA and the AP during the initial two steps of the Four-Way Handshake.  The
     40 third step of the handshake establishes the GTK (Group Temporal Key). The
     41 fourth step serves as the acknowledgement step.
     42 
     43 The Four-Way Handshake is accomplished by exchanging EAPoL-Key protocol frames
     44 after performing OPEN_SYSTEM Association to the target AP.
     45 
     46 
     47 Key Derivation
     48 ==============
     49 
     50 The PTK obtained from the 4-Way handshake is divided into 3 separate keys:
     51 
     52 - 16 byte KCK (Confirmation Key).  The KCK is used in the computation of the
     53   MIC field used by EAPoL-Key frames.  The KCK is used as input to HMAC-MD5,
     54   HMAC-SHA1 or CMAC-AES depending on what hashing function is used.
     55 
     56 - 16 byte KEK (Encryption Key).  The KEK is used to encrypt data in message 3
     57   if it contains the GTK.
     58 
     59 - 16 byte TK (Temporal Key).  Used to encrypt / decrypt normal packets flowing
     60   between the STA and the AP.
     61 
     62 If TKIP used, then the following elements are also derived from the same PTK:
     63 
     64 - 8 byte Michael MIC Authenticator TX Key
     65 - 8 byte Michael MIC Authenticator RX Key
     66 
     67 For more details on the Four-Way Handshake, refer to 802.11 Section 11.6.2
     68 
     69 
     70 Overall Process
     71 ===============
     72 
     73 - The user selects a network to connect to.  This network can be known
     74   implicitly or via a scan.  A Probe request or a Beacon must first be
     75   received and the RSN IE must be stored in order to connect to the AP.  The
     76   RSN element contains the security parameters supported by the BSS.  This RSN
     77   element must also be compared against the RSN element received from the AP
     78   in message 3 of the 4-Way Handshake.
     79 
     80 - OPEN_SYSTEM Authentication and Association requests are sent to the AP.  In
     81   the case of the Association request, the RSN element with the selected
     82   encryption parameters must be included.
     83 
     84 - Once the OPEN_SYSTEM Association is successful, the AP shall send Message 1
     85   of the 4-Way Handshake.  This comes in the form of EAPoL-Key messages and
     86   require special privileges / setup in order to be read from the netdev
     87   device.
     88 
     89 - STA records all necessary parameters from Message 1 (ANonce, Key Replay
     90   Counter).  STA Generates the PTK, constructs Message 2 and sends it to the
     91   AP.
     92 
     93 - Once Message 3 is received from the AP, the STA sanity checks certain
     94   parameters (Key Replay Counter, ANonce, MIC).  The RSN received from the AP
     95   is also checked against the one received in Message 3.  If everything checks
     96   out, then Message 4 is constructed and sent to the AP.
     97 
     98 - Based on TK and GTK, the keys are set into the hardware.  The Re-Key offload
     99   is enabled as well (if supported?)
    100 
    101   Here's an example of how this looks like:
    102 
    103 < Request: New Key (0x0b) len 68 [ack]
    104     Key Data: len 16
    105         3c 7d 08 8b 94 10 0f 21 06 6d 7b 18 a1 7e e0 ad
    106     Key Cipher: CCMP (0x000fac04)
    107     Key Sequence: len 6
    108         00 00 00 00 00 00
    109     MAC Address: 24:A2:E1:EC:17:04
    110     Key Index: 0 (0x00)
    111     Interface Index: 3 (0x00000003)
    112 
    113 < Request: Set Key (0x0a) len 28 [ack]
    114     Key Index: 0 (0x00)
    115     Interface Index: 3 (0x00000003)
    116     Key Default: true
    117     Key Default Types: len 4
    118         Unicast: true
    119 
    120 < Request: New Key (0x0b) len 64 [ack]
    121     Key Data: len 16
    122         2e 15 6e 7c 4e 3d f1 37 09 13 ed bd 62 8e 25 65
    123     Key Cipher: CCMP (0x000fac04)
    124     Key Sequence: len 6
    125         00 00 00 00 00 00
    126     Key Default Types: len 4
    127         Multicast: true
    128     Key Index: 2 (0x02)
    129     Interface Index: 3
    130 
    131 < Request: Set Rekey Offload (0x4f) len 64 [ack]
    132     Interface Index: 3 (0x00000003)
    133     Rekey Data: len 52
    134         14 00 01 00 24 7a 90 94 e5 43 de 1b 1e 3d d4 a0
    135         5c d0 e7 76 14 00 02 00 28 4d b5 b1 cf bc e4 25
    136         f4 f5 00 47 64 83 87 bc 0c 00 03 00 00 00 00
    137 	00 00 00 01