Skip to content

Enterprise_mode_+_wifi_configuraiton_api: update ODIN drivers to v3.7.0 RC1 #10454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@
#ifndef MBEDTLS_DEVICE_H
#define MBEDTLS_DEVICE_H

#ifdef TARGET_UBLOX_EVK_ODIN_W2
#define MBEDTLS_MPI_WINDOW_SIZE 3 /**< Maximum windows size used. */
#endif

#endif /* MBEDTLS_DEVICE_H */
2 changes: 2 additions & 0 deletions features/netsocket/nsapi_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ typedef enum nsapi_security {
NSAPI_SECURITY_WPA_WPA2 = 0x4, /*!< phrase conforms to WPA/WPA2 */
NSAPI_SECURITY_PAP = 0x5, /*!< phrase conforms to PPP authentication context */
NSAPI_SECURITY_CHAP = 0x6, /*!< phrase conforms to PPP authentication context */
NSAPI_SECURITY_EAP_TLS = 0x7, /*!< phrase conforms to EAP-TLS */
NSAPI_SECURITY_PEAP = 0x8, /*!< phrase conforms to PEAP */
NSAPI_SECURITY_UNKNOWN = 0xFF, /*!< unknown/unsupported security in scan results */
} nsapi_security_t;

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
#include "UbloxWiFiSoftAPInterface.h"
#endif

#include "UbloxWiFiConfigInterface.h"
#include "mbed.h"
#include "netsocket/WiFiAccessPoint.h"
#include "netsocket/EMACInterface.h"
#include "nsapi_types.h"
#include "lwip/netif.h"
#include "rtos.h"
#include "cb_wlan.h"
#include "odin_drv_conf.h"
#include "wifi_emac.h"

#define ODIN_WIFI_MAX_MAC_ADDR_STR (18)
Expand All @@ -43,6 +45,12 @@ struct wlan_status_connected_s;
struct wlan_status_connection_failure_s;
struct wlan_scan_indication_s;

typedef struct {
const char *client_cert;
const char *client_prvt_key;
const char *ca_cert;
}auth_cert_s;

/** OdinWiFiInterface class
* Implementation of the WiFiInterface for the ODIN-W2 module
*/
Expand Down Expand Up @@ -70,7 +78,16 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface
* @return 0 on success, or error code on failure
*/
virtual nsapi_error_t set_credentials(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE);


/** Set the WiFi network credentials
*
* @param client_cert Pointer to client certificate
* @param client_pvt_key Pointer to client private key
* @param ca_cert Pointer to ca certificate
* @return 0 on success, or error code on failure
*/
nsapi_error_t set_certificates(const char *client_cert, const char *client_pvt_key , const char *ca_cert );

/** Set the WiFi network channel
*
* @param channel Channel on which the connection is to be made, or 0 for any (Default: 0)
Expand All @@ -89,10 +106,32 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface
* @return 0 on success, or error code on failure
*/
virtual nsapi_error_t connect(
const char *ssid,
const char *pass,
nsapi_security_t security = NSAPI_SECURITY_NONE,
uint8_t channel = 0);
const char *ssid,
const char *pass,
nsapi_security_t security = NSAPI_SECURITY_NONE,
uint8_t channel = 0);

/** Start the interface [local interface]
*
* Attempt to connect to a Wi-Fi network using EAP (EAP_TLS and PEAP).
*
* @param ssid Name of the network to connect to.
* @param pass Security passphrase to connect to the network.
* @param security Type of encryption for connection (Default: NSAPI_SECURITY_NONE).
* @param channel Channel to make the connection, or 0 for any (Default: 0).
* @param auth_cert_s struct contains pointer to client_certificate, client_private_key and ca_certificate (Default: NULL).
* @param username name of client registered with authentication server (Default: NULL).
* @param password password against user registered with authentication server (Default: NULL).
* @return NSAPI_ERROR_OK on success, or error code on failure.
*/
nsapi_error_t connect(
const char *ssid,
const char *pass,
nsapi_security_t security,
auth_cert_s *cert_handle,
const char *username = NULL,
const char *user_pswd = NULL,
uint8_t channel = 0);

/** Start the interface
*
Expand Down Expand Up @@ -141,7 +180,22 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface
*/
virtual nsapi_error_t set_timeout(int ms);

#if DEVICE_WIFI_AP
/** Get general settings and tuning parameters
*
*
* @param setting setting to read.
* @return parameter value
*/
virtual unsigned int get_config(void *setting);

/**
* Set general tuning parameter.
*
* @param setting setting to modify.
* @param value value to set.
*/
virtual void set_config(void *setting, cb_uint32 value);
#ifdef DEVICE_WIFI_AP

/** Set IP config for access point
*
Expand Down Expand Up @@ -326,12 +380,19 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface
void handle_wlan_status_ap_up();
void handle_wlan_status_ap_down();

unsigned int wlan_get_gParams(cbTARGET_ConfigParams setting);
void wlan_set_gParams(cbTARGET_ConfigParams setting, cb_uint32 value);

void init(bool debug);
nsapi_error_t wlan_set_channel(uint8_t channel);
nsapi_error_t wlan_connect(
const char *ssid,
const char *passwd,
nsapi_security_t security);
nsapi_security_t security,
auth_cert_s *cert_handle = NULL,
const char *username = NULL,
const char *user_pswd = NULL,
uint8_t channel = 0);
nsapi_error_t wlan_ap_start(
const char *ssid,
const char *pass,
Expand All @@ -354,6 +415,7 @@ class OdinWiFiInterface : public WiFiInterface, public EMACInterface

struct sta_s _sta;
struct ap_s _ap;
auth_cert_s _certs;
char _mac_addr_str[ODIN_WIFI_MAX_MAC_ADDR_STR];

cbWLAN_StatusConnectedInfo _wlan_status_connected_info;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------
* Copyright (c) 2019, u-blox Malm�, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef UBLOX_WIFI_CONFIGAPINTERFACE_H
#define UBLOX_WIFI_CONFIGAPINTERFACE_H

#include <string.h>
#include "cb_wlan_driver_config.h"

/** UbloxWiFiConfigInterface class
*
* Common interface that is shared between WiFi devices supporting SoftAP mode
*/
class UbloxWiFiConfigInterface
{
public:
/** UbloxWiFiConfigInterface lifetime
*/
virtual ~UbloxWiFiConfigInterface() {};

/** Get general settings and tuning parameters
*
*
* @param setting setting to read.
* @return parameter value
*/
virtual unsigned int get_config(void *setting) = 0;

/**
* Set general tuning parameter.
*
* @param setting setting to modify.
* @param value value to set.
*/
virtual void set_config(void *setting, cb_uint32 value) = 0;
};

#endif

Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,50 @@ typedef enum targetConfigParams {
cbTARGET_CFG_GET_BAD_RSSI_YIELD_TMO, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_BLACKLIST_LAST_BSSID_TIMEOUT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_BLACKLIST_LAST_BSSID_TIMEOUT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_PMF_STA, //!< Set PMF option
cbTARGET_CFG_GET_PMF_STA, //!< Get PMF option
cbTARGET_CFG_SET_FT_MODE, //!< Set fast transition option
cbTARGET_CFG_GET_FT_MODE, //!< Get fast transition option
cbTARGET_CFG_SET_MIN_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_MIN_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_MAX_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_MAX_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_SCAN_TYPE, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_SCAN_TYPE, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_QOS_ENABLE, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_QOS_ENABLE, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_RTS_THRESHOLD, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_RTS_THRESHOLD, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_TX_POWER, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_TX_POWER, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_MAX_PASSIVE_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_MAX_PASSIVE_SCAN_TIME, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_SCAN_LISTEN_INTERVAL, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_SCAN_LISTEN_INTERVAL, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_DOT11_SHORT_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_DOT11_SHORT_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_DOT11_LONG_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_DOT11_LONG_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_AP_DOT11_SHORT_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_AP_DOT11_SHORT_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_AP_DOT11_LONG_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_AP_DOT11_LONG_RETRY_LIMIT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_REMAIN_ON_CHANNEL, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_REMAIN_ON_CHANNEL, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_STA_TX_RATE_MASK, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_STA_TX_RATE_MASK, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_FORCE_WORLD_MODE, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_FORCE_WORLD_MODE, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_TX_PACKET_ACK_TIMEOUT_WD, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_TX_PACKET_ACK_TIMEOUT_WD, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_CTS_PROTECTION, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_CTS_PROTECTION, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_HIDDEN_SSID, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_HIDDEN_SSID, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_AP_STA_INACTIVITY_TIMEOUT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_AP_STA_INACTIVITY_TIMEOUT, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_SET_ROAMING_AREA_HYSTERESIS, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_GET_ROAMING_AREA_HYSTERESIS, //!< SEE CORRESPONDING GSETTING
cbTARGET_CFG_LAST,
cbTARGET_CFG_SET_GSETTING = 1000, //!< Pipe to @ref cbWM_gSet.
cbTARGET_CFG_SET_TSETTING = 2000, //!< Pipe to @ref cbWM_tSet.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*---------------------------------------------------------------------------
* Copyright (c) 2016, u-blox Malmö, All Rights Reserved
* SPDX-License-Identifier: LicenseRef-PBL
*
* This file and the related binary are licensed under the
* Permissive Binary License, Version 1.0 (the "License");
* you may not use these files except in compliance with the License.
*
* You may obtain a copy of the License here:
* LICENSE-permissive-binary-license-1.0.txt and at
* https://www.mbed.com/licenses/PBL-1.0
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Component : WIFI
* File : enterprize_handle.h
*
* Description :
*-------------------------------------------------------------------------*/
#include <string.h>
#include "cb_comdefs.h"
#include <string.h>
#include <stdlib.h>
#include "cb_cert_utils.h"
#include "cb_wlan.h"
#include "cb_hw.h"

/*===========================================================================
* DEFINES
*=========================================================================*/
#define cbSECMNG_MAX_CERTIFICATE_SIZE 4096
#define cbSECMNG_MAX_DER_FILE_SIZE (4096 + 3) // we need to make room for the 3 size bytes
#define cbSECMNG_MD5_LEN 16
#define cbSECMNG_MD5_STRING_LEN ((cbSECMNG_MD5_LEN * 2) + 1)
#define cbSECMNG_MAX_CERTIFICATE_NAME_LEN 32
#define cbSECMNG_MAX_CERTIFICATE_PASSWORD_LEN 64

/*===========================================================================
* TYPES
*=========================================================================*/
typedef enum {
cbSECMNG_TYPE_ALL = -1,
cbSECMNG_TRUSTED_ROOT,
cbSECMNG_CLIENT_CERT,
cbSECMNG_CLIENT_PRIVATE_KEY,
} cbSECMNG_Type;

/*===========================================================================
* DECLARATIONS
*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif

/** Call eap connection handler
*
* @param cert Reference to certificate e.g client or CA server certificate
* @param pvt_key Reference to private key in case if private key is inside cert reference it can be passed as NULL.
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.
* @param commonParams Connection parameters.
* @param enterpriseParams Enterprise parameters.
* @return 0 on success, or error code on failure
*/
cbRTSL_Status cb_eap_conn_handler(cb_char const* cert, cb_char const* pvt_key, cbWLAN_CommonConnectParameters *commonParams, cbWLAN_EnterpriseConnectParameters *enterpriseParams);

#ifdef __cplusplus
}
#endif
Loading