Skip to content

Commit 4ac7842

Browse files
author
Mika Leppänen
committed
Corrected authenticator GTK setting
When using random GTK on authenticator init GTK hash and key were not correctly updated to Wi-SUN boostrap.
1 parent 32af62b commit 4ac7842

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

source/6LoWPAN/ws/ws_pae_auth.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,19 @@ void ws_pae_auth_start(protocol_interface_info_entry_t *interface_ptr)
257257
return;
258258
}
259259

260+
// Checks if there is predefined active key
260261
int8_t index = sec_prot_keys_gtk_status_active_get(pae_auth->gtks);
261-
if (index >= 0) {
262-
// If there is predefined active key inserts it
263-
ws_pae_auth_network_keys_from_gtks_set(pae_auth);
264-
} else {
265-
// Gets a new key
262+
if (index < 0) {
263+
// If there is no key, inserts a new one
266264
ws_pae_auth_gtk_key_insert(pae_auth);
267265
index = sec_prot_keys_gtk_install_order_first_index_get(pae_auth->gtks);
268266
ws_pae_auth_active_gtk_set(pae_auth, index);
269267
}
270268

269+
// Inserts keys and updates GTK hash on stack
270+
ws_pae_auth_network_keys_from_gtks_set(pae_auth);
271+
272+
// Sets active key index
271273
ws_pae_auth_network_key_index_set(pae_auth, index);
272274
}
273275

0 commit comments

Comments
 (0)