mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 22:45:48 +01:00
psa: Enable use of PSA examples with CHECK_PARAMS
When MBEDTLS_CHECK_PARAMS is enabled, it's required to have an implementation of mbedtls_param_failed() present. Without it in the PSA examples, building the PSA examples will result in linker errors like the following. ../../library/libmbedcrypto.a(rsa.c.o): In function `mbedtls_rsa_import': rsa.c:(.text+0x9fd): undefined reference to `mbedtls_param_failed' ../../library/libmbedcrypto.a(rsa.c.o): In function `mbedtls_rsa_import_raw': rsa.c:(.text+0xb0b): undefined reference to `mbedtls_param_failed' ../../library/libmbedcrypto.a(rsa.c.o): In function `mbedtls_rsa_complete': rsa.c:(.text+0xe63): undefined reference to `mbedtls_param_failed' ../../library/libmbedcrypto.a(rsa.c.o): In function `mbedtls_rsa_export_raw': rsa.c:(.text+0xfee): undefined reference to `mbedtls_param_failed' ../../library/libmbedcrypto.a(rsa.c.o): In function `mbedtls_rsa_export': rsa.c:(.text+0x116f): undefined reference to `mbedtls_param_failed' ../../library/libmbedcrypto.a(rsa.c.o):rsa.c:(.text+0x1304): more undefined references to `mbedtls_param_failed' follow collect2: error: ld returned 1 exit status programs/psa/CMakeFiles/crypto_examples.dir/build.make:97: recipe for target 'programs/psa/crypto_examples' failed make[2]: *** [programs/psa/crypto_examples] Error 1 Add an implementation of mbedtls_param_failed() to the PSA Crypto examples to avoid getting this error on the PSA examples.
This commit is contained in:
parent
892cd6df70
commit
44a59ab3f5
@ -324,6 +324,18 @@ static void cipher_examples( void )
|
||||
mbedtls_printf( "\tsuccess!\r\n" );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_CHECK_PARAMS)
|
||||
#include "mbedtls/platform_util.h"
|
||||
void mbedtls_param_failed( const char *failure_condition,
|
||||
const char *file,
|
||||
int line )
|
||||
{
|
||||
mbedtls_printf( "%s:%i: Input param failed - %s\n",
|
||||
file, line, failure_condition );
|
||||
mbedtls_exit( MBEDTLS_EXIT_FAILURE );
|
||||
}
|
||||
#endif
|
||||
|
||||
int main( void )
|
||||
{
|
||||
ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
|
||||
|
@ -618,6 +618,18 @@ static void usage( void )
|
||||
mbedtls_printf( " and the same sequence of labels.\n" );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_CHECK_PARAMS)
|
||||
#include "mbedtls/platform_util.h"
|
||||
void mbedtls_param_failed( const char *failure_condition,
|
||||
const char *file,
|
||||
int line )
|
||||
{
|
||||
mbedtls_printf( "%s:%i: Input param failed - %s\n",
|
||||
file, line, failure_condition );
|
||||
mbedtls_exit( MBEDTLS_EXIT_FAILURE );
|
||||
}
|
||||
#endif
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
const char *key_file_name = "master.key";
|
||||
|
Loading…
Reference in New Issue
Block a user