diff options
author | Shivangi <66447522+gshvang@users.noreply.github.com> | 2021-07-16 16:30:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-16 16:30:09 -0700 |
commit | a9c27ccdac99ee5d5991298720066d6480ca4671 (patch) | |
tree | 966739ecde0f4bd8c663762e8b37feb5bb06b488 | |
parent | 2fedeff3328346fcd97e8b8e68176e62a1ed7ff9 (diff) | |
download | freertos-git-a9c27ccdac99ee5d5991298720066d6480ca4671.tar.gz |
[P3] Update corePKCS11 demo to read the public key (#652)
* PKCS11 fix
4 files changed, 14 insertions, 4 deletions
diff --git a/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/aws_mbedtls_config.h b/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/aws_mbedtls_config.h index 24df60316..002ccce7a 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/aws_mbedtls_config.h +++ b/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/aws_mbedtls_config.h @@ -2137,7 +2137,7 @@ extern void vPortFree( void *pv ); * Requires: MBEDTLS_AES_C or MBEDTLS_DES_C * */ -//#define MBEDTLS_CMAC_C +#define MBEDTLS_CMAC_C /** * \def MBEDTLS_CTR_DRBG_C diff --git a/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/core_pkcs11_config.h b/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/core_pkcs11_config.h index 19b035166..fdcaf50f0 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/core_pkcs11_config.h +++ b/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/core_pkcs11_config.h @@ -140,6 +140,16 @@ extern void vLoggingPrintf( const char * pcFormatString, #define pkcs11configJITP_CODEVERIFY_ROOT_CERT_SUPPORTED 0 /** + * @brief The PKCS #11 label for the object to be used for HMAC operations. + */ +#define pkcs11configLABEL_HMAC_KEY "HMAC Key" + +/** + * @brief The PKCS #11 label for the object to be used for CMAC operations. + */ +#define pkcs11configLABEL_CMAC_KEY "CMAC Key" + +/** * @brief The PKCS #11 label for device private key. * * Private key for connection to AWS IoT endpoint. The corresponding diff --git a/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/examples/objects.c b/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/examples/objects.c index 5b4769943..9ac8258c9 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/examples/objects.c +++ b/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/examples/objects.c @@ -316,8 +316,8 @@ static void prvObjectGeneration( void ) /* 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_BYTE pucPublicKeyLabel[] = { pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS }; + CK_BYTE pucPrivateKeyLabel[] = { pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS }; /* CK_ATTRIBUTE'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 diff --git a/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/examples/sign_and_verify.c b/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/examples/sign_and_verify.c index 728d9f944..27ce70750 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/examples/sign_and_verify.c +++ b/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/examples/sign_and_verify.c @@ -164,7 +164,7 @@ void vPKCS11SignVerifyDemo( void ) xResult = xFindObjectWithLabelAndClass( hSession, pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS, sizeof( pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS ) - 1UL, - CKO_PRIVATE_KEY, + CKO_PUBLIC_KEY, &xPublicKeyHandle ); configASSERT( xResult == CKR_OK ); configASSERT( xPublicKeyHandle != CK_INVALID_HANDLE ); |