3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00

unit: Update to the new API

This commit also fixes the unit test data for GTK Step 2 since we now
include WPA Key Index in this frame
This commit is contained in:
Denis Kenzior 2015-05-18 14:43:43 -05:00
parent 8593ebaad4
commit 72babefa33

View File

@ -851,15 +851,15 @@ static struct eapol_key_data eapol_key_test_17 = {
/* WPA frame, 2 of 2. For parameters see eapol_wpa_handshake_test */ /* WPA frame, 2 of 2. For parameters see eapol_wpa_handshake_test */
static const unsigned char eapol_key_data_18[] = { static const unsigned char eapol_key_data_18[] = {
0x02, 0x03, 0x00, 0x5f, 0xfe, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x5f, 0xfe, 0x03, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x5e, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x92, 0xb9,
0xe6, 0x84, 0xc4, 0xd0, 0xa5, 0x56, 0x9e, 0x2d, 0x0c, 0x75, 0x2c, 0x45, 0x33, 0x25, 0xa9, 0xdc, 0x46, 0xe3, 0xb2, 0xa1, 0x5c, 0xf7, 0x2f, 0x82,
0x2a, 0x00, 0x00 0x52, 0x00, 0x00,
}; };
static struct eapol_key_data eapol_key_test_18 = { static struct eapol_key_data eapol_key_test_18 = {
@ -870,7 +870,7 @@ static struct eapol_key_data eapol_key_test_18 = {
.descriptor_type = EAPOL_DESCRIPTOR_TYPE_WPA, .descriptor_type = EAPOL_DESCRIPTOR_TYPE_WPA,
.key_descriptor_version = EAPOL_KEY_DESCRIPTOR_VERSION_HMAC_MD5_ARC4, .key_descriptor_version = EAPOL_KEY_DESCRIPTOR_VERSION_HMAC_MD5_ARC4,
.key_type = false, .key_type = false,
.wpa_key_id = 0, .wpa_key_id = 2,
.install = false, .install = false,
.key_ack = false, .key_ack = false,
.key_mic = true, .key_mic = true,
@ -888,8 +888,8 @@ static struct eapol_key_data eapol_key_test_18 = {
.eapol_key_iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, .eapol_key_iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.key_rsc = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, .key_rsc = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.key_mic_data = { 0x36, 0x5e, 0x72, 0xe6, 0x84, 0xc4, 0xd0, 0xa5, .key_mic_data = { 0xe9, 0x92, 0xb9, 0x33, 0x25, 0xa9, 0xdc, 0x46, 0xe3,
0x56, 0x9e, 0x2d, 0x0c, 0x75, 0x2c, 0x45, 0x2a }, 0xb2, 0xa1, 0x5c, 0xf7, 0x2f, 0x82, 0x52 },
.key_data_len = 0, .key_data_len = 0,
}; };
@ -1510,7 +1510,7 @@ static void eapol_wpa2_handshake_test(const void *data)
frame = eapol_create_gtk_2_of_2(EAPOL_PROTOCOL_VERSION_2004, frame = eapol_create_gtk_2_of_2(EAPOL_PROTOCOL_VERSION_2004,
EAPOL_KEY_DESCRIPTOR_VERSION_HMAC_SHA1_AES, EAPOL_KEY_DESCRIPTOR_VERSION_HMAC_SHA1_AES,
eapol_key_test_12.key_replay_counter, false); eapol_key_test_12.key_replay_counter, false, 0);
assert(frame); assert(frame);
assert(eapol_calculate_mic(ptk->kck, frame, mic)); assert(eapol_calculate_mic(ptk->kck, frame, mic));
memcpy(frame->key_mic_data, mic, sizeof(mic)); memcpy(frame->key_mic_data, mic, sizeof(mic));
@ -1627,7 +1627,8 @@ static void eapol_wpa_handshake_test(const void *data)
frame = eapol_create_gtk_2_of_2(EAPOL_PROTOCOL_VERSION_2004, frame = eapol_create_gtk_2_of_2(EAPOL_PROTOCOL_VERSION_2004,
EAPOL_KEY_DESCRIPTOR_VERSION_HMAC_MD5_ARC4, EAPOL_KEY_DESCRIPTOR_VERSION_HMAC_MD5_ARC4,
eapol_key_test_18.key_replay_counter, true); eapol_key_test_18.key_replay_counter, true,
gtk_step1->wpa_key_id);
assert(frame); assert(frame);
assert(eapol_calculate_mic(ptk->kck, frame, mic)); assert(eapol_calculate_mic(ptk->kck, frame, mic));
memcpy(frame->key_mic_data, mic, sizeof(mic)); memcpy(frame->key_mic_data, mic, sizeof(mic));