psa_sim_crypto_[client/server]: check if CRYPTO_C is enabled

CRYPTO_C must or must-not be enabled on client and server
sides as follows:

- if it's enabled while building the client side it's a failure;
- it it's NOT enabled while building the server it's a failure.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2024-06-10 20:11:43 +02:00 committed by Tom Cosgrove
parent 51b2c86852
commit 75129e2ce3
3 changed files with 16 additions and 0 deletions

View File

@ -26,6 +26,10 @@
static psa_handle_t handle = -1;
#if defined(MBEDTLS_PSA_CRYPTO_C)
#error "Error: MBEDTLS_PSA_CRYPTO_C must be disabled on client build"
#endif
int psa_crypto_call(int function,
uint8_t *in_params, size_t in_params_len,
uint8_t **out_params, size_t *out_params_len)

View File

@ -17,6 +17,10 @@
#include "service.h"
#if !defined(MBEDTLS_PSA_CRYPTO_C)
#error "Error: MBEDTLS_PSA_CRYPTO_C must be enabled on server build"
#endif
// Returns 1 for success, 0 for failure
int psa_crypto_init_wrapper(
uint8_t *in_params, size_t in_params_len,

View File

@ -268,6 +268,10 @@ sub server_implementations_header
#include "psa_sim_serialise.h"
#include "service.h"
#if !defined(MBEDTLS_PSA_CRYPTO_C)
#error "Error: MBEDTLS_PSA_CRYPTO_C must be enabled on server build"
#endif
EOF
}
@ -301,6 +305,10 @@ sub client_calls_header
PRINT("Client: " fmt, ##__VA_ARGS__)
static psa_handle_t handle = -1;
#if defined(MBEDTLS_PSA_CRYPTO_C)
#error "Error: MBEDTLS_PSA_CRYPTO_C must be disabled on client build"
#endif
EOF
$code .= debug_functions() if $debug;