Update corePKCS11 MQTT Mutual Auth demo

This commit is contained in:
Paul Bartell
2022-10-31 15:23:37 -07:00
parent b8ee762acd
commit 935bc3e263
8 changed files with 407 additions and 53 deletions

View File

@@ -39,6 +39,15 @@
* connection.
*/
#include "logging_levels.h"
#define LIBRARY_LOG_NAME "MQTTDemo"
#define LIBRARY_LOG_LEVEL LOG_INFO
#include "logging_stack.h"
/* Standard includes. */
#include <string.h>
#include <stdio.h>
@@ -55,7 +64,7 @@
#include "core_mqtt.h"
/* Transport interface implementation include header for TLS. */
#include "using_mbedtls_pkcs11.h"
#include "transport_mbedtls_pkcs11.h"
/*-----------------------------------------------------------*/
@@ -161,8 +170,8 @@
/*-----------------------------------------------------------*/
/**
* @brief Each compilation unit that consumes the NetworkContext must define it.
/**
* @brief Each compilation unit that consumes the NetworkContext must define it.
* It should contain a single pointer to the type of your desired transport.
* When using multiple transports in the same compilation unit, define this pointer as void *.
*
@@ -364,14 +373,14 @@ static void prvMQTTDemoTask( void * pvParameters )
/* Establish a TLS connection with the MQTT broker. This example connects
* to the MQTT broker as specified by democonfigMQTT_BROKER_ENDPOINT and
* democonfigMQTT_BROKER_PORT in the demo_config.h file. */
LogInfo( ( "Creating a TLS connection to %s:%u.\r\n",
LogInfo( ( "Creating a TLS connection to %s:%u.",
democonfigMQTT_BROKER_ENDPOINT,
democonfigMQTT_BROKER_PORT ) );
prvTLSConnect( &xNetworkCredentials, &xNetworkContext );
/* Sends an MQTT Connect packet over the already established TLS connection,
* and waits for connection acknowledgment (CONNACK) packet. */
LogInfo( ( "Creating an MQTT connection to %s.\r\n", democonfigMQTT_BROKER_ENDPOINT ) );
LogInfo( ( "Creating an MQTT connection to %s.", democonfigMQTT_BROKER_ENDPOINT ) );
prvCreateMQTTConnectionWithBroker( &xMQTTContext, &xNetworkContext );
/**************************** Subscribe. ******************************/
@@ -385,7 +394,7 @@ static void prvMQTTDemoTask( void * pvParameters )
* through the callback registered (#prvEventCallback for this application).
* This demo uses QoS1 in Subscribe, therefore, the Publish messages
* received from the broker will have QoS1. */
LogInfo( ( "Attempt to subscribe to the MQTT topic %s.\r\n", mqttexampleTOPIC ) );
LogInfo( ( "Attempt to subscribe to the MQTT topic %s.", mqttexampleTOPIC ) );
prvMQTTSubscribeToTopic( &xMQTTContext );
/* Process incoming packet from the broker. After sending the subscribe, the
@@ -402,22 +411,22 @@ static void prvMQTTDemoTask( void * pvParameters )
/* Publish messages with QoS1, send and process Keep alive messages. */
for( ulPublishCount = 0; ulPublishCount < ulMaxPublishCount; ulPublishCount++ )
{
LogInfo( ( "Publish to the MQTT topic %s.\r\n", mqttexampleTOPIC ) );
LogInfo( ( "Publish to the MQTT topic %s.", mqttexampleTOPIC ) );
prvMQTTPublishToTopic( &xMQTTContext );
/* Process incoming publish echo, since application subscribed to the
* same topic, the broker will send publish message back to the application. */
LogInfo( ( "Attempt to receive publish message from broker.\r\n" ) );
LogInfo( ( "Attempt to receive publish message from broker." ) );
xMQTTStatus = MQTT_ProcessLoop( &xMQTTContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS );
configASSERT( xMQTTStatus == MQTTSuccess );
/* Leave Connection Idle for some time. */
LogInfo( ( "Keeping Connection Idle...\r\n\r\n" ) );
LogInfo( ( "Keeping Connection Idle..." ) );
vTaskDelay( mqttexampleDELAY_BETWEEN_PUBLISHES_TICKS );
}
/******************** Unsubscribe from the topic. *********************/
LogInfo( ( "Unsubscribe from the MQTT topic %s.\r\n", mqttexampleTOPIC ) );
LogInfo( ( "Unsubscribe from the MQTT topic %s.", mqttexampleTOPIC ) );
prvMQTTUnsubscribeFromTopic( &xMQTTContext );
/* Process incoming UNSUBACK packet from the broker. */
@@ -429,7 +438,7 @@ static void prvMQTTDemoTask( void * pvParameters )
/* Send an MQTT Disconnect packet over the already connected TLS over TCP
* connection. There is no corresponding response for the disconnect packet.
* After sending disconnect, client must close the network connection. */
LogInfo( ( "Disconnecting the MQTT connection with %s.\r\n",
LogInfo( ( "Disconnecting the MQTT connection with %s.",
democonfigMQTT_BROKER_ENDPOINT ) );
xMQTTStatus = MQTT_Disconnect( &xMQTTContext );
configASSERT( xMQTTStatus == MQTTSuccess );
@@ -440,10 +449,10 @@ static void prvMQTTDemoTask( void * pvParameters )
/* Wait for some time between two iterations to ensure that we do not
* bombard the broker. */
LogInfo( ( "prvMQTTDemoTask() completed an iteration successfully. "
"Total free heap is %u.\r\n",
"Total free heap is %u.",
xPortGetFreeHeapSize() ) );
LogInfo( ( "Demo completed successfully.\r\n" ) );
LogInfo( ( "Short delay before starting the next iteration.... \r\n\r\n" ) );
LogInfo( ( "Demo completed successfully." ) );
LogInfo( ( "Short delay before starting the next iteration.... " ) );
vTaskDelay( mqttexampleDELAY_BETWEEN_DEMO_ITERATIONS_TICKS );
}
}
@@ -468,7 +477,7 @@ static void prvTLSConnect( NetworkCredentials_t * pxNetworkCredentials,
mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS,
mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS );
configASSERT( xNetworkStatus == TLS_TRANSPORT_SUCCESS );
LogInfo( ( "A mutually authenticated TLS connection established with %s:%u.\r\n",
LogInfo( ( "A mutually authenticated TLS connection established with %s:%u.",
democonfigMQTT_BROKER_ENDPOINT,
democonfigMQTT_BROKER_PORT ) );
}
@@ -625,19 +634,19 @@ static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket,
switch( pxIncomingPacket->type )
{
case MQTT_PACKET_TYPE_PUBACK:
LogInfo( ( "PUBACK received for packet Id %u.\r\n", usPacketId ) );
LogInfo( ( "PUBACK received for packet Id %u.", usPacketId ) );
/* Make sure ACK packet identifier matches with Request packet identifier. */
configASSERT( usPublishPacketIdentifier == usPacketId );
break;
case MQTT_PACKET_TYPE_SUBACK:
LogInfo( ( "Subscribed to the topic %s.\r\n", mqttexampleTOPIC ) );
LogInfo( ( "Subscribed to the topic %s.", mqttexampleTOPIC ) );
/* Make sure ACK packet identifier matches with Request packet identifier. */
configASSERT( usSubscribePacketIdentifier == usPacketId );
break;
case MQTT_PACKET_TYPE_UNSUBACK:
LogInfo( ( "Unsubscribed from the topic %s.\r\n", mqttexampleTOPIC ) );
LogInfo( ( "Unsubscribed from the topic %s.", mqttexampleTOPIC ) );
/* Make sure ACK packet identifier matches with Request packet identifier. */
configASSERT( usUnsubscribePacketIdentifier == usPacketId );
break;
@@ -652,7 +661,7 @@ static void prvMQTTProcessResponse( MQTTPacketInfo_t * pxIncomingPacket,
/* Any other packet type is invalid. */
default:
LogWarn( ( "prvMQTTProcessResponse() called with unknown packet type:(%02X).\r\n",
LogWarn( ( "prvMQTTProcessResponse() called with unknown packet type:(%02X).",
pxIncomingPacket->type ) );
}
}
@@ -670,8 +679,8 @@ static void prvMQTTProcessIncomingPublish( MQTTPublishInfo_t * pxPublishInfo )
if( ( pxPublishInfo->topicNameLength == strlen( mqttexampleTOPIC ) ) &&
( 0 == strncmp( mqttexampleTOPIC, pxPublishInfo->pTopicName, pxPublishInfo->topicNameLength ) ) )
{
LogInfo( ( "\r\nIncoming Publish Topic Name: %.*s matches subscribed topic.\r\n"
"Incoming Publish Message : %.*s\r\n",
LogInfo( ( "Incoming Publish Topic Name: %.*s matches subscribed topic."
"Incoming Publish Message : %.*s",
pxPublishInfo->topicNameLength,
pxPublishInfo->pTopicName,
pxPublishInfo->payloadLength,
@@ -679,7 +688,7 @@ static void prvMQTTProcessIncomingPublish( MQTTPublishInfo_t * pxPublishInfo )
}
else
{
LogInfo( ( "Incoming Publish Topic Name: %.*s does not match subscribed topic.\r\n",
LogInfo( ( "Incoming Publish Topic Name: %.*s does not match subscribed topic.",
pxPublishInfo->topicNameLength,
pxPublishInfo->pTopicName ) );
}

View File

@@ -1,5 +0,0 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://www.freertos.org/pkcs11/index.html

View File

@@ -0,0 +1,84 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32819.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\WindowsSimulator\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\WindowsSimulator\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "corePKCS11_MQTT_Mutual_Auth", "corePKCS11_MQTT_Mutual_Auth.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\WindowsSimulator\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbedTLS", "..\..\WindowsSimulator\MbedTLS\MbedTLS.vcxproj", "{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "corePKCS11", "..\..\WindowsSimulator\corePKCS11\corePKCS11.vcxproj", "{19F0FF1A-3368-491A-9932-A2F089508F51}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|Win32.ActiveCfg = Debug|Win32
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|Win32.Build.0 = Debug|Win32
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x64.ActiveCfg = Debug|x64
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x64.Build.0 = Debug|x64
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|Win32.ActiveCfg = Release|Win32
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|Win32.Build.0 = Release|Win32
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x64.ActiveCfg = Release|x64
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x64.Build.0 = Release|x64
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|Win32.ActiveCfg = Debug|Win32
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|Win32.Build.0 = Debug|Win32
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x64.ActiveCfg = Debug|x64
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x64.Build.0 = Debug|x64
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|Win32.ActiveCfg = Release|Win32
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|Win32.Build.0 = Release|Win32
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x64.ActiveCfg = Release|x64
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x64.Build.0 = Release|x64
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Debug|Win32.ActiveCfg = Debug|Win32
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Debug|Win32.Build.0 = Debug|Win32
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Debug|x64.ActiveCfg = Debug|x64
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Debug|x64.Build.0 = Debug|x64
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Release|Win32.ActiveCfg = Release|Win32
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Release|Win32.Build.0 = Release|Win32
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Release|x64.ActiveCfg = Release|x64
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Release|x64.Build.0 = Release|x64
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|Win32.ActiveCfg = Debug|Win32
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|Win32.Build.0 = Debug|Win32
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x64.ActiveCfg = Debug|x64
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x64.Build.0 = Debug|x64
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|Win32.ActiveCfg = Release|Win32
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|Win32.Build.0 = Release|Win32
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x64.ActiveCfg = Release|x64
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x64.Build.0 = Release|x64
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|Win32.ActiveCfg = Debug|Win32
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|Win32.Build.0 = Debug|Win32
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x64.ActiveCfg = Debug|x64
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x64.Build.0 = Debug|x64
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|Win32.ActiveCfg = Release|Win32
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|Win32.Build.0 = Release|Win32
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x64.ActiveCfg = Release|x64
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x64.Build.0 = Release|x64
{19F0FF1A-3368-491A-9932-A2F089508F51}.Debug|Win32.ActiveCfg = Debug|Win32
{19F0FF1A-3368-491A-9932-A2F089508F51}.Debug|Win32.Build.0 = Debug|Win32
{19F0FF1A-3368-491A-9932-A2F089508F51}.Debug|x64.ActiveCfg = Debug|x64
{19F0FF1A-3368-491A-9932-A2F089508F51}.Debug|x64.Build.0 = Debug|x64
{19F0FF1A-3368-491A-9932-A2F089508F51}.Release|Win32.ActiveCfg = Release|Win32
{19F0FF1A-3368-491A-9932-A2F089508F51}.Release|Win32.Build.0 = Release|Win32
{19F0FF1A-3368-491A-9932-A2F089508F51}.Release|x64.ActiveCfg = Release|x64
{19F0FF1A-3368-491A-9932-A2F089508F51}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3876F3F5-8086-4F8E-BB5E-D8840E7D926C}
EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = FreeRTOS_Plus_TCP_Minimal.vsmdi
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{382dc80f-e278-4bc9-9db6-59014486da0f}</ProjectGuid>
<RootNamespace>corePKCS11_MQTT_Mutual_Auth</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);.;..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\Source\Application-Protocols\network_transport;..\..\Source\Utilities\backoff_algorithm\source\include;..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\Source\Application-Protocols\coreMQTT\source\interface;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);.;..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\Source\Application-Protocols\network_transport;..\..\Source\Utilities\backoff_algorithm\source\include;..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\Source\Application-Protocols\coreMQTT\source\interface;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);.;..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\Source\Application-Protocols\network_transport;..\..\Source\Utilities\backoff_algorithm\source\include;..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\Source\Application-Protocols\coreMQTT\source\interface;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);.;..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp;..\..\Source\Application-Protocols\network_transport;..\..\Source\Utilities\backoff_algorithm\source\include;..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\Source\Application-Protocols\coreMQTT\source\interface;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnabled>false</VcpkgEnabled>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c" />
<ClCompile Include="..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c" />
<ClCompile Include="..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c" />
<ClCompile Include="..\..\Source\Application-Protocols\network_transport\mbedtls_bio_freertos_plus_tcp.c" />
<ClCompile Include="..\..\Source\Application-Protocols\network_transport\mbedtls_pk_pkcs11.c" />
<ClCompile Include="..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp\sockets_wrapper.c" />
<ClCompile Include="..\..\Source\Application-Protocols\network_transport\transport_mbedtls_pkcs11.c" />
<ClCompile Include="..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c" />
<ClCompile Include="main.c" />
<ClCompile Include="PKCS11_Mqtt_MutualAuthDemo.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h" />
<ClInclude Include="..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h" />
<ClInclude Include="..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h" />
<ClInclude Include="..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h" />
<ClInclude Include="..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h" />
<ClInclude Include="..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp\sockets_wrapper.h" />
<ClInclude Include="..\..\Source\Application-Protocols\network_transport\transport_mbedtls_pkcs11.h" />
<ClInclude Include="..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h" />
<ClInclude Include="core_mqtt_config.h" />
<ClInclude Include="demo_config.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\WindowsSimulator\corePKCS11\corePKCS11.vcxproj">
<Project>{19f0ff1a-3368-491a-9932-a2f089508f51}</Project>
</ProjectReference>
<ProjectReference Include="..\..\WindowsSimulator\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj">
<Project>{c90e6cc5-818b-4c97-8876-0986d989387c}</Project>
<Private>false</Private>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\..\WindowsSimulator\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj">
<Project>{72c209c4-49a4-4942-a201-44706c9d77ec}</Project>
<Private>false</Private>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\..\WindowsSimulator\Logging\Logging.vcxproj">
<Project>{be362ac0-b10b-4276-b84e-6304652ba228}</Project>
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\WindowsSimulator\MbedTLS\MbedTLS.vcxproj">
<Project>{e1016f3e-94e9-4864-9fd8-1d7c1fefbfd7}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="backoff_algorithm">
<UniqueIdentifier>{a442e1bd-e141-45a4-860d-a8eccab1b8c2}</UniqueIdentifier>
</Filter>
<Filter Include="network_transport">
<UniqueIdentifier>{ec612a95-3f21-4e0a-b9cd-0ba89d62067e}</UniqueIdentifier>
</Filter>
<Filter Include="coreMQTT">
<UniqueIdentifier>{c69eabd6-7eed-4959-9351-41b8c3b731b8}</UniqueIdentifier>
</Filter>
<Filter Include="coreMQTT\include">
<UniqueIdentifier>{64a78119-97f6-4252-b793-87cb6e7902d1}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp\sockets_wrapper.c">
<Filter>network_transport</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c">
<Filter>backoff_algorithm</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\Application-Protocols\network_transport\mbedtls_bio_freertos_plus_tcp.c">
<Filter>network_transport</Filter>
</ClCompile>
<ClCompile Include="PKCS11_Mqtt_MutualAuthDemo.c" />
<ClCompile Include="main.c" />
<ClCompile Include="..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c">
<Filter>coreMQTT</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c">
<Filter>coreMQTT</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c">
<Filter>coreMQTT</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\Application-Protocols\network_transport\transport_mbedtls_pkcs11.c">
<Filter>network_transport</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\Application-Protocols\network_transport\mbedtls_pk_pkcs11.c">
<Filter>network_transport</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Source\Application-Protocols\network_transport\sockets_wrapper\freertos_plus_tcp\sockets_wrapper.h">
<Filter>network_transport</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h">
<Filter>backoff_algorithm</Filter>
</ClInclude>
<ClInclude Include="demo_config.h" />
<ClInclude Include="core_mqtt_config.h" />
<ClInclude Include="..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h">
<Filter>coreMQTT\include</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h">
<Filter>coreMQTT\include</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h">
<Filter>coreMQTT\include</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h">
<Filter>coreMQTT\include</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h">
<Filter>coreMQTT\include</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\Application-Protocols\network_transport\transport_mbedtls_pkcs11.h">
<Filter>network_transport</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@@ -24,6 +24,13 @@
*
*/
#include "logging_levels.h"
#define LIBRARY_LOG_NAME "P11MQTTDemo"
#define LIBRARY_LOG_LEVEL LOG_INFO
#include "logging_stack.h"
/***
* See https://www.FreeRTOS.org/pkcs11/ for configuration and usage instructions.
***/
@@ -37,7 +44,7 @@
#include <intrin.h>
/* FreeRTOS includes. */
#include <FreeRTOS.h>
#include "FreeRTOS.h"
#include "task.h"
/* TCP/IP stack includes. */
@@ -225,6 +232,8 @@ static void prvMiscInitialisation( void )
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configUDP_LOGGING_ADDR0, configUDP_LOGGING_ADDR1, configUDP_LOGGING_ADDR2, configUDP_LOGGING_ADDR3 );
vLoggingInit( xLogToStdout, xLogToFile, xLogToUDP, ulLoggingIPAddress, configPRINT_PORT );
LogInfo(("Testing 123"));
/*
* Seed random number generator.
*

View File

@@ -1,25 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29215.179
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {150F08BF-9D61-4CC2-8DBF-1335172A1EA4}
EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = FreeRTOS_Plus_TCP_Minimal.vsmdi
EndGlobalSection
EndGlobal