Update code to correct function pointer casting (#1366)

* Update code to correct function pointer casting

Signed-off-by: Dinh Van Nam <vannam.dinh.xt@renesas.com>

* Update function signature

Signed-off-by: Dinh Van Nam <vannam.dinh.xt@renesas.com>

* Continue updating the function signature and revert a variable

Signed-off-by: Dinh Van Nam <vannam.dinh.xt@renesas.com>

* Fix format

Signed-off-by: Dinh Van Nam <vannam.dinh.xt@renesas.com>

* Fix CI check

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

* Fix CI checks

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

---------

Signed-off-by: Dinh Van Nam <vannam.dinh.xt@renesas.com>
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
Dinh Van Nam 2025-08-05 23:09:20 +09:00 committed by GitHub
parent 5cf13754a5
commit 51467d89e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 38 additions and 38 deletions

View file

@ -20,7 +20,7 @@ env:
jobs: jobs:
winsim_cellular: winsim_cellular:
name: Windows Simulator Cellular Demos name: Windows Simulator Cellular Demos
runs-on: windows-2019 runs-on: windows-latest
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -128,7 +128,7 @@ jobs:
winsim_coreHTTP: winsim_coreHTTP:
name: coreHTTP WinSim Demos name: coreHTTP WinSim Demos
runs-on: windows-2019 runs-on: windows-latest
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -281,7 +281,7 @@ jobs:
winsim_corePKCS11: winsim_corePKCS11:
name: corePKCS11 WinSim Demos name: corePKCS11 WinSim Demos
runs-on: windows-2019 runs-on: windows-latest
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -321,7 +321,7 @@ jobs:
echo "::group::${{ env.stepName }}" echo "::group::${{ env.stepName }}"
Push-Location Push-Location
Get-Location Get-Location
& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\Launch-VsDevShell.ps1" & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1"
Get-Location Get-Location
Pop-Location Pop-Location
@ -370,7 +370,7 @@ jobs:
winsim_corelibs: winsim_corelibs:
name: core Library Windows Simulator Demos name: core Library Windows Simulator Demos
runs-on: windows-2019 runs-on: windows-latest
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -425,7 +425,7 @@ jobs:
echo "::group::${{ env.stepName }}" echo "::group::${{ env.stepName }}"
Push-Location Push-Location
Get-Location Get-Location
& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\Launch-VsDevShell.ps1" & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1"
Get-Location Get-Location
Pop-Location Pop-Location
@ -862,7 +862,7 @@ jobs:
winsim_aws_iot: winsim_aws_iot:
name: AWS IoT Windows Simulator Demos name: AWS IoT Windows Simulator Demos
runs-on: windows-2019 runs-on: windows-latest
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -1146,7 +1146,7 @@ jobs:
plus_tcp_winsim: plus_tcp_winsim:
name: FreeRTOS+TCP Windows Simulator Demos name: FreeRTOS+TCP Windows Simulator Demos
runs-on: windows-2019 runs-on: windows-latest
continue-on-error: true continue-on-error: true
steps: steps:
- name: Checkout Repository - name: Checkout Repository
@ -1181,7 +1181,7 @@ jobs:
echo "::group::${{ env.stepName }}" echo "::group::${{ env.stepName }}"
Push-Location Push-Location
Get-Location Get-Location
& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\Launch-VsDevShell.ps1" & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1"
Get-Location Get-Location
Pop-Location Pop-Location
@ -1303,7 +1303,7 @@ jobs:
winsim_plus_demos: winsim_plus_demos:
name: FreeRTOS+CLI Windows Simulator Demos name: FreeRTOS+CLI Windows Simulator Demos
runs-on: windows-2019 runs-on: windows-latest
continue-on-error: true continue-on-error: true
steps: steps:
- name: Checkout Repository - name: Checkout Repository

View file

@ -153,7 +153,7 @@ static int p11_ecdsa_sign( mbedtls_pk_context * pk,
* @param pvCtx Void pointer to the relevant P11EcDsaCtx_t. * @param pvCtx Void pointer to the relevant P11EcDsaCtx_t.
* @return size_t Bit length of the key. * @return size_t Bit length of the key.
*/ */
static size_t p11_ecdsa_get_bitlen( const mbedtls_pk_context * pxMbedtlsPkCtx ); static size_t p11_ecdsa_get_bitlen( mbedtls_pk_context * pxMbedtlsPkCtx );
/** /**
* @brief Returns true if the pk context can perform the given pk operation. * @brief Returns true if the pk context can perform the given pk operation.
@ -185,12 +185,12 @@ static int p11_ecdsa_verify( mbedtls_pk_context * pxMbedtlsPkCtx,
const unsigned char * pucSig, const unsigned char * pucSig,
size_t xSigLen ); size_t xSigLen );
static int p11_ecdsa_check_pair( const void * pvPub, static int p11_ecdsa_check_pair( mbedtls_pk_context * pxPub,
const mbedtls_pk_context * pxMbedtlsPkCtx, mbedtls_pk_context * pxMbedtlsPkCtx,
int ( * lFRng )( void *, unsigned char *, size_t ), int ( * lFRng )( void *, unsigned char *, size_t ),
void * pvPRng ); void * pvPRng );
static void p11_ecdsa_debug( const mbedtls_pk_context * pxMbedtlsPkCtx, static void p11_ecdsa_debug( mbedtls_pk_context * pxMbedtlsPkCtx,
mbedtls_pk_debug_item * pxItems ); mbedtls_pk_debug_item * pxItems );
static int prvEcdsaSigToASN1InPlace( unsigned char * pucSig, static int prvEcdsaSigToASN1InPlace( unsigned char * pucSig,
@ -231,7 +231,7 @@ mbedtls_pk_info_t mbedtls_pkcs11_pk_ecdsa =
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static size_t p11_rsa_get_bitlen( const mbedtls_pk_context * ctx ); static size_t p11_rsa_get_bitlen( mbedtls_pk_context * ctx );
static int p11_rsa_can_do( mbedtls_pk_type_t xType ); static int p11_rsa_can_do( mbedtls_pk_type_t xType );
@ -252,8 +252,8 @@ static int p11_rsa_sign( mbedtls_pk_context * pk,
int ( * f_rng )( void *, unsigned char *, size_t ), int ( * f_rng )( void *, unsigned char *, size_t ),
void * p_rng ); void * p_rng );
static int p11_rsa_check_pair( const void * pvPub, static int p11_rsa_check_pair( mbedtls_pk_context * pvPub,
const mbedtls_pk_context * pxMbedtlsPkCtx, mbedtls_pk_context * pxMbedtlsPkCtx,
int ( * lFRng )( void *, unsigned char *, size_t ), int ( * lFRng )( void *, unsigned char *, size_t ),
void * pvPRng ); void * pvPRng );
@ -266,7 +266,7 @@ static CK_RV p11_rsa_ctx_init( mbedtls_pk_context * pk,
static void p11_rsa_ctx_free( void * pvCtx ); static void p11_rsa_ctx_free( void * pvCtx );
static void p11_rsa_debug( const mbedtls_pk_context * pxMbedtlsPkCtx, static void p11_rsa_debug( mbedtls_pk_context * pxMbedtlsPkCtx,
mbedtls_pk_debug_item * pxItems ); mbedtls_pk_debug_item * pxItems );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -759,11 +759,11 @@ static int p11_ecdsa_sign( mbedtls_pk_context * pk,
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static size_t p11_ecdsa_get_bitlen( const mbedtls_pk_context * pxMbedtlsPkCtx ) static size_t p11_ecdsa_get_bitlen( mbedtls_pk_context * pxMbedtlsPkCtx )
{ {
configASSERT( mbedtls_ecdsa_info.get_bitlen ); configASSERT( mbedtls_ecdsa_info.get_bitlen );
return mbedtls_ecdsa_info.get_bitlen( ( mbedtls_pk_context * ) pxMbedtlsPkCtx ); return mbedtls_ecdsa_info.get_bitlen( pxMbedtlsPkCtx );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -792,14 +792,14 @@ static int p11_ecdsa_verify( mbedtls_pk_context * pxMbedtlsPkCtx,
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static int p11_ecdsa_check_pair( const void * pvPub, static int p11_ecdsa_check_pair( mbedtls_pk_context * pxPub,
const mbedtls_pk_context * pxMbedtlsPkCtx, mbedtls_pk_context * pxMbedtlsPkCtx,
int ( * lFRng )( void *, unsigned char *, size_t ), int ( * lFRng )( void *, unsigned char *, size_t ),
void * pvPRng ) void * pvPRng )
{ {
P11EcDsaCtx_t * pxP11PrvKey = ( P11EcDsaCtx_t * ) pxMbedtlsPkCtx->pk_ctx; P11EcDsaCtx_t * pxP11PrvKey = ( P11EcDsaCtx_t * ) pxMbedtlsPkCtx->pk_ctx;
mbedtls_ecp_keypair * pxPubKey = ( mbedtls_ecp_keypair * ) pvPub; mbedtls_ecp_keypair * pxPubKey = ( mbedtls_ecp_keypair * ) pxPub;
mbedtls_ecp_keypair * pxPrvKey = &( pxP11PrvKey->xMbedEcDsaCtx ); mbedtls_ecp_keypair * pxPrvKey = &( pxP11PrvKey->xMbedEcDsaCtx );
int lResult = 0; int lResult = 0;
@ -867,7 +867,7 @@ static int p11_ecdsa_check_pair( const void * pvPub,
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void p11_ecdsa_debug( const mbedtls_pk_context * pxMbedtlsPkCtx, static void p11_ecdsa_debug( mbedtls_pk_context * pxMbedtlsPkCtx,
mbedtls_pk_debug_item * pxItems ) mbedtls_pk_debug_item * pxItems )
{ {
configASSERT( mbedtls_ecdsa_info.debug_func ); configASSERT( mbedtls_ecdsa_info.debug_func );
@ -877,13 +877,13 @@ static void p11_ecdsa_debug( const mbedtls_pk_context * pxMbedtlsPkCtx,
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static size_t p11_rsa_get_bitlen( const mbedtls_pk_context * pxMbedtlsPkCtx ) static size_t p11_rsa_get_bitlen( mbedtls_pk_context * pxMbedtlsPkCtx )
{ {
mbedtls_rsa_context * pxRsaCtx = ( mbedtls_rsa_context * ) pxMbedtlsPkCtx->pk_ctx; mbedtls_rsa_context * pxRsaCtx = ( mbedtls_rsa_context * ) pxMbedtlsPkCtx->pk_ctx;
configASSERT( mbedtls_rsa_info.get_bitlen ); configASSERT( mbedtls_rsa_info.get_bitlen );
return mbedtls_rsa_info.get_bitlen( ( mbedtls_pk_context * ) pxMbedtlsPkCtx ); return mbedtls_rsa_info.get_bitlen( pxMbedtlsPkCtx );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -1002,15 +1002,15 @@ static int p11_rsa_sign( mbedtls_pk_context * pk,
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static int p11_rsa_check_pair( const void * pvPub, static int p11_rsa_check_pair( mbedtls_pk_context * pxPub,
const mbedtls_pk_context * pxMbedtlsPkCtx, mbedtls_pk_context * pxMbedtlsPkCtx,
int ( * lFRng )( void *, unsigned char *, size_t ), int ( * lFRng )( void *, unsigned char *, size_t ),
void * pvPRng ) void * pvPRng )
{ {
configASSERT( mbedtls_rsa_info.check_pair_func ); configASSERT( mbedtls_rsa_info.check_pair_func );
return mbedtls_rsa_info.check_pair_func( ( void * ) pvPub, return mbedtls_rsa_info.check_pair_func( pxPub,
( mbedtls_pk_context * ) pxMbedtlsPkCtx, pxMbedtlsPkCtx,
lFRng, lFRng,
pvPRng ); pvPRng );
} }
@ -1105,12 +1105,12 @@ static void p11_rsa_ctx_free( void * pvCtx )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void p11_rsa_debug( const mbedtls_pk_context * pxMbedtlsPkCtx, static void p11_rsa_debug( mbedtls_pk_context * pxMbedtlsPkCtx,
mbedtls_pk_debug_item * pxItems ) mbedtls_pk_debug_item * pxItems )
{ {
configASSERT( mbedtls_rsa_info.debug_func ); configASSERT( mbedtls_rsa_info.debug_func );
mbedtls_rsa_info.debug_func( ( mbedtls_pk_context * ) pxMbedtlsPkCtx, pxItems ); mbedtls_rsa_info.debug_func( pxMbedtlsPkCtx, pxItems );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -165,9 +165,9 @@ static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext,
* *
* @return Zero on success. * @return Zero on success.
*/ */
static int32_t generateRandomBytes( void * pvCtx, static int generateRandomBytes( void * pvCtx,
unsigned char * pucRandom, unsigned char * pucRandom,
size_t xRandomLength ); size_t xRandomLength );
/** /**
* @brief Helper for reading the specified certificate object, if present, * @brief Helper for reading the specified certificate object, if present,
@ -544,9 +544,9 @@ static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext,
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static int32_t generateRandomBytes( void * pvCtx, static int generateRandomBytes( void * pvCtx,
unsigned char * pucRandom, unsigned char * pucRandom,
size_t xRandomLength ) size_t xRandomLength )
{ {
/* Must cast from void pointer to conform to mbed TLS API. */ /* Must cast from void pointer to conform to mbed TLS API. */
SSLContext_t * pxCtx = ( SSLContext_t * ) pvCtx; SSLContext_t * pxCtx = ( SSLContext_t * ) pvCtx;