Skip to content

Commit d4122b0

Browse files
authored
Merge pull request #10454 from u-blox/ublox_odin_driver_os_5_v3.7.0_rc1
Enterprise_mode_+_wifi_configuraiton_api: update ODIN drivers to v3.7.0 RC1
2 parents d299b3f + 43759c0 commit d4122b0

File tree

11 files changed

+650
-45
lines changed

11 files changed

+650
-45
lines changed

features/mbedtls/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/mbedtls_device.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@
2020
#ifndef MBEDTLS_DEVICE_H
2121
#define MBEDTLS_DEVICE_H
2222

23+
#ifdef TARGET_UBLOX_EVK_ODIN_W2
24+
#define MBEDTLS_MPI_WINDOW_SIZE 3 /**< Maximum windows size used. */
25+
#endif
26+
2327
#endif /* MBEDTLS_DEVICE_H */

features/netsocket/nsapi_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ typedef enum nsapi_security {
125125
NSAPI_SECURITY_WPA_WPA2 = 0x4, /*!< phrase conforms to WPA/WPA2 */
126126
NSAPI_SECURITY_PAP = 0x5, /*!< phrase conforms to PPP authentication context */
127127
NSAPI_SECURITY_CHAP = 0x6, /*!< phrase conforms to PPP authentication context */
128+
NSAPI_SECURITY_EAP_TLS = 0x7, /*!< phrase conforms to EAP-TLS */
129+
NSAPI_SECURITY_PEAP = 0x8, /*!< phrase conforms to PEAP */
128130
NSAPI_SECURITY_UNKNOWN = 0xFF, /*!< unknown/unsupported security in scan results */
129131
} nsapi_security_t;
130132

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/OdinWiFiInterface.cpp

Lines changed: 291 additions & 38 deletions
Large diffs are not rendered by default.

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/OdinWiFiInterface.h

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
#include "UbloxWiFiSoftAPInterface.h"
2323
#endif
2424

25+
#include "UbloxWiFiConfigInterface.h"
2526
#include "mbed.h"
2627
#include "netsocket/WiFiAccessPoint.h"
2728
#include "netsocket/EMACInterface.h"
2829
#include "nsapi_types.h"
2930
#include "lwip/netif.h"
3031
#include "rtos.h"
3132
#include "cb_wlan.h"
33+
#include "odin_drv_conf.h"
3234
#include "wifi_emac.h"
3335

3436
#define ODIN_WIFI_MAX_MAC_ADDR_STR (18)
@@ -43,6 +45,12 @@ struct wlan_status_connected_s;
4345
struct wlan_status_connection_failure_s;
4446
struct wlan_scan_indication_s;
4547

48+
typedef struct {
49+
const char *client_cert;
50+
const char *client_prvt_key;
51+
const char *ca_cert;
52+
}auth_cert_s;
53+
4654
/** OdinWiFiInterface class
4755
* Implementation of the WiFiInterface for the ODIN-W2 module
4856
*/
@@ -70,7 +78,16 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface
7078
* @return 0 on success, or error code on failure
7179
*/
7280
virtual nsapi_error_t set_credentials(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE);
73-
81+
82+
/** Set the WiFi network credentials
83+
*
84+
* @param client_cert Pointer to client certificate
85+
* @param client_pvt_key Pointer to client private key
86+
* @param ca_cert Pointer to ca certificate
87+
* @return 0 on success, or error code on failure
88+
*/
89+
nsapi_error_t set_certificates(const char *client_cert, const char *client_pvt_key , const char *ca_cert );
90+
7491
/** Set the WiFi network channel
7592
*
7693
* @param channel Channel on which the connection is to be made, or 0 for any (Default: 0)
@@ -89,10 +106,32 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface
89106
* @return 0 on success, or error code on failure
90107
*/
91108
virtual nsapi_error_t connect(
92-
const char *ssid,
93-
const char *pass,
94-
nsapi_security_t security = NSAPI_SECURITY_NONE,
95-
uint8_t channel = 0);
109+
const char *ssid,
110+
const char *pass,
111+
nsapi_security_t security = NSAPI_SECURITY_NONE,
112+
uint8_t channel = 0);
113+
114+
/** Start the interface [local interface]
115+
*
116+
* Attempt to connect to a Wi-Fi network using EAP (EAP_TLS and PEAP).
117+
*
118+
* @param ssid Name of the network to connect to.
119+
* @param pass Security passphrase to connect to the network.
120+
* @param security Type of encryption for connection (Default: NSAPI_SECURITY_NONE).
121+
* @param channel Channel to make the connection, or 0 for any (Default: 0).
122+
* @param auth_cert_s struct contains pointer to client_certificate, client_private_key and ca_certificate (Default: NULL).
123+
* @param username name of client registered with authentication server (Default: NULL).
124+
* @param password password against user registered with authentication server (Default: NULL).
125+
* @return NSAPI_ERROR_OK on success, or error code on failure.
126+
*/
127+
nsapi_error_t connect(
128+
const char *ssid,
129+
const char *pass,
130+
nsapi_security_t security,
131+
auth_cert_s *cert_handle,
132+
const char *username = NULL,
133+
const char *user_pswd = NULL,
134+
uint8_t channel = 0);
96135

97136
/** Start the interface
98137
*
@@ -141,7 +180,22 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface
141180
*/
142181
virtual nsapi_error_t set_timeout(int ms);
143182

144-
#if DEVICE_WIFI_AP
183+
/** Get general settings and tuning parameters
184+
*
185+
*
186+
* @param setting setting to read.
187+
* @return parameter value
188+
*/
189+
virtual unsigned int get_config(void *setting);
190+
191+
/**
192+
* Set general tuning parameter.
193+
*
194+
* @param setting setting to modify.
195+
* @param value value to set.
196+
*/
197+
virtual void set_config(void *setting, cb_uint32 value);
198+
#ifdef DEVICE_WIFI_AP
145199

146200
/** Set IP config for access point
147201
*
@@ -326,12 +380,19 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface
326380
void handle_wlan_status_ap_up();
327381
void handle_wlan_status_ap_down();
328382

383+
unsigned int wlan_get_gParams(cbTARGET_ConfigParams setting);
384+
void wlan_set_gParams(cbTARGET_ConfigParams setting, cb_uint32 value);
385+
329386
void init(bool debug);
330387
nsapi_error_t wlan_set_channel(uint8_t channel);
331388
nsapi_error_t wlan_connect(
332389
const char *ssid,
333390
const char *passwd,
334-
nsapi_security_t security);
391+
nsapi_security_t security,
392+
auth_cert_s *cert_handle = NULL,
393+
const char *username = NULL,
394+
const char *user_pswd = NULL,
395+
uint8_t channel = 0);
335396
nsapi_error_t wlan_ap_start(
336397
const char *ssid,
337398
const char *pass,
@@ -354,6 +415,7 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface
354415

355416
struct sta_s _sta;
356417
struct ap_s _ap;
418+
auth_cert_s _certs;
357419
char _mac_addr_str[ODIN_WIFI_MAX_MAC_ADDR_STR];
358420

359421
cbWLAN_StatusConnectedInfo _wlan_status_connected_info;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*---------------------------------------------------------------------------
2+
* Copyright (c) 2019, u-blox Malmö, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#ifndef UBLOX_WIFI_CONFIGAPINTERFACE_H
19+
#define UBLOX_WIFI_CONFIGAPINTERFACE_H
20+
21+
#include <string.h>
22+
#include "cb_wlan_driver_config.h"
23+
24+
/** UbloxWiFiConfigInterface class
25+
*
26+
* Common interface that is shared between WiFi devices supporting SoftAP mode
27+
*/
28+
class UbloxWiFiConfigInterface
29+
{
30+
public:
31+
/** UbloxWiFiConfigInterface lifetime
32+
*/
33+
virtual ~UbloxWiFiConfigInterface() {};
34+
35+
/** Get general settings and tuning parameters
36+
*
37+
*
38+
* @param setting setting to read.
39+
* @return parameter value
40+
*/
41+
virtual unsigned int get_config(void *setting) = 0;
42+
43+
/**
44+
* Set general tuning parameter.
45+
*
46+
* @param setting setting to modify.
47+
* @param value value to set.
48+
*/
49+
virtual void set_config(void *setting, cb_uint32 value) = 0;
50+
};
51+
52+
#endif
53+

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/cb_wlan_driver_config.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,50 @@ typedef enum targetConfigParams {
118118
cbTARGET_CFG_GET_BAD_RSSI_YIELD_TMO, //!< SEE CORRESPONDING GSETTING
119119
cbTARGET_CFG_SET_BLACKLIST_LAST_BSSID_TIMEOUT, //!< SEE CORRESPONDING GSETTING
120120
cbTARGET_CFG_GET_BLACKLIST_LAST_BSSID_TIMEOUT, //!< SEE CORRESPONDING GSETTING
121+
cbTARGET_CFG_SET_PMF_STA, //!< Set PMF option
122+
cbTARGET_CFG_GET_PMF_STA, //!< Get PMF option
123+
cbTARGET_CFG_SET_FT_MODE, //!< Set fast transition option
124+
cbTARGET_CFG_GET_FT_MODE, //!< Get fast transition option
125+
cbTARGET_CFG_SET_MIN_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
126+
cbTARGET_CFG_GET_MIN_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
127+
cbTARGET_CFG_SET_MAX_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
128+
cbTARGET_CFG_GET_MAX_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
129+
cbTARGET_CFG_SET_SCAN_TYPE, //!< SEE CORRESPONDING GSETTING
130+
cbTARGET_CFG_GET_SCAN_TYPE, //!< SEE CORRESPONDING GSETTING
131+
cbTARGET_CFG_SET_QOS_ENABLE, //!< SEE CORRESPONDING GSETTING
132+
cbTARGET_CFG_GET_QOS_ENABLE, //!< SEE CORRESPONDING GSETTING
133+
cbTARGET_CFG_SET_RTS_THRESHOLD, //!< SEE CORRESPONDING GSETTING
134+
cbTARGET_CFG_GET_RTS_THRESHOLD, //!< SEE CORRESPONDING GSETTING
135+
cbTARGET_CFG_SET_TX_POWER, //!< SEE CORRESPONDING GSETTING
136+
cbTARGET_CFG_GET_TX_POWER, //!< SEE CORRESPONDING GSETTING
137+
cbTARGET_CFG_SET_MAX_PASSIVE_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
138+
cbTARGET_CFG_GET_MAX_PASSIVE_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
139+
cbTARGET_CFG_SET_SCAN_LISTEN_INTERVAL, //!< SEE CORRESPONDING GSETTING
140+
cbTARGET_CFG_GET_SCAN_LISTEN_INTERVAL, //!< SEE CORRESPONDING GSETTING
141+
cbTARGET_CFG_SET_DOT11_SHORT_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
142+
cbTARGET_CFG_GET_DOT11_SHORT_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
143+
cbTARGET_CFG_SET_DOT11_LONG_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
144+
cbTARGET_CFG_GET_DOT11_LONG_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
145+
cbTARGET_CFG_SET_AP_DOT11_SHORT_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
146+
cbTARGET_CFG_GET_AP_DOT11_SHORT_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
147+
cbTARGET_CFG_SET_AP_DOT11_LONG_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
148+
cbTARGET_CFG_GET_AP_DOT11_LONG_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
149+
cbTARGET_CFG_SET_REMAIN_ON_CHANNEL, //!< SEE CORRESPONDING GSETTING
150+
cbTARGET_CFG_GET_REMAIN_ON_CHANNEL, //!< SEE CORRESPONDING GSETTING
151+
cbTARGET_CFG_SET_STA_TX_RATE_MASK, //!< SEE CORRESPONDING GSETTING
152+
cbTARGET_CFG_GET_STA_TX_RATE_MASK, //!< SEE CORRESPONDING GSETTING
153+
cbTARGET_CFG_SET_FORCE_WORLD_MODE, //!< SEE CORRESPONDING GSETTING
154+
cbTARGET_CFG_GET_FORCE_WORLD_MODE, //!< SEE CORRESPONDING GSETTING
155+
cbTARGET_CFG_SET_TX_PACKET_ACK_TIMEOUT_WD, //!< SEE CORRESPONDING GSETTING
156+
cbTARGET_CFG_GET_TX_PACKET_ACK_TIMEOUT_WD, //!< SEE CORRESPONDING GSETTING
157+
cbTARGET_CFG_SET_CTS_PROTECTION, //!< SEE CORRESPONDING GSETTING
158+
cbTARGET_CFG_GET_CTS_PROTECTION, //!< SEE CORRESPONDING GSETTING
159+
cbTARGET_CFG_SET_HIDDEN_SSID, //!< SEE CORRESPONDING GSETTING
160+
cbTARGET_CFG_GET_HIDDEN_SSID, //!< SEE CORRESPONDING GSETTING
161+
cbTARGET_CFG_SET_AP_STA_INACTIVITY_TIMEOUT, //!< SEE CORRESPONDING GSETTING
162+
cbTARGET_CFG_GET_AP_STA_INACTIVITY_TIMEOUT, //!< SEE CORRESPONDING GSETTING
163+
cbTARGET_CFG_SET_ROAMING_AREA_HYSTERESIS, //!< SEE CORRESPONDING GSETTING
164+
cbTARGET_CFG_GET_ROAMING_AREA_HYSTERESIS, //!< SEE CORRESPONDING GSETTING
121165
cbTARGET_CFG_LAST,
122166
cbTARGET_CFG_SET_GSETTING = 1000, //!< Pipe to @ref cbWM_gSet.
123167
cbTARGET_CFG_SET_TSETTING = 2000, //!< Pipe to @ref cbWM_tSet.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*---------------------------------------------------------------------------
2+
* Copyright (c) 2016, u-blox Malmö, All Rights Reserved
3+
* SPDX-License-Identifier: LicenseRef-PBL
4+
*
5+
* This file and the related binary are licensed under the
6+
* Permissive Binary License, Version 1.0 (the "License");
7+
* you may not use these files except in compliance with the License.
8+
*
9+
* You may obtain a copy of the License here:
10+
* LICENSE-permissive-binary-license-1.0.txt and at
11+
* https://www.mbed.com/licenses/PBL-1.0
12+
*
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* Component : WIFI
17+
* File : enterprize_handle.h
18+
*
19+
* Description :
20+
*-------------------------------------------------------------------------*/
21+
#include <string.h>
22+
#include "cb_comdefs.h"
23+
#include <string.h>
24+
#include <stdlib.h>
25+
#include "cb_cert_utils.h"
26+
#include "cb_wlan.h"
27+
#include "cb_hw.h"
28+
29+
/*===========================================================================
30+
* DEFINES
31+
*=========================================================================*/
32+
#define cbSECMNG_MAX_CERTIFICATE_SIZE 4096
33+
#define cbSECMNG_MAX_DER_FILE_SIZE (4096 + 3) // we need to make room for the 3 size bytes
34+
#define cbSECMNG_MD5_LEN 16
35+
#define cbSECMNG_MD5_STRING_LEN ((cbSECMNG_MD5_LEN * 2) + 1)
36+
#define cbSECMNG_MAX_CERTIFICATE_NAME_LEN 32
37+
#define cbSECMNG_MAX_CERTIFICATE_PASSWORD_LEN 64
38+
39+
/*===========================================================================
40+
* TYPES
41+
*=========================================================================*/
42+
typedef enum {
43+
cbSECMNG_TYPE_ALL = -1,
44+
cbSECMNG_TRUSTED_ROOT,
45+
cbSECMNG_CLIENT_CERT,
46+
cbSECMNG_CLIENT_PRIVATE_KEY,
47+
} cbSECMNG_Type;
48+
49+
/*===========================================================================
50+
* DECLARATIONS
51+
*=========================================================================*/
52+
#ifdef __cplusplus
53+
extern "C" {
54+
#endif
55+
56+
/** Call eap connection handler
57+
*
58+
* @param cert Reference to certificate e.g client or CA server certificate
59+
* @param pvt_key Reference to private key in case if private key is inside cert reference it can be passed as NULL.
60+
In case of EAP_TLS we need private key along with client certificate and not require in case of PEAP so NULL can be passed.
61+
* @param commonParams Connection parameters.
62+
* @param enterpriseParams Enterprise parameters.
63+
* @return 0 on success, or error code on failure
64+
*/
65+
cbRTSL_Status cb_eap_conn_handler(cb_char const* cert, cb_char const* pvt_key, cbWLAN_CommonConnectParameters *commonParams, cbWLAN_EnterpriseConnectParameters *enterpriseParams);
66+
67+
#ifdef __cplusplus
68+
}
69+
#endif

0 commit comments

Comments
 (0)