Skip to content

Commit 96c5496

Browse files
author
Mika Leppänen
committed
Added GTK, PMK, PTK lifecycles and node's access of revocation
For certification tests added certification add and remove interfaces (trusted certificates, CRL). Added key lifetime interfaces needed on tests. Improved TLS memory usage (CRL is allocated only when needed). Corrected TLS and MPX send errors. Enabled conversion from GTK to Group AES Key (GAK) when new keys are installed.
1 parent 8f10a6e commit 96c5496

25 files changed

+1723
-219
lines changed

nanostack/net_ws_test.h

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ int ws_test_active_key_set(int8_t interface_id, uint8_t index);
113113
* Pairwise Transient Key (PTK) lifetimes.
114114
*
115115
* \param interface_id Network interface ID.
116-
* \param gtk_lifetime GTK lifetime in minutes
117-
* \param pmk_lifetime PMK lifetime in minutes
118-
* \param ptk_lifetime PTK lifetime in minutes
116+
* \param gtk_lifetime GTK lifetime in minutes or zero if value is not changed
117+
* \param pmk_lifetime PMK lifetime in minutes or zero if value is not changed
118+
* \param ptk_lifetime PTK lifetime in minutes or zero if value is not changed
119119
*
120120
* \return 0 Lifetimes are set
121121
* \return <0 Lifetime set has failed
@@ -135,9 +135,10 @@ int ws_test_key_lifetime_set(
135135
* maximum mismatch time in minutes.
136136
*
137137
* \param interface_id Network interface ID.
138-
* \param revocat_lifetime_reduct GTK Revocation Lifetime Reduction (1 / value * GTK lifetime)
139-
* \param new_activation_time GTK New Activation Time (1 / value * GTK lifetime)
140-
* \param max_mismatch GTK maximum mismatch in minutes
138+
* \param revocat_lifetime_reduct GTK Revocation Lifetime Reduction (1 / value * GTK lifetime) or zero if value is not changed
139+
* \param new_activation_time GTK New Activation Time (1 / value * GTK lifetime) or zero if value is not changed
140+
* \param new_install_req GTK New Install Required (percent * GTK lifetime) or zero if value is not changed
141+
* \param max_mismatch GTK maximum mismatch in minutes or zero if value is not changed
141142
*
142143
* \return 0 Lifetimes are set
143144
* \return <0 Lifetime set has failed.
@@ -146,9 +147,26 @@ int ws_test_gtk_time_settings_set(
146147
int8_t interface_id,
147148
uint8_t revocat_lifetime_reduct,
148149
uint8_t new_activation_time,
150+
uint8_t new_install_req,
149151
uint32_t max_mismatch
150152
);
151153

154+
/**
155+
* Sets Next Group Transient Keys used during GTK life cycle
156+
*
157+
* Sets next Group Transient Keys (GTKs) used during GTK life cycle. Up to four
158+
* GTKs can be set (GTKs from index 0 to 3). When next GTK(s) are set, border
159+
* router inserts GTKs from the next GTK list into use during GTK update
160+
* procedure.
161+
*
162+
* \param interface_id Network interface ID.
163+
* \param gtk GTK array, if GTK is not set, pointer for the index shall be NULL.
164+
*
165+
* \return 0 GTKs are set
166+
* \return <0 GTK set has failed
167+
*/
168+
int ws_test_next_gtk_set(int8_t interface_id, uint8_t *gtk[4]);
169+
152170
#ifdef __cplusplus
153171
}
154172
#endif

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "net_rpl.h"
3636
#include "Service_Libs/nd_proxy/nd_proxy.h"
3737
#include "6LoWPAN/ws/ws_bbr_api_internal.h"
38+
#include "6LoWPAN/ws/ws_pae_controller.h"
3839
#include "DHCPv6_Server/DHCPv6_server_service.h"
3940

4041
#include "ws_bbr_api.h"
@@ -564,12 +565,20 @@ int ws_bbr_node_keys_remove(int8_t interface_id, uint8_t *eui64)
564565
(void) interface_id;
565566
(void) eui64;
566567

568+
#ifdef HAVE_WS_BORDER_ROUTER
569+
return ws_pae_controller_node_keys_remove(interface_id, eui64);
570+
#else
567571
return -1;
572+
#endif
568573
}
569574

570575
int ws_bbr_node_access_revoke_start(int8_t interface_id)
571576
{
572577
(void) interface_id;
573578

579+
#ifdef HAVE_WS_BORDER_ROUTER
580+
return ws_pae_controller_node_access_revoke_start(interface_id);
581+
#else
574582
return -1;
583+
#endif
575584
}

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,6 +1926,9 @@ static void ws_bootstrap_start_discovery(protocol_interface_info_entry_t *cur)
19261926
static void ws_bootstrap_start_authentication(protocol_interface_info_entry_t *cur)
19271927
{
19281928
tr_debug("authentication start");
1929+
// Set PAN ID and network name to controller
1930+
ws_pae_controller_nw_info_set(cur, cur->ws_info->network_pan_id, cur->ws_info->network_name);
1931+
19291932
ws_pae_controller_authenticate(cur);
19301933
}
19311934

@@ -2252,6 +2255,9 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
22522255
// Set authenticator relay to port 10253 and PAE to 10254 (and to own ll address)
22532256
ws_eapol_auth_relay_start(cur, EAPOL_RELAY_SOCKET_PORT, ll_addr, PAE_AUTH_SOCKET_PORT);
22542257

2258+
// Set PAN ID and network name to controller
2259+
ws_pae_controller_nw_info_set(cur, cur->ws_info->network_pan_id, cur->ws_info->network_name);
2260+
22552261
// Set PAE port to 10254 and authenticator relay to 10253 (and to own ll address)
22562262
ws_pae_controller_authenticator_start(cur, PAE_AUTH_SOCKET_PORT, ll_addr, EAPOL_RELAY_SOCKET_PORT);
22572263
break;

source/6LoWPAN/ws/ws_eapol_pdu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,15 @@ int8_t ws_eapol_pdu_send_to_mpx(protocol_interface_info_entry_t *interface_ptr,
197197
}
198198
msdu_entry->data_ptr = data;
199199
msdu_entry->buffer = buffer;
200-
msdu_entry->handle = eapol_pdu_data->msdu_handle++;
200+
msdu_entry->handle = eapol_pdu_data->msdu_handle;
201201
ns_list_add_to_start(&eapol_pdu_data->msdu_list, msdu_entry);
202202

203203
memcpy(data_request.DstAddr, eui_64, 8);
204204
data_request.msdu = data;
205205
data_request.msduLength = size;
206+
data_request.msduHandle = eapol_pdu_data->msdu_handle;
207+
208+
eapol_pdu_data->msdu_handle++;
206209

207210
eapol_pdu_data->mpx_api->mpx_data_request(eapol_pdu_data->mpx_api, &data_request, eapol_pdu_data->mpx_user_id);
208211
return 0;

0 commit comments

Comments
 (0)