aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/bip.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2015-01-23 15:24:24 (GMT)
committerJouni Malinen <j@w1.fi>2015-01-24 17:37:42 (GMT)
commitcb80fadaa7374a9ab8191d0ac45f3cb5e7ddcca4 (patch)
tree3cc0a41eb58804a1c6ee9a2cf8e5fcc814474ddd /wlantest/bip.c
parent30bff1d0f43799835e12276866450786bbf594e1 (diff)
downloadhostap-cb80fadaa7374a9ab8191d0ac45f3cb5e7ddcca4.zip
hostap-cb80fadaa7374a9ab8191d0ac45f3cb5e7ddcca4.tar.gz
hostap-cb80fadaa7374a9ab8191d0ac45f3cb5e7ddcca4.tar.bz2
wlantest: Extend BIP support to cover BIP-CMAC-256
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wlantest/bip.c')
-rw-r--r--wlantest/bip.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/wlantest/bip.c b/wlantest/bip.c
index d9a52e9..bda8036 100644
--- a/wlantest/bip.c
+++ b/wlantest/bip.c
@@ -14,8 +14,8 @@
#include "wlantest.h"
-u8 * bip_protect(const u8 *igtk, u8 *frame, size_t len, u8 *ipn, int keyid,
- size_t *prot_len)
+u8 * bip_protect(const u8 *igtk, size_t igtk_len, u8 *frame, size_t len,
+ u8 *ipn, int keyid, size_t *prot_len)
{
u8 *prot, *pos, *buf;
u8 mic[16];
@@ -23,19 +23,19 @@ u8 * bip_protect(const u8 *igtk, u8 *frame, size_t len, u8 *ipn, int keyid,
struct ieee80211_hdr *hdr;
size_t plen;
- plen = len + 18;
+ plen = len + igtk_len == 32 ? 26 : 18;
prot = os_malloc(plen);
if (prot == NULL)
return NULL;
os_memcpy(prot, frame, len);
pos = prot + len;
*pos++ = WLAN_EID_MMIE;
- *pos++ = 16;
+ *pos++ = igtk_len == 32 ? 24 : 16;
WPA_PUT_LE16(pos, keyid);
pos += 2;
os_memcpy(pos, ipn, 6);
pos += 6;
- os_memset(pos, 0, 8); /* MIC */
+ os_memset(pos, 0, igtk_len == 32 ? 16 : 8); /* MIC */
buf = os_malloc(plen + 20 - 24);
if (buf == NULL) {
@@ -59,8 +59,8 @@ u8 * bip_protect(const u8 *igtk, u8 *frame, size_t len, u8 *ipn, int keyid,
}
os_free(buf);
- os_memcpy(pos, mic, 8);
- wpa_hexdump(MSG_DEBUG, "BIP MMIE MIC", pos, 8);
+ os_memcpy(pos, mic, igtk_len == 32 ? 16 : 8);
+ wpa_hexdump(MSG_DEBUG, "BIP MMIE MIC", pos, igtk_len == 32 ? 16 : 8);
*prot_len = plen;
return prot;