fix(psa): guard Crypto APIs with CRYPTO_SUPPORT

When building Crypto APIs, it requires dependency on external headers,
e.g., Mbedtls headers.  Without the CRYPTO_SUPPORT configuration,
external dependencies are not set up,  building Crypto APIs will fail.

Guard Crypto APIs with the CRYPTO_SUPPORT configuration, to make sure
the code is built only for Crypto enabled case.

Change-Id: Iffe1220b0e6272586c46432b4f8d0512cb39b0b5
Signed-off-by: Leo Yan <leo.yan@arm.com>
This commit is contained in:
Leo Yan 2025-01-31 17:16:34 +00:00
parent 2ae197acd6
commit 8a41106c83
2 changed files with 8 additions and 0 deletions

View file

@ -11,7 +11,9 @@
#include <stdint.h>
#include "psa/error.h"
#if CRYPTO_SUPPORT
#include <rse_crypto_defs.h>
#endif
#define RSE_PLATFORM_API_ID_NV_READ (1010)
#define RSE_PLATFORM_API_ID_NV_INCREMENT (1011)
@ -42,6 +44,7 @@ psa_status_t
rse_platform_nv_counter_read(uint32_t counter_id,
uint32_t size, uint8_t *val);
#if CRYPTO_SUPPORT
/*
* Reads the public key or the public part of a key pair in binary format.
*
@ -56,5 +59,6 @@ rse_platform_nv_counter_read(uint32_t counter_id,
psa_status_t
rse_platform_key_read(enum rse_key_id_builtin_t key, uint8_t *data,
size_t data_size, size_t *data_length);
#endif
#endif /* RSE_PLATFORM_API_H */

View file

@ -7,7 +7,9 @@
#include <psa/client.h>
#include <psa_manifest/sid.h>
#if CRYPTO_SUPPORT
#include <rse_crypto_defs.h>
#endif
#include <rse_platform_api.h>
psa_status_t
@ -41,6 +43,7 @@ rse_platform_nv_counter_read(uint32_t counter_id,
in_vec, 1, out_vec, 1);
}
#if CRYPTO_SUPPORT
psa_status_t
rse_platform_key_read(enum rse_key_id_builtin_t key, uint8_t *data,
size_t data_size, size_t *data_length)
@ -67,3 +70,4 @@ rse_platform_key_read(enum rse_key_id_builtin_t key, uint8_t *data,
return status;
}
#endif