Initialize PSA Crypto implementation in ssl_server2
diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c
index efda65d..1c6ccae 100644
--- a/programs/ssl/ssl_server2.c
+++ b/programs/ssl/ssl_server2.c
@@ -60,6 +60,10 @@
#include "mbedtls/debug.h"
#include "mbedtls/timing.h"
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+#include "psa/crypto.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -1238,6 +1242,9 @@
int i;
char *p, *q;
const int *list;
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+ psa_status_t status;
+#endif
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) );
@@ -1277,6 +1284,17 @@
mbedtls_ssl_cookie_init( &cookie_ctx );
#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 !defined(_WIN32)
/* Abort cleanly on SIGTERM and SIGINT */
signal( SIGTERM, term_handler );