From b2b468ba450e82ca4836a6ec3f16d334e069a21d Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Mon, 12 Nov 2018 17:46:59 +0000 Subject: [PATCH] Initialize PSA Crypto implementation in ssl_client2.c --- programs/ssl/ssl_client2.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 15c778d31..87b9ab1bd 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -59,6 +59,10 @@ int main( void ) #include "mbedtls/debug.h" #include "mbedtls/timing.h" +#if defined(MBEDTLS_USE_PSA_CRYPTO) +#include "psa/crypto.h" +#endif + #include #include #include @@ -555,6 +559,9 @@ int main( int argc, char *argv[] ) #endif char *p, *q; const int *list; +#if defined(MBEDTLS_USE_PSA_CRYPTO) + psa_status_t status; +#endif /* * Make sure memory references are valid. @@ -573,6 +580,17 @@ int main( int argc, char *argv[] ) memset( (void * ) alpn_list, 0, sizeof( alpn_list ) ); #endif +#if defined(MBEDTLS_USE_PSA_CRYPTO) + status = psa_crypto_init(); + if( status != PSA_SUCCESS ) + { + mbedtls_fprintf( stderr, "Failed to initialize PSA Crypto implementation: %d\n", + (int) status ); + ret = MBEDTLS_ERR_SSL_HW_ACCEL_FAILED; + goto exit; + } +#endif + if( argc == 0 ) { usage: