Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
Hi,
Here are my software and hardware versions:
LP-EM-CC2745R10-Q1
simplelink_lowpower_f3_sdk_8_40_00_61
CCS Version: 20.0.2.5__1.6.2
I tested the HSM functionality in the f3 sdk based on the examples\rtos\LP_EM_CC2745R10_Q1\ble5stack\basic_ble routine, and I have tested that AES-CBC/AES-GCM can work properly. But when I add the ECDH test, I keep getting ECDH_open() return NULL. I have tried to find out relevant problems on the forum, and made modifications such as add the Predefined Symbols "DeviceFamily_CC27XX" and "USE_HSM", but they still haven't been solved. Can you help me see what's causing it?
Here is my function, I deleted the function inside the thread and just ran my own test function
static const char ecdh_msg[] = "\n\n\rECDH Open fail";
static void ECDH_Test(void)
{
ECDH_Handle ecdhHandle;
ECDH_Params ecdhParams;
CryptoKey myPrivateKey;
CryptoKey myPublicKey;
CryptoKey theirPublicKey;
CryptoKey theirPrivateKey;
CryptoKey mysharedSecret;
CryptoKey theirsharedSecret;
CryptoKey symmetricKey;
int_fast16_t operationResult;
ECDH_OperationGeneratePublicKey operationGeneratePublicKey;
ECDH_OperationComputeSharedSecret operationComputeSharedSecret;
ECDH_init();
ECDH_Params_init(&ecdhParams);
ecdhParams.returnBehavior = ECDH_RETURN_BEHAVIOR_BLOCKING;
ecdhHandle = ECDH_open(CONFIG_ECDH0, &ecdhParams);
if (!ecdhHandle)
{
printMessage(uart, (char *)ecdh_msg, NULL, 0);
while(1);
}
// CryptoKeyPlaintextHSM_initKey(&myPrivateKey, myPrivateKeyingMaterial, sizeof(myPrivateKeyingMaterial));
// CryptoKeyPlaintextHSM_initBlankKey(&myPublicKey, myPublicKeyingMaterial, sizeof(myPublicKeyingMaterial));
// ECDH_OperationGeneratePublicKey_init(&operationGeneratePublicKey);
// operationGeneratePublicKey.curve = &ECCParams_Curve25519;
// operationGeneratePublicKey.myPrivateKey = &myPrivateKey;
// operationGeneratePublicKey.myPublicKey = &myPublicKey;
// // If generating public key in little-endian format, we use the following format:
// operationGeneratePublicKey.keyMaterialEndianness = ECDH_LITTLE_ENDIAN_KEY;
// //generate my pub-key
// operationResult = ECDH_generatePublicKey(ecdhHandle, &operationGeneratePublicKey);
// if (operationResult != ECDH_STATUS_SUCCESS)
// {
// printMessage(uart, (char *)ecdh_msg2, NULL, 0);
// // Handle error
// }
// printMessage(uart, (char *)promptClearText, (char *)myPublicKeyingMaterial, sizeof(myPublicKeyingMaterial));
// printBanner(uart, (char *)"*");
}
void App_StackInitDoneHandler(gapDeviceInitDoneEvent_t *deviceInitDoneData)
{
bStatus_t status = SUCCESS;
GPIO_init();
GPIO_setConfig(CONFIG_GPIO_LED_GREEN, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(CONFIG_GPIO_LED_RED, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_write( CONFIG_GPIO_LED_GREEN, CONFIG_LED_ON );
GPIO_write( CONFIG_GPIO_LED_RED, CONFIG_LED_ON );
UART2_Params_init(&uartParams);
uartParams.baudRate = 115200;
uart = UART2_open(CONFIG_UART2_0, &uartParams);
if (uart == NULL)
{
/* UART2_open() failed */
while (1) {}
}
char array[] = "example start !! \r\n";
printClearText(uart,array,NULL,0);
// AES_CBC_Test();
// AES_GCM_Test();
ECDH_Test();
}