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

unit: Handle key_replay_counter as a uint64_t

This commit is contained in:
Denis Kenzior 2015-02-13 13:55:05 -06:00
parent 005fc0c0d1
commit 11de45fa4d

View File

@ -58,7 +58,7 @@ struct eapol_key_data {
bool encrypted_key_data:1;
bool smk_message:1;
uint16_t key_length;
uint8_t key_replay_counter[8];
uint64_t key_replay_counter;
uint8_t key_nonce[32];
uint8_t eapol_key_iv[16];
uint8_t key_rsc[8];
@ -96,8 +96,7 @@ static struct eapol_key_data eapol_key_test_1 = {
.encrypted_key_data = false,
.smk_message = false,
.key_length = 32,
.key_replay_counter =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
.key_replay_counter = 1,
.key_nonce = { 0xd5, 0xe2, 0x13, 0x9b, 0x1b, 0x1c, 0x1e, 0xcb, 0xf4,
0xc7, 0x9d, 0xb3, 0x70, 0xcd, 0x1c, 0xea, 0x07, 0xf1,
0x61, 0x76, 0xed, 0xa6, 0x78, 0x8a, 0xc6, 0x8c, 0x2c,
@ -142,8 +141,7 @@ static struct eapol_key_data eapol_key_test_2 = {
.encrypted_key_data = false,
.smk_message = false,
.key_length = 16,
.key_replay_counter =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.key_replay_counter = 0,
.key_nonce = { 0x12, 0x6a, 0xce, 0x64, 0xc1, 0xa6, 0x44, 0xd2, 0x7b,
0x84, 0xe0, 0x39, 0x26, 0x3b, 0x63, 0x3b, 0xc3, 0x74,
0xe3, 0x29, 0x9d, 0x7d, 0x45, 0xe1, 0xc4, 0x25, 0x44,
@ -186,8 +184,7 @@ static struct eapol_key_data eapol_key_test_3 = {
.encrypted_key_data = false,
.smk_message = false,
.key_length = 16,
.key_replay_counter =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.key_replay_counter = 0,
.key_nonce = { 0xc2, 0xbb, 0x57, 0xab, 0x58, 0x8f, 0x92, 0xeb, 0xbd,
0x44, 0xe8, 0x11, 0x09, 0x4f, 0x60, 0x1c, 0x08, 0x79,
0x86, 0x03, 0x0c, 0x3a, 0xc7, 0x49, 0xcc, 0x61, 0xd6,
@ -232,8 +229,7 @@ static struct eapol_key_data eapol_key_test_4 = {
.encrypted_key_data = false,
.smk_message = false,
.key_length = 0,
.key_replay_counter =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.key_replay_counter = 0,
.key_nonce = { 0x32, 0x89, 0xe9, 0x15, 0x65, 0x09, 0x4f, 0x32, 0x9a,
0x9c, 0xd5, 0x4a, 0x4a, 0x09, 0x0d, 0x2c, 0xf4, 0x34,
0x46, 0x83, 0xbf, 0x50, 0xef, 0xee, 0x36, 0x08, 0xb6,
@ -280,8 +276,7 @@ static struct eapol_key_data eapol_key_test_5 = {
.encrypted_key_data = true,
.smk_message = false,
.key_length = 16,
.key_replay_counter =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
.key_replay_counter = 1,
.key_nonce = { 0xc2, 0xbb, 0x57, 0xab, 0x58, 0x8f, 0x92, 0xeb, 0xbd,
0x44, 0xe8, 0x11, 0x09, 0x4f, 0x60, 0x1c, 0x08, 0x79,
0x86, 0x03, 0x0c, 0x3a, 0xc7, 0x49, 0xcc, 0x61, 0xd6,
@ -324,8 +319,7 @@ static struct eapol_key_data eapol_key_test_6 = {
.encrypted_key_data = false,
.smk_message = false,
.key_length = 0,
.key_replay_counter =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
.key_replay_counter = 1,
.key_nonce = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -361,8 +355,8 @@ static void eapol_key_test(const void *data)
assert(packet->encrypted_key_data == test->encrypted_key_data);
assert(packet->smk_message == test->smk_message);
assert(L_BE16_TO_CPU(packet->key_length) == test->key_length);
assert(!memcmp(packet->key_replay_counter, test->key_replay_counter,
sizeof(packet->key_replay_counter)));
assert(L_BE64_TO_CPU(packet->key_replay_counter) ==
test->key_replay_counter);
assert(!memcmp(packet->key_nonce, test->key_nonce,
sizeof(packet->key_nonce)));
assert(!memcmp(packet->eapol_key_iv, test->eapol_key_iv,