File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
features/nanostack/mbed-mesh-api Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 153
153
"wisun-uc-dwell-interval" : {
154
154
"help" : " Unicast dwell interval. Range: 15-255 milliseconds" ,
155
155
"value" : 0
156
+ },
157
+ "certificate-header" : {
158
+ "help" : " File name of the certificate header file (used on include directive)" ,
159
+ "value" : null
160
+ },
161
+ "root-certificate" : {
162
+ "help" : " Root certificate in PEM format (must be a null terminated c-string)" ,
163
+ "value" : null
164
+ },
165
+ "own-certificate" : {
166
+ "help" : " Own certificate in PEM format (must be a null terminated c-string)" ,
167
+ "value" : null
168
+ },
169
+ "own-certificate-key" : {
170
+ "help" : " Own certificate's key in PEM format (must be a null terminated c-string)" ,
171
+ "value" : null
156
172
}
157
173
},
158
174
"target_overrides" : {
Original file line number Diff line number Diff line change 28
28
#include "mac_api.h"
29
29
#include "sw_mac.h"
30
30
#include "ws_management_api.h" //ws_management_node_init
31
+ #ifdef MBED_CONF_MBED_MESH_API_CERTIFICATE_HEADER
32
+ #if !defined(MBED_CONF_MBED_MESH_API_ROOT_CERTIFICATE ) || !defined(MBED_CONF_MBED_MESH_API_OWN_CERTIFICATE ) || \
33
+ !defined(MBED_CONF_MBED_MESH_API_OWN_CERTIFICATE_KEY )
34
+ #error Invalid Wi-SUN certificate configuration
35
+ #endif
36
+ #include MBED_CONF_MBED_MESH_API_CERTIFICATE_HEADER
37
+ #endif
31
38
32
39
// For tracing we need to define flag, have include and define group
33
40
//#define HAVE_DEBUG
@@ -210,6 +217,18 @@ static void wisun_tasklet_configure_and_connect_to_network(void)
210
217
network_name ,
211
218
fhss_timer_ptr );
212
219
220
+ #if defined(MBED_CONF_MBED_MESH_API_CERTIFICATE_HEADER )
221
+ arm_certificate_chain_entry_s chain_info ;
222
+ memset (& chain_info , 0 , sizeof (arm_certificate_chain_entry_s ));
223
+ chain_info .cert_chain [0 ] = (const uint8_t * ) MBED_CONF_MBED_MESH_API_ROOT_CERTIFICATE ;
224
+ chain_info .cert_len [0 ] = strlen ((const char * ) MBED_CONF_MBED_MESH_API_ROOT_CERTIFICATE ) + 1 ;
225
+ chain_info .cert_chain [1 ] = (const uint8_t * ) MBED_CONF_MBED_MESH_API_OWN_CERTIFICATE ;
226
+ chain_info .cert_len [1 ] = strlen ((const char * ) MBED_CONF_MBED_MESH_API_OWN_CERTIFICATE ) + 1 ;
227
+ chain_info .key_chain [1 ] = (const uint8_t * ) MBED_CONF_MBED_MESH_API_OWN_CERTIFICATE_KEY ;
228
+ chain_info .chain_length = 2 ;
229
+ arm_network_certificate_chain_set ((const arm_certificate_chain_entry_s * ) & chain_info );
230
+ #endif
231
+
213
232
status = arm_nwk_interface_up (wisun_tasklet_data_ptr -> network_interface_id );
214
233
if (status >= 0 ) {
215
234
wisun_tasklet_data_ptr -> tasklet_state = TASKLET_STATE_BOOTSTRAP_STARTED ;
You can’t perform that action at this time.
0 commit comments