Skip to content

Commit 6867dd7

Browse files
author
Mika Leppänen
committed
Suplicant EAP-TLS timeout is not incremented from retries
Supplicant no longer resets wait timer for EAP-TLS retries when receiving retried TLS packet from Authenticator (has same EAP-TLS sequence number). Moved GTK/GAK trace under EXTRA_DEBUG_INFO flag on controller.
1 parent 1f1c2a2 commit 6867dd7

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

source/6LoWPAN/ws/ws_pae_controller.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,16 @@ static int8_t ws_pae_controller_nw_key_check_and_insert(protocol_interface_info_
365365
if (ws_pae_controller_gak_from_gtk(gak, gtk, controller->network_name) >= 0) {
366366
// Install the new network key derived from GTK and network name (GAK) to MAC
367367
controller->nw_key_set(interface_ptr, i, i, gak);
368-
tr_info("NW: %s", controller->network_name);
369-
tr_info("NW: %s", trace_array((uint8_t *)controller->network_name, 20));
370-
tr_info("GTK: %s", trace_array(gtk, 16));
371-
tr_info("GAK: %s", trace_array(gak, 16));
372368
nw_key[i].installed = true;
373369
ret = 0;
370+
#ifdef EXTRA_DEBUG_INFO
371+
tr_info("NW name: %s", controller->network_name);
372+
size_t nw_name_len = strlen(controller->network_name);
373+
tr_info("NW name: %s", trace_array((uint8_t *)controller->network_name, nw_name_len));
374+
tr_info("GTK: %s", trace_array(gtk, 16));
375+
tr_info("GAK: %s", trace_array(gak, 16));
376+
#endif
377+
374378
} else {
375379
tr_error("GAK generation failed network name: %s", controller->network_name);
376380
continue;

source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ typedef struct {
7272
bool send_pending: 1; /**< TLS data is not yet send to network */
7373
} eap_tls_sec_prot_int_t;
7474

75-
#define FWH_RETRY_TIMEOUT_SMALL 330*10 // retry timeout for small network additional 30 seconds for authenticator delay
76-
#define FWH_RETRY_TIMEOUT_LARGE 750*10 // retry timeout for large network additional 30 seconds for authenticator delay
75+
#define EAP_TLS_RETRY_TIMEOUT_SMALL 330*10 // retry timeout for small network additional 30 seconds for authenticator delay
76+
#define EAP_TLS_RETRY_TIMEOUT_LARGE 750*10 // retry timeout for large network additional 30 seconds for authenticator delay
7777

78-
static uint16_t retry_timeout = FWH_RETRY_TIMEOUT_SMALL;
78+
static uint16_t retry_timeout = EAP_TLS_RETRY_TIMEOUT_SMALL;
7979

8080
static uint16_t supp_eap_tls_sec_prot_size(void);
8181
static int8_t supp_eap_tls_sec_prot_init(sec_prot_t *prot);
@@ -93,7 +93,7 @@ static void supp_eap_tls_sec_prot_timer_timeout(sec_prot_t *prot, uint16_t ticks
9393
static int8_t supp_eap_tls_sec_prot_init_tls(sec_prot_t *prot);
9494
static void supp_eap_tls_sec_prot_delete_tls(sec_prot_t *prot);
9595

96-
static void supp_eap_tls_sec_prot_seq_id_update(sec_prot_t *prot);
96+
static bool supp_eap_tls_sec_prot_seq_id_update(sec_prot_t *prot);
9797

9898
#define eap_tls_sec_prot_get(prot) (eap_tls_sec_prot_int_t *) &prot->data
9999

@@ -113,9 +113,9 @@ int8_t supp_eap_tls_sec_prot_register(kmp_service_t *service)
113113
int8_t supp_eap_sec_prot_timing_adjust(uint8_t timing)
114114
{
115115
if (timing < 16) {
116-
retry_timeout = FWH_RETRY_TIMEOUT_SMALL;
116+
retry_timeout = EAP_TLS_RETRY_TIMEOUT_SMALL;
117117
} else {
118-
retry_timeout = FWH_RETRY_TIMEOUT_LARGE;
118+
retry_timeout = EAP_TLS_RETRY_TIMEOUT_LARGE;
119119
}
120120
return 0;
121121
}
@@ -493,7 +493,10 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
493493
}
494494

495495
// Store sequence ID
496-
supp_eap_tls_sec_prot_seq_id_update(prot);
496+
if (supp_eap_tls_sec_prot_seq_id_update(prot)) {
497+
// When receiving a new sequence number, adds more time for re-send if no response
498+
data->common.ticks = retry_timeout;
499+
}
497500

498501
// All fragments received for a message
499502
if (result == EAP_TLS_MSG_RECEIVE_DONE && data->tls_ongoing) {
@@ -524,10 +527,6 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
524527
// Send EAP response
525528
supp_eap_tls_sec_prot_message_send(prot, EAP_RESPONSE, EAP_TLS, EAP_TLS_EXCHANGE_ONGOING);
526529
data->send_pending = false;
527-
528-
// Add more time for re-send if no response
529-
data->common.ticks = retry_timeout;
530-
531530
break;
532531

533532
case EAP_TLS_STATE_FINISH:
@@ -550,10 +549,16 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
550549
}
551550
}
552551

553-
static void supp_eap_tls_sec_prot_seq_id_update(sec_prot_t *prot)
552+
static bool supp_eap_tls_sec_prot_seq_id_update(sec_prot_t *prot)
554553
{
555554
eap_tls_sec_prot_int_t *data = eap_tls_sec_prot_get(prot);
555+
bool new_seq_id = false;
556+
557+
if (data->recv_eapol_pdu.msg.eap.id_seq > data->eap_id_seq) {
558+
new_seq_id = true;
559+
}
556560
data->eap_id_seq = data->recv_eapol_pdu.msg.eap.id_seq;
561+
return new_seq_id;
557562
}
558563

559564
#endif /* HAVE_WS */

0 commit comments

Comments
 (0)