Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config: Fix PSA configuration backwards compat
At the moment, the only difference in Mbed TLS configuration options set by MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR and MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY is that MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR defines MBEDTLS_GENPRIME and MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY does not. When working backwards however, when configuring what functionality is available in Mbed TLS's PSA implementation based on Mbed TLS configuration defines (i.e. when MBEDTLS_PSA_CRYPTO_CONFIG is not defined), both MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR and MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY are set regardless of the MBEDTLS_GENPRIME setting. On space-constrained platforms, it is a useful configuration to be able to import/export and work with RSA, but exclude RSA key generation, potentially saving flash space. Change config_psa.h to only set MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR if MBEDTLS_GENPRIME is also set. This restores the configuration behavior present in Mbed TLS v2.24.0 and earlier versions. Without this change, linker errors will occur when attempts to call, which doesn't exist when MBEDTLS_GENPRIME is unset. psa_crypto_rsa.c.obj: in function `rsa_generate_key': psa_crypto_rsa.c:320: undefined reference to `mbedtls_rsa_gen_key' Fixes Mbed-TLS#4512 Signed-off-by: Jaeden Amero <jaeden.amero@arm.com>
- Loading branch information