Update corePKCS11 submodule pointer (#1208)

* Update corePKCS11 submodule pointer
* Fix corePKCS11 MQTT mutual authenticated demo
* Sync with other demo to wait for network up.
* Fix compiler warning.
pull/1203/head
chinglee-iot 10 months ago committed by GitHub
parent e6b4e8288f
commit 66b0b0a5a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -304,6 +304,10 @@ static MQTTStatus_t prvProcessLoopWithTimeout( MQTTContext_t * pMqttContext,
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
extern BaseType_t xPlatformIsNetworkUp( void );
/*-----------------------------------------------------------*/
/* @brief Static buffer used to hold MQTT messages being sent and received. */ /* @brief Static buffer used to hold MQTT messages being sent and received. */
static uint8_t ucSharedBuffer[ democonfigNETWORK_BUFFER_SIZE ]; static uint8_t ucSharedBuffer[ democonfigNETWORK_BUFFER_SIZE ];
@ -416,7 +420,18 @@ static void prvMQTTDemoTask( void * pvParameters )
for( ; ; ) for( ; ; )
{ {
LogInfo( ( "---------STARTING DEMO---------\r\n" ) ); LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
/****************************** Connect. ******************************/ /****************************** Connect. ******************************/
/* Wait for Networking */
if( xPlatformIsNetworkUp() == pdFALSE )
{
LogInfo( ( "Waiting for the network link up event..." ) );
while( xPlatformIsNetworkUp() == pdFALSE )
{
vTaskDelay( pdMS_TO_TICKS( 1000U ) );
}
}
/* Establish a TLS connection with the MQTT broker. This example connects /* Establish a TLS connection with the MQTT broker. This example connects
* to the MQTT broker as specified by democonfigMQTT_BROKER_ENDPOINT and * to the MQTT broker as specified by democonfigMQTT_BROKER_ENDPOINT and

@ -52,6 +52,8 @@
extern void vPlatformInitIpStack( void ); extern void vPlatformInitIpStack( void );
extern void vStartPKCSMutualAuthDemo( void );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
int main( void ) int main( void )

@ -849,7 +849,7 @@ static int p11_ecdsa_check_pair( const void * pvPub,
}; };
unsigned char pucTestSignature[ MBEDTLS_ECDSA_MAX_SIG_LEN( 256 ) ] = { 0 }; unsigned char pucTestSignature[ MBEDTLS_ECDSA_MAX_SIG_LEN( 256 ) ] = { 0 };
size_t uxSigLen = 0; size_t uxSigLen = 0;
lResult = p11_ecdsa_sign( pxMbedtlsPkCtx, MBEDTLS_MD_SHA256, lResult = p11_ecdsa_sign( ( mbedtls_pk_context * ) pxMbedtlsPkCtx, MBEDTLS_MD_SHA256,
pucTestHash, sizeof( pucTestHash ), pucTestHash, sizeof( pucTestHash ),
pucTestSignature, sizeof( pucTestSignature ), &uxSigLen, pucTestSignature, sizeof( pucTestSignature ), &uxSigLen,
NULL, NULL ); NULL, NULL );
@ -883,7 +883,7 @@ static size_t p11_rsa_get_bitlen( const mbedtls_pk_context * pxMbedtlsPkCtx )
configASSERT( mbedtls_rsa_info.get_bitlen ); configASSERT( mbedtls_rsa_info.get_bitlen );
return mbedtls_rsa_info.get_bitlen( pxMbedtlsPkCtx ); return mbedtls_rsa_info.get_bitlen( ( mbedtls_pk_context * ) pxMbedtlsPkCtx );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -1009,8 +1009,8 @@ static int p11_rsa_check_pair( const void * pvPub,
{ {
configASSERT( mbedtls_rsa_info.check_pair_func ); configASSERT( mbedtls_rsa_info.check_pair_func );
return mbedtls_rsa_info.check_pair_func( pvPub, return mbedtls_rsa_info.check_pair_func( ( void * ) pvPub,
pxMbedtlsPkCtx, ( mbedtls_pk_context * ) pxMbedtlsPkCtx,
lFRng, lFRng,
pvPRng ); pvPRng );
} }
@ -1112,7 +1112,7 @@ static void p11_rsa_debug( const mbedtls_pk_context * pxMbedtlsPkCtx,
{ {
configASSERT( mbedtls_rsa_info.debug_func ); configASSERT( mbedtls_rsa_info.debug_func );
mbedtls_rsa_info.debug_func( pxMbedtlsPkCtx, pxItems ); mbedtls_rsa_info.debug_func( ( mbedtls_pk_context * ) pxMbedtlsPkCtx, pxItems );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

@ -569,7 +569,7 @@ static CK_RV readCertificateIntoContext( SSLContext_t * pSslContext,
/* Get the handle of the certificate. */ /* Get the handle of the certificate. */
xResult = xFindObjectWithLabelAndClass( pSslContext->xP11Session, xResult = xFindObjectWithLabelAndClass( pSslContext->xP11Session,
pcLabelName, ( char * ) pcLabelName,
strnlen( pcLabelName, strnlen( pcLabelName,
pkcs11configMAX_LABEL_LENGTH ), pkcs11configMAX_LABEL_LENGTH ),
xClass, xClass,
@ -643,7 +643,6 @@ static CK_RV initializeClientKeys( SSLContext_t * pxCtx,
CK_RV xResult = CKR_OK; CK_RV xResult = CKR_OK;
CK_SLOT_ID * pxSlotIds = NULL; CK_SLOT_ID * pxSlotIds = NULL;
CK_ULONG xCount = 0; CK_ULONG xCount = 0;
CK_ATTRIBUTE xTemplate[ 2 ];
mbedtls_pk_type_t xKeyAlgo = ( mbedtls_pk_type_t ) ~0; mbedtls_pk_type_t xKeyAlgo = ( mbedtls_pk_type_t ) ~0;
/* Get the PKCS #11 module/token slot count. */ /* Get the PKCS #11 module/token slot count. */
@ -686,7 +685,7 @@ static CK_RV initializeClientKeys( SSLContext_t * pxCtx,
{ {
/* Get the handle of the device private key. */ /* Get the handle of the device private key. */
xResult = xFindObjectWithLabelAndClass( pxCtx->xP11Session, xResult = xFindObjectWithLabelAndClass( pxCtx->xP11Session,
pcLabelName, ( char * ) pcLabelName,
strnlen( pcLabelName, strnlen( pcLabelName,
pkcs11configMAX_LABEL_LENGTH ), pkcs11configMAX_LABEL_LENGTH ),
CKO_PRIVATE_KEY, CKO_PRIVATE_KEY,

@ -1 +1 @@
Subproject commit cb865c1a25de899c598b1ca47571f9f74b60a118 Subproject commit 59875a9aa3f08a95eb8cdc0ba345b38dc49134ab

@ -43,11 +43,11 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PublicIncludeDirectories>..\..\Source\corePKCS11\source\include;..\..\Source\corePKCS11\source\dependency\3rdparty\mbedtls_utils;..\..\Source\corePKCS11\source\dependency\3rdparty\pkcs11;.\</PublicIncludeDirectories> <PublicIncludeDirectories>..\..\Source\corePKCS11\source\include;..\..\Source\corePKCS11\source\dependency\3rdparty\mbedtls_utils;..\..\Source\corePKCS11\source\dependency\3rdparty\pkcs11\published\2-40-errata-1;.\</PublicIncludeDirectories>
<AllProjectIncludesArePublic>true</AllProjectIncludesArePublic> <AllProjectIncludesArePublic>true</AllProjectIncludesArePublic>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_with_Libslirp|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_with_Libslirp|Win32'">
<PublicIncludeDirectories>..\..\Source\corePKCS11\source\include;..\..\Source\corePKCS11\source\dependency\3rdparty\mbedtls_utils;..\..\Source\corePKCS11\source\dependency\3rdparty\pkcs11;.\</PublicIncludeDirectories> <PublicIncludeDirectories>..\..\Source\corePKCS11\source\include;..\..\Source\corePKCS11\source\dependency\3rdparty\mbedtls_utils;..\..\Source\corePKCS11\source\dependency\3rdparty\pkcs11\published\2-40-errata-1;.\</PublicIncludeDirectories>
<AllProjectIncludesArePublic>true</AllProjectIncludesArePublic> <AllProjectIncludesArePublic>true</AllProjectIncludesArePublic>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -56,7 +56,7 @@
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;WIN32_LEAN_AND_MEAN;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.5.1.h";_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;WIN32_LEAN_AND_MEAN;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.5.1.h";_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\Source\corePKCS11\source\include;..\..\Source\corePKCS11\source\portable\os;..\..\Source\corePKCS11\source\portable\os\freertos_winsim;..\..\Source\corePKCS11\source\dependency\3rdparty\mbedtls_utils;..\..\Source\corePKCS11\source\dependency\3rdparty\pkcs11;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\Source\corePKCS11\source\include;..\..\Source\corePKCS11\source\portable\os;..\..\Source\corePKCS11\source\portable\os\freertos_winsim;..\..\Source\corePKCS11\source\dependency\3rdparty\mbedtls_utils;..\..\Source\corePKCS11\source\dependency\3rdparty\pkcs11\published\2-40-errata-1;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
@ -70,7 +70,7 @@
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config_v3.5.1.h";WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config_v3.5.1.h";WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\Source\corePKCS11\source\include;..\..\Source\corePKCS11\source\portable\os;..\..\Source\corePKCS11\source\portable\os\freertos_winsim;..\..\Source\corePKCS11\source\dependency\3rdparty\mbedtls_utils;..\..\Source\corePKCS11\source\dependency\3rdparty\pkcs11;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\Source\corePKCS11\source\include;..\..\Source\corePKCS11\source\portable\os;..\..\Source\corePKCS11\source\portable\os\freertos_winsim;..\..\Source\corePKCS11\source\dependency\3rdparty\mbedtls_utils;..\..\Source\corePKCS11\source\dependency\3rdparty\pkcs11\published\2-40-errata-1;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>

@ -54,7 +54,7 @@ dependencies:
path: "FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent" path: "FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent"
- name: "corePKCS11" - name: "corePKCS11"
version: "cb865c1" version: "59875a9"
repository: repository:
type: "git" type: "git"
url: "https://github.com/FreeRTOS/corePKCS11.git" url: "https://github.com/FreeRTOS/corePKCS11.git"

Loading…
Cancel
Save