IEEE P802.11\
Wireless LANs

  ------------ --------------- -------------------- ------------ -----------------------
  Proposal                                                       
  selected                                                       
  Pseudo Code                                                    
  in LB88                                                        

  Date:                                                          
  2006-10-13                                                     

  Author(s):                                                     

  Name         Company         Address              Phone        email

  David Cypher NIST            100 Bureau Drive,    301 975 4855 david.cypher@nist.gov
                               Stop 8920                         

                                                                 
  ------------ --------------- -------------------- ------------ -----------------------

**8.7.2.3A Per-MPDU Rx pseudo-code for an MMPDU**

**if** d*ot11RSNAEnabled* = TRUE **and** Bit 6 of RSNA Capability Field
is set **then**

**if** the Protected Frame subfield of the Frame Control Field is zero
**then**

> **if** *Protection for TA is off for Rx* **then**
>
> Receive the unencrypted MPDU without protections
>
> **else**
>
> Discard the frame body without indication to LLC
>
> **endif**

**elseif** Protection is true for TA **then**

> **if** ((MPDU has individual RA **and** Pairwise key exists for the
> MPDU's TA) **or** (MPDU has a broadcast/multicast RA **and** network
> type is IBSS **and** IBSS GTK exists for MPDU's RA)) **then**
>
> **if** key is null **then**
>
> discard the frame body
>
> **elseif** entry has an AES-CCM key **then**
>
> decrypt frame using AES-CCM key
>
> **if** the integrity check fails **then**
>
> discard the frame
>
> increment dot11RSNAStatsCCMPDecryptErrors
>
> **endif**
>
> **elseif** entry has an AES-128-CMAC key **then**
>
> check integrity of the frame using AES-128-CMAC key
>
> **if** the ICV fails **then**
>
> discard the frame
>
> increment dot11RSNAStatsCMACICVErrors
>
> **endif**
>
> **else**
>
> discard the frame body
>
> **endif**
>
> **elseif** GTK for the Key ID does not exist **then**
>
> discard the frame body
>
> **elseif** GTK for the Key ID is null **then**
>
> discard the frame body
>
> **elseif** GTK for the Key ID is a CCM key **then**
>
> decrypt frame using AES-CCM key
>
> **if** the integrity check fails **then**
>
> discard the frame
>
> increment dot11RSNAStatsCCMPDecryptErrors
>
> **endif**
>
> **elseif** the IGTK for the Key ID is an AES-128-CMAC key **then**
>
> integrity check the frame using AES-128-CMAC decryption
>
> **if** the ICV fails **then**
>
> discard the frame
>
> increment dot11RSNAStatsCMACICVErrors
>
> **endif**
>
> **endif**

**else**

> discard the frame body

**endif**

**endif**

**8.7.2.4A Per-MDPU Rx pseudo-code**

**if** *dot11RSNAEnable* = TRUE **and** Bit 6 of RSNA Capability Field
is set **then**

**if** the frame was not protected **then**

> Receive the MMPDU unprotected

**else** //Have a protected MMPDU

> **if** Pairwise key is an AES-CCM key **then**
>
> **if** its MPDUs had sequential PNs **or** it consists of only one
> MPDU **then**
>
> Accept the MMPDU
>
> **else**
>
> discard the MMPDU as a replay attack
>
> increment dot11RSNAStatsCCMPReplays
>
> **endif**
>
> **elseif** Pairwise key is an AES-128-CMAC key **then**
>
> **if** its MPDUs had sequential PNs **or** it consists of only one
> MPDU **then**
>
> Accept the MMPDU
>
> **else**
>
> discard the MMPDU as a replay attack
>
> increment dot11RSNAStatsCMACReplays
>
> **endif**
>
> **endif**
>
> **endif**

**endif**

**References:**

IEEE 802.11 WG LB88: IEEE P802.11w/1.0, October 2006-10-13

IEEE P802.11-REVma-D7.0-redline.pdf