I need CCM encryption in my Matter project, so I'm trying to use the PSA crypto drivers for that. I am using the exact same code as in the AES CCM sample (https://github.com/nrfconnect/sdk-nrf/tree/main/samples/crypto/aes_ccm), but then in a Matter project.
Unfortunately the psa_aead_decrypt function gives a -134 error (PSA_ERROR_NOT_SUPPORTED).
I already found some other users with similar problems:
PSA crypto drivers is not working in zephyr on nrf52840 with ncs v2.5.0 in multiprotocol example
PSA crypto features not enabled when CONFIG_MBEDTLS_LEGACY_CRYPTO_C is enabled
psa_generate_key failed! with Error: -134
Zephyr bus fault when using PSA crypto with CC310 and Openthread L2 layer
RE: NCS 1.9.1 unable to use PSA crypto methods with OpenThread enabled
A promising option provided in one of the answers is to add CONFIG_OPENTHREAD_NRF_SECURITY_PSA_CHOICE=y to the config. However if I do this, I'm not able to build the Matter project anymore, as it fails with the following error:
[478/558] Performing build step for 'chip-gn' Starting Matter library build in C:/Users/bertl/NCSProjects/firmware-ncs/build/modules/connectedhomeip usage: make_gn_args.py [-h] [--module MODULE] [--arg ARG ARG] [--arg-string ARG_STRING ARG_STRING] [--arg-cflags ARG_CFLAGS ARG_CFLAGS] make_gn_args.py: error: argument --arg-cflags: expected 2 arguments
What can I do to make the psa crypto libraries work with a Matter project? Or should I use legacy crypto functions instead?