aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/test_vectors.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-09-09 16:04:53 (GMT)
committerJouni Malinen <j@w1.fi>2012-09-09 16:04:53 (GMT)
commite88f0901ebfeac3cd07b8408c880bb4d8c3dbdb9 (patch)
tree468e9a5aa68263166caedc410e928d6167090f3d /wlantest/test_vectors.c
parent7d19d3e9db33b31e768c94e3e9101cd7b28402b9 (diff)
downloadhostap-e88f0901ebfeac3cd07b8408c880bb4d8c3dbdb9.zip
hostap-e88f0901ebfeac3cd07b8408c880bb4d8c3dbdb9.tar.gz
hostap-e88f0901ebfeac3cd07b8408c880bb4d8c3dbdb9.tar.bz2
wlantest: Add BIP-GMAC-128/256 test vectors
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wlantest/test_vectors.c')
-rw-r--r--wlantest/test_vectors.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/wlantest/test_vectors.c b/wlantest/test_vectors.c
index 968ce99..6c716c4 100644
--- a/wlantest/test_vectors.c
+++ b/wlantest/test_vectors.c
@@ -408,6 +408,78 @@ static void test_vector_ccmp_256(void)
}
+static void test_vector_bip_gmac_128(void)
+{
+ u8 igtk[] = {
+ 0x4e, 0xa9, 0x54, 0x3e, 0x09, 0xcf, 0x2b, 0x1e,
+ 0xca, 0x66, 0xff, 0xc5, 0x8b, 0xde, 0xcb, 0xcf
+ };
+ u8 ipn[] = { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ u8 frame[] = {
+ 0xc0, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00,
+ 0x02, 0x00
+ };
+ u8 *prot;
+ size_t prot_len;
+
+ wpa_printf(MSG_INFO, "\nBIP-GMAC-128 with broadcast "
+ "Deauthentication frame\n");
+
+ wpa_hexdump(MSG_INFO, "IGTK", igtk, sizeof(igtk));
+ wpa_hexdump(MSG_INFO, "IPN", ipn, sizeof(ipn));
+ wpa_hexdump(MSG_INFO, "Plaintext frame", frame, sizeof(frame));
+
+ prot = bip_gmac_protect(igtk, sizeof(igtk), frame, sizeof(frame),
+ ipn, 4, &prot_len);
+ if (prot == NULL) {
+ wpa_printf(MSG_ERROR, "Failed to protect BIP-GMAC-128 frame");
+ return;
+ }
+
+ wpa_hexdump(MSG_INFO, "Protected MPDU (without FCS)", prot, prot_len);
+ os_free(prot);
+}
+
+
+static void test_vector_bip_gmac_256(void)
+{
+ u8 igtk[] = {
+ 0x4e, 0xa9, 0x54, 0x3e, 0x09, 0xcf, 0x2b, 0x1e,
+ 0xca, 0x66, 0xff, 0xc5, 0x8b, 0xde, 0xcb, 0xcf,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
+ };
+ u8 ipn[] = { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ u8 frame[] = {
+ 0xc0, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00,
+ 0x02, 0x00
+ };
+ u8 *prot;
+ size_t prot_len;
+
+ wpa_printf(MSG_INFO, "\nBIP-GMAC-256 with broadcast "
+ "Deauthentication frame\n");
+
+ wpa_hexdump(MSG_INFO, "IGTK", igtk, sizeof(igtk));
+ wpa_hexdump(MSG_INFO, "IPN", ipn, sizeof(ipn));
+ wpa_hexdump(MSG_INFO, "Plaintext frame", frame, sizeof(frame));
+
+ prot = bip_gmac_protect(igtk, sizeof(igtk), frame, sizeof(frame),
+ ipn, 4, &prot_len);
+ if (prot == NULL) {
+ wpa_printf(MSG_ERROR, "Failed to protect BIP-GMAC-256 frame");
+ return;
+ }
+
+ wpa_hexdump(MSG_INFO, "Protected MPDU (without FCS)", prot, prot_len);
+ os_free(prot);
+}
+
+
int main(int argc, char *argv[])
{
wpa_debug_level = MSG_EXCESSIVE;
@@ -423,6 +495,8 @@ int main(int argc, char *argv[])
test_vector_gcmp();
test_vector_gcmp_256();
test_vector_ccmp_256();
+ test_vector_bip_gmac_128();
+ test_vector_bip_gmac_256();
os_program_deinit();