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

unit: Decrypt key data and verify RSN is present

This commit is contained in:
Denis Kenzior 2015-02-17 17:41:08 -06:00
parent d8931f5b58
commit 57c51a2e12

View File

@ -33,6 +33,7 @@
#include "src/sha1.h" #include "src/sha1.h"
#include "src/eapol.h" #include "src/eapol.h"
#include "src/crypto.h" #include "src/crypto.h"
#include "src/aes.h"
struct eapol_key_data { struct eapol_key_data {
const unsigned char *frame; const unsigned char *frame;
@ -494,6 +495,7 @@ static void eapol_4way_test(const void *data)
const struct eapol_key *step2; const struct eapol_key *step2;
const struct eapol_key *step3; const struct eapol_key *step3;
const struct eapol_key *step4; const struct eapol_key *step4;
uint8_t *decrypted_key_data;
step1 = eapol_verify_ptk_1_of_4(eapol_key_data_3, step1 = eapol_verify_ptk_1_of_4(eapol_key_data_3,
sizeof(eapol_key_data_3)); sizeof(eapol_key_data_3));
@ -532,6 +534,10 @@ static void eapol_4way_test(const void *data)
assert(step3); assert(step3);
assert(!memcmp(anonce, step3->key_nonce, sizeof(step3->key_nonce))); assert(!memcmp(anonce, step3->key_nonce, sizeof(step3->key_nonce)));
decrypted_key_data = eapol_decrypt_key_data(ptk->kek, step3);
assert(decrypted_key_data[0] == 48); // RSNE
l_free(decrypted_key_data);
step4 = eapol_verify_ptk_4_of_4(eapol_key_data_6, step4 = eapol_verify_ptk_4_of_4(eapol_key_data_6,
sizeof(eapol_key_data_6)); sizeof(eapol_key_data_6));
assert(step4); assert(step4);