Move corePKCS11 forward and update to latest core_pkcs11.h (#441)

* Move corePKCS11 forward.
* Update licenses.
* strip NULL terminator.
* Add threading_alt.h
* Use github link.

Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
pull/450/head^2
Carl Lundin 4 years ago committed by GitHub
parent 353d2ef35b
commit 492ac6edb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
/*
* FreeRTOS V1.4.8
* FreeRTOS V202011.00
* 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
@ -19,11 +19,11 @@
* 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
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/**
* @file core_pkcs11_config.h
* @brief PCKS#11 config options.

@ -58,7 +58,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\FreeRTOS-Plus\Source\Utilities\logging;..\..\..\FreeRTOS-Plus\Source\corePKCS11\source\include;..\..\..\FreeRTOS-Plus\Source\corePKCS11\source\portable\mbedtls\include;..\..\..\FreeRTOS-Plus\Source\corePKCS11\source\dependency\3rdparty\pkcs11;..\..\ThirdParty\mbedtls\include;..\..\..\FreeRTOS-Plus\Source\corePKCS11\source\dependency\3rdparty\mbedtls_utils;..\..\..\FreeRTOS\Source\include;..\..\..\FreeRTOS\Source\portable\MSVC-MingW;examples;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\FreeRTOS-Plus\Source\Utilities\logging;..\..\..\FreeRTOS-Plus\Source\corePKCS11\source\include;..\..\..\FreeRTOS-Plus\Source\corePKCS11\source\dependency\3rdparty\pkcs11;..\..\ThirdParty\mbedtls\include;..\..\..\FreeRTOS-Plus\Source\corePKCS11\source\dependency\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>
@ -358,7 +358,7 @@
<ClInclude Include="..\..\Source\corePKCS11\source\include\core_pkcs11.h" />
<ClInclude Include="..\..\Source\corePKCS11\source\include\core_pkcs11_pal.h" />
<ClInclude Include="..\..\Source\corePKCS11\source\include\core_pki_utils.h" />
<ClInclude Include="..\..\Source\corePKCS11\source\portable\mbedtls\threading_alt.h" />
<ClInclude Include="threading_alt.h" />
<ClInclude Include="aws_mbedtls_config.h" />
<ClInclude Include="examples\demo_helpers.h" />
<ClInclude Include="examples\pkcs11_demos.h" />

@ -412,8 +412,8 @@
<ClInclude Include="..\..\Source\corePKCS11\source\include\core_pki_utils.h">
<Filter>corePKCS11\include</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\corePKCS11\source\portable\mbedtls\threading_alt.h">
<Filter>corePKCS11\include</Filter>
<ClInclude Include="threading_alt.h">
<Filter>examples</Filter>
</ClInclude>
<ClInclude Include="..\..\ThirdParty\mbedtls\include\mbedtls\aes.h">
<Filter>3rdparty\mbedtls\include</Filter>
@ -707,4 +707,4 @@
<Filter>3rdparty\mbedtls</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>

@ -1,5 +1,5 @@
/*
* FreeRTOS V1.4.8
* FreeRTOS V202011.00
* 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
@ -19,8 +19,9 @@
* 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
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/**

@ -1,5 +1,5 @@
/*
* FreeRTOS PKCS #11 V1.0.3
* FreeRTOS V202011.00
* 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
@ -19,8 +19,9 @@
* 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
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/* FreeRTOS includes. */

@ -1,5 +1,5 @@
/*
* FreeRTOS PKCS #11 V1.0.3
* FreeRTOS V202011.00
* 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
@ -19,9 +19,11 @@
* 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
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef _DEMO_HELPER_FUNCTIONS_
#define _DEMO_HELPER_FUNCTIONS_

@ -1,5 +1,5 @@
/*
* FreeRTOS PKCS #11 V1.0.3
* FreeRTOS V202011.00
* 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
@ -19,9 +19,11 @@
* 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
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"

@ -1,5 +1,5 @@
/*
* FreeRTOS PKCS #11 V1.0.3
* FreeRTOS V202011.00
* 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
@ -19,9 +19,11 @@
* 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
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"

@ -1,5 +1,5 @@
/*
* FreeRTOS PKCS #11 V1.0.3
* FreeRTOS V202011.00
* 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
@ -19,9 +19,11 @@
* 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
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
@ -185,17 +187,17 @@ static void prvObjectImporting( void )
/* Specify certificate subject. */
xCertificateTemplate.xSubject.type = CKA_SUBJECT;
xCertificateTemplate.xSubject.pValue = xSubject;
xCertificateTemplate.xSubject.ulValueLen = strlen( ( const char * ) xSubject );
xCertificateTemplate.xSubject.ulValueLen = sizeof( xSubject ) - 1UL;
/* 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 );
xCertificateTemplate.xValue.ulValueLen = ( CK_ULONG ) sizeof( pkcs11demo_RSA_CERTIFICATE ) - 1UL;
/* Specify certificate label. */
xCertificateTemplate.xLabel.type = CKA_LABEL;
xCertificateTemplate.xLabel.pValue = ( CK_VOID_PTR ) pucLabel;
xCertificateTemplate.xLabel.ulValueLen = strlen( ( const char * ) pucLabel );
xCertificateTemplate.xLabel.ulValueLen = sizeof( pucLabel ) - 1UL;
/* Specify certificate type as x509. */
xCertificateTemplate.xCertificateType.type = CKA_CERTIFICATE_TYPE;

@ -1,5 +1,5 @@
/*
* FreeRTOS PKCS #11 V1.0.3
* FreeRTOS V202011.00
* 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
@ -19,9 +19,11 @@
* 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
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef _PKCS11_DEMOS_h_
#define _PKCS11_DEMOS_h_

@ -1,5 +1,5 @@
/*
* FreeRTOS PKCS #11 V1.0.3
* FreeRTOS V202011.00
* 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
@ -19,9 +19,11 @@
* 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
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
@ -151,6 +153,7 @@ void vPKCS11SignVerifyDemo( void )
*/
xResult = xFindObjectWithLabelAndClass( hSession,
pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS,
sizeof( pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS ) - 1UL,
CKO_PRIVATE_KEY,
&xPrivateKeyHandle );
configASSERT( xResult == CKR_OK );
@ -160,6 +163,7 @@ void vPKCS11SignVerifyDemo( void )
* demo. */
xResult = xFindObjectWithLabelAndClass( hSession,
pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS,
sizeof( pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS ) - 1UL,
CKO_PRIVATE_KEY,
&xPublicKeyHandle );
configASSERT( xResult == CKR_OK );

@ -1,5 +1,5 @@
/*
* FreeRTOS PKCS #11 V1.0.3
* FreeRTOS V202011.00
* 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
@ -19,8 +19,9 @@
* 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
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef _PKCS11_DEMO_CONFIG_

@ -0,0 +1,50 @@
/*
* FreeRTOS V202011.00
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef __THREADING_ALT_H__
#define __THREADING_ALT_H__
#include "FreeRTOS.h"
#include "semphr.h"
/**
* @brief Mutex struct used to synchronize mbed TLS operations.
*
*/
typedef struct
{
SemaphoreHandle_t mutex; /**< @brief FreeRTOS semaphore. */
char is_valid; /**< @brief Flag used by mbedTLS to track wether a mutex is valid. */
} mbedtls_threading_mutex_t;
extern void mbedtls_threading_set_alt( void ( * mutex_init )( mbedtls_threading_mutex_t * ),
void ( * mutex_free )( mbedtls_threading_mutex_t * ),
int ( * mutex_lock )( mbedtls_threading_mutex_t * ),
int ( * mutex_unlock )( mbedtls_threading_mutex_t * ) );
#endif /* ifndef __THREADING_ALT_H__ */

@ -517,6 +517,7 @@ static CK_RV readCertificateIntoContext( SSLContext_t * pSslContext,
/* Get the handle of the certificate. */
xResult = xFindObjectWithLabelAndClass( pSslContext->xP11Session,
pcLabelName,
strlen( pcLabelName ),
xClass,
&xCertObj );
@ -630,6 +631,7 @@ static CK_RV initializeClientKeys( SSLContext_t * pxCtx )
/* Get the handle of the device private key. */
xResult = xFindObjectWithLabelAndClass( pxCtx->xP11Session,
pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS,
sizeof( pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS ) - 1UL,
CKO_PRIVATE_KEY,
&pxCtx->xP11PrivateKey );
}

@ -1 +1 @@
Subproject commit 40bef76639fc5e85a7ec188a31a45cf72d5fb6a0
Subproject commit d35a8f041fa335a1661ad0a523c44f4c967fa492
Loading…
Cancel
Save