This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC2745R10-Q1:关于 CryptoKeyStore_PSA 示例代码

Guru**** 2325560 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1497949/cc2745r10-q1-about-cryptokeykeystore_psa-sample-code

器件型号:CC2745R10-Q1

工具/软件:

我已经从 SDK 中执行了以下示例程序、但它在 ExceptionArmV8m.c 处停止于 exception_handlerSpin

具体而言、在 vListInsert() 中似乎发生了错误 list.c

您能否就此问题提供任何解决方案或解决方法?

此 代码是 CryptoKeyStore_PSA 和  empty.c 中示例代码的组合

SDK 版本为8.40.02.01

#include <unistd.h>
#include <stdint.h>
#include <stddef.h>

/* Driver Header files */
#include <ti/drivers/GPIO.h>
// #include <ti/drivers/I2C.h>
// #include <ti/drivers/SPI.h>
// #include <ti/drivers/Watchdog.h>

#include <ti/drivers/cryptoutils/cryptokey/CryptoKeyKeyStore_PSA.h>
#include <ti/drivers/cryptoutils/cryptokey/CryptoKeyKeyStore_PSA_helpers.h>

/* Driver configuration */
#include "ti_drivers_config.h"

/*
 *  ======== mainThread ========
 */
void *mainThread(void *arg0)
{

    uint8_t keyingMaterial[16] = {0x1f, 0x8e, 0x49, 0x73, 0x95, 0x3f, 0x3f, 0xb0,
                                  0xbd, 0x6b, 0x16, 0x66, 0x2e, 0x9a, 0x3c, 0x17};
    CryptoKey cryptoKey;
    KeyStore_PSA_KeyFileId keyID;
    int_fast16_t status;
    KeyStore_PSA_KeyAttributes attributes = KEYSTORE_PSA_KEY_ATTRIBUTES_INIT;
    // Assign key attributes
    KeyStore_PSA_setKeyUsageFlags(&attributes, (KEYSTORE_PSA_KEY_USAGE_DECRYPT | KEYSTORE_PSA_KEY_USAGE_ENCRYPT));
    KeyStore_PSA_setKeyAlgorithm(&attributes, KEYSTORE_PSA_ALG_CCM);
    KeyStore_PSA_setKeyType(&attributes, KEYSTORE_PSA_KEY_TYPE_AES);
    KeyStore_PSA_setKeyLifetime(&attributes, KEYSTORE_PSA_KEY_LIFETIME_PERSISTENT);
    // Set key ID
    GET_KEY_ID(keyID, KEYSTORE_PSA_KEY_ID_USER_MIN);
    KeyStore_PSA_setKeyId(&attributes, keyID);
    // Import the keyingMaterial
    status = KeyStore_PSA_importKey(&attributes, keyingMaterial, sizeof(keyingMaterial), &keyID);
    if (status != KEYSTORE_PSA_STATUS_SUCCESS)
    {
         // Handle error
    }
    // Initialize cryptoKey for crypto operations
    KeyStore_PSA_initKey(&cryptoKey, keyID, sizeof(keyingMaterial), NULL);
    // Use the cryptoKey for AESCCM operations
    // Destroy key after use
    status = KeyStore_PSA_destroyKey(keyID);
    if (status != KEYSTORE_PSA_STATUS_SUCCESS)
    {
         // Handle error
    }


    while (1)
    {
    }
}

此致、