2 * ---------------------------------------------------------------------------
6 * This file provides functions to send data requests to the UniFi.
8 * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd.
10 * Refer to LICENSE.txt included with this source code for details on
13 * ---------------------------------------------------------------------------
15 #include "csr_wifi_hip_unifi.h"
16 #include "unifi_priv.h"
19 uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet, unsigned int length)
21 const unsigned char *p = packet;
25 if (length < (4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 1 + 8))
29 keyinfo = p[5] << 8 | p[6]; /* big-endian */
31 (p[0] == 1 || p[0] == 2) /* protocol version 802.1X-2001 (WPA) or -2004 (WPA2) */ &&
32 p[1] == 3 /* EAPOL-Key */ &&
33 /* don't bother checking p[2] p[3] (hh ll, packet body length) */
34 (p[4] == 254 || p[4] == 2) /* descriptor type P802.1i-D3.0 (WPA) or 802.11i-2004 (WPA2) */ &&
35 ((keyinfo & 0x0007) == 1 || (keyinfo & 0x0007) == 2) /* key descriptor version */ &&
36 (keyinfo & ~0x0207U) == 0x0108 && /* key info for 4/4 or 4/2 -- ignore key desc version and sec bit (since varies in WPA 4/4) */
37 (p[4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 0] == 0 && /* key data length (2 octets) 0 for 4/4 only */
38 p[4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 1] == 0)
40 unifi_trace(priv, UDBG1, "uf_verify_m4: M4 detected\n");
48 * ---------------------------------------------------------------------------
50 * Data transport signals.
52 * ---------------------------------------------------------------------------