Skip to content

Commit 45a76e1

Browse files
author
Mika Leppänen
committed
Corrected eapol key length
Set the key length to 16 octets. Also set the initial EAPOL-Key sequence counter and key length to zero.
1 parent 39582e8 commit 45a76e1

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

source/Security/eapol/eapol_helper.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818
#ifndef EAPOL_HELPER_H_
1919
#define EAPOL_HELPER_H_
2020

21-
#define EAPOL_PROTOCOL_VERSION 3
22-
#define EAPOL_EAP_TYPE 0
23-
#define EAPOL_KEY_TYPE 3
24-
#define EAPOL_KEY_NONCE_LEN 32
25-
#define EAPOL_KEY_MIC_LEN 16
21+
#define EAPOL_PROTOCOL_VERSION 3
22+
#define EAPOL_EAP_TYPE 0
23+
#define EAPOL_KEY_TYPE 3
24+
#define EAPOL_KEY_NONCE_LEN 32
25+
#define EAPOL_KEY_MIC_LEN 16
26+
#define EAPOL_KEY_LEN 16
2627

27-
#define EAPOL_BASE_LENGTH 4 //Protocol version 1 byte, Packet type 1 byte, packet length 2 byte
28+
#define EAPOL_BASE_LENGTH 4 //Protocol version 1 byte, Packet type 1 byte, packet length 2 byte
2829

29-
#define EAPOL_KEY_FRAME_BASE_SIZE 95
30+
#define EAPOL_KEY_FRAME_BASE_SIZE 95
3031

3132
struct eap_header_t;
3233

source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static int8_t auth_fwh_sec_prot_message_send(sec_prot_t *prot, fwh_sec_prot_msg_
273273
sec_prot_keys_pmk_replay_cnt_increment(prot->sec_keys);
274274
eapol_pdu.msg.key.replay_counter = sec_prot_keys_pmk_replay_cnt_get(prot->sec_keys);
275275
eapol_pdu.msg.key.key_information.key_ack = true;
276-
eapol_pdu.msg.key.key_length = 32;
276+
eapol_pdu.msg.key.key_length = EAPOL_KEY_LEN;
277277
eapol_pdu.msg.key.key_nonce = data->nonce;
278278
break;
279279
case FWH_MESSAGE_3:
@@ -285,7 +285,7 @@ static int8_t auth_fwh_sec_prot_message_send(sec_prot_t *prot, fwh_sec_prot_msg_
285285
eapol_pdu.msg.key.key_information.secured_key_frame = true;
286286
eapol_pdu.msg.key.key_information.encrypted_key_data = true;
287287
eapol_pdu.msg.key.key_nonce = data->nonce;
288-
eapol_pdu.msg.key.key_length = 32;
288+
eapol_pdu.msg.key.key_length = EAPOL_KEY_LEN;
289289
break;
290290
default:
291291
break;

source/Security/protocols/key_sec_prot/key_sec_prot.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,11 @@ static void key_sec_prot_create_request(sec_prot_t *prot, sec_prot_keys_t *sec_k
161161
if (!eapol_decoded_data) {
162162
data->result = SEC_RESULT_ERR_NO_MEM;
163163
} else {
164-
//Test Data
165164
eapol_pdu.msg.key.key_information.install = false;
166165
eapol_pdu.msg.key.key_information.pairwise_key = false;
167166
eapol_pdu.msg.key.key_information.request = true;
168-
eapol_pdu.msg.key.replay_counter = 10;
169-
eapol_pdu.msg.key.key_length = 32;
167+
eapol_pdu.msg.key.replay_counter = 0;
168+
eapol_pdu.msg.key.key_length = 0;
170169
eapol_write_pdu_frame(eapol_decoded_data + prot->header_size, &eapol_pdu);
171170

172171
tr_info("Initial EAPOL-Key send, PMKID %s PTKID %s GTKL %x", pmk ? "set" : "not set", ptk ? "set" : "not set", gtkl);

0 commit comments

Comments
 (0)