diff --git a/README.md b/README.md
index b627bb1..0564fc4 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,8 @@ This library and its features are supported on the following Infineon platforms:
- [XMC7200D-E272K8384 kit (KIT_XMC72_EVK_MUR_43439M2)](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc72_evk/)
+- [PSoC™ 62S2 evaluation kit (CY8CEVAL-062S2-CYW43022CUB)](https://www.infineon.com/cms/en/product/evaluation-boards/cy8ceval-062s2/)
+
**Note**: Virtual APIs are supported on all PSoC 62 devices, but they have only been tested on the CY8CEVAL-062S2-MUR-43439M2 kit.
## Dependent libraries
diff --git a/RELEASE.md b/RELEASE.md
index 154e897..0a55773 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -14,6 +14,11 @@ See the [README.md](./README.md) for a complete description of the Wi-Fi Connect
## Changelog
+### v3.3.0
+
+- WPS changes to support MBEDTLS version 3.4.0
+- Added support for CY8CEVAL-062S2-CYW43022CUB kit
+
### v3.2.0
- Added support for KIT_XMC72_EVK_MUR_43439M2 kit
diff --git a/docs/api_reference_manual/html/index.html b/docs/api_reference_manual/html/index.html
index b7c2789..69753ca 100644
--- a/docs/api_reference_manual/html/index.html
+++ b/docs/api_reference_manual/html/index.html
@@ -118,7 +118,8 @@
CYW954907AEVAL1F Evaluation Kit(CYW954907AEVAL1F)
CYW943907AEVAL1F Evaluation Kit(CYW943907AEVAL1F)
PSoC™ 62S2 evaluation kit (CY8CEVAL-062S2-MUR-43439M2)
-XMC7200D-E272K8384 kit (KIT_XMC72_EVK_MUR_43439M2) - Note
- Virtual APIs are supported on all PSoC 62 devices, but they have only been tested on the CY8CEVAL-062S2-MUR-43439M2 kit.
+XMC7200D-E272K8384 kit (KIT_XMC72_EVK_MUR_43439M2)
+PSoC™ 62S2 evaluation kit (CY8CEVAL-062S2-CYW43022CUB) - Note
- Virtual APIs are supported on all PSoC 62 devices, but they have only been tested on the CY8CEVAL-062S2-MUR-43439M2 kit.
diff --git a/source/COMPONENT_43022/cy_chip_constants.h b/source/COMPONENT_43022/cy_chip_constants.h
new file mode 100644
index 0000000..98a16fc
--- /dev/null
+++ b/source/COMPONENT_43022/cy_chip_constants.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2023, Cypress Semiconductor Corporation (an Infineon company) or
+ * an affiliate of Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * This software, including source code, documentation and related
+ * materials ("Software") is owned by Cypress Semiconductor Corporation
+ * or one of its affiliates ("Cypress") and is protected by and subject to
+ * worldwide patent protection (United States and foreign),
+ * United States copyright laws and international treaty provisions.
+ * Therefore, you may use this Software only as provided in the license
+ * agreement accompanying the software package from which you
+ * obtained this Software ("EULA").
+ * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+ * non-transferable license to copy, modify, and compile the Software
+ * source code solely for use in connection with Cypress's
+ * integrated circuit products. Any reproduction, modification, translation,
+ * compilation, or representation of this Software except as specified
+ * above is prohibited without the express written permission of Cypress.
+ *
+ * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+ * reserves the right to make changes to the Software without notice. Cypress
+ * does not assume any liability arising out of the application or use of the
+ * Software or any product or circuit described in the Software. Cypress does
+ * not authorize its products for use in any products where a malfunction or
+ * failure of the Cypress product may reasonably be expected to result in
+ * significant property damage, injury or death ("High Risk Product"). By
+ * including Cypress's product in a High Risk Product, the manufacturer
+ * of such system or application assumes all risk of such use and in doing
+ * so agrees to indemnify Cypress against all liability.
+ */
+
+/**
+* @file cy_chip_constant.h
+* @brief Chip-specific constants
+*/
+
+#define WL_CHANSPEC_BAND_MASK (0xc000)
+#define WL_CHANSPEC_BW_MASK (0x3800)
+#define WL_CHANSPEC_BW_10 (0x0800)
+#define WL_CHANSPEC_BW_20 (0x1000)
+#define WL_CHANSPEC_BW_40 (0x1800)
diff --git a/source/COMPONENT_MBEDTLS/cy_wps_aes_ctr_ccm.c b/source/COMPONENT_MBEDTLS/cy_wps_aes_ctr_ccm.c
index 44ab1de..e00cb46 100644
--- a/source/COMPONENT_MBEDTLS/cy_wps_aes_ctr_ccm.c
+++ b/source/COMPONENT_MBEDTLS/cy_wps_aes_ctr_ccm.c
@@ -56,6 +56,12 @@
#define AES_CCM_AUTH_AAD_FLAG 0x40
#define AES_CCM_CRYPT_FLAGS(iv_len) (AES_CCM_NONCE_LEN - 1 - iv_len)
+/* NOTE:
+ * AES encrypt/decrypt functions are used for WPS functionality. Remaining non-used functions by WPS are kept under
+ * AES_SELF_TEST macro to increase the code-coverage of WCM library.
+ */
+
+#ifdef AES_SELF_TEST
/* AES-CTR mode encryption/decryption algorithm
* - max data_len is (AES_BLOCK_SZ * 2^16)
* - nonce must be AES_BLOCK_SZ bytes
@@ -111,7 +117,6 @@ int aes_crypt_ctr( mbedtls_aes_context *ctx, uint32_t length, const unsigned cha
return ( 0 );
}
-
/* AES-CCM mode MAC calculation
* - computes AES_CCM_AUTH_LEN MAC
* - nonce must be AES_CCM_NONCE_LEN bytes
@@ -287,6 +292,7 @@ int aes_decrypt_ccm( mbedtls_aes_context *ctx, uint32_t length, uint32_t aad_len
return ( 0 );
}
+#endif
/* AES-CBC mode encryption/decryption algorithm with padding
* - handle partial plaintext blocks with padding
diff --git a/source/COMPONENT_MBEDTLS/cy_wps_crypto.c b/source/COMPONENT_MBEDTLS/cy_wps_crypto.c
index 1a941af..b4e7030 100644
--- a/source/COMPONENT_MBEDTLS/cy_wps_crypto.c
+++ b/source/COMPONENT_MBEDTLS/cy_wps_crypto.c
@@ -41,7 +41,7 @@
#include "cy_wps_crypto.h"
#include "cyabs_rtos_impl.h"
#include "cyhal.h"
-
+#include "cy_wps_mbedtls_version.h"
/******************************************************
* Macros
******************************************************/
@@ -78,7 +78,14 @@ extern int aes_cbc_crypt_pad_length_padding( mbedtls_aes_context *ctx, int mode,
cy_rslt_t cy_sha256( const unsigned char *input, size_t ilen, unsigned char output[32], int is224 )
{
+#if MBEDTLS_VERSION_MAJOR == MBEDTLS_MAJOR_VERSION_3
+ mbedtls_sha256( (uint8_t*) input, ilen, output, is224 );
+#elif MBEDTLS_VERSION_MAJOR == MBEDTLS_MAJOR_VERSION_2
mbedtls_sha256_ret( (uint8_t*) input, ilen, output, is224 );
+#else
+error "Unsupported MBEDTLS version"
+#endif
+
return CY_RSLT_SUCCESS;
}
@@ -115,7 +122,14 @@ void cy_sha2_hmac_starts(cy_sha2_hmac_context *ctx, const unsigned char *key, ui
unsigned char sum[32];
if (keylen > 64) {
- mbedtls_sha256_ret(key, keylen, sum, is224);
+#if MBEDTLS_VERSION_MAJOR == MBEDTLS_MAJOR_VERSION_3
+ mbedtls_sha256(key, keylen, sum, is224);
+#elif MBEDTLS_VERSION_MAJOR == MBEDTLS_MAJOR_VERSION_2
+ mbedtls_sha256_ret(key, keylen, sum, is224);
+#else
+error "Unsupported MBEDTLS version"
+#endif
+
keylen = (is224) ? 28 : 32;
key = sum;
}
@@ -129,8 +143,15 @@ void cy_sha2_hmac_starts(cy_sha2_hmac_context *ctx, const unsigned char *key, ui
}
mbedtls_sha256_init(&ctx->ctx);
+#if MBEDTLS_VERSION_MAJOR == MBEDTLS_MAJOR_VERSION_3
+ mbedtls_sha256_starts(&ctx->ctx, is224);
+ mbedtls_sha256_update(&ctx->ctx, ctx->ipad, 64);
+#elif MBEDTLS_VERSION_MAJOR == MBEDTLS_MAJOR_VERSION_2
mbedtls_sha256_starts_ret(&ctx->ctx, is224);
mbedtls_sha256_update_ret(&ctx->ctx, ctx->ipad, 64);
+#else
+error "Unsupported MBEDTLS version"
+#endif
memset(sum, 0, sizeof(sum));
}
@@ -140,7 +161,13 @@ void cy_sha2_hmac_starts(cy_sha2_hmac_context *ctx, const unsigned char *key, ui
*/
void cy_sha2_hmac_update(cy_sha2_hmac_context *ctx, const unsigned char *input, uint32_t ilen)
{
+#if MBEDTLS_VERSION_MAJOR == MBEDTLS_MAJOR_VERSION_3
+ mbedtls_sha256_update(&ctx->ctx, input, ilen);
+#elif MBEDTLS_VERSION_MAJOR == MBEDTLS_MAJOR_VERSION_2
mbedtls_sha256_update_ret(&ctx->ctx, input, ilen);
+#else
+ error "Unsupported MBEDTLS version"
+#endif
}
/*
@@ -165,12 +192,23 @@ void cy_sha2_hmac_finish(cy_sha2_hmac_context * ctx, unsigned char output[32])
*/
hlen = 32;
+#if MBEDTLS_VERSION_MAJOR == MBEDTLS_MAJOR_VERSION_3
+ mbedtls_sha256_finish(&ctx->ctx, tmpbuf);
+ mbedtls_sha256_starts(&ctx->ctx, is224);
+ mbedtls_sha256_update(&ctx->ctx, ctx->opad, 64);
+ mbedtls_sha256_update(&ctx->ctx, tmpbuf, hlen);
+ mbedtls_sha256_finish(&ctx->ctx, output);
+ mbedtls_sha256_free(&ctx->ctx);
+#elif MBEDTLS_VERSION_MAJOR == MBEDTLS_MAJOR_VERSION_2
mbedtls_sha256_finish_ret(&ctx->ctx, tmpbuf);
mbedtls_sha256_starts_ret(&ctx->ctx, is224);
mbedtls_sha256_update_ret(&ctx->ctx, ctx->opad, 64);
mbedtls_sha256_update_ret(&ctx->ctx, tmpbuf, hlen);
mbedtls_sha256_finish_ret(&ctx->ctx, output);
mbedtls_sha256_free(&ctx->ctx);
+#else
+ error "Unsupported MBEDTLS version"
+#endif
memset(tmpbuf, 0, sizeof(tmpbuf));
}
diff --git a/source/COMPONENT_WPS/cy_eapol.c b/source/COMPONENT_MBEDTLS/cy_wps_mbedtls_version.h
similarity index 79%
rename from source/COMPONENT_WPS/cy_eapol.c
rename to source/COMPONENT_MBEDTLS/cy_wps_mbedtls_version.h
index 3ccafe2..581ad4d 100644
--- a/source/COMPONENT_WPS/cy_eapol.c
+++ b/source/COMPONENT_MBEDTLS/cy_wps_mbedtls_version.h
@@ -1,83 +1,79 @@
-/*
- * Copyright 2023, Cypress Semiconductor Corporation (an Infineon company) or
- * an affiliate of Cypress Semiconductor Corporation. All rights reserved.
- *
- * This software, including source code, documentation and related
- * materials ("Software") is owned by Cypress Semiconductor Corporation
- * or one of its affiliates ("Cypress") and is protected by and subject to
- * worldwide patent protection (United States and foreign),
- * United States copyright laws and international treaty provisions.
- * Therefore, you may use this Software only as provided in the license
- * agreement accompanying the software package from which you
- * obtained this Software ("EULA").
- * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
- * non-transferable license to copy, modify, and compile the Software
- * source code solely for use in connection with Cypress's
- * integrated circuit products. Any reproduction, modification, translation,
- * compilation, or representation of this Software except as specified
- * above is prohibited without the express written permission of Cypress.
- *
- * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
- * reserves the right to make changes to the Software without notice. Cypress
- * does not assume any liability arising out of the application or use of the
- * Software or any product or circuit described in the Software. Cypress does
- * not authorize its products for use in any products where a malfunction or
- * failure of the Cypress product may reasonably be expected to result in
- * significant property damage, injury or death ("High Risk Product"). By
- * including Cypress's product in a High Risk Product, the manufacturer
- * of such system or application assumes all risk of such use and in doing
- * so agrees to indemnify Cypress against all liability.
- */
-
-/**
-* @file cy_eapol.c
-* @brief EAPOL handling for receiving EAPOL data from WHD
-*/
-
-#include "cy_eapol.h"
-
-#include "whd_buffer_api.h"
-#include
-
-/******************************************************
- * Macros
- ******************************************************/
-
-/******************************************************
- * Constants
- ******************************************************/
-
-/******************************************************
- * Enumerations
- ******************************************************/
-
-/******************************************************
- * Type Definitions
- ******************************************************/
-
-/******************************************************
- * Structures
- ******************************************************/
-
-/******************************************************
- * Function Declarations
- ******************************************************/
-
-/******************************************************
- * Variables Definitions
- ******************************************************/
-
-/******************************************************
- * Function Definitions
- ******************************************************/
-uint8_t* cy_eapol_get_eapol_data( whd_buffer_t packet, whd_interface_t interface )
-{
- return whd_buffer_get_current_piece_data_pointer(interface->whd_driver, packet);
-}
-
-uint16_t cy_get_eapol_packet_size( whd_buffer_t packet, whd_interface_t interface )
-{
- return whd_buffer_get_current_piece_size(interface->whd_driver, packet);
-}
+/*
+ * Copyright 2023, Cypress Semiconductor Corporation (an Infineon company) or
+ * an affiliate of Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * This software, including source code, documentation and related
+ * materials ("Software") is owned by Cypress Semiconductor Corporation
+ * or one of its affiliates ("Cypress") and is protected by and subject to
+ * worldwide patent protection (United States and foreign),
+ * United States copyright laws and international treaty provisions.
+ * Therefore, you may use this Software only as provided in the license
+ * agreement accompanying the software package from which you
+ * obtained this Software ("EULA").
+ * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+ * non-transferable license to copy, modify, and compile the Software
+ * source code solely for use in connection with Cypress's
+ * integrated circuit products. Any reproduction, modification, translation,
+ * compilation, or representation of this Software except as specified
+ * above is prohibited without the express written permission of Cypress.
+ *
+ * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+ * reserves the right to make changes to the Software without notice. Cypress
+ * does not assume any liability arising out of the application or use of the
+ * Software or any product or circuit described in the Software. Cypress does
+ * not authorize its products for use in any products where a malfunction or
+ * failure of the Cypress product may reasonably be expected to result in
+ * significant property damage, injury or death ("High Risk Product"). By
+ * including Cypress's product in a High Risk Product, the manufacturer
+ * of such system or application assumes all risk of such use and in doing
+ * so agrees to indemnify Cypress against all liability.
+ */
+
+/** @file cy_wps_mbedtls_version.h
+* @brief MBEDTLS major version for WPS
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mbedtls/version.h"
+
+#define MBEDTLS_MAJOR_VERSION_3 (3)
+#define MBEDTLS_MAJOR_VERSION_2 (2)
+
+/******************************************************
+ * Macros
+ ******************************************************/
+
+/******************************************************
+ * Constants
+ ******************************************************/
+
+/******************************************************
+ * Enumerations
+ ******************************************************/
+
+/******************************************************
+ * Type Definitions
+ ******************************************************/
+
+/******************************************************
+ * Structures
+ ******************************************************/
+
+/******************************************************
+ * Global Variables
+ ******************************************************/
+
+/******************************************************
+ * Function Declarations
+ ******************************************************/
+
+#ifdef __cplusplus
+} /*extern "C" */
+#endif
diff --git a/source/COMPONENT_WPS/cy_wps.c b/source/COMPONENT_WPS/cy_wps.c
index 0a35067..80d2fa1 100644
--- a/source/COMPONENT_WPS/cy_wps.c
+++ b/source/COMPONENT_WPS/cy_wps.c
@@ -147,7 +147,9 @@ static cy_wps_pbc_probreq_notify_callback_t pbc_probreq_notify_callback;
static void cy_wps_thread ( cy_thread_arg_t arg );
static void cy_wps_whd_scan_result_handler ( whd_scan_result_t** result_ptr, void* user_data, whd_scan_status_t status );
static void* cy_wps_softap_event_handler ( whd_interface_t interface, const whd_event_header_t* event_header, const uint8_t* event_data, /*@returned@*/ void* handler_user_data );
+#ifdef WCM_ENABLE_WPS_REGISTRAR
static cy_rslt_t cy_wps_internal_pbc_overlap_check( const whd_mac_t* mac );
+#endif
static void cy_network_process_wps_eapol_data( /*@only@*/ whd_interface_t interface, whd_buffer_t buffer );
static tlv8_header_t* cy_wps_parse_dot11_tlvs ( const tlv8_header_t* tlv_buf, uint32_t buflen, dot11_ie_id_t key );
@@ -298,11 +300,13 @@ cy_rslt_t cy_wps_start( cy_wps_agent_t* workspace, cy_wps_mode_t mode, const cha
break;
}
+#ifdef WCM_ENABLE_WPS_REGISTRAR
if ( ( workspace->agent_type == CY_WPS_REGISTRAR_AGENT ) &&
( cy_wps_internal_pbc_overlap_check( NULL ) == CY_RSLT_WPS_PBC_OVERLAP ) && ( mode == CY_WPS_PBC_MODE ) )
{
return CY_RSLT_WPS_PBC_OVERLAP;
}
+#endif
result = cy_wps_internal_init( workspace, (uint32_t) workspace->interface, mode, password, credentials, credential_length );
if ( result == CY_RSLT_SUCCESS )
@@ -317,6 +321,7 @@ cy_rslt_t cy_wps_start( cy_wps_agent_t* workspace, cy_wps_mode_t mode, const cha
return result;
}
+#ifdef WCM_ENABLE_P2P
cy_rslt_t cy_p2p_wps_start( cy_wps_agent_t* workspace )
{
cy_rslt_t result;
@@ -333,6 +338,7 @@ cy_rslt_t cy_p2p_wps_start( cy_wps_agent_t* workspace )
return result;
}
+#endif
cy_rslt_t cy_wps_restart( cy_wps_agent_t* workspace )
{
@@ -550,6 +556,7 @@ void cy_wps_scan_result_handler( whd_scan_result_t* result, void* user_data )
return;
}
+#ifdef WCM_ENABLE_WPS_REGISTRAR
cy_rslt_t cy_wps_set_directed_wps_target( cy_wps_agent_t* workspace, cy_wps_ap_t* ap, uint32_t maximum_join_attempts )
{
workspace->directed_wps_max_attempts = maximum_join_attempts;
@@ -566,6 +573,7 @@ static cy_rslt_t cy_wps_internal_pbc_overlap_check( const whd_mac_t* mac )
}
return CY_RSLT_SUCCESS;
}
+#endif
static void cy_wps_thread( cy_thread_arg_t arg )
{
@@ -734,6 +742,7 @@ static void cy_network_process_wps_eapol_data( /*@only@*/ whd_interface_t interf
}
}
+#ifdef WCM_ENABLE_WPS_REGISTRAR
int cy_wps_validate_pin_checksum( const char* str )
{
unsigned long int PIN;
@@ -752,6 +761,7 @@ int cy_wps_validate_pin_checksum( const char* str )
return (0 == (accum % 10));
}
+#endif
/******************************************************
@@ -968,6 +978,7 @@ void cy_wps_host_store_credential( void* workspace, cy_wps_internal_credential_t
}
}
+#ifdef WCM_ENABLE_WPS_REGISTRAR
void cy_wps_host_retrieve_credential( void* workspace, cy_wps_internal_credential_t* credential )
{
cy_wps_workspace_t* host = (cy_wps_workspace_t*) workspace;
@@ -1010,6 +1021,7 @@ void cy_wps_host_retrieve_credential( void* workspace, cy_wps_internal_credentia
break;
}
}
+#endif
static void cy_wps_whd_scan_result_handler( whd_scan_result_t** result_ptr, void* user_data, whd_scan_status_t status )
{
@@ -1242,10 +1254,12 @@ void cy_wps_update_pbc_overlap_array(cy_wps_agent_t* workspace, const whd_mac_t*
return;
}
+#ifdef WCM_ENABLE_WPS_REGISTRAR
void wps_register_pbc_probreq_callback( cy_wps_pbc_probreq_notify_callback_t pbc_probreq_callback )
{
pbc_probreq_notify_callback = pbc_probreq_callback;
}
+#endif
void cy_wps_pbc_overlap_array_notify( const whd_mac_t* mac )
{
diff --git a/source/COMPONENT_WPS/cy_wps_common.c b/source/COMPONENT_WPS/cy_wps_common.c
index 82414bf..74ce94c 100644
--- a/source/COMPONENT_WPS/cy_wps_common.c
+++ b/source/COMPONENT_WPS/cy_wps_common.c
@@ -155,7 +155,9 @@ static uint8_t* cy_wps_write_nonce ( cy_wps_agent_t* workspa
static uint8_t* cy_wps_write_hashes ( cy_wps_agent_t* workspace, uint8_t* iter );
static uint8_t* cy_wps_write_secret1 ( cy_wps_agent_t* workspace, uint8_t* iter );
static uint8_t* cy_wps_write_secret2 ( cy_wps_agent_t* workspace, uint8_t* iter );
+#ifdef WCM_ENABLE_WPS_REGISTRAR
static uint8_t* cy_wps_write_credentials ( cy_wps_agent_t* workspace, uint8_t* iter );
+#endif
static uint8_t* cy_wps_write_common_header ( cy_wps_agent_t* workspace, uint8_t* start_of_packet, uint8_t message_type );
static uint8_t* cy_wps_write_vendor_extension ( uint8_t* iter, cy_wps_agent_t* workspace );
static uint8_t* cy_wps_start_encrypted_tlv ( uint8_t* iter);
@@ -265,6 +267,7 @@ const cy_wps_state_machine_state_t wps_states[2][4] =
},
},
+#ifdef WCM_ENABLE_WPS_REGISTRAR
[CY_WPS_REGISTRAR_AGENT] =
{
// Receiving M1, Sending M2
@@ -304,6 +307,7 @@ const cy_wps_state_machine_state_t wps_states[2][4] =
.packet_generator = (cy_wps_packet_generator_t)cy_wps_write_credentials,
},
},
+#endif
};
/******************************************************
@@ -1581,6 +1585,7 @@ uint8_t* cy_wps_write_secret2(cy_wps_agent_t* workspace, uint8_t* iter)
return iter;
}
+#ifdef WCM_ENABLE_WPS_REGISTRAR
/*
* Function to create M8
*/
@@ -1647,6 +1652,7 @@ static uint8_t* cy_wps_write_credentials(cy_wps_agent_t* workspace, uint8_t* ite
return iter;
}
+#endif
static uint8_t* cy_wps_start_encrypted_tlv(uint8_t* iter)
{
diff --git a/source/COMPONENT_WPS/nn.c b/source/COMPONENT_WPS/nn.c
index 7b96c3a..c671eca 100644
--- a/source/COMPONENT_WPS/nn.c
+++ b/source/COMPONENT_WPS/nn.c
@@ -200,6 +200,11 @@ the transformation back is negligible compared to the savings you make
on the multiplies. The best known such situation is exponentiation.
*/
+
+/* Note : Only few functions are used by WPS from NN library. Hence adding functions which are not used
+ * under ENABLE_UNUSED_NN_FUNCTIONS define to improve the code coverage of WCM asset. Please define ENABLE_UNUSED_NN_FUNCTIONS
+ * if you need to use the remaining functions
+ */
/****************************************************************************/
/* Local definitions and types */
/****************************************************************************/
@@ -227,6 +232,7 @@ void NN_Clr( NN_t* m )
}
+#ifdef ENABLE_UNUSED_NN_FUNCTIONS
/*!
******************************************************************************
Adds two numbers
@@ -364,6 +370,7 @@ uint64_t tr;
}
}
}
+#endif
/*
* Division
@@ -390,6 +397,7 @@ The operands must be less than the modulus. The result must be as long as the
modulus.
*/
+#ifdef ENABLE_UNUSED_NN_FUNCTIONS
void NN_AddMod( NN_t* r, const NN_t* x, const NN_t* y, const NN_t* m )
{
const uint32_t *xp, *yp;
@@ -482,7 +490,7 @@ sint64 tr;
}
}
}
-
+#endif
/*!
******************************************************************************
@@ -1144,6 +1152,7 @@ void NN_ExpModMont( NN_t* r, NN_t* x, NN_t* e, NN_t* m, NN_t* w )
}
+#ifdef ENABLE_UNUSED_NN_FUNCTIONS
/*!
******************************************************************************
Classical exponentiation
@@ -1232,6 +1241,7 @@ void NN_ExpMod( NN_t* r, NN_t* x, NN_t* e, NN_t* m, NN_t* w )
}
}
}
+#endif
/****************************************************************************/
/* Auxcilliary functions */
diff --git a/source/cy_wcm.c b/source/cy_wcm.c
index 70a848d..4ed0eff 100644
--- a/source/cy_wcm.c
+++ b/source/cy_wcm.c
@@ -47,6 +47,7 @@
#include "whd.h"
#include "cyabs_rtos.h"
#include "whd_chip_constants.h"
+#include "whd_wlioctl.h"
/* Chip identifiers for WLAN CPUs */
#define CY_WCM_WLAN_CHIP_ID_43907 (43907u) /**< Chip Identifier for 43907 */
@@ -429,6 +430,7 @@ cy_rslt_t cy_wcm_get_whd_interface(cy_wcm_interface_t interface_type, whd_interf
#include "whd_network_types.h"
#include "whd_buffer_api.h"
#include "whd_wlioctl.h"
+#include "whd_types.h"
#include "whd_debug.h"
#include "cy_nw_helper.h"
@@ -460,7 +462,9 @@ extern cy_rslt_t wpa3_supplicant_sae_start (uint8_t *ssid, uint8_t ssid_len, uin
#define CY_WCM_INTERFACE_TYPE_UNKNOWN (4)
#define CY_WCM_DEFAULT_STA_CHANNEL (0)
#define WCM_WORKER_THREAD_PRIORITY (CY_RTOS_PRIORITY_ABOVENORMAL)
+#ifndef WCM_WORKER_THREAD_STACK_SIZE
#define WCM_WORKER_THREAD_STACK_SIZE (10 * 1024)
+#endif
#define WCM_HANDSHAKE_TIMEOUT_MS (3000)
#define WLC_EVENT_MSG_LINK (0x01)
#define JOIN_RETRY_ATTEMPTS (3)
@@ -543,6 +547,16 @@ typedef struct xtlv
uint8_t data[1];
} xtlv_t;
+/******************************************************
+ * Enumerations
+ ******************************************************/
+/* Chanspec values. */
+typedef enum
+{
+ WCM_WIFI_CHANSPEC_5GHZ = 0xC0, /**< 5-GHz radio band. */
+ WCM_WIFI_CHANSPEC_2_4GHZ = 0x00, /**< 2.4-GHz radio band. */
+} wcm_wifi_band_chanspec_t;
+
/******************************************************
* Variable Definitions
******************************************************/
@@ -1485,6 +1499,11 @@ cy_rslt_t cy_wcm_connect_ap(cy_wcm_connect_params_t *connect_params, cy_wcm_ip_a
{
cy_wcm_log_msg(CYLF_MIDDLEWARE, CY_LOG_ERR, "L%d : %s() : ERROR : Failed to send connection status. Err = [%lu]\r\n", __LINE__, __FUNCTION__, res);
}
+ if(res == WHD_UNSUPPORTED)
+ {
+ cy_wcm_log_msg(CYLF_MIDDLEWARE, CY_LOG_ERR, "Security type not supported, result = %d \n", res);
+ res = CY_RSLT_WCM_SECURITY_NOT_SUPPORTED;
+ }
goto exit;
}
@@ -2620,6 +2639,7 @@ cy_rslt_t cy_wcm_start_ap(const cy_wcm_ap_config_t *ap_config)
whd_ssid_t ssid;
uint8_t *key;
uint8_t keylen;
+ uint16_t chanspec = 0;
whd_security_t security;
cy_network_static_ip_addr_t static_ip;
@@ -2652,9 +2672,31 @@ cy_rslt_t cy_wcm_start_ap(const cy_wcm_ap_config_t *ap_config)
read_ap_config(ap_config, &ssid, &key, &keylen, &security, &static_ip);
/* Store the SoftAP security type */
ap_security = whd_to_wcm_security(security);
+
+ /* Construct chanspec from channel number */
+ if((ap_config->channel > 35) && (ap_config->channel < 166))
+ {
+ chanspec = WCM_WIFI_CHANSPEC_5GHZ;
+ }
+ else if((ap_config->channel > 0) && (ap_config->channel < 12))
+ {
+ /* 2.4 GHz band */
+ chanspec = WCM_WIFI_CHANSPEC_2_4GHZ;
+ }
+ else
+ {
+ cy_wcm_log_msg(CYLF_MIDDLEWARE, CY_LOG_ERR, "Unsupported channel or band!!\n");
+ res = CY_RSLT_WCM_BAND_NOT_SUPPORTED;
+ goto exit;
+ }
+
+ /* Add channel info */
+ chanspec = ((chanspec << 8) | ap_config->channel);
+
/* set up the AP info */
res = whd_wifi_init_ap(whd_ifs[CY_WCM_INTERFACE_TYPE_AP], &ssid, security, (const uint8_t *)key,
- keylen, ap_config->channel);
+ keylen, chanspec);
+
if (res != CY_RSLT_SUCCESS)
{
if(res == WHD_UNSUPPORTED || res == WHD_WEP_NOT_ALLOWED)
@@ -3851,8 +3893,12 @@ void notify_ip_change(void *arg)
cy_wcm_event_data_t link_event_data;
cy_rslt_t res = CY_RSLT_SUCCESS;
cy_nw_ip_address_t ipv4_addr;
+ cy_nw_ip_address_t ipv6_addr;
+ uint32_t offld_cfg_support = 0;
UNUSED_PARAMETER(arg);
+ whd_wifi_get_fwcap(whd_ifs[CY_WCM_INTERFACE_TYPE_STA], &offld_cfg_support);
+
cy_wcm_log_msg(CYLF_MIDDLEWARE, CY_LOG_INFO, "Notify application that ip has changed!\n");
memset(&link_event_data, 0, sizeof(cy_wcm_event_data_t));
res = cy_network_get_ip_address(nw_sta_if_ctx, &ipv4_addr);
@@ -3862,8 +3908,30 @@ void notify_ip_change(void *arg)
link_event_data.ip_addr.version = CY_WCM_IP_VER_V4;
link_event_data.ip_addr.ip.v4 = ipv4_addr.ip.v4;
invoke_app_callbacks(CY_WCM_EVENT_IP_CHANGED, &link_event_data);
+
+ if (offld_cfg_support & (1 << WHD_FWCAP_OFFLOADS) )
+ {
+ res = whd_wifi_offload_ipv4_update(whd_ifs[CY_WCM_INTERFACE_TYPE_STA], OFFLOAD_FEATURE, ipv4_addr.ip.v4, WHD_TRUE);
+ if (res != CY_RSLT_SUCCESS )
+ {
+ cy_wcm_log_msg(CYLF_MIDDLEWARE, CY_LOG_ERR, "Unable to update ipv4 address\n");
+ }
+ }
}
-}
+
+ res = cy_network_get_ipv6_address(nw_sta_if_ctx, CY_NETWORK_IPV6_LINK_LOCAL, &ipv6_addr);
+ if (res == CY_RSLT_SUCCESS)
+ {
+ if (offld_cfg_support & (1 << WHD_FWCAP_OFFLOADS) )
+ {
+ res = whd_wifi_offload_ipv6_update(whd_ifs[CY_WCM_INTERFACE_TYPE_STA], OFFLOAD_FEATURE, ipv6_addr.ip.v6, 0, WHD_TRUE);
+ if (res != CY_RSLT_SUCCESS )
+ {
+ cy_wcm_log_msg(CYLF_MIDDLEWARE, CY_LOG_ERR, "Unable to update ipv6 address\n");
+ }
+ }
+ }
+}
static bool check_if_platform_supports_band(whd_interface_t interface, cy_wcm_wifi_band_t requested_band)
@@ -3886,16 +3954,28 @@ static bool check_if_platform_supports_band(whd_interface_t interface, cy_wcm_wi
*/
if(band_list.number_of_bands == 1)
{
- if(requested_band == CY_WCM_WIFI_BAND_5GHZ)
+ if(requested_band == CY_WCM_WIFI_BAND_2_4GHZ || requested_band == CY_WCM_WIFI_BAND_ANY)
{
- return false;
+ return true;
}
else
{
- return true;
+ return false;
}
}
- return true;
+ else if(band_list.number_of_bands == 2)
+ {
+// FW still have some issue for band_list so skip check first
+// if((requested_band == band_list.other_band[0]) || (requested_band == band_list.other_band[1]))
+// {
+ return true;
+// }
+ }
+ else
+ {
+ cy_wcm_log_msg(CYLF_MIDDLEWARE, CY_LOG_DEBUG, "Unexpected value in band_list.number_of_bands !! \n ");
+ return false;
+ }
}
static cy_rslt_t network_up(whd_interface_t interface, cy_network_hw_interface_type_t iface_type, cy_network_static_ip_addr_t *static_ip_ptr)
diff --git a/version.xml b/version.xml
index 1818f01..0074074 100644
--- a/version.xml
+++ b/version.xml
@@ -1 +1 @@
-3.2.0.2058
+3.3.0.2136