Persistent Key Storage build problems (Kconfig and/or files not found)

I'm having trouble getting persistent key storage to work properly on my NRF52(832)DK.

I'm currently running the AES-GCM example successfully, but it only works if the key lifetime is set like so:

psa_set_key_lifetime(&key_attributes, PSA_KEY_LIFETIME_VOLATILE);

If I set that to PSA_KEY_LIFETIME_VOLATILE, I get error -134 due to MBEDTLS_PSA_CRYPTO_STORAGE_C not being enabled.

When I add CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C=y to the conf file, I get this error during compilation:

oberon/psa/core/library/psa_crypto_storage.c:35:10: fatal error: psa/error.h: No such file or directory

I've looked a number of Q&A items and compared my config and code to the Persistent Key Storage example, which has CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C and CONFIG_PSA_NATIVE_ITS=y, but the latter of the two is completely unrecognized by the SDK and the build just fails due to Kconfig errors.

The crypto features in my build are shown below (with non-working options commented out)

# Crypto
CONFIG_NRF_SECURITY=y
CONFIG_PSA_CRYPTO_DRIVER_OBERON=y
CONFIG_PSA_WANT_GENERATE_RANDOM=y
CONFIG_PSA_WANT_KEY_TYPE_AES=y
CONFIG_PSA_WANT_ALG_GCM=y
CONFIG_PSA_WANT_AES_KEY_SIZE_128=y
CONFIG_PSA_WANT_ALG_CTR_DRBG=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
# CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C=y
# CONFIG_PSA_NATIVE_ITS=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=8192

I've tried a number of configs based on examples and Q&A posts, but whatever I put together either doesn't build due to the above errors or gives an error during runtime.

Related