Skip to content

Commit ec12e17

Browse files
authored
Move PKCS FreeRTOS#11 Mutual Auth Demo from LTS Dev branch (FreeRTOS#338)
Move the PKCS FreeRTOS#11 Mutual Auth demo from the LTS development branch. Remove left over and unused mbed TLS contexts.
1 parent 56d44da commit ec12e17

File tree

15 files changed

+3491
-16
lines changed

15 files changed

+3491
-16
lines changed

FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/DemoTasks/MutualAuthMQTTExample.c

Lines changed: 701 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
/*
2+
* FreeRTOS Kernel V10.3.0
3+
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
* this software and associated documentation files (the "Software"), to deal in
7+
* the Software without restriction, including without limitation the rights to
8+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
* the Software, and to permit persons to whom the Software is furnished to do so,
10+
* subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
* http://www.FreeRTOS.org
23+
* http://aws.amazon.com/freertos
24+
*/
25+
26+
#ifndef FREERTOS_CONFIG_H
27+
#define FREERTOS_CONFIG_H
28+
29+
/*-----------------------------------------------------------
30+
* Application specific definitions.
31+
*
32+
* These definitions should be adjusted for your particular hardware and
33+
* application requirements.
34+
*
35+
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
36+
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
37+
* http://www.freertos.org/a00110.html
38+
*
39+
* The bottom of this file contains some constants specific to running the UDP
40+
* stack in this demo. Constants specific to FreeRTOS+TCP itself (rather than
41+
* the demo) are contained in FreeRTOSIPConfig.h.
42+
*----------------------------------------------------------*/
43+
#define configUSE_PREEMPTION 1
44+
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
45+
#define configMAX_PRIORITIES ( 7 )
46+
#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. */
47+
#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. */
48+
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2048U * 1024U ) )
49+
#define configMAX_TASK_NAME_LEN ( 15 )
50+
#define configUSE_TRACE_FACILITY 0
51+
#define configUSE_16_BIT_TICKS 0
52+
#define configIDLE_SHOULD_YIELD 1
53+
#define configUSE_CO_ROUTINES 0
54+
#define configUSE_MUTEXES 1
55+
#define configUSE_RECURSIVE_MUTEXES 1
56+
#define configQUEUE_REGISTRY_SIZE 0
57+
#define configUSE_APPLICATION_TASK_TAG 0
58+
#define configUSE_COUNTING_SEMAPHORES 1
59+
#define configUSE_ALTERNATIVE_API 0
60+
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
61+
#define configENABLE_BACKWARD_COMPATIBILITY 1
62+
#define configSUPPORT_STATIC_ALLOCATION 1
63+
64+
/* Hook function related definitions. */
65+
#define configUSE_TICK_HOOK 0
66+
#define configUSE_IDLE_HOOK 0
67+
#define configUSE_MALLOC_FAILED_HOOK 0
68+
#define configCHECK_FOR_STACK_OVERFLOW 0 /* Not applicable to the Win32 port. */
69+
70+
/* Software timer related definitions. */
71+
#define configUSE_TIMERS 1
72+
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
73+
#define configTIMER_QUEUE_LENGTH 5
74+
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
75+
76+
/* Event group related definitions. */
77+
#define configUSE_EVENT_GROUPS 1
78+
79+
/* Run time stats gathering configuration options. */
80+
#define configGENERATE_RUN_TIME_STATS 0
81+
82+
/* Co-routine definitions. */
83+
#define configUSE_CO_ROUTINES 0
84+
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
85+
86+
/* Set the following definitions to 1 to include the API function, or zero
87+
* to exclude the API function. */
88+
#define INCLUDE_vTaskPrioritySet 1
89+
#define INCLUDE_uxTaskPriorityGet 1
90+
#define INCLUDE_vTaskDelete 1
91+
#define INCLUDE_vTaskCleanUpResources 0
92+
#define INCLUDE_vTaskSuspend 1
93+
#define INCLUDE_vTaskDelayUntil 1
94+
#define INCLUDE_vTaskDelay 1
95+
#define INCLUDE_uxTaskGetStackHighWaterMark 1
96+
#define INCLUDE_xTaskGetSchedulerState 1
97+
#define INCLUDE_xTimerGetTimerTaskHandle 0
98+
#define INCLUDE_xTaskGetIdleTaskHandle 0
99+
#define INCLUDE_xQueueGetMutexHolder 1
100+
#define INCLUDE_eTaskGetState 1
101+
#define INCLUDE_xEventGroupSetBitsFromISR 1
102+
#define INCLUDE_xTimerPendFunctionCall 1
103+
#define INCLUDE_pcTaskGetTaskName 1
104+
105+
/* This demo makes use of one or more example stats formatting functions. These
106+
* format the raw data provided by the uxTaskGetSystemState() function in to human
107+
* readable ASCII form. See the notes in the implementation of vTaskList() within
108+
* FreeRTOS/Source/tasks.c for limitations. configUSE_STATS_FORMATTING_FUNCTIONS
109+
* is set to 2 so the formatting functions are included without the stdio.h being
110+
* included in tasks.c. That is because this project defines its own sprintf()
111+
* functions. */
112+
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
113+
114+
/* Assert call defined for debug builds. */
115+
#ifdef _DEBUG
116+
extern void vAssertCalled( const char * pcFile,
117+
uint32_t ulLine );
118+
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
119+
#endif /* _DEBUG */
120+
121+
122+
123+
/* Application specific definitions follow. **********************************/
124+
125+
/* Only used when running in the FreeRTOS Windows simulator. Defines the
126+
* priority of the task used to simulate Ethernet interrupts. */
127+
#define configMAC_ISR_SIMULATOR_PRIORITY ( configMAX_PRIORITIES - 1 )
128+
129+
/* This demo creates a virtual network connection by accessing the raw Ethernet
130+
* or WiFi data to and from a real network connection. Many computers have more
131+
* than one real network port, and configNETWORK_INTERFACE_TO_USE is used to tell
132+
* the demo which real port should be used to create the virtual port. The ports
133+
* available are displayed on the console when the application is executed. For
134+
* example, on my development laptop setting configNETWORK_INTERFACE_TO_USE to 4
135+
* results in the wired network being used, while setting
136+
* configNETWORK_INTERFACE_TO_USE to 2 results in the wireless network being
137+
* used. */
138+
#define configNETWORK_INTERFACE_TO_USE 1L
139+
140+
/* The address to which logging is sent should UDP logging be enabled. */
141+
#define configUDP_LOGGING_ADDR0 192
142+
#define configUDP_LOGGING_ADDR1 168
143+
#define configUDP_LOGGING_ADDR2 0
144+
#define configUDP_LOGGING_ADDR3 11
145+
146+
/* Default MAC address configuration. The demo creates a virtual network
147+
* connection that uses this MAC address by accessing the raw Ethernet/WiFi data
148+
* to and from a real network connection on the host PC. See the
149+
* configNETWORK_INTERFACE_TO_USE definition above for information on how to
150+
* configure the real network connection to use. */
151+
#define configMAC_ADDR0 0x00
152+
#define configMAC_ADDR1 0x11
153+
#define configMAC_ADDR2 0x11
154+
#define configMAC_ADDR3 0x11
155+
#define configMAC_ADDR4 0x11
156+
#define configMAC_ADDR5 0x41
157+
158+
/* Default IP address configuration. Used in ipconfigUSE_DNS is set to 0, or
159+
* ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
160+
#define configIP_ADDR0 10
161+
#define configIP_ADDR1 10
162+
#define configIP_ADDR2 10
163+
#define configIP_ADDR3 200
164+
165+
/* Default gateway IP address configuration. Used in ipconfigUSE_DNS is set to
166+
* 0, or ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
167+
#define configGATEWAY_ADDR0 10
168+
#define configGATEWAY_ADDR1 10
169+
#define configGATEWAY_ADDR2 10
170+
#define configGATEWAY_ADDR3 1
171+
172+
/* Default DNS server configuration. OpenDNS addresses are 208.67.222.222 and
173+
* 208.67.220.220. Used in ipconfigUSE_DNS is set to 0, or ipconfigUSE_DNS is set
174+
* to 1 but a DNS server cannot be contacted.*/
175+
#define configDNS_SERVER_ADDR0 208
176+
#define configDNS_SERVER_ADDR1 67
177+
#define configDNS_SERVER_ADDR2 222
178+
#define configDNS_SERVER_ADDR3 222
179+
180+
/* Default netmask configuration. Used in ipconfigUSE_DNS is set to 0, or
181+
* ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
182+
#define configNET_MASK0 255
183+
#define configNET_MASK1 0
184+
#define configNET_MASK2 0
185+
#define configNET_MASK3 0
186+
187+
/* The UDP port to which print messages are sent. */
188+
#define configPRINT_PORT ( 15000 )
189+
190+
/* Task pool definitions for the demos of IoT Libraries. */
191+
#define configTASKPOOL_ENABLE_ASSERTS 1
192+
#define configTASKPOOL_NUMBER_OF_WORKERS 1
193+
#define configTASKPOOL_WORKER_PRIORITY tskIDLE_PRIORITY
194+
#define configTASKPOOL_WORKER_STACK_SIZE_BYTES 2048
195+
196+
#if ( defined( _MSC_VER ) && ( _MSC_VER <= 1600 ) && !defined( snprintf ) )
197+
/* Map to Windows names. */
198+
#define snprintf _snprintf
199+
#define vsnprintf _vsnprintf
200+
#endif
201+
202+
/* Visual studio does not have an implementation of strcasecmp(). */
203+
#define strcasecmp _stricmp
204+
#define strncasecmp _strnicmp
205+
#define strcmpi _strcmpi
206+
207+
/* Prototype for the function used to print out. In this case it prints to the
208+
* console before the network is connected then a UDP port after the network has
209+
* connected. */
210+
extern void vLoggingPrintf( const char * pcFormatString,
211+
... );
212+
#define configPRINTF( X ) vLoggingPrintf X
213+
214+
#endif /* FREERTOS_CONFIG_H */

0 commit comments

Comments
 (0)