mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-23 16:20:49 +00:00
Fix build error in CI about test_fail_if_psa_leaking
During test of component build_arm_linux_gnueabi_gcc_arm5vte and build_arm_none_eabi_gcc_m0plus. It fails with - error: implicit declaration of function ‘test_fail_if_psa_leaking’ It happens because test_fail_if_psa_leaking is defined in helpers.function. This block of code is not converted into C code while compiling ssl_helpers.c. The function has been moved to psa_crypto_helpers.c in order to fix this build error. Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
parent
b458b8c0ec
commit
e64b40520d
@ -104,11 +104,11 @@ const char *mbedtls_test_helper_is_psa_leaking(void);
|
||||
* `TEST_ASSERT( ! mbedtls_test_helper_is_psa_leaking( ) )`
|
||||
* but with a more informative message.
|
||||
*/
|
||||
#define ASSERT_PSA_PRISTINE() \
|
||||
#define ASSERT_PSA_PRISTINE() \
|
||||
do \
|
||||
{ \
|
||||
if (test_fail_if_psa_leaking(__LINE__, __FILE__)) \
|
||||
goto exit; \
|
||||
if (mbedtls_test_fail_if_psa_leaking(__LINE__, __FILE__)) \
|
||||
goto exit; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@ -122,12 +122,12 @@ const char *mbedtls_test_helper_is_psa_leaking(void);
|
||||
* \note Persistent keys must be recorded with #TEST_USES_KEY_ID before
|
||||
* creating them.
|
||||
*/
|
||||
#define PSA_DONE() \
|
||||
#define PSA_DONE() \
|
||||
do \
|
||||
{ \
|
||||
test_fail_if_psa_leaking(__LINE__, __FILE__); \
|
||||
mbedtls_test_psa_purge_key_storage(); \
|
||||
mbedtls_psa_crypto_free(); \
|
||||
mbedtls_test_fail_if_psa_leaking(__LINE__, __FILE__); \
|
||||
mbedtls_test_psa_purge_key_storage(); \
|
||||
mbedtls_psa_crypto_free(); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@ -193,6 +193,14 @@ psa_status_t mbedtls_test_record_status(psa_status_t status,
|
||||
*/
|
||||
psa_key_usage_t mbedtls_test_update_key_usage_flags(psa_key_usage_t usage_flags);
|
||||
|
||||
/** Check that no PSA Crypto key slots are in use.
|
||||
*
|
||||
* If any slots are in use, mark the current test as failed.
|
||||
*
|
||||
* \return 0 if the key store is empty, 1 otherwise.
|
||||
*/
|
||||
int mbedtls_test_fail_if_psa_leaking(int line_no, const char *filename);
|
||||
|
||||
/** Skip a test case if the given key is a 192 bits AES key and the AES
|
||||
* implementation is at least partially provided by an accelerator or
|
||||
* alternative implementation.
|
||||
|
@ -138,4 +138,15 @@ psa_key_usage_t mbedtls_test_update_key_usage_flags(psa_key_usage_t usage_flags)
|
||||
return updated_usage;
|
||||
}
|
||||
|
||||
int mbedtls_test_fail_if_psa_leaking(int line_no, const char *filename)
|
||||
{
|
||||
const char *msg = mbedtls_test_helper_is_psa_leaking();
|
||||
if (msg == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
mbedtls_test_fail(msg, line_no, filename);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
||||
|
@ -76,25 +76,6 @@ typedef UINT32 uint32_t;
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Helper Functions */
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||
/** Check that no PSA Crypto key slots are in use.
|
||||
*
|
||||
* If any slots are in use, mark the current test as failed.
|
||||
*
|
||||
* \return 0 if the key store is empty, 1 otherwise.
|
||||
*/
|
||||
int test_fail_if_psa_leaking(int line_no, const char *filename)
|
||||
{
|
||||
const char *msg = mbedtls_test_helper_is_psa_leaking();
|
||||
if (msg == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
mbedtls_test_fail(msg, line_no, filename);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif /* defined(MBEDTLS_PSA_CRYPTO_C) */
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
static int redirect_output(FILE *out_stream, const char *path)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user