mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2025-06-26 03:08:27 +08:00
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -19,3 +19,6 @@
|
|||||||
[submodule "FreeRTOS-Plus/Test/CMock"]
|
[submodule "FreeRTOS-Plus/Test/CMock"]
|
||||||
path = FreeRTOS-Plus/Test/CMock
|
path = FreeRTOS-Plus/Test/CMock
|
||||||
url = https://github.com/ThrowTheSwitch/CMock
|
url = https://github.com/ThrowTheSwitch/CMock
|
||||||
|
[submodule "FreeRTOS-Plus/Source/Application-Protocols/corePKCS11"]
|
||||||
|
path = FreeRTOS-Plus/Source/corePKCS11
|
||||||
|
url = https://github.com/FreeRTOS/corePKCS11.git
|
||||||
|
140
FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/FreeRTOSConfig.h
Normal file
140
FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/FreeRTOSConfig.h
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS Kernel V10.3.0
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
*
|
||||||
|
* 1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FREERTOS_CONFIG_H
|
||||||
|
#define FREERTOS_CONFIG_H
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* Application specific definitions.
|
||||||
|
*
|
||||||
|
* These definitions should be adjusted for your particular hardware and
|
||||||
|
* application requirements.
|
||||||
|
*
|
||||||
|
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||||
|
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||||
|
* http://www.freertos.org/a00110.html
|
||||||
|
*
|
||||||
|
* The bottom of this file contains some constants specific to running the UDP
|
||||||
|
* stack in this demo. Constants specific to FreeRTOS+TCP itself (rather than
|
||||||
|
* the demo) are contained in FreeRTOSIPConfig.h.
|
||||||
|
*----------------------------------------------------------*/
|
||||||
|
#define configUSE_PREEMPTION 1
|
||||||
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||||
|
#define configMAX_PRIORITIES ( 7 )
|
||||||
|
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
|
||||||
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 60 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the Win32 thread. */
|
||||||
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2048U * 1024U ) )
|
||||||
|
#define configMAX_TASK_NAME_LEN ( 15 )
|
||||||
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
#define configUSE_16_BIT_TICKS 0
|
||||||
|
#define configIDLE_SHOULD_YIELD 1
|
||||||
|
#define configUSE_CO_ROUTINES 0
|
||||||
|
#define configUSE_MUTEXES 1
|
||||||
|
#define configUSE_RECURSIVE_MUTEXES 1
|
||||||
|
#define configQUEUE_REGISTRY_SIZE 0
|
||||||
|
#define configUSE_APPLICATION_TASK_TAG 0
|
||||||
|
#define configUSE_COUNTING_SEMAPHORES 1
|
||||||
|
#define configUSE_ALTERNATIVE_API 0
|
||||||
|
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
|
||||||
|
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||||
|
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||||
|
|
||||||
|
/* Hook function related definitions. */
|
||||||
|
#define configUSE_TICK_HOOK 0
|
||||||
|
#define configUSE_IDLE_HOOK 0
|
||||||
|
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||||
|
#define configCHECK_FOR_STACK_OVERFLOW 0 /* Not applicable to the Win32 port. */
|
||||||
|
|
||||||
|
/* Software timer related definitions. */
|
||||||
|
#define configUSE_TIMERS 1
|
||||||
|
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||||
|
#define configTIMER_QUEUE_LENGTH 5
|
||||||
|
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||||
|
|
||||||
|
/* Event group related definitions. */
|
||||||
|
#define configUSE_EVENT_GROUPS 1
|
||||||
|
|
||||||
|
/* Co-routine definitions. */
|
||||||
|
#define configUSE_CO_ROUTINES 0
|
||||||
|
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||||
|
|
||||||
|
/* Set the following definitions to 1 to include the API function, or zero
|
||||||
|
to exclude the API function. */
|
||||||
|
#define INCLUDE_vTaskPrioritySet 1
|
||||||
|
#define INCLUDE_uxTaskPriorityGet 1
|
||||||
|
#define INCLUDE_vTaskDelete 1
|
||||||
|
#define INCLUDE_vTaskCleanUpResources 0
|
||||||
|
#define INCLUDE_vTaskSuspend 1
|
||||||
|
#define INCLUDE_vTaskDelayUntil 1
|
||||||
|
#define INCLUDE_vTaskDelay 1
|
||||||
|
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||||
|
#define INCLUDE_xTaskGetSchedulerState 1
|
||||||
|
#define INCLUDE_xTimerGetTimerTaskHandle 0
|
||||||
|
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||||
|
#define INCLUDE_xQueueGetMutexHolder 1
|
||||||
|
#define INCLUDE_eTaskGetState 1
|
||||||
|
#define INCLUDE_xEventGroupSetBitsFromISR 1
|
||||||
|
#define INCLUDE_xTimerPendFunctionCall 1
|
||||||
|
#define INCLUDE_pcTaskGetTaskName 1
|
||||||
|
|
||||||
|
/* This demo makes use of one or more example stats formatting functions. These
|
||||||
|
format the raw data provided by the uxTaskGetSystemState() function in to human
|
||||||
|
readable ASCII form. See the notes in the implementation of vTaskList() within
|
||||||
|
FreeRTOS/Source/tasks.c for limitations. configUSE_STATS_FORMATTING_FUNCTIONS
|
||||||
|
is set to 2 so the formatting functions are included without the stdio.h being
|
||||||
|
included in tasks.c. That is because this project defines its own sprintf()
|
||||||
|
functions. */
|
||||||
|
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||||
|
|
||||||
|
/* Assert call defined for debug builds. */
|
||||||
|
#ifdef _DEBUG
|
||||||
|
extern void vAssertCalled( const char *pcFile, uint32_t ulLine );
|
||||||
|
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
|
||||||
|
#endif /* _DEBUG */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Application specific definitions follow. **********************************/
|
||||||
|
|
||||||
|
/* Only used when running in the FreeRTOS Windows simulator. Defines the
|
||||||
|
priority of the task used to simulate Ethernet interrupts. */
|
||||||
|
|
||||||
|
#if( defined( _MSC_VER ) && ( _MSC_VER <= 1600 ) && !defined( snprintf ) )
|
||||||
|
/* Map to Windows names. */
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#define vsnprintf _vsnprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Visual studio does not have an implementation of strcasecmp(). */
|
||||||
|
#define strcasecmp _stricmp
|
||||||
|
#define strncasecmp _strnicmp
|
||||||
|
#define strcmpi _strcmpi
|
||||||
|
|
||||||
|
#define configPRINTF( X ) printf X
|
||||||
|
|
||||||
|
#endif /* FREERTOS_CONFIG_H */
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
[{000214A0-0000-0000-C000-000000000046}]
|
||||||
|
Prop3=19,11
|
||||||
|
[InternetShortcut]
|
||||||
|
IDList=
|
||||||
|
URL=https://www.freertos.org/pkcs11/
|
357
FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/WIN32.vcxproj
Normal file
357
FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/WIN32.vcxproj
Normal file
@ -0,0 +1,357 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" 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>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{C686325E-3261-42F7-AEB1-DDE5280E1CEB}</ProjectGuid>
|
||||||
|
<ProjectName>RTOSDemo</ProjectName>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseOfMfc>false</UseOfMfc>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseOfMfc>false</UseOfMfc>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
|
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Midl>
|
||||||
|
<TypeLibraryName>.\Debug/WIN32.tlb</TypeLibraryName>
|
||||||
|
<HeaderFileName>
|
||||||
|
</HeaderFileName>
|
||||||
|
</Midl>
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<AdditionalIncludeDirectories>..\..\..\FreeRTOS-Plus\Demo\Common\Logging;..\..\..\FreeRTOS-Plus\Source\corePKCS11\source\include;..\..\..\FreeRTOS-Plus\Source\corePKCS11\source\portable\mbedtls\include;..\..\..\FreeRTOS-Plus\Source\corePKCS11\3rdparty\pkcs11;..\..\..\FreeRTOS-Plus\Source\corePKCS11\3rdparty\mbedtls\include;..\..\..\FreeRTOS-Plus\Source\corePKCS11\3rdparty\mbedtls_utils;..\..\..\FreeRTOS\Source\include;..\..\..\FreeRTOS\Source\portable\MSVC-MingW;examples;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;MBEDTLS_CONFIG_FILE="aws_mbedtls_config.h";CONFIG_MEDTLS_USE_AFR_MEMORY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeaderOutputFile>.\Debug/WIN32.pch</PrecompiledHeaderOutputFile>
|
||||||
|
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
|
||||||
|
<ObjectFileName>.\Debug/</ObjectFileName>
|
||||||
|
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
|
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||||
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
|
<AdditionalOptions>/wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 /wd4200 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<BrowseInformation>true</BrowseInformation>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<ExceptionHandling>false</ExceptionHandling>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<DisableSpecificWarnings>4204;4221;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<ResourceCompile>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<Culture>0x0c09</Culture>
|
||||||
|
</ResourceCompile>
|
||||||
|
<Link>
|
||||||
|
<OutputFile>.\Debug/RTOSDemo.exe</OutputFile>
|
||||||
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<ProgramDatabaseFile>.\Debug/WIN32.pdb</ProgramDatabaseFile>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>
|
||||||
|
</AdditionalLibraryDirectories>
|
||||||
|
<Profile>false</Profile>
|
||||||
|
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||||
|
</Link>
|
||||||
|
<Bscmake>
|
||||||
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
|
<OutputFile>.\Debug/WIN32.bsc</OutputFile>
|
||||||
|
</Bscmake>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Midl>
|
||||||
|
<TypeLibraryName>.\Release/WIN32.tlb</TypeLibraryName>
|
||||||
|
<HeaderFileName>
|
||||||
|
</HeaderFileName>
|
||||||
|
</Midl>
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||||
|
<PreprocessorDefinitions>_WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<StringPooling>true</StringPooling>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<PrecompiledHeaderOutputFile>.\Release/WIN32.pch</PrecompiledHeaderOutputFile>
|
||||||
|
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
|
||||||
|
<ObjectFileName>.\Release/</ObjectFileName>
|
||||||
|
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
|
<AdditionalIncludeDirectories>..\Common\Utils;..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap;..\Common\ethernet\lwip-1.4.0\src\include\ipv4;..\Common\ethernet\lwip-1.4.0\src\include;..\..\..\Source\include;..\..\..\Source\portable\MSVC-MingW;..\Common\ethernet\lwip-1.4.0\ports\win32\include;..\Common\Include;.\lwIP_Apps;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<ResourceCompile>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<Culture>0x0c09</Culture>
|
||||||
|
</ResourceCompile>
|
||||||
|
<Link>
|
||||||
|
<OutputFile>.\Release/RTOSDemo.exe</OutputFile>
|
||||||
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
|
<ProgramDatabaseFile>.\Release/WIN32.pdb</ProgramDatabaseFile>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
<AdditionalLibraryDirectories>..\Common\ethernet\lwip-1.4.0\ports\win32\WinPCap</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>wpcap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<Bscmake>
|
||||||
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
|
<OutputFile>.\Release/WIN32.bsc</OutputFile>
|
||||||
|
</Bscmake>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\croutine.c" />
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\event_groups.c" />
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\list.c" />
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MemMang\heap_4.c" />
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c" />
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\queue.c" />
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\stream_buffer.c" />
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\tasks.c" />
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\timers.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\aes.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\aesni.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\arc4.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\aria.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\asn1parse.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\asn1write.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\base64.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\bignum.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\blowfish.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\camellia.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ccm.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\certs.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\chacha20.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\chachapoly.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\cipher.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\cipher_wrap.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\cmac.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ctr_drbg.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\debug.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\des.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\dhm.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ecdh.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ecdsa.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ecjpake.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ecp.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ecp_curves.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\entropy.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\entropy_poll.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\error.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\gcm.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\havege.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\hkdf.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\hmac_drbg.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\md.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\md2.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\md4.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\md5.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\md_wrap.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\memory_buffer_alloc.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\net_sockets.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\nist_kw.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\oid.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\padlock.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pem.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pk.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pkcs11.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pkcs12.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pkcs5.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pkparse.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pkwrite.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pk_wrap.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\platform.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\platform_util.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\poly1305.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ripemd160.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\rsa.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\rsa_internal.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\sha1.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\sha256.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\sha512.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_cache.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_ciphersuites.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_cli.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_cookie.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_srv.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_ticket.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_tls.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\threading.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\timing.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\version.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\version_features.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509write_crt.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509write_csr.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509_create.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509_crl.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509_crt.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509_csr.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\xtea.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls_utils\mbedtls_error.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls_utils\mbedtls_utils.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\source\iot_pkcs11.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\source\iot_pki_utils.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\source\portable\mbedtls\iot_pkcs11_mbedtls.c" />
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\source\portable\windows\iot_pkcs11_pal.c" />
|
||||||
|
<ClCompile Include="examples\demo_helpers.c" />
|
||||||
|
<ClCompile Include="examples\management_and_rng.c" />
|
||||||
|
<ClCompile Include="examples\objects.c" />
|
||||||
|
<ClCompile Include="examples\mechanisms_and_digests.c" />
|
||||||
|
<ClCompile Include="examples\sign_and_verify.c" />
|
||||||
|
<ClCompile Include="main.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\event_groups.h" />
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\FreeRTOS.h" />
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\portable.h" />
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\projdefs.h" />
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\queue.h" />
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\semphr.h" />
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\stack_macros.h" />
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\task.h" />
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\timers.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\aes.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\aesni.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\arc4.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\aria.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\asn1.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\asn1write.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\base64.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\bignum.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\blowfish.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\bn_mul.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\camellia.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ccm.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\certs.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\chacha20.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\chachapoly.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\check_config.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\cipher.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\cipher_internal.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\cmac.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\compat-1.3.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\config.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ctr_drbg.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\debug.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\des.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\dhm.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ecdh.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ecdsa.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ecjpake.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ecp.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ecp_internal.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\entropy.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\entropy_poll.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\error.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\gcm.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\havege.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\hkdf.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\hmac_drbg.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\md.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\md2.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\md4.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\md5.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\md_internal.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\memory_buffer_alloc.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\net.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\net_sockets.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\nist_kw.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\oid.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\padlock.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pem.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pk.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pkcs11.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pkcs12.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pkcs5.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pk_internal.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\platform.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\platform_time.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\platform_util.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\poly1305.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ripemd160.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\rsa.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\rsa_internal.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\sha1.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\sha256.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\sha512.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl_cache.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl_ciphersuites.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl_cookie.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl_internal.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl_ticket.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\threading.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\timing.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\version.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\x509.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\x509_crl.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\x509_crt.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\x509_csr.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\xtea.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls_utils\mbedtls_error.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\pkcs11\pkcs11.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\pkcs11\pkcs11f.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\pkcs11\pkcs11t.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\source\include\iot_pkcs11.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\source\include\iot_pkcs11_pal.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\source\include\iot_pki_utils.h" />
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\source\portable\mbedtls\threading_alt.h" />
|
||||||
|
<ClInclude Include="..\Common\Logging\logging_levels.h" />
|
||||||
|
<ClInclude Include="..\Common\Logging\logging_stack.h" />
|
||||||
|
<ClInclude Include="aws_mbedtls_config.h" />
|
||||||
|
<ClInclude Include="examples\demo_helpers.h" />
|
||||||
|
<ClInclude Include="examples\pkcs11_demos.h" />
|
||||||
|
<ClInclude Include="FreeRTOSConfig.h" />
|
||||||
|
<ClInclude Include="pkcs11_demo_config.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\CMakeLists.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\Makefile" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
@ -0,0 +1,660 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="FreeRTOS">
|
||||||
|
<UniqueIdentifier>{af3445a1-4908-4170-89ed-39345d90d30c}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="FreeRTOS\Source">
|
||||||
|
<UniqueIdentifier>{f32be356-4763-4cae-9020-974a2638cb08}</UniqueIdentifier>
|
||||||
|
<Extensions>*.c</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="FreeRTOS\Source\Portable">
|
||||||
|
<UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="FreeRTOS\Source\include">
|
||||||
|
<UniqueIdentifier>{d2dcd641-8d91-492b-852f-5563ffadaec6}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="3rdparty">
|
||||||
|
<UniqueIdentifier>{6a7d78a6-4f09-4a5f-a692-ce4791240881}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="3rdparty\pkcs11">
|
||||||
|
<UniqueIdentifier>{e32be358-792b-45ab-b1c5-f87e64315cd3}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="examples">
|
||||||
|
<UniqueIdentifier>{44f1dc25-5639-4f3f-a6ec-f5c19cb7fe8d}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="3rdparty\mbedtls">
|
||||||
|
<UniqueIdentifier>{78a81f37-e1f1-4ef1-b067-bb23c8e1dfe2}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="3rdparty\mbedtls\include">
|
||||||
|
<UniqueIdentifier>{38512398-609b-4a9b-bc1a-67cab17720ae}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="3rdparty\mbedtls_utils">
|
||||||
|
<UniqueIdentifier>{dc5729ea-7c04-484d-babd-d3537c27b7a1}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="corePKCS11">
|
||||||
|
<UniqueIdentifier>{e88d4eab-3fad-4755-a5a4-41c6e4f59089}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="corePKCS11\include">
|
||||||
|
<UniqueIdentifier>{817c6143-0ae9-4cac-828f-08f0da380f99}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="corePKCS11\source">
|
||||||
|
<UniqueIdentifier>{8ffa2635-7ef9-4c6b-b392-96e0cc935ad3}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Common">
|
||||||
|
<UniqueIdentifier>{30af02a1-fc2d-4142-b173-508ece3f033d}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.c" />
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\croutine.c">
|
||||||
|
<Filter>FreeRTOS\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\event_groups.c">
|
||||||
|
<Filter>FreeRTOS\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\list.c">
|
||||||
|
<Filter>FreeRTOS\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\queue.c">
|
||||||
|
<Filter>FreeRTOS\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\stream_buffer.c">
|
||||||
|
<Filter>FreeRTOS\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\tasks.c">
|
||||||
|
<Filter>FreeRTOS\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\timers.c">
|
||||||
|
<Filter>FreeRTOS\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MemMang\heap_4.c">
|
||||||
|
<Filter>FreeRTOS\Source\Portable</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\FreeRTOS\Source\portable\MSVC-MingW\port.c">
|
||||||
|
<Filter>FreeRTOS\Source\Portable</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="examples\management_and_rng.c">
|
||||||
|
<Filter>examples</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="examples\objects.c">
|
||||||
|
<Filter>examples</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="examples\mechanisms_and_digests.c">
|
||||||
|
<Filter>examples</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="examples\demo_helpers.c">
|
||||||
|
<Filter>examples</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="examples\sign_and_verify.c">
|
||||||
|
<Filter>examples</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\source\portable\mbedtls\iot_pkcs11_mbedtls.c">
|
||||||
|
<Filter>corePKCS11\source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\source\iot_pkcs11.c">
|
||||||
|
<Filter>corePKCS11\source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\source\iot_pki_utils.c">
|
||||||
|
<Filter>corePKCS11\source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\source\portable\windows\iot_pkcs11_pal.c">
|
||||||
|
<Filter>corePKCS11\source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls_utils\mbedtls_error.c">
|
||||||
|
<Filter>3rdparty\mbedtls_utils</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls_utils\mbedtls_utils.c">
|
||||||
|
<Filter>3rdparty\mbedtls_utils</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\aes.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\aesni.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\arc4.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\aria.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\asn1parse.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\asn1write.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\base64.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\bignum.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\blowfish.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\camellia.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ccm.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\certs.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\chacha20.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\chachapoly.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\cipher.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\cipher_wrap.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\cmac.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ctr_drbg.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\debug.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\des.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\dhm.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ecdh.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ecdsa.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ecjpake.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ecp.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ecp_curves.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\entropy.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\entropy_poll.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\error.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\gcm.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\havege.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\hkdf.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\hmac_drbg.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\md.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\md_wrap.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\md2.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\md4.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\md5.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\memory_buffer_alloc.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\net_sockets.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\nist_kw.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\oid.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\padlock.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pem.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pk.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pk_wrap.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pkcs5.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pkcs11.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pkcs12.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pkparse.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\pkwrite.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\platform.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\platform_util.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\poly1305.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ripemd160.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\rsa.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\rsa_internal.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\sha1.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\sha256.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\sha512.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_cache.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_ciphersuites.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_cli.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_cookie.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_srv.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_ticket.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\ssl_tls.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\threading.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\timing.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\version.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\version_features.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509_create.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509_crl.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509_crt.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509_csr.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509write_crt.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\x509write_csr.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\xtea.c">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="FreeRTOSConfig.h" />
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\event_groups.h">
|
||||||
|
<Filter>FreeRTOS\Source\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\FreeRTOS.h">
|
||||||
|
<Filter>FreeRTOS\Source\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\portable.h">
|
||||||
|
<Filter>FreeRTOS\Source\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\projdefs.h">
|
||||||
|
<Filter>FreeRTOS\Source\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\queue.h">
|
||||||
|
<Filter>FreeRTOS\Source\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\semphr.h">
|
||||||
|
<Filter>FreeRTOS\Source\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\stack_macros.h">
|
||||||
|
<Filter>FreeRTOS\Source\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\task.h">
|
||||||
|
<Filter>FreeRTOS\Source\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\FreeRTOS\Source\include\timers.h">
|
||||||
|
<Filter>FreeRTOS\Source\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="aws_mbedtls_config.h" />
|
||||||
|
<ClInclude Include="pkcs11_demo_config.h" />
|
||||||
|
<ClInclude Include="examples\pkcs11_demos.h">
|
||||||
|
<Filter>examples</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="examples\demo_helpers.h">
|
||||||
|
<Filter>examples</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\source\include\iot_pkcs11.h">
|
||||||
|
<Filter>corePKCS11\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\source\include\iot_pkcs11_pal.h">
|
||||||
|
<Filter>corePKCS11\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\source\include\iot_pki_utils.h">
|
||||||
|
<Filter>corePKCS11\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\source\portable\mbedtls\threading_alt.h">
|
||||||
|
<Filter>corePKCS11\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\pkcs11\pkcs11.h">
|
||||||
|
<Filter>3rdparty\pkcs11</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\pkcs11\pkcs11f.h">
|
||||||
|
<Filter>3rdparty\pkcs11</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\pkcs11\pkcs11t.h">
|
||||||
|
<Filter>3rdparty\pkcs11</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls_utils\mbedtls_error.h">
|
||||||
|
<Filter>3rdparty\mbedtls_utils</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\aes.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\aesni.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\arc4.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\aria.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\asn1.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\asn1write.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\base64.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\bignum.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\blowfish.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\bn_mul.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\camellia.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ccm.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\certs.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\chacha20.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\chachapoly.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\check_config.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\cipher.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\cipher_internal.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\cmac.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\compat-1.3.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\config.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ctr_drbg.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\debug.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\des.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\dhm.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ecdh.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ecdsa.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ecjpake.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ecp.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ecp_internal.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\entropy.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\entropy_poll.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\error.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\gcm.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\havege.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\hkdf.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\hmac_drbg.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\md.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\md_internal.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\md2.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\md4.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\md5.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\memory_buffer_alloc.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\net.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\net_sockets.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\nist_kw.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\oid.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\padlock.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pem.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pk.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pk_internal.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pkcs5.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pkcs11.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\pkcs12.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\platform.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\platform_time.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\platform_util.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\poly1305.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ripemd160.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\rsa.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\rsa_internal.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\sha1.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\sha256.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\sha512.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl_cache.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl_ciphersuites.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl_cookie.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl_internal.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\ssl_ticket.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\threading.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\timing.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\version.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\x509.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\x509_crl.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\x509_crt.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\x509_csr.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Source\corePKCS11\3rdparty\mbedtls\include\mbedtls\xtea.h">
|
||||||
|
<Filter>3rdparty\mbedtls\include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Common\Logging\logging_levels.h">
|
||||||
|
<Filter>Common</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Common\Logging\logging_stack.h">
|
||||||
|
<Filter>Common</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\CMakeLists.txt">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</Text>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\Source\corePKCS11\3rdparty\mbedtls\library\Makefile">
|
||||||
|
<Filter>3rdparty\mbedtls</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
3322
FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/aws_mbedtls_config.h
Normal file
3322
FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/aws_mbedtls_config.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,341 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS PKCS #11 V1.0.3
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* FreeRTOS includes. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
/* Standard includes. */
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
|
/* PKCS #11 includes. */
|
||||||
|
#include "iot_pkcs11_config.h"
|
||||||
|
#include "iot_pkcs11.h"
|
||||||
|
#include "pkcs11.h"
|
||||||
|
|
||||||
|
/* mbed TLS includes. */
|
||||||
|
#include "mbedtls/pk.h"
|
||||||
|
#include "mbedtls/oid.h"
|
||||||
|
|
||||||
|
/* Helpers include. */
|
||||||
|
#include "demo_helpers.h"
|
||||||
|
|
||||||
|
void vStart( CK_SESSION_HANDLE * pxSession,
|
||||||
|
CK_SLOT_ID ** ppxSlotId )
|
||||||
|
{
|
||||||
|
CK_RV xResult = CKR_OK;
|
||||||
|
|
||||||
|
CK_FUNCTION_LIST_PTR pxFunctionList = NULL;
|
||||||
|
CK_C_INITIALIZE_ARGS xInitArgs = { 0 };
|
||||||
|
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||||
|
CK_ULONG xSlotCount = 0;
|
||||||
|
CK_SLOT_ID * pxSlotId = NULL;
|
||||||
|
|
||||||
|
xResult = C_GetFunctionList( &pxFunctionList );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configASSERT( pxFunctionList != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_Initialize != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_GetSlotList != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_OpenSession != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_Login != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_GenerateRandom != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_CloseSession != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_Finalize != NULL );
|
||||||
|
|
||||||
|
xResult = pxFunctionList->C_Initialize( &xInitArgs );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
xResult = pxFunctionList->C_GetSlotList( CK_TRUE,
|
||||||
|
NULL,
|
||||||
|
&xSlotCount );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
pxSlotId = pvPortMalloc( sizeof( CK_SLOT_ID ) * ( xSlotCount ) );
|
||||||
|
configASSERT( pxSlotId != NULL );
|
||||||
|
|
||||||
|
xResult = pxFunctionList->C_GetSlotList( CK_TRUE,
|
||||||
|
pxSlotId,
|
||||||
|
&xSlotCount );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
xResult = pxFunctionList->C_OpenSession( pxSlotId[ 0 ],
|
||||||
|
CKF_SERIAL_SESSION | CKF_RW_SESSION,
|
||||||
|
NULL, /* Application defined pointer. */
|
||||||
|
NULL, /* Callback function. */
|
||||||
|
&hSession );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
|
||||||
|
xResult = pxFunctionList->C_Login( hSession,
|
||||||
|
CKU_USER,
|
||||||
|
( CK_UTF8CHAR_PTR ) configPKCS11_DEFAULT_USER_PIN,
|
||||||
|
sizeof( configPKCS11_DEFAULT_USER_PIN ) - 1UL );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
*ppxSlotId = pxSlotId;
|
||||||
|
*pxSession = hSession;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vEnd( CK_SESSION_HANDLE xSession,
|
||||||
|
CK_SLOT_ID * pxSlotId )
|
||||||
|
{
|
||||||
|
C_CloseSession( xSession );
|
||||||
|
C_Finalize( NULL );
|
||||||
|
vPortFree( pxSlotId );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vWriteHexBytesToConsole( char * pcDescription,
|
||||||
|
CK_BYTE * pucData,
|
||||||
|
CK_ULONG ulDataLength )
|
||||||
|
{
|
||||||
|
/* This function is simply a helper function to print the raw hex values
|
||||||
|
* of an EC public key. It's explanation is not within the scope of the demos
|
||||||
|
* and is sparsely commented. */
|
||||||
|
#define BYTES_TO_DISPLAY_PER_ROW 16
|
||||||
|
char pcByteRow[ 1 + ( BYTES_TO_DISPLAY_PER_ROW * 2 ) + ( BYTES_TO_DISPLAY_PER_ROW / 2 ) ];
|
||||||
|
char * pcNextChar = pcByteRow;
|
||||||
|
uint32_t ulIndex = 0;
|
||||||
|
uint8_t ucByteValue = 0;
|
||||||
|
|
||||||
|
/* Write help text to the console. */
|
||||||
|
configPRINTF( ( "%s, %d bytes:\r\n", pcDescription, ulDataLength ) );
|
||||||
|
|
||||||
|
/* Iterate over the bytes of the encoded public key. */
|
||||||
|
for( ulIndex = 0; ulIndex < ulDataLength; ulIndex++ )
|
||||||
|
{
|
||||||
|
/* Convert one byte to ASCII hex. */
|
||||||
|
ucByteValue = *( pucData + ulIndex );
|
||||||
|
snprintf( pcNextChar,
|
||||||
|
sizeof( pcByteRow ) - ( pcNextChar - pcByteRow ),
|
||||||
|
"%02x",
|
||||||
|
ucByteValue );
|
||||||
|
pcNextChar += 2;
|
||||||
|
|
||||||
|
/* Check for the end of a two-byte display word. */
|
||||||
|
if( 0 == ( ( ulIndex + 1 ) % sizeof( uint16_t ) ) )
|
||||||
|
{
|
||||||
|
*pcNextChar = ' ';
|
||||||
|
pcNextChar++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for the end of a row. */
|
||||||
|
if( 0 == ( ( ulIndex + 1 ) % BYTES_TO_DISPLAY_PER_ROW ) )
|
||||||
|
{
|
||||||
|
*pcNextChar = '\0';
|
||||||
|
configPRINTF( ( pcByteRow ) );
|
||||||
|
configPRINTF( ( "\r\n" ) );
|
||||||
|
pcNextChar = pcByteRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for a partial line to print. */
|
||||||
|
if( pcNextChar > pcByteRow )
|
||||||
|
{
|
||||||
|
*pcNextChar = '\0';
|
||||||
|
configPRINTF( ( pcByteRow ) );
|
||||||
|
configPRINTF( ( "\r\n" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Extract ECDSA public key. */
|
||||||
|
CK_RV vExportPublicKey( CK_SESSION_HANDLE xSession,
|
||||||
|
CK_OBJECT_HANDLE xPublicKeyHandle,
|
||||||
|
CK_BYTE ** ppucDerPublicKey,
|
||||||
|
CK_ULONG * pulDerPublicKeyLength )
|
||||||
|
{
|
||||||
|
/* This function is simply a helper function to export the raw hex values
|
||||||
|
* of an EC public key into a buffer. It's explanation is not within the
|
||||||
|
* scope of the demos and is sparsely commented. */
|
||||||
|
CK_RV xResult;
|
||||||
|
CK_FUNCTION_LIST_PTR pxFunctionList;
|
||||||
|
CK_KEY_TYPE xKeyType = 0;
|
||||||
|
CK_ATTRIBUTE xTemplate = { 0 };
|
||||||
|
uint8_t pucEcP256AsnAndOid[] =
|
||||||
|
{
|
||||||
|
0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86,
|
||||||
|
0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a,
|
||||||
|
0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03,
|
||||||
|
0x42, 0x00
|
||||||
|
};
|
||||||
|
uint8_t pucUnusedKeyTag[] = { 0x04, 0x41 };
|
||||||
|
|
||||||
|
/* This variable is used only for its size. This gets rid of compiler warnings. */
|
||||||
|
( void ) pucUnusedKeyTag;
|
||||||
|
|
||||||
|
xResult = C_GetFunctionList( &pxFunctionList );
|
||||||
|
|
||||||
|
/* Query the key type. */
|
||||||
|
if( CKR_OK == xResult )
|
||||||
|
{
|
||||||
|
xTemplate.type = CKA_KEY_TYPE;
|
||||||
|
xTemplate.pValue = &xKeyType;
|
||||||
|
xTemplate.ulValueLen = sizeof( xKeyType );
|
||||||
|
xResult = pxFunctionList->C_GetAttributeValue( xSession,
|
||||||
|
xPublicKeyHandle,
|
||||||
|
&xTemplate,
|
||||||
|
1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scope to ECDSA keys only, since there's currently no use case for
|
||||||
|
* onboard keygen and certificate enrollment for RSA. */
|
||||||
|
if( ( CKR_OK == xResult ) && ( CKK_ECDSA == xKeyType ) )
|
||||||
|
{
|
||||||
|
/* Query the size of the public key. */
|
||||||
|
xTemplate.type = CKA_EC_POINT;
|
||||||
|
xTemplate.pValue = NULL;
|
||||||
|
xTemplate.ulValueLen = 0;
|
||||||
|
xResult = pxFunctionList->C_GetAttributeValue( xSession,
|
||||||
|
xPublicKeyHandle,
|
||||||
|
&xTemplate,
|
||||||
|
1 );
|
||||||
|
|
||||||
|
/* Allocate a buffer large enough for the full, encoded public key. */
|
||||||
|
if( CKR_OK == xResult )
|
||||||
|
{
|
||||||
|
/* Add space for the full DER header. */
|
||||||
|
xTemplate.ulValueLen += sizeof( pucEcP256AsnAndOid ) - sizeof( pucUnusedKeyTag );
|
||||||
|
*pulDerPublicKeyLength = xTemplate.ulValueLen;
|
||||||
|
|
||||||
|
/* Get a heap buffer. */
|
||||||
|
*ppucDerPublicKey = pvPortMalloc( xTemplate.ulValueLen );
|
||||||
|
|
||||||
|
/* Check for resource exhaustion. */
|
||||||
|
if( NULL == *ppucDerPublicKey )
|
||||||
|
{
|
||||||
|
xResult = CKR_HOST_MEMORY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Export the public key. */
|
||||||
|
if( CKR_OK == xResult )
|
||||||
|
{
|
||||||
|
xTemplate.pValue = *ppucDerPublicKey + sizeof( pucEcP256AsnAndOid ) - sizeof( pucUnusedKeyTag );
|
||||||
|
xTemplate.ulValueLen -= ( sizeof( pucEcP256AsnAndOid ) - sizeof( pucUnusedKeyTag ) );
|
||||||
|
xResult = pxFunctionList->C_GetAttributeValue( xSession,
|
||||||
|
xPublicKeyHandle,
|
||||||
|
&xTemplate,
|
||||||
|
1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Prepend the full DER header. */
|
||||||
|
if( CKR_OK == xResult )
|
||||||
|
{
|
||||||
|
memcpy( *ppucDerPublicKey, pucEcP256AsnAndOid, sizeof( pucEcP256AsnAndOid ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free memory if there was an error after allocation. */
|
||||||
|
if( ( NULL != *ppucDerPublicKey ) && ( CKR_OK != xResult ) )
|
||||||
|
{
|
||||||
|
vPortFree( *ppucDerPublicKey );
|
||||||
|
*ppucDerPublicKey = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return xResult;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void * pvCalloc( size_t xNumElements,
|
||||||
|
size_t xSize )
|
||||||
|
{
|
||||||
|
void * pvNew = pvPortMalloc( xNumElements * xSize );
|
||||||
|
|
||||||
|
if( NULL != pvNew )
|
||||||
|
{
|
||||||
|
memset( pvNew, 0, xNumElements * xSize );
|
||||||
|
}
|
||||||
|
|
||||||
|
return pvNew;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void aws_mbedtls_mutex_init( mbedtls_threading_mutex_t * mutex )
|
||||||
|
{
|
||||||
|
mutex->mutex = xSemaphoreCreateMutex();
|
||||||
|
|
||||||
|
if( mutex->mutex != NULL )
|
||||||
|
{
|
||||||
|
mutex->is_valid = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mutex->is_valid = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void aws_mbedtls_mutex_free( mbedtls_threading_mutex_t * mutex )
|
||||||
|
{
|
||||||
|
if( mutex->is_valid == 1 )
|
||||||
|
{
|
||||||
|
vSemaphoreDelete( mutex->mutex );
|
||||||
|
mutex->is_valid = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
int aws_mbedtls_mutex_lock( mbedtls_threading_mutex_t * mutex )
|
||||||
|
{
|
||||||
|
int ret = MBEDTLS_ERR_THREADING_BAD_INPUT_DATA;
|
||||||
|
|
||||||
|
if( mutex->is_valid == 1 )
|
||||||
|
{
|
||||||
|
if( xSemaphoreTake( mutex->mutex, portMAX_DELAY ) )
|
||||||
|
{
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
int aws_mbedtls_mutex_unlock( mbedtls_threading_mutex_t * mutex )
|
||||||
|
{
|
||||||
|
int ret = MBEDTLS_ERR_THREADING_BAD_INPUT_DATA;
|
||||||
|
|
||||||
|
if( mutex->is_valid == 1 )
|
||||||
|
{
|
||||||
|
if( xSemaphoreGive( mutex->mutex ) )
|
||||||
|
{
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS PKCS #11 V1.0.3
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
*/
|
||||||
|
#ifndef _DEMO_HELPER_FUNCTIONS_
|
||||||
|
#define _DEMO_HELPER_FUNCTIONS_
|
||||||
|
|
||||||
|
#include "iot_pkcs11.h"
|
||||||
|
#include "threading_alt.h"
|
||||||
|
#include "mbedtls/pk.h"
|
||||||
|
|
||||||
|
/* This function contains standard setup code for PKCS #11. See the
|
||||||
|
* "management_and_rng.c" file for the demo code explaining this section
|
||||||
|
* of cryptoki.
|
||||||
|
*/
|
||||||
|
void vStart( CK_SESSION_HANDLE * pxSession,
|
||||||
|
CK_SLOT_ID ** ppxSlotId );
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* This function contains standard tear down code for PKCS #11. See the
|
||||||
|
* "management_and_rng.c" file for the demo code explaining this section
|
||||||
|
* of cryptoki.
|
||||||
|
*/
|
||||||
|
void vEnd( CK_SESSION_HANDLE xSession,
|
||||||
|
CK_SLOT_ID * pxSlotId );
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* This function is simply a helper function to print the raw hex values
|
||||||
|
* of an EC public key. It's explanation is not within the scope of the demos
|
||||||
|
* and is sparsely commented. */
|
||||||
|
void vWriteHexBytesToConsole( char * pcDescription,
|
||||||
|
CK_BYTE * pucData,
|
||||||
|
CK_ULONG ulDataLength );
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* This function is simply a helper function to export the raw hex values
|
||||||
|
* of an EC public key into a buffer. It's explanation is not within the
|
||||||
|
* scope of the demos and is sparsely commented. */
|
||||||
|
CK_RV vExportPublicKey( CK_SESSION_HANDLE xSession,
|
||||||
|
CK_OBJECT_HANDLE xPublicKeyHandle,
|
||||||
|
CK_BYTE ** ppucDerPublicKey,
|
||||||
|
CK_ULONG * pulDerPublicKeyLength );
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Implements libc calloc semantics using the FreeRTOS heap
|
||||||
|
*/
|
||||||
|
void * pvCalloc( size_t xNumElements,
|
||||||
|
size_t xSize );
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Implementation of mbedtls_mutex_init for thread-safety.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void aws_mbedtls_mutex_init( mbedtls_threading_mutex_t * mutex );
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Implementation of mbedtls_mutex_free for thread-safety.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void aws_mbedtls_mutex_free( mbedtls_threading_mutex_t * mutex );
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Implementation of mbedtls_mutex_lock for thread-safety.
|
||||||
|
*
|
||||||
|
* @return 0 if successful, MBEDTLS_ERR_THREADING_MUTEX_ERROR if timeout,
|
||||||
|
* MBEDTLS_ERR_THREADING_BAD_INPUT_DATA if the mutex is not valid.
|
||||||
|
*/
|
||||||
|
int aws_mbedtls_mutex_lock( mbedtls_threading_mutex_t * mutex );
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Implementation of mbedtls_mutex_unlock for thread-safety.
|
||||||
|
*
|
||||||
|
* @return 0 if successful, MBEDTLS_ERR_THREADING_MUTEX_ERROR if timeout,
|
||||||
|
* MBEDTLS_ERR_THREADING_BAD_INPUT_DATA if the mutex is not valid.
|
||||||
|
*/
|
||||||
|
int aws_mbedtls_mutex_unlock( mbedtls_threading_mutex_t * mutex );
|
||||||
|
|
||||||
|
#endif /* _DEMO_HELPER_FUNCTIONS_ */
|
@ -0,0 +1,219 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS PKCS #11 V1.0.3
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
*/
|
||||||
|
/* FreeRTOS includes. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
/* Standard includes. */
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
|
/* PKCS #11 includes. */
|
||||||
|
#include "iot_pkcs11_config.h"
|
||||||
|
#include "iot_pkcs11.h"
|
||||||
|
#include "pkcs11.h"
|
||||||
|
|
||||||
|
/* Demo include. */
|
||||||
|
#include "pkcs11_demos.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function details how to use the PKCS #11 "Management" functions to
|
||||||
|
* manage the internal state machine of the PKCS #11 implementation. These
|
||||||
|
* functions are all defined in
|
||||||
|
* http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html
|
||||||
|
* please consult the standard for more information regarding these functions.
|
||||||
|
*
|
||||||
|
* The standard has grouped the functions presented in this demo as:
|
||||||
|
* General Purpose Functions
|
||||||
|
* Slot and Token Management Functions
|
||||||
|
* Session Management Functions
|
||||||
|
* Random Number Generation Functions
|
||||||
|
*/
|
||||||
|
void vPKCS11ManagementAndRNGDemo( void )
|
||||||
|
{
|
||||||
|
/* We will use the terminology as defined in the standard, Cryptoki is in
|
||||||
|
* reference to the Cryptographic Token Interface defined in the PKCS #11
|
||||||
|
* standard. An implementation of Cryptoki is referred to as a
|
||||||
|
* "Cryptoki library". */
|
||||||
|
configPRINTF( ( "\r\nStarting PKCS #11 Management and Random Number Generation" \
|
||||||
|
" Demo.\r\n" ) );
|
||||||
|
|
||||||
|
/* CK_RV is the return type for a Cryptoki function. Generally the underlying
|
||||||
|
* type is a CK_ULONG, it can also be a CKR_VENDOR_DEFINED type. */
|
||||||
|
CK_RV xResult = CKR_OK;
|
||||||
|
|
||||||
|
/* The CK_FUNCTION_LIST is a structure that contains the Cryptoki version
|
||||||
|
* and a function pointer to each function in the Cryptoki API. If the
|
||||||
|
* function pointer is NULL it is unimplemented. */
|
||||||
|
CK_FUNCTION_LIST_PTR pxFunctionList = NULL;
|
||||||
|
|
||||||
|
/* This Cryptoki library does not implement any initialization arguments. At the time of
|
||||||
|
* writing this demo, the purpose of these optional arguments is to provide
|
||||||
|
* function pointers for mutex operations. */
|
||||||
|
CK_C_INITIALIZE_ARGS xInitArgs = { 0 };
|
||||||
|
|
||||||
|
/* A slot ID is an integer that defines a slot. The Cryptoki definition of
|
||||||
|
* a slot is "A logical reader that potentially contains a token."
|
||||||
|
*
|
||||||
|
* Essentially it is an abstraction for accessing the token. The reason for
|
||||||
|
* this is Some tokens are a physical "card' that needs to be inserted into
|
||||||
|
* a slot for the device to read.
|
||||||
|
*
|
||||||
|
* A concrete example of a slot could be a USB Hardware Security Module (HSM),
|
||||||
|
* which generally appears as a singular slot, and abstracts it's internal "token".
|
||||||
|
*
|
||||||
|
* Some implementations have multiple slots mapped to a single token, or maps
|
||||||
|
* a slot per token. */
|
||||||
|
CK_SLOT_ID * pxSlotId = NULL;
|
||||||
|
|
||||||
|
/* A session is defined to be "The logical connection between an application
|
||||||
|
* and a token."
|
||||||
|
*
|
||||||
|
* The session can either be private or public, and differentiates
|
||||||
|
* your application from the other users of the token. */
|
||||||
|
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||||
|
|
||||||
|
/* Helper variables. */
|
||||||
|
CK_BYTE xRandomData[ 10 ] = { 0 };
|
||||||
|
uint32_t ulIndex = 0;
|
||||||
|
CK_ULONG xSlotCount = 0;
|
||||||
|
|
||||||
|
/* We use the function list returned by C_GetFunctionList to see what functions
|
||||||
|
* the Cryptoki library supports. We use asserts to ensure that all the
|
||||||
|
* functionality needed in this demo is available. */
|
||||||
|
xResult = C_GetFunctionList( &pxFunctionList );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configASSERT( pxFunctionList != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_Initialize != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_GetSlotList != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_OpenSession != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_Login != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_GenerateRandom != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_CloseSession != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_Finalize != NULL );
|
||||||
|
|
||||||
|
configPRINTF( ( "Cryptoki Major Version: %lu Minor Version %lu\r\n",
|
||||||
|
pxFunctionList->version.major,
|
||||||
|
pxFunctionList->version.minor ) );
|
||||||
|
|
||||||
|
/* C_Initialize will initialize the Cryptoki library and the hardware it
|
||||||
|
* abstracts. */
|
||||||
|
xResult = pxFunctionList->C_Initialize( &xInitArgs );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
/* C_GetSlotList will retrieve an array of CK_SLOT_IDs.
|
||||||
|
* This Cryptoki library does not implement slots, but it is important to
|
||||||
|
* highlight how Cryptoki can be used to interface with real hardware.
|
||||||
|
*
|
||||||
|
* By setting the first argument "tokenPresent" to true, we only retrieve
|
||||||
|
* slots that have a token. If the second argument "pSlotList" is NULL, the
|
||||||
|
* third argument "pulCount" will be modified to contain the total slots. */
|
||||||
|
xResult = pxFunctionList->C_GetSlotList( CK_TRUE,
|
||||||
|
NULL,
|
||||||
|
&xSlotCount );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
/* Since C_GetSlotList does not allocate the memory itself for getting a list
|
||||||
|
* of CK_SLOT_ID, we allocate one for it to populate with the list of
|
||||||
|
* slot ids. */
|
||||||
|
pxSlotId = pvPortMalloc( sizeof( CK_SLOT_ID ) * ( xSlotCount ) );
|
||||||
|
configASSERT( pxSlotId != NULL );
|
||||||
|
|
||||||
|
/* Now since pSlotList is not NULL, C_GetSlotList will populate it with the
|
||||||
|
* available slots. */
|
||||||
|
xResult = pxFunctionList->C_GetSlotList( CK_TRUE,
|
||||||
|
pxSlotId,
|
||||||
|
&xSlotCount );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
/* Since this Cryptoki library does not actually implement the concept of slots,
|
||||||
|
* but we will use the first available slot, so the demo code conforms to
|
||||||
|
* Cryptoki.
|
||||||
|
*
|
||||||
|
* C_OpenSession will establish a session between the application and
|
||||||
|
* the token and we can then use the returned CK_SESSION_HANDLE for
|
||||||
|
* cryptographic operations with the token.
|
||||||
|
*
|
||||||
|
* For legacy reasons, Cryptoki demands that the CKF_SERIAL_SESSION bit
|
||||||
|
* is always set. */
|
||||||
|
xResult = pxFunctionList->C_OpenSession( pxSlotId[0],
|
||||||
|
CKF_SERIAL_SESSION | CKF_RW_SESSION,
|
||||||
|
NULL, /* Application defined pointer. */
|
||||||
|
NULL, /* Callback function. */
|
||||||
|
&hSession );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
|
||||||
|
/* C_Login is called to log the user in to the token. The login status is
|
||||||
|
* shared between sessions, so logging in once is sufficient for all the sessions
|
||||||
|
* tied to the token. Most of the behavior for C_Login is defined by the token
|
||||||
|
* so it may be necessary to modify calls to C_Login when switching to a different
|
||||||
|
* Cryptoki library or token.
|
||||||
|
*
|
||||||
|
* This Cryptoki library does not implement C_Login, and only defines the function
|
||||||
|
* for compatibility reasons.
|
||||||
|
*/
|
||||||
|
xResult = pxFunctionList->C_Login( hSession,
|
||||||
|
CKU_USER,
|
||||||
|
( CK_UTF8CHAR_PTR ) configPKCS11_DEFAULT_USER_PIN,
|
||||||
|
sizeof( configPKCS11_DEFAULT_USER_PIN ) - 1UL );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
/* C_GenerateRandom generates random or pseudo random data. As arguments it
|
||||||
|
* takes the application session, and a pointer to a byte buffer, as well as
|
||||||
|
* the length of the byte buffer. Then it will fill this buffer with random
|
||||||
|
* bytes. */
|
||||||
|
xResult = pxFunctionList->C_GenerateRandom( hSession,
|
||||||
|
xRandomData,
|
||||||
|
sizeof( xRandomData ) );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
for( ulIndex = 0; ulIndex < sizeof( xRandomData ); ulIndex++ )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "Generated random number: %x\r\n", xRandomData[ ulIndex ] ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* C_CloseSession closes the session that was established between the
|
||||||
|
* application and the token. This will clean up the resources that maintained
|
||||||
|
* the link between the application and the token. If the application wishes
|
||||||
|
* to use the token again, it will need to open a new session. */
|
||||||
|
xResult = pxFunctionList->C_CloseSession( hSession );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
/* C_Finalize signals to the Cryptoki library that the application is done
|
||||||
|
* using it. It should always be the last call to the Cryptoki library.
|
||||||
|
* NULL should always be passed as the argument, as the parameter is currently
|
||||||
|
* just reserved for future revisions.
|
||||||
|
*
|
||||||
|
* Calling this function in a multi threaded environment can lead to undefined
|
||||||
|
* behavior if other threads are accessing the Cryptoki library. */
|
||||||
|
xResult = pxFunctionList->C_Finalize( NULL );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
configPRINTF( ( "Finished PKCS #11 Management and Random Number Generation" \
|
||||||
|
" Demo.\r\n" ) );
|
||||||
|
|
||||||
|
vPortFree( pxSlotId );
|
||||||
|
}
|
@ -0,0 +1,258 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS PKCS #11 V1.0.3
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
*/
|
||||||
|
/* FreeRTOS includes. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
/* Standard includes. */
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
|
/* PKCS #11 includes. */
|
||||||
|
#include "iot_pkcs11_config.h"
|
||||||
|
#include "iot_pkcs11.h"
|
||||||
|
#include "pkcs11.h"
|
||||||
|
|
||||||
|
/* Demo includes. */
|
||||||
|
#include "demo_helpers.h"
|
||||||
|
#include "pkcs11_demos.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function details what Cryptoki mechanisms are, how to query a slot's
|
||||||
|
* support for them, and how to use those mechanisms to generate a hash of a buffer.
|
||||||
|
* This can then be used as a message digest.
|
||||||
|
*
|
||||||
|
* http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html
|
||||||
|
* please consult the standard for more information.
|
||||||
|
*
|
||||||
|
* The standard has grouped the functions presented in this demo as:
|
||||||
|
* Slot and token management functions.
|
||||||
|
* Message digesting functions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void vPKCS11MechanismsAndDigestDemo( void )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* This demo builds upon the demo found in "management_and_rng.c". It borrows
|
||||||
|
* code and terminology defined and explained, and it is recommended to complete
|
||||||
|
* the "management and rng" demo before this one.
|
||||||
|
*/
|
||||||
|
configPRINTF( ( "\r\nStarting PKCS #11 Mechanisms and Digest Demo.\r\n" ) );
|
||||||
|
|
||||||
|
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||||
|
CK_SLOT_ID * pxSlotId = 0;
|
||||||
|
CK_FUNCTION_LIST_PTR pxFunctionList = NULL;
|
||||||
|
CK_ULONG ulIndex = 0;
|
||||||
|
CK_RV xResult = CKR_OK;
|
||||||
|
|
||||||
|
/* The PKCS #11 standard defines a mechanism to be a "A process for
|
||||||
|
* implementing a cryptographic operation." For example the SHA-256 algorithm
|
||||||
|
* will be the mechanism used in this demo to perform a digest (hash operation).
|
||||||
|
*
|
||||||
|
* The mechanism types are defined in "pkcs11t.h", and are prefixed CKM_, to
|
||||||
|
* provide a portable way to identify mechanisms.
|
||||||
|
*/
|
||||||
|
CK_MECHANISM_TYPE xMechanismType = 0;
|
||||||
|
|
||||||
|
/* This variable is not directly used, but is instantiated for demonstration
|
||||||
|
* purposes.
|
||||||
|
*/
|
||||||
|
( void ) xMechanismType;
|
||||||
|
|
||||||
|
/* The CK_MECHANISM_INFO allows the application to retrieve the minimum and
|
||||||
|
* maximum key sizes supported by the mechanism (could be in bits or bytes).
|
||||||
|
* The structure also has a flags field, that is populated with bit flags
|
||||||
|
* for what features the mechanism supports.
|
||||||
|
*/
|
||||||
|
CK_MECHANISM_INFO MechanismInfo = { 0 };
|
||||||
|
|
||||||
|
/* The CK_MECHANISM type contains the mechanism type, as well as a pointer
|
||||||
|
* for mechanism parameters and a CK_ULONG indicating the length of the
|
||||||
|
* parameters.
|
||||||
|
*/
|
||||||
|
CK_MECHANISM xDigestMechanism = { 0 };
|
||||||
|
|
||||||
|
/* The digest will return a hash of the known SHA-256 hash size, 32 bytes.
|
||||||
|
* Please see this page for further explanation of the SHA-256 hash.
|
||||||
|
* https://en.wikipedia.org/wiki/SHA-2
|
||||||
|
*/
|
||||||
|
CK_BYTE xDigestResult[ pkcs11SHA256_DIGEST_LENGTH ] = { 0 };
|
||||||
|
CK_ULONG ulDigestLength = pkcs11SHA256_DIGEST_LENGTH;
|
||||||
|
|
||||||
|
CK_BYTE pxKnownMessage[] = "Hello world!";
|
||||||
|
|
||||||
|
vStart( &hSession, &pxSlotId );
|
||||||
|
xResult = C_GetFunctionList( &pxFunctionList );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
configASSERT( pxFunctionList->C_GetMechanismInfo != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_DigestInit != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_DigestUpdate != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_DigestFinal != NULL );
|
||||||
|
|
||||||
|
/*************************** RSA Capabilities ***************************/
|
||||||
|
xResult = pxFunctionList->C_GetMechanismInfo( pxSlotId[ 0 ],
|
||||||
|
CKM_RSA_PKCS,
|
||||||
|
&MechanismInfo );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
|
||||||
|
/* Check to see if the slot supports signing. This capability is important
|
||||||
|
* because we want to use the Cryptoki API to sign messages, without directly
|
||||||
|
* accessing the private key. This concept will be explained further in the
|
||||||
|
* "sign_verify.c" demo, but for now we will just check that the slot has the
|
||||||
|
* capabilities we need. See https://en.wikipedia.org/wiki/Public-key_cryptography
|
||||||
|
* for more information regarding private keys and public keys.
|
||||||
|
*/
|
||||||
|
if( 0 != ( CKF_SIGN & MechanismInfo.flags ) )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "This Cryptoki library supports signing messages with RSA" \
|
||||||
|
" private keys.\r\n" ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configPRINTF( ( "This Cryptoki library does not support signing messages" \
|
||||||
|
" with RSA private keys.\r\n" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This Cryptoki library assumes that RSA private keys are 2048 bit . */
|
||||||
|
configASSERT( MechanismInfo.ulMaxKeySize >= pkcs11RSA_2048_MODULUS_BITS );
|
||||||
|
configASSERT( MechanismInfo.ulMinKeySize <= pkcs11RSA_2048_MODULUS_BITS );
|
||||||
|
|
||||||
|
/* Check for pre-padded signature verification support, this feature will
|
||||||
|
* be used in the "sign_verify.c" demo.
|
||||||
|
*/
|
||||||
|
xResult = pxFunctionList->C_GetMechanismInfo( pxSlotId[ 0 ],
|
||||||
|
CKM_RSA_X_509,
|
||||||
|
&MechanismInfo );
|
||||||
|
|
||||||
|
/* If this fails, the slot is not able to verify the signature using
|
||||||
|
* a RSA public key. Please see https://en.wikipedia.org/wiki/Public_key_infrastructure
|
||||||
|
* for more information regarding PKI (Public Key Infrastructure).
|
||||||
|
*/
|
||||||
|
if( 0 != ( CKF_VERIFY & MechanismInfo.flags ) )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "This Cryptoki library supports verifying messages with RSA" \
|
||||||
|
" public keys.\r\n" ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configPRINTF( ( "This Cryptoki library does not support verifying messages" \
|
||||||
|
" with RSA public keys.\r\n" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This Cryptoki library assumes that RSA public keys are 2048 bit . */
|
||||||
|
configASSERT( MechanismInfo.ulMaxKeySize >= pkcs11RSA_2048_MODULUS_BITS );
|
||||||
|
configASSERT( MechanismInfo.ulMinKeySize <= pkcs11RSA_2048_MODULUS_BITS );
|
||||||
|
|
||||||
|
/*************************** ECDSA Capabilities ***************************/
|
||||||
|
xResult = pxFunctionList->C_GetMechanismInfo( pxSlotId[ 0 ],
|
||||||
|
CKM_ECDSA,
|
||||||
|
&MechanismInfo );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
|
||||||
|
if( 0 != ( CKF_SIGN & MechanismInfo.flags ) )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "This Cryptoki library supports signing messages with" \
|
||||||
|
" ECDSA private keys.\r\n" ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configPRINTF( ( "This Cryptoki library does not support signing messages" \
|
||||||
|
" with ECDSA private keys.\r\n" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( 0 != ( CKF_VERIFY & MechanismInfo.flags ) )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "This Cryptoki library supports verifying messages with" \
|
||||||
|
" ECDSA public keys.\r\n" ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configPRINTF( ( "This Cryptoki library does not support verifying" \
|
||||||
|
" messages with ECDSA public keys.\r\n" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
configASSERT( MechanismInfo.ulMaxKeySize >= pkcs11ECDSA_P256_KEY_BITS );
|
||||||
|
configASSERT( MechanismInfo.ulMinKeySize <= pkcs11ECDSA_P256_KEY_BITS );
|
||||||
|
|
||||||
|
/************************** Digest Capabilities **************************/
|
||||||
|
xResult = pxFunctionList->C_GetMechanismInfo( pxSlotId[ 0 ],
|
||||||
|
CKM_SHA256,
|
||||||
|
&MechanismInfo );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
|
||||||
|
if( 0 != ( CKF_DIGEST & MechanismInfo.flags ) )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "The Cryptoki library supports the " \
|
||||||
|
"SHA-256 algorithm.\r\n" ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configPRINTF( ( "The Cryptoki library doesn't support the " \
|
||||||
|
"SHA-256 algorithm.\r\n" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/***************************** Buffer Digest *****************************/
|
||||||
|
/* Hash with SHA256 mechanism. */
|
||||||
|
xDigestMechanism.mechanism = CKM_SHA256;
|
||||||
|
|
||||||
|
/* Initializes the digest operation and sets what mechanism will be used
|
||||||
|
* for the digest. */
|
||||||
|
xResult = pxFunctionList->C_DigestInit( hSession,
|
||||||
|
&xDigestMechanism );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
|
||||||
|
|
||||||
|
/* Pass a pointer to the buffer of bytes to be hashed, and it's size. */
|
||||||
|
xResult = pxFunctionList->C_DigestUpdate( hSession,
|
||||||
|
pxKnownMessage,
|
||||||
|
/* Strip NULL Terminator. */
|
||||||
|
sizeof( pxKnownMessage ) - 1 );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
|
||||||
|
/* Retrieve the digest buffer. Since the mechanism is a SHA-256 algorithm,
|
||||||
|
* the size will always be 32 bytes. If the size cannot be known ahead of time,
|
||||||
|
* a NULL value to the second parameter pDigest, will set the third parameter,
|
||||||
|
* pulDigestLen to the number of required bytes. */
|
||||||
|
xResult = pxFunctionList->C_DigestFinal( hSession,
|
||||||
|
xDigestResult,
|
||||||
|
&ulDigestLength );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
|
||||||
|
/* This will now print out the digest of the known message. You can compare
|
||||||
|
* the hash generated by the Cryptoki library in a UNIX shell by using the
|
||||||
|
* command '$ echo -n "{pxKnownMessage}" | shasum -a 256'
|
||||||
|
* this command should generate the same hash. */
|
||||||
|
configPRINTF( ( "Known message: %s\r\n", ( char * ) pxKnownMessage ) );
|
||||||
|
configPRINTF( ( "Hash of known message using SHA256:\r\n" ) );
|
||||||
|
|
||||||
|
for( ulIndex = 0; ulIndex < ulDigestLength; ulIndex++ )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "%x", xDigestResult[ ulIndex ] ) );
|
||||||
|
}
|
||||||
|
configPRINTF( ( "\r\n" ) );
|
||||||
|
|
||||||
|
configPRINTF( ( "Finished PKCS #11 Mechanisms and Digest Demo.\r\n" ) );
|
||||||
|
vEnd( hSession, pxSlotId );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,393 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS PKCS #11 V1.0.3
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
*/
|
||||||
|
/* FreeRTOS includes. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
/* Standard include. */
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
|
/* PKCS #11 includes. */
|
||||||
|
#include "iot_pkcs11_config.h"
|
||||||
|
#include "iot_pkcs11.h"
|
||||||
|
#include "pkcs11.h"
|
||||||
|
|
||||||
|
/* mbed TLS includes. */
|
||||||
|
#include "mbedtls/pk.h"
|
||||||
|
|
||||||
|
/* Demo includes. */
|
||||||
|
#include "demo_helpers.h"
|
||||||
|
#include "pkcs11_demos.h"
|
||||||
|
|
||||||
|
/* RSA certificate that has been generated off the device.
|
||||||
|
* This key will be used as an example for importing an object onto the device.
|
||||||
|
* This is useful when the device itself cannot create credentials or for storing
|
||||||
|
* a well known CA certificate.
|
||||||
|
*/
|
||||||
|
#define pkcs11demo_RSA_CERTIFICATE \
|
||||||
|
"" \
|
||||||
|
"-----BEGIN CERTIFICATE-----\n" \
|
||||||
|
"MIIFgTCCA2mgAwIBAgIUPsOLvI1VI8EtdIZi1s2vp7sGhy8wDQYJKoZIhvcNAQEL\n" \
|
||||||
|
"BQAwTzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAldBMRAwDgYDVQQHDAdTZWF0dGxl\n" \
|
||||||
|
"MSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwIBcNMjAwNzEzMTY0\n" \
|
||||||
|
"MDUyWhgPMjEyMDA2MTkxNjQwNTJaME8xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJX\n" \
|
||||||
|
"QTEQMA4GA1UEBwwHU2VhdHRsZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQ\n" \
|
||||||
|
"dHkgTHRkMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtSrIA3Esgjtf\n" \
|
||||||
|
"5Ltk/zMaUIbdX8F3VJKyQ9L3Bu07BDNVYmSqPg7+TNvUSrVT7npYmF7TE+jKJXvW\n" \
|
||||||
|
"Lf9UUQZUb5KFf6cKkUKoZlXY3Jn3oInD9md7Yyry1z7eTrBz20UnUaTx28lqq2T8\n" \
|
||||||
|
"SzwAthMyjhHmXeFXTD+KKY7j9H73kgOH4EUme3Nrxp+z/yaSQN5Naeqp1/HBGayY\n" \
|
||||||
|
"TqFOgDlv2NXdrvKPlvBeEpWa6WoRnq7iC3jCuafO4ZUueu4hdt9tfQLXtKixLKhu\n" \
|
||||||
|
"Tjw1w7iKi88KjQhGz7gCDxCGQxWm22HgXdNEBHUctN+lUpYyMQy/dafHvUgug2YJ\n" \
|
||||||
|
"aRwN+QBL7GH6N75Mfh9t3dFTERxa1tphNeiVeqlb5/D2yY0JaqqIBUxpSsgpn/a1\n" \
|
||||||
|
"orR+XgAtMaHL0I+xwE1gdhYOWAhfcGo6vTD45b9fgERoeUC5KOUiZ2xABUV278lF\n" \
|
||||||
|
"QJ7uPwwhV+fjpwwZcum3viFnk5SUBtENhm9QGoH0KW8K43doPc7yeeaY4gxXdV1g\n" \
|
||||||
|
"im2uQ07Vk9bIm/HDYpW+tRQX7BM7o4BhqL7FbnKgfN2YcyMds+16YfugaaNJy53I\n" \
|
||||||
|
"O4640KT9NrpmJ0el+rmwb+2Ut9Ie+V7ja40V0M0hBToDWXjoIY2i9nf6rIXws76J\n" \
|
||||||
|
"A3jIMNTDLhoCT0cMcSs8zB9mqxNlbqkCAwEAAaNTMFEwHQYDVR0OBBYEFFPkZ81v\n" \
|
||||||
|
"G9lKvZv9XvKOOF0nwu8fMB8GA1UdIwQYMBaAFFPkZ81vG9lKvZv9XvKOOF0nwu8f\n" \
|
||||||
|
"MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBACjoiRIwP+mIggZ/\n" \
|
||||||
|
"PEBGqR+siV4TDDTVgUBeanLilkfKYeNEo4tapRy1Jvm2Kd/T26O2X2fTCVGG5Hpf\n" \
|
||||||
|
"KUYC9RLq7gPEytLUIlfwn0jp3uY3DotKQD03GWZ5nc0FJyhMoMH72MdoculbQ4UL\n" \
|
||||||
|
"x4CCrCvnGodXm0oXa6cEl4Do8MadU7fgRF1Bj05FD7LfDUgBGJp8pZbKiPIKLzAx\n" \
|
||||||
|
"UlMQen5PHJOke4+y2O/mL2iQshat7a5MOwJgPp1Wkn0q5kLO9AGVXbq3DD40jLrh\n" \
|
||||||
|
"b9EDVsWTa1Xu3RQV4zqHFsm3OGliwJbtO1BA6P7QFBRGMMos4xZQWjxJXbr1m+uf\n" \
|
||||||
|
"1y/X5icXdwWQ/f9h0ovjWeqOZBW8hfW6CRD1ehJpBB2YCwTjK7Fn5p4PH0PJUWf5\n" \
|
||||||
|
"rPuShvCAUy73QC/Iud4xwNQf6D9MWzOcDWvh7NPGhCHFmz4swKlN8oglMD1JaE4U\n" \
|
||||||
|
"97LLfATEYy5ajjlWoJ8qF/in8jzsYxq9OZ2/ObchZsU9ybzLRuE1Cv7v4Mx1sgH3\n" \
|
||||||
|
"EoWYZK1j3WytKmbaWYDR6INYklT/d+14OyIflUfBGiSXNKMITWVRZYjTHKUeAPdb\n" \
|
||||||
|
"1bsyMu+g4y1PVOrp/d9AyZTZrDW81zuYpO5Ah0DgF4EYiz2fWnz2ITVUmq35znIQ\n" \
|
||||||
|
"xg07nhvDeydwB48xXrPQ1KutrRyh\n" \
|
||||||
|
"-----END CERTIFICATE-----"
|
||||||
|
|
||||||
|
/* This function can be found in
|
||||||
|
* FreeRTOS/FreeRTOS-Plus/Source/FreeRTOS-Plus-PKCS11/3rdparty/mbedtls_utils/mbedtls_utils.c.
|
||||||
|
* It will be used to convert the RSA certificate from PEM format
|
||||||
|
* to DER format. */
|
||||||
|
extern int convert_pem_to_der( const unsigned char * pucInput,
|
||||||
|
size_t xLen,
|
||||||
|
unsigned char * pucOutput,
|
||||||
|
size_t * pxOlen );
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* prvObjectImporting covers how to import a RSA certificate that was
|
||||||
|
* not generated by the Cryptoki library.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void prvObjectImporting( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* prvObjectGeneration covers how to create a public key and private key pair
|
||||||
|
* with Cryptoki defined attributes using C_GenerateKeyPair.
|
||||||
|
*
|
||||||
|
* Note: The "sign-verify.c" demo has a dependency on the objects created
|
||||||
|
* in this function, and will not work without first running this function.
|
||||||
|
*/
|
||||||
|
static void prvObjectGeneration( void );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function details how to use the PKCS #11 "Object" functions to
|
||||||
|
* manage the objects abstracted by cryptoki.
|
||||||
|
*
|
||||||
|
* http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html
|
||||||
|
* please consult the standard for more information.
|
||||||
|
*
|
||||||
|
* The standard has grouped the functions presented in this demo as:
|
||||||
|
* Object Management Functions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void vPKCS11ObjectDemo( void )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "\r\nStarting PKCS #11 Objects Demo.\r\n" ) );
|
||||||
|
|
||||||
|
/* PKCS #11 defines objects as "An item that is stored on a token. May be
|
||||||
|
* data, a certificate, or a key." This demo will show how to create objects
|
||||||
|
* that are managed by Cryptoki. */
|
||||||
|
prvObjectImporting();
|
||||||
|
prvObjectGeneration();
|
||||||
|
configPRINTF( ( "\r\nFinished PKCS #11 Objects Demo.\r\n" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void prvObjectImporting( void )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "---------Importing Objects---------\r\n" ) );
|
||||||
|
configPRINTF( ( "Importing RSA Certificate...\r\n" ) );
|
||||||
|
|
||||||
|
/* Helper variables and variables that have been covered. */
|
||||||
|
CK_RV xResult = CKR_OK;
|
||||||
|
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||||
|
CK_SLOT_ID * pxSlotId = 0;
|
||||||
|
CK_FUNCTION_LIST_PTR pxFunctionList = NULL;
|
||||||
|
uint8_t * pucDerObject = NULL;
|
||||||
|
int32_t lConversionReturn = 0;
|
||||||
|
size_t xDerLen = 0;
|
||||||
|
CK_BBOOL xTokenStorage = CK_TRUE;
|
||||||
|
CK_OBJECT_HANDLE xCertHandle = CK_INVALID_HANDLE;
|
||||||
|
CK_BYTE xSubject[] = "TestSubject";
|
||||||
|
|
||||||
|
|
||||||
|
/* The PKCS11_CertificateTemplate_t is a custom struct defined in "iot_pkcs11.h"
|
||||||
|
* in order to make it easier to import a certificate. This struct will be
|
||||||
|
* populated with the parameters necessary to import the certificate into the
|
||||||
|
* Cryptoki library.
|
||||||
|
*/
|
||||||
|
PKCS11_CertificateTemplate_t xCertificateTemplate;
|
||||||
|
|
||||||
|
/* The object class is specified as a certificate to help the Cryptoki library
|
||||||
|
* parse the arguments.
|
||||||
|
*/
|
||||||
|
CK_OBJECT_CLASS xCertificateClass = CKO_CERTIFICATE;
|
||||||
|
|
||||||
|
/* The certificate type is an x509 certificate, which is the only type
|
||||||
|
* supported by this stack. To read more about x509 certificates one can
|
||||||
|
* read the following:
|
||||||
|
*
|
||||||
|
* https://en.wikipedia.org/wiki/X.509
|
||||||
|
* https://www.ssl.com/faqs/what-is-an-x-509-certificate/
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
CK_CERTIFICATE_TYPE xCertificateType = CKC_X_509;
|
||||||
|
|
||||||
|
/* The label will help the application identify which object it would like
|
||||||
|
* to access.
|
||||||
|
*/
|
||||||
|
CK_BYTE pucLabel[] = pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS;
|
||||||
|
|
||||||
|
/* Specify certificate class. */
|
||||||
|
xCertificateTemplate.xObjectClass.type = CKA_CLASS;
|
||||||
|
xCertificateTemplate.xObjectClass.pValue = &xCertificateClass;
|
||||||
|
xCertificateTemplate.xObjectClass.ulValueLen = sizeof( xCertificateClass );
|
||||||
|
|
||||||
|
/* Specify certificate subject. */
|
||||||
|
xCertificateTemplate.xSubject.type = CKA_SUBJECT;
|
||||||
|
xCertificateTemplate.xSubject.pValue = xSubject;
|
||||||
|
xCertificateTemplate.xSubject.ulValueLen = strlen( ( const char * ) xSubject );
|
||||||
|
|
||||||
|
/* Point to contents of certificate. */
|
||||||
|
xCertificateTemplate.xValue.type = CKA_VALUE;
|
||||||
|
xCertificateTemplate.xValue.pValue = ( CK_VOID_PTR ) pkcs11demo_RSA_CERTIFICATE;
|
||||||
|
xCertificateTemplate.xValue.ulValueLen = ( CK_ULONG ) sizeof( pkcs11demo_RSA_CERTIFICATE );
|
||||||
|
|
||||||
|
/* Specify certificate label. */
|
||||||
|
xCertificateTemplate.xLabel.type = CKA_LABEL;
|
||||||
|
xCertificateTemplate.xLabel.pValue = ( CK_VOID_PTR ) pucLabel;
|
||||||
|
xCertificateTemplate.xLabel.ulValueLen = strlen( ( const char * ) pucLabel );
|
||||||
|
|
||||||
|
/* Specify certificate type as x509. */
|
||||||
|
xCertificateTemplate.xCertificateType.type = CKA_CERTIFICATE_TYPE;
|
||||||
|
xCertificateTemplate.xCertificateType.pValue = &xCertificateType;
|
||||||
|
xCertificateTemplate.xCertificateType.ulValueLen = sizeof( CK_CERTIFICATE_TYPE );
|
||||||
|
|
||||||
|
/* Specify that the certificate should be on a token. */
|
||||||
|
xCertificateTemplate.xTokenObject.type = CKA_TOKEN;
|
||||||
|
xCertificateTemplate.xTokenObject.pValue = &xTokenStorage;
|
||||||
|
xCertificateTemplate.xTokenObject.ulValueLen = sizeof( xTokenStorage );
|
||||||
|
|
||||||
|
vStart( &hSession, &pxSlotId );
|
||||||
|
|
||||||
|
/* Ensure the Cryptoki library has the necessary functions implemented. */
|
||||||
|
xResult = C_GetFunctionList( &pxFunctionList );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configASSERT( pxFunctionList->C_CreateObject != NULL );
|
||||||
|
|
||||||
|
/* Convert the certificate to DER format if it was in PEM. The DER key
|
||||||
|
* should be about 3/4 the size of the PEM key, so mallocing the PEM key
|
||||||
|
* size is sufficient. */
|
||||||
|
pucDerObject = pvPortMalloc( xCertificateTemplate.xValue.ulValueLen );
|
||||||
|
configASSERT( pucDerObject != NULL );
|
||||||
|
|
||||||
|
xDerLen = xCertificateTemplate.xValue.ulValueLen;
|
||||||
|
lConversionReturn = convert_pem_to_der( xCertificateTemplate.xValue.pValue,
|
||||||
|
xCertificateTemplate.xValue.ulValueLen,
|
||||||
|
pucDerObject,
|
||||||
|
&xDerLen );
|
||||||
|
|
||||||
|
configASSERT( 0 == lConversionReturn );
|
||||||
|
|
||||||
|
/* Set the template pointers to refer to the DER converted objects. */
|
||||||
|
xCertificateTemplate.xValue.pValue = pucDerObject;
|
||||||
|
xCertificateTemplate.xValue.ulValueLen = xDerLen;
|
||||||
|
|
||||||
|
/* Create an object using the encoded client certificate. */
|
||||||
|
configPRINTF( ( "Creating x509 certificate with label: %s \r\n",
|
||||||
|
pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS ) );
|
||||||
|
|
||||||
|
/* Once the Cryptoki library has finished importing the new x509 certificate
|
||||||
|
* a CK_OBJECT_HANDLE is associated with it. The application can now use this
|
||||||
|
* to refer to the object in following operations.
|
||||||
|
*
|
||||||
|
* xCertHandle in the below example will have it's value modified to
|
||||||
|
* be the CK_OBJECT_HANDLE.
|
||||||
|
*
|
||||||
|
* Compare the hard coded x509, in PEM format, with the DER formatted
|
||||||
|
* x509 certificate that is created by the Cryptoki library, with the following
|
||||||
|
* OpenSSL command:
|
||||||
|
* "$ openssl x509 -in FreeRTOS_P11_Certificate.dat -inform der -text"
|
||||||
|
*
|
||||||
|
* See this explanation for the difference between the PEM format and the
|
||||||
|
* DER format:
|
||||||
|
* https://stackoverflow.com/questions/22743415/what-are-the-differences-between-pem-cer-and-der/22743616
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
xResult = pxFunctionList->C_CreateObject( hSession,
|
||||||
|
( CK_ATTRIBUTE_PTR ) &xCertificateTemplate,
|
||||||
|
sizeof( xCertificateTemplate ) / sizeof( CK_ATTRIBUTE ),
|
||||||
|
&xCertHandle );
|
||||||
|
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configASSERT( xCertHandle != CK_INVALID_HANDLE );
|
||||||
|
|
||||||
|
configPRINTF( ( "FreeRTOS_P11_Certificate.dat has been created in the Visual Studio" \
|
||||||
|
" Solution directory\r\n" ) );
|
||||||
|
|
||||||
|
vPortFree( pucDerObject );
|
||||||
|
vEnd( hSession, pxSlotId );
|
||||||
|
configPRINTF( ( "Finished Importing RSA Certificate.\r\n" ) );
|
||||||
|
configPRINTF( ( "---------Finished Importing Objects---------\r\n" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void prvObjectGeneration( void )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "---------Generating Objects---------\r\n" ) );
|
||||||
|
|
||||||
|
/* Helper variables. */
|
||||||
|
CK_RV xResult = CKR_OK;
|
||||||
|
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||||
|
CK_SLOT_ID * pxSlotId = 0;
|
||||||
|
CK_FUNCTION_LIST_PTR pxFunctionList = NULL;
|
||||||
|
CK_BYTE * pxDerPublicKey = NULL;
|
||||||
|
CK_ULONG ulDerPublicKeyLength = 0;
|
||||||
|
CK_BBOOL xTrue = CK_TRUE;
|
||||||
|
|
||||||
|
/* Specify the mechanism to use in the key pair generation. Mechanisms are
|
||||||
|
* previously explained in the "mechanims_and_digests.c" demo. */
|
||||||
|
CK_MECHANISM xMechanism =
|
||||||
|
{
|
||||||
|
CKM_EC_KEY_PAIR_GEN, NULL_PTR, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The EC curve used in this demo will be the named EC curve prime256v1.
|
||||||
|
* For further explanations of EC Cryptography please see the following:
|
||||||
|
* https://en.wikipedia.org/wiki/Elliptic-curve_cryptography
|
||||||
|
* https://wiki.openssl.org/index.php/Elliptic_Curve_Cryptography
|
||||||
|
*/
|
||||||
|
CK_BYTE xEcParams[] = pkcs11DER_ENCODED_OID_P256;
|
||||||
|
|
||||||
|
/* Specify the key type to be EC. */
|
||||||
|
CK_KEY_TYPE xKeyType = CKK_EC;
|
||||||
|
|
||||||
|
/* Object handles are a token specific identifier for an object. They are
|
||||||
|
* used so the application's sessions can specify which object to interact
|
||||||
|
* with. Non-zero values are valid, 0 is always invalid, and is defined as
|
||||||
|
* CK_INVALID_HANDLE
|
||||||
|
*
|
||||||
|
* The lifetime of the handle is not necessarily the same as the lifetime of
|
||||||
|
* the object.
|
||||||
|
*/
|
||||||
|
CK_OBJECT_HANDLE xPrivateKeyHandle = CK_INVALID_HANDLE;
|
||||||
|
CK_OBJECT_HANDLE xPublicKeyHandle = CK_INVALID_HANDLE;
|
||||||
|
|
||||||
|
|
||||||
|
/* Labels are application defined strings that are used to identify an
|
||||||
|
* object. It should not be NULL terminated. */
|
||||||
|
CK_BYTE pucPublicKeyLabel[] = { pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS };
|
||||||
|
CK_BYTE pucPrivateKeyLabel[] = { pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS };
|
||||||
|
|
||||||
|
/* CK_ATTTRIBUTE's contain an attribute type, a value, and the length of
|
||||||
|
* the value. An array of CK_ATTRIBUTEs is called a template. They are used
|
||||||
|
* for creating, searching, and manipulating for objects. The order of the
|
||||||
|
* template does not matter.
|
||||||
|
*
|
||||||
|
* In the below template we are creating a public key:
|
||||||
|
* Specify the key type as EC.
|
||||||
|
* The key will be able to verify a message.
|
||||||
|
* Specify the EC Curve.
|
||||||
|
* Assign a label to the object that will be created.
|
||||||
|
*/
|
||||||
|
CK_ATTRIBUTE xPublicKeyTemplate[] =
|
||||||
|
{
|
||||||
|
{ CKA_KEY_TYPE, &xKeyType, sizeof( xKeyType ) },
|
||||||
|
{ CKA_VERIFY, &xTrue, sizeof( xTrue ) },
|
||||||
|
{ CKA_EC_PARAMS, xEcParams, sizeof( xEcParams ) },
|
||||||
|
{ CKA_LABEL, pucPublicKeyLabel, sizeof( pucPublicKeyLabel ) - 1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
/* In the below template we are creating a private key:
|
||||||
|
* The key type is EC.
|
||||||
|
* The key is a token object.
|
||||||
|
* The key will be a private key.
|
||||||
|
* The key will be able to sign messages.
|
||||||
|
* Assign a label to the object that will be created.
|
||||||
|
*/
|
||||||
|
CK_ATTRIBUTE xPrivateKeyTemplate[] =
|
||||||
|
{
|
||||||
|
{ CKA_KEY_TYPE, &xKeyType, sizeof( xKeyType ) },
|
||||||
|
{ CKA_TOKEN, &xTrue, sizeof( xTrue ) },
|
||||||
|
{ CKA_PRIVATE, &xTrue, sizeof( xTrue ) },
|
||||||
|
{ CKA_SIGN, &xTrue, sizeof( xTrue ) },
|
||||||
|
{ CKA_LABEL, pucPrivateKeyLabel, sizeof( pucPrivateKeyLabel ) - 1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
vStart( &hSession, &pxSlotId );
|
||||||
|
|
||||||
|
xResult = C_GetFunctionList( &pxFunctionList );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
configPRINTF( ( "Creating private key with label: %s \r\n",
|
||||||
|
pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS ) );
|
||||||
|
configPRINTF( ( "Creating public key with label: %s \r\n",
|
||||||
|
pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS ) );
|
||||||
|
|
||||||
|
/* This function will generate a new EC private and public key pair. You can
|
||||||
|
* use " $openssl ec -inform der -in FreeRTOS_P11_Key.dat -text " to see
|
||||||
|
* the structure of the keys that were generated.
|
||||||
|
*/
|
||||||
|
xResult = pxFunctionList->C_GenerateKeyPair( hSession,
|
||||||
|
&xMechanism,
|
||||||
|
xPublicKeyTemplate,
|
||||||
|
sizeof( xPublicKeyTemplate ) / sizeof( CK_ATTRIBUTE ),
|
||||||
|
xPrivateKeyTemplate,
|
||||||
|
sizeof( xPrivateKeyTemplate ) / sizeof( CK_ATTRIBUTE ),
|
||||||
|
&xPublicKeyHandle,
|
||||||
|
&xPrivateKeyHandle );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configPRINTF( ( "FreeRTOS_P11_Key.dat has been created in the Visual Studio" \
|
||||||
|
" Solution directory\r\n" ) );
|
||||||
|
configPRINTF( ( "Extracting public key bytes...\r\n" ) );
|
||||||
|
|
||||||
|
/* Export public key as hex bytes and print the hex representation of the
|
||||||
|
* public key. */
|
||||||
|
vExportPublicKey( hSession,
|
||||||
|
xPublicKeyHandle,
|
||||||
|
&pxDerPublicKey,
|
||||||
|
&ulDerPublicKeyLength );
|
||||||
|
vWriteHexBytesToConsole( "Public Key in Hex Format",
|
||||||
|
pxDerPublicKey,
|
||||||
|
ulDerPublicKeyLength );
|
||||||
|
configPRINTF( ( "---------Finished Generating Objects---------" ) );
|
||||||
|
vEnd( hSession, pxSlotId );
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS PKCS #11 V1.0.3
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
*/
|
||||||
|
#ifndef _PKCS11_DEMOS_h_
|
||||||
|
#define _PKCS11_DEMOS_h_
|
||||||
|
|
||||||
|
/* Prototype for the PKCS #11 "Management" demo. This demo covers the various
|
||||||
|
* functions used to manage the internal state of the PKCS #11 stack, and then
|
||||||
|
* demonstrates how to generate random numbers using PKCS #11.
|
||||||
|
*/
|
||||||
|
void vPKCS11ManagementAndRNGDemo( void );
|
||||||
|
|
||||||
|
/* Prototype for the PKCS #11 "Digests" demo. This demo covers how to query
|
||||||
|
* slots for supported capabilities, and creating a message digest if the
|
||||||
|
* slot supports it.
|
||||||
|
*/
|
||||||
|
void vPKCS11MechanismsAndDigestDemo( void );
|
||||||
|
|
||||||
|
/* Prototype for the PKCS #11 "Object" demo. This demo covers objects and how
|
||||||
|
* they are defined and used within PKCS #11.
|
||||||
|
*/
|
||||||
|
void vPKCS11ObjectDemo( void );
|
||||||
|
|
||||||
|
/* Prototype for the PKCS #11 "Sign and Verify" demo. This demo covers how
|
||||||
|
* PKCS #11 can be used to sign a message, and verify the integrity of a message
|
||||||
|
* using private and public keys.
|
||||||
|
*
|
||||||
|
* This demo will also cover the "iot_pkcs11.h" functions, and how they can be
|
||||||
|
* used to make the PKCS #11 flow easier to use.
|
||||||
|
*
|
||||||
|
* Warning: This demo depends on the objects created in the objects demo.
|
||||||
|
*/
|
||||||
|
void vPKCS11SignVerifyDemo( void );
|
||||||
|
|
||||||
|
#endif /* _PKCS11_DEMOS_h_ */
|
@ -0,0 +1,367 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS PKCS #11 V1.0.3
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
*/
|
||||||
|
/* FreeRTOS includes. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
/* Standard include. */
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
|
/* PKCS #11 includes. */
|
||||||
|
#include "iot_pkcs11_config.h"
|
||||||
|
#include "iot_pkcs11.h"
|
||||||
|
#include "pkcs11.h"
|
||||||
|
#include "iot_pki_utils.h"
|
||||||
|
|
||||||
|
/* Demo includes. */
|
||||||
|
#include "demo_helpers.h"
|
||||||
|
#include "pkcs11_demos.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function details how to use the PKCS #11 "Sign and Verify" functions to
|
||||||
|
* create and interact with digital signatures.
|
||||||
|
* The functions described are all defined in
|
||||||
|
* http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html
|
||||||
|
* please consult the standard for more information regarding these functions.
|
||||||
|
*
|
||||||
|
* The standard has grouped the functions presented in this demo as:
|
||||||
|
* Object Management Functions
|
||||||
|
* Signing and MACing Functions
|
||||||
|
*/
|
||||||
|
void vPKCS11SignVerifyDemo( void )
|
||||||
|
{
|
||||||
|
/* This demo will use the generated private and public key from the
|
||||||
|
* "objects.c" demo and use them to sign and verify the integrity of a
|
||||||
|
* message digest. This demo will use concepts from all the other demos,
|
||||||
|
* and is recommended be done last.
|
||||||
|
*
|
||||||
|
* The intention of this demo is how to use PKCS #11's Crypotki API to do
|
||||||
|
* these signature operations, not to explain when and why they should be
|
||||||
|
* used. For a deeper understanding of that please read:
|
||||||
|
* https://en.wikipedia.org/wiki/Public_key_infrastructure
|
||||||
|
* https://en.wikipedia.org/wiki/Transport_Layer_Security
|
||||||
|
* https://en.wikipedia.org/wiki/Digital_signature
|
||||||
|
*/
|
||||||
|
configPRINTF( ( "\r\nStarting PKCS #11 Sign and Verify Demo.\r\n" ) );
|
||||||
|
|
||||||
|
/* Helper / previously explained variables. */
|
||||||
|
CK_RV xResult = CKR_OK;
|
||||||
|
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||||
|
CK_SLOT_ID * pxSlotId = NULL;
|
||||||
|
CK_ULONG ulSlotCount = 0;
|
||||||
|
CK_ULONG ulIndex = 0;
|
||||||
|
CK_OBJECT_HANDLE xPrivateKeyHandle = CK_INVALID_HANDLE;
|
||||||
|
CK_OBJECT_HANDLE xPublicKeyHandle = CK_INVALID_HANDLE;
|
||||||
|
CK_FUNCTION_LIST_PTR pxFunctionList = NULL;
|
||||||
|
CK_BYTE * pxDerPublicKey = NULL;
|
||||||
|
CK_ULONG ulDerPublicKeyLength = 0;
|
||||||
|
|
||||||
|
/* Digest variables. See "mechanisms_and_digests" for an explanation. */
|
||||||
|
CK_BYTE pxKnownMessage[] = { "Hello world" };
|
||||||
|
CK_BYTE xDigestResult[ pkcs11SHA256_DIGEST_LENGTH ] = { 0 };
|
||||||
|
CK_ULONG ulDigestLength = pkcs11SHA256_DIGEST_LENGTH;
|
||||||
|
CK_MECHANISM xDigestMechanism = { 0 };
|
||||||
|
|
||||||
|
/* Signing variables. */
|
||||||
|
/* The ECDSA mechanism will be used to sign the message digest. */
|
||||||
|
CK_MECHANISM xMechanism = { CKM_ECDSA, NULL, 0 };
|
||||||
|
|
||||||
|
/* This signature buffer will be used to store the signature created by the
|
||||||
|
* private key. (64 bytes). We pad it with an extra 8 bytes so it can be
|
||||||
|
* converted to an ASN.1 encoding. */
|
||||||
|
CK_BYTE xSignature[ pkcs11ECDSA_P256_SIGNATURE_LENGTH + 8 ] = { 0 };
|
||||||
|
CK_ULONG xSignatureLength = sizeof( xSignature );
|
||||||
|
|
||||||
|
/* Ensure the Cryptoki library has the necessary functions implemented. */
|
||||||
|
xResult = C_GetFunctionList( &pxFunctionList );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configASSERT( pxFunctionList->C_SignInit != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_Sign != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_FindObjectsInit != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_FindObjects != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_FindObjectsFinal != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_Login != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_InitToken != NULL );
|
||||||
|
configASSERT( pxFunctionList->C_GetTokenInfo != NULL );
|
||||||
|
|
||||||
|
/* Instead of using the vStart helper, we will use the "iot_pkcs11.h"
|
||||||
|
* functions that help wrap around some common PKCS #11 use cases.
|
||||||
|
*
|
||||||
|
* This function will:
|
||||||
|
* Initialize the PKCS #11 module if it is not already.
|
||||||
|
* Initialize a PKCS #11 session.
|
||||||
|
*/
|
||||||
|
xResult = xInitializePkcs11Session( &hSession );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configASSERT( hSession != CK_INVALID_HANDLE );
|
||||||
|
|
||||||
|
/* This function will:
|
||||||
|
* Initialize the PKCS #11 module if it is not already.
|
||||||
|
* Initialize the token to be used.
|
||||||
|
*
|
||||||
|
* Note: By default this function will always initialize the token in the
|
||||||
|
* first slot in the slot list. If it desired to use a different slot, it
|
||||||
|
* is necessary to modify the implementation of this function to use a
|
||||||
|
* different slot. */
|
||||||
|
xResult = xInitializePkcs11Token();
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
/* This function will:
|
||||||
|
* Query the Cryptoki library for the total number of slots. Malloc an array
|
||||||
|
* of slots. Then the pxSlotId and ulSlotCount variables will be updated to
|
||||||
|
* point to the slot array, and the total slot count.
|
||||||
|
*/
|
||||||
|
xResult = xGetSlotList( &pxSlotId, &ulSlotCount );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configASSERT( ulSlotCount != 0 );
|
||||||
|
configASSERT( pxSlotId != NULL );
|
||||||
|
|
||||||
|
/***************************** Find Objects *****************************/
|
||||||
|
|
||||||
|
/* This function will:
|
||||||
|
* Find an object, given it's label.
|
||||||
|
*
|
||||||
|
* This is done using the FindObjects group of functions defined as
|
||||||
|
* "Object Management Functions" in PKCS #11.
|
||||||
|
*
|
||||||
|
* This will acquire the object handle for the private key created in the
|
||||||
|
* "objects.c" demo.
|
||||||
|
*/
|
||||||
|
xResult = xFindObjectWithLabelAndClass( hSession,
|
||||||
|
pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS,
|
||||||
|
CKO_PRIVATE_KEY,
|
||||||
|
&xPrivateKeyHandle );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configASSERT( xPrivateKeyHandle != CK_INVALID_HANDLE );
|
||||||
|
|
||||||
|
/* Acquire the object handle for the public key created in the "objects.c"
|
||||||
|
* demo. */
|
||||||
|
xResult = xFindObjectWithLabelAndClass( hSession,
|
||||||
|
pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS,
|
||||||
|
CKO_PRIVATE_KEY,
|
||||||
|
&xPublicKeyHandle );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configASSERT( xPublicKeyHandle != CK_INVALID_HANDLE );
|
||||||
|
|
||||||
|
/***************************** Buffer Digest *****************************/
|
||||||
|
xDigestMechanism.mechanism = CKM_SHA256;
|
||||||
|
|
||||||
|
/* Initializes the digest operation and sets what mechanism will be used
|
||||||
|
* for the digest. */
|
||||||
|
xResult = pxFunctionList->C_DigestInit( hSession,
|
||||||
|
&xDigestMechanism );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
|
||||||
|
/* Pass a pointer to the buffer of bytes to be hashed, and it's size. */
|
||||||
|
xResult = pxFunctionList->C_DigestUpdate( hSession,
|
||||||
|
pxKnownMessage,
|
||||||
|
/* Strip NULL Terminator. */
|
||||||
|
sizeof( pxKnownMessage ) - 1 );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
|
||||||
|
/* Retrieve the digest buffer length. When passing in a NULL pointer as the
|
||||||
|
* second argument, instead of a point to a buffer, this will signal the
|
||||||
|
* Cryptoki library to fill the third parameter with the required amount of
|
||||||
|
* bytes to store the resulting digest.
|
||||||
|
*/
|
||||||
|
xResult = pxFunctionList->C_DigestFinal( hSession,
|
||||||
|
NULL,
|
||||||
|
&ulDigestLength );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
/* Since the length of a SHA-256 digest is known, we made an assumption and
|
||||||
|
* allocated the buffer originally with the known length. Assert to make sure
|
||||||
|
* we queried the length we expected. */
|
||||||
|
configASSERT( pkcs11SHA256_DIGEST_LENGTH == ulDigestLength );
|
||||||
|
|
||||||
|
/* Now that ulDigestLength contains the required byte length, retrieve the
|
||||||
|
* digest buffer.
|
||||||
|
*/
|
||||||
|
xResult = pxFunctionList->C_DigestFinal( hSession,
|
||||||
|
xDigestResult,
|
||||||
|
&ulDigestLength );
|
||||||
|
configASSERT( CKR_OK == xResult );
|
||||||
|
|
||||||
|
/********************************* Sign **********************************/
|
||||||
|
|
||||||
|
configPRINTF( ( "Signing known message:\r\n %s\r\n",
|
||||||
|
( char * ) pxKnownMessage ) );
|
||||||
|
|
||||||
|
/* Initializes the sign operation and sets what mechanism will be used
|
||||||
|
* for signing the message digest. Specify what object handle to use for this
|
||||||
|
* operation, in this case the private key object handle. */
|
||||||
|
xResult = pxFunctionList->C_SignInit( hSession,
|
||||||
|
&xMechanism,
|
||||||
|
xPrivateKeyHandle );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
/* Sign the message digest that was created with the C_Digest series of
|
||||||
|
* functions. A signature will be created using the private key specified in
|
||||||
|
* C_SignInit and put in the byte buffer xSignature. */
|
||||||
|
xResult = pxFunctionList->C_Sign( hSession,
|
||||||
|
xDigestResult,
|
||||||
|
pkcs11SHA256_DIGEST_LENGTH,
|
||||||
|
xSignature,
|
||||||
|
&xSignatureLength );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
configASSERT( xSignatureLength == pkcs11ECDSA_P256_SIGNATURE_LENGTH );
|
||||||
|
|
||||||
|
|
||||||
|
/********************************* Verify **********************************/
|
||||||
|
/* Verify the signature created by C_Sign. First we will verify that the
|
||||||
|
* same Cryptoki library was able to trust itself.
|
||||||
|
*
|
||||||
|
* C_VerifyInit will begin the verify operation, by specifying what mechanism
|
||||||
|
* to use (CKM_ECDSA, the same as the sign operation) and then specifying
|
||||||
|
* which public key handle to use.
|
||||||
|
*/
|
||||||
|
xResult = pxFunctionList->C_VerifyInit( hSession,
|
||||||
|
&xMechanism,
|
||||||
|
xPublicKeyHandle );
|
||||||
|
configASSERT( xResult == CKR_OK );
|
||||||
|
|
||||||
|
/* Given the signature and it's length, the Cryptoki will use the public key
|
||||||
|
* to verify that the signature was created by the corresponding private key.
|
||||||
|
* If C_Verify returns CKR_OK, it means that the sender of the message has
|
||||||
|
* the same private key as the private key that was used to generate the
|
||||||
|
* public key, and we can trust that the message we received was from that
|
||||||
|
* sender.
|
||||||
|
*
|
||||||
|
* Note that we are not using the actual message, but the digest that we
|
||||||
|
* created earlier of the message, for the verification.
|
||||||
|
*/
|
||||||
|
xResult = pxFunctionList->C_Verify( hSession,
|
||||||
|
xDigestResult,
|
||||||
|
pkcs11SHA256_DIGEST_LENGTH,
|
||||||
|
xSignature,
|
||||||
|
xSignatureLength );
|
||||||
|
|
||||||
|
if( xResult == CKR_OK )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "The signature of the digest was verified with the" \
|
||||||
|
" public key and can be trusted.\r\n" ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configPRINTF( ( "Unable to verify the signature with the given public" \
|
||||||
|
" key, the message cannot be trusted.\r\n" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Export public key as hex bytes and print the hex representation of the
|
||||||
|
* public key.
|
||||||
|
*
|
||||||
|
* We need to export the public key so that it can be used by a different
|
||||||
|
* device to verify messages signed by the private key of the device that
|
||||||
|
* generated the key pair.
|
||||||
|
*
|
||||||
|
* To do this, we will output the hex representation of the public key.
|
||||||
|
* Then create an empty text file called "DevicePublicKeyAsciiHex.txt".
|
||||||
|
*
|
||||||
|
* Copy and paste the hex value of the public key into this text file.
|
||||||
|
*
|
||||||
|
* Then we will need to convert the text file to binary using the xxd tool.
|
||||||
|
*
|
||||||
|
* xxd will take a text file that contains hex data and output a binary of
|
||||||
|
* the hex in the file. See "$ man xxd" for more information about xxd.
|
||||||
|
*
|
||||||
|
* Copy the below command into the terminal.
|
||||||
|
* "$ xxd -r -ps DevicePublicKeyAsciiHex.txt DevicePublicKeyDer.bin"
|
||||||
|
*
|
||||||
|
* Now that we have the binary encoding of the public key, we will convert
|
||||||
|
* it to PEM using OpenSSL.
|
||||||
|
*
|
||||||
|
* The following command will create a PEM file of the public key called
|
||||||
|
* "public_key.pem"
|
||||||
|
*
|
||||||
|
* "$ openssl ec -inform der -in DevicePublicKeyDer.bin -pubin -pubout -outform pem -out public_key.pem"
|
||||||
|
*
|
||||||
|
* Now we can use the extracted public key to verify the signature of the
|
||||||
|
* device's private key.
|
||||||
|
*
|
||||||
|
* WARNING: Running the object generation demo will create a new key pair,
|
||||||
|
* and make it necessary to redo these steps!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
configPRINTF( ( "Verifying with public key.\r\n" ) );
|
||||||
|
vExportPublicKey( hSession,
|
||||||
|
xPublicKeyHandle,
|
||||||
|
&pxDerPublicKey,
|
||||||
|
&ulDerPublicKeyLength );
|
||||||
|
vWriteHexBytesToConsole( "Public Key in Hex Format",
|
||||||
|
pxDerPublicKey,
|
||||||
|
ulDerPublicKeyLength );
|
||||||
|
|
||||||
|
/* This utility function converts the PKCS #11 signature into an ASN.1
|
||||||
|
* encoded binary der signature. This is necessary so we can export the
|
||||||
|
* signature and verify it with OpenSSL, otherwise OpenSSL will not be able
|
||||||
|
* to parse the buffer.
|
||||||
|
*
|
||||||
|
* See https://en.wikipedia.org/wiki/ASN.1 for more information about the
|
||||||
|
* ASN.1 encoding format.
|
||||||
|
*/
|
||||||
|
PKI_pkcs11SignatureTombedTLSSignature( xSignature, ( size_t * ) &xSignatureLength );
|
||||||
|
|
||||||
|
|
||||||
|
/* The following loop will output the signature in hex.
|
||||||
|
*
|
||||||
|
* In order to get the signature exported in binary form copy the output
|
||||||
|
* of the loop, and paste it to an empty text file.
|
||||||
|
*
|
||||||
|
* Then we will need to convert the text file to binary using the xxd tool.
|
||||||
|
*
|
||||||
|
* The following commands outline this process.
|
||||||
|
* Write buffer to signature.txt
|
||||||
|
* xxd will take a text file that contains hex data and output a binary of
|
||||||
|
* the hex in the file. See "$ man xxd" for more information about xxd.
|
||||||
|
*
|
||||||
|
* Copy the below command into the terminal.
|
||||||
|
* "$ xxd -r -ps signature.txt signature.bin"
|
||||||
|
*
|
||||||
|
* Next, we need to copy the original message that the Cryptoki library
|
||||||
|
* signed, the following shell command will create the message without any
|
||||||
|
* newlines, so the messages are similar.
|
||||||
|
*
|
||||||
|
* The contents of the echo command can be replaced with whatever data was
|
||||||
|
* in the known message, but the example uses "Hello world" to make it easier
|
||||||
|
* for copy and pasting.
|
||||||
|
*
|
||||||
|
* "$ echo -n "Hello world" > msg.txt"
|
||||||
|
*
|
||||||
|
* Now we will use OpenSSL to verify that the signature we created can be
|
||||||
|
* trusted by another device using the public key we created and then
|
||||||
|
* extracted earlier.
|
||||||
|
*
|
||||||
|
* "$ openssl dgst -sha256 -verify public_key.pem -signature signature.bin msg.txt"
|
||||||
|
* This command should output "Verified OK" and we then know we can trust
|
||||||
|
* the sender of the message!
|
||||||
|
*/
|
||||||
|
configPRINTF( ( "Created signature: \r\n" ) );
|
||||||
|
for( ulIndex = 0; ulIndex < xSignatureLength; ulIndex++ )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "%02x", xSignature[ ulIndex ] ) );
|
||||||
|
}
|
||||||
|
configPRINTF( ( "\r\n" ) );
|
||||||
|
|
||||||
|
configPRINTF( ( "Finished PKCS #11 Sign and Verify Demo.\r\n" ) );
|
||||||
|
}
|
@ -0,0 +1,173 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS V1.4.8
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file iot_pkcs11_config.h
|
||||||
|
* @brief PCKS#11 config options.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _IOT_PKCS11_CONFIG_H_
|
||||||
|
#define _IOT_PKCS11_CONFIG_H_
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
|
||||||
|
/**************************************************/
|
||||||
|
/******* DO NOT CHANGE the following order ********/
|
||||||
|
/**************************************************/
|
||||||
|
|
||||||
|
/* Include logging header files and define logging macros in the following order:
|
||||||
|
* 1. Include the header file "logging_levels.h".
|
||||||
|
* 2. Define the LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL macros depending on
|
||||||
|
* the logging configuration for PKCS #11.
|
||||||
|
* 3. Include the header file "logging_stack.h", if logging is enabled for PKCS #11.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "logging_levels.h"
|
||||||
|
|
||||||
|
/* Logging configuration for the PKCS #11 library. */
|
||||||
|
#ifndef LIBRARY_LOG_NAME
|
||||||
|
#define LIBRARY_LOG_NAME "PKCS11"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LIBRARY_LOG_LEVEL
|
||||||
|
#define LIBRARY_LOG_LEVEL LOG_ERROR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "logging_stack.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Malloc API used by iot_pkcs11.h
|
||||||
|
*/
|
||||||
|
#define PKCS11_MALLOC pvPortMalloc
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Free API used by iot_pkcs11.h
|
||||||
|
*/
|
||||||
|
#define PKCS11_FREE vPortFree
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief PKCS #11 default user PIN.
|
||||||
|
*
|
||||||
|
* The PKCS #11 standard specifies the presence of a user PIN. That feature is
|
||||||
|
* sensible for applications that have an interactive user interface and memory
|
||||||
|
* protections. However, since typical microcontroller applications lack one or
|
||||||
|
* both of those, the user PIN is assumed to be used herein for interoperability
|
||||||
|
* purposes only, and not as a security feature.
|
||||||
|
*
|
||||||
|
* Note: Do not cast this to a pointer! The library calls sizeof to get the length
|
||||||
|
* of this string.
|
||||||
|
*/
|
||||||
|
#define configPKCS11_DEFAULT_USER_PIN "0000"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum length (in characters) for a PKCS #11 CKA_LABEL
|
||||||
|
* attribute.
|
||||||
|
*/
|
||||||
|
#define pkcs11configMAX_LABEL_LENGTH 32
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum number of token objects that can be stored
|
||||||
|
* by the PKCS #11 module.
|
||||||
|
*/
|
||||||
|
#define pkcs11configMAX_NUM_OBJECTS 6
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum number of sessions that can be stored
|
||||||
|
* by the PKCS #11 module.
|
||||||
|
*/
|
||||||
|
#define pkcs11configMAX_SESSIONS 10
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set to 1 if a PAL destroy object is implemented.
|
||||||
|
*
|
||||||
|
* If set to 0, no PAL destroy object is implemented, and this functionality
|
||||||
|
* is implemented in the common PKCS #11 layer.
|
||||||
|
*/
|
||||||
|
#define pkcs11configPAL_DESTROY_SUPPORTED 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set to 1 if OTA image verification via PKCS #11 module is supported.
|
||||||
|
*
|
||||||
|
* If set to 0, OTA code signing certificate is built in via
|
||||||
|
* aws_ota_codesigner_certificate.h.
|
||||||
|
*/
|
||||||
|
#define pkcs11configOTA_SUPPORTED 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set to 1 if PAL supports storage for JITP certificate,
|
||||||
|
* code verify certificate, and trusted server root certificate.
|
||||||
|
*
|
||||||
|
* If set to 0, PAL does not support storage mechanism for these, and
|
||||||
|
* they are accessed via headers compiled into the code.
|
||||||
|
*/
|
||||||
|
#define pkcs11configJITP_CODEVERIFY_ROOT_CERT_SUPPORTED 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The PKCS #11 label for device private key.
|
||||||
|
*
|
||||||
|
* Private key for connection to AWS IoT endpoint. The corresponding
|
||||||
|
* public key should be registered with the AWS IoT endpoint.
|
||||||
|
*/
|
||||||
|
#define pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS "Device Priv TLS Key"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The PKCS #11 label for device public key.
|
||||||
|
*
|
||||||
|
* The public key corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS.
|
||||||
|
*/
|
||||||
|
#define pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS "Device Pub TLS Key"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The PKCS #11 label for the device certificate.
|
||||||
|
*
|
||||||
|
* Device certificate corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS.
|
||||||
|
*/
|
||||||
|
#define pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS "Device Cert"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The PKCS #11 label for the object to be used for code verification.
|
||||||
|
*
|
||||||
|
* Used by over-the-air update code to verify an incoming signed image.
|
||||||
|
*/
|
||||||
|
#define pkcs11configLABEL_CODE_VERIFICATION_KEY "Code Verify Key"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The PKCS #11 label for Just-In-Time-Provisioning.
|
||||||
|
*
|
||||||
|
* The certificate corresponding to the issuer of the device certificate
|
||||||
|
* (pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS) when using the JITR or
|
||||||
|
* JITP flow.
|
||||||
|
*/
|
||||||
|
#define pkcs11configLABEL_JITP_CERTIFICATE "JITP Cert"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The PKCS #11 label for the AWS Trusted Root Certificate.
|
||||||
|
*
|
||||||
|
* @see aws_default_root_certificates.h
|
||||||
|
*/
|
||||||
|
#define pkcs11configLABEL_ROOT_CERTIFICATE "Root Cert"
|
||||||
|
|
||||||
|
#endif /* _AWS_PKCS11_CONFIG_H_ include guard. */
|
232
FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/main.c
Normal file
232
FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/main.c
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS Kernel V10.3.0
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
*
|
||||||
|
* 1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***
|
||||||
|
* See https://www.FreeRTOS.org/pkcs11/index.html for configuration and usage instructions.
|
||||||
|
***/
|
||||||
|
|
||||||
|
/* Standard includes. */
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* Visual studio intrinsics used so the __debugbreak() function is available
|
||||||
|
* should an assert get hit. */
|
||||||
|
#include <intrin.h>
|
||||||
|
|
||||||
|
/* FreeRTOS includes. */
|
||||||
|
#include <FreeRTOS.h>
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
/* Windows Crypto includes. */
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <wincrypt.h>
|
||||||
|
#include "mbedtls/entropy.h"
|
||||||
|
|
||||||
|
/* PKCS #11 Demo includes. */
|
||||||
|
#include "demo_helpers.h"
|
||||||
|
#include "pkcs11_demo_config.h"
|
||||||
|
#include "pkcs11_demos.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Private function for starting the various PKCS #11 demos.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void prvStartPKCS11Demo( void )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "---------STARTING DEMO---------\r\n" ) );
|
||||||
|
#if ( configPKCS11_MANAGEMENT_AND_RNG_DEMO == 1 )
|
||||||
|
vPKCS11ManagementAndRNGDemo();
|
||||||
|
#endif
|
||||||
|
#if ( configPKCS11_MECHANISMS_AND_DIGESTS_DEMO == 1 )
|
||||||
|
vPKCS11MechanismsAndDigestDemo();
|
||||||
|
#endif
|
||||||
|
#if ( configPKCS11_OBJECT_DEMO == 1 )
|
||||||
|
vPKCS11ObjectDemo();
|
||||||
|
#endif
|
||||||
|
#if ( configPKCS11_SIGN_AND_VERIFY_DEMO == 1 )
|
||||||
|
vPKCS11SignVerifyDemo();
|
||||||
|
#endif
|
||||||
|
configPRINTF( ( "---------Finished DEMO---------\r\n" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
configPRINTF( ( "Creating PKCS #11 Demo Task.\r\n" ) );
|
||||||
|
BaseType_t xReturned;
|
||||||
|
TaskHandle_t xHandle = NULL;
|
||||||
|
|
||||||
|
mbedtls_threading_set_alt( aws_mbedtls_mutex_init,
|
||||||
|
aws_mbedtls_mutex_free,
|
||||||
|
aws_mbedtls_mutex_lock,
|
||||||
|
aws_mbedtls_mutex_unlock );
|
||||||
|
|
||||||
|
/* Create the PKCS #11 demo task. */
|
||||||
|
xReturned = xTaskCreate(
|
||||||
|
( TaskFunction_t ) prvStartPKCS11Demo,
|
||||||
|
"PKCS11 Demo",
|
||||||
|
configPKCS11_DEMO_STACK_SIZE,
|
||||||
|
NULL,
|
||||||
|
tskIDLE_PRIORITY + 1,
|
||||||
|
&xHandle );
|
||||||
|
configASSERT( xReturned == pdPASS );
|
||||||
|
|
||||||
|
/* Start the RTOS scheduler. */
|
||||||
|
vTaskStartScheduler();
|
||||||
|
|
||||||
|
/* If all is well, the scheduler will now be running, and the following
|
||||||
|
* line will never be reached. If the following line does execute, then
|
||||||
|
* there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||||
|
* timer tasks to be created. See the memory management section on the
|
||||||
|
* FreeRTOS web site for more details (this is standard text that is not
|
||||||
|
* really applicable to the Win32 simulator port). */
|
||||||
|
for( ; ; )
|
||||||
|
{
|
||||||
|
__debugbreak();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vLoggingPrintf( const char *pcFormat,
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
|
||||||
|
va_start( arg, pcFormat );
|
||||||
|
vprintf( pcFormat, arg );
|
||||||
|
va_end( arg );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vAssertCalled( const char * pcFile,
|
||||||
|
uint32_t ulLine )
|
||||||
|
{
|
||||||
|
volatile uint32_t ulBlockVariable = 0UL;
|
||||||
|
volatile char * pcFileName = ( volatile char * ) pcFile;
|
||||||
|
volatile uint32_t ulLineNumber = ulLine;
|
||||||
|
|
||||||
|
( void ) pcFileName;
|
||||||
|
( void ) ulLineNumber;
|
||||||
|
|
||||||
|
printf( "vAssertCalled( %s, %u\n", pcFile, ulLine );
|
||||||
|
|
||||||
|
/* Setting ulBlockVariable to a non-zero value in the debugger will allow
|
||||||
|
* this function to be exited. */
|
||||||
|
taskDISABLE_INTERRUPTS();
|
||||||
|
{
|
||||||
|
while( ulBlockVariable == 0UL )
|
||||||
|
{
|
||||||
|
__debugbreak();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taskENABLE_INTERRUPTS();
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
int mbedtls_hardware_poll( void * data,
|
||||||
|
unsigned char * output,
|
||||||
|
size_t len,
|
||||||
|
size_t * olen )
|
||||||
|
{
|
||||||
|
int lStatus = MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
|
||||||
|
HCRYPTPROV hProv = 0;
|
||||||
|
|
||||||
|
/* Unferenced parameter. */
|
||||||
|
( void ) data;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is port-specific for the Windows simulator, so just use Crypto API.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if( TRUE == CryptAcquireContextA(
|
||||||
|
&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) )
|
||||||
|
{
|
||||||
|
if( TRUE == CryptGenRandom( hProv, len, output ) )
|
||||||
|
{
|
||||||
|
lStatus = 0;
|
||||||
|
*olen = len;
|
||||||
|
}
|
||||||
|
|
||||||
|
CryptReleaseContext( hProv, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return lStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||||
|
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||||
|
* used by the Idle task. */
|
||||||
|
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||||
|
StackType_t ** ppxIdleTaskStackBuffer,
|
||||||
|
uint32_t * pulIdleTaskStackSize )
|
||||||
|
{
|
||||||
|
/* If the buffers to be provided to the Idle task are declared inside this
|
||||||
|
* function then they must be declared static - otherwise they will be allocated on
|
||||||
|
* the stack and so not exists after this function exits. */
|
||||||
|
static StaticTask_t xIdleTaskTCB;
|
||||||
|
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||||
|
|
||||||
|
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||||
|
* state will be stored. */
|
||||||
|
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||||
|
|
||||||
|
/* Pass out the array that will be used as the Idle task's stack. */
|
||||||
|
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||||
|
|
||||||
|
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||||
|
* Note that, as the array is necessarily of type StackType_t,
|
||||||
|
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||||
|
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||||
|
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||||
|
* to provide the memory that is used by the Timer service task. */
|
||||||
|
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||||
|
StackType_t ** ppxTimerTaskStackBuffer,
|
||||||
|
uint32_t * pulTimerTaskStackSize )
|
||||||
|
{
|
||||||
|
/* If the buffers to be provided to the Timer task are declared inside this
|
||||||
|
* function then they must be declared static - otherwise they will be allocated on
|
||||||
|
* the stack and so not exists after this function exits. */
|
||||||
|
static StaticTask_t xTimerTaskTCB;
|
||||||
|
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||||
|
|
||||||
|
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||||
|
* task's state will be stored. */
|
||||||
|
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||||
|
|
||||||
|
/* Pass out the array that will be used as the Timer task's stack. */
|
||||||
|
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||||
|
|
||||||
|
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||||
|
* Note that, as the array is necessarily of type StackType_t,
|
||||||
|
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||||
|
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* FreeRTOS PKCS #11 V1.0.3
|
||||||
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* http://aws.amazon.com/freertos
|
||||||
|
* http://www.FreeRTOS.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PKCS11_DEMO_CONFIG_
|
||||||
|
#define _PKCS11_DEMO_CONFIG_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief this macro defines the stack size for the PKCS #11 demo task.
|
||||||
|
*/
|
||||||
|
#define configPKCS11_DEMO_STACK_SIZE 200
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief set this macro to "1" in order to run the PKCS #11 management and
|
||||||
|
* random number generator demo.
|
||||||
|
*/
|
||||||
|
#define configPKCS11_MANAGEMENT_AND_RNG_DEMO 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief set this macro to "1" in order to run the PKCS #11 mechanisms and
|
||||||
|
* digest demo.
|
||||||
|
*/
|
||||||
|
#define configPKCS11_MECHANISMS_AND_DIGESTS_DEMO 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief set this macro to "1" in order to run the PKCS #11 object demo.
|
||||||
|
*/
|
||||||
|
#define configPKCS11_OBJECT_DEMO 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief set this macro to "1" in order to run the PKCS #11 sign and verify
|
||||||
|
* demo.
|
||||||
|
*
|
||||||
|
* @warning This demo relies on the objects created in the object demo.
|
||||||
|
*/
|
||||||
|
#define configPKCS11_SIGN_AND_VERIFY_DEMO 0
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
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
|
1
FreeRTOS-Plus/Source/corePKCS11
Submodule
1
FreeRTOS-Plus/Source/corePKCS11
Submodule
Submodule FreeRTOS-Plus/Source/corePKCS11 added at 66720bea59
Reference in New Issue
Block a user