Move psa_crypto_init() after other init calls
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
diff --git a/programs/ssl/ssl_client1.c b/programs/ssl/ssl_client1.c
index a497c60..c7aaf49 100644
--- a/programs/ssl/ssl_client1.c
+++ b/programs/ssl/ssl_client1.c
@@ -83,6 +83,16 @@
mbedtls_debug_set_threshold(DEBUG_LEVEL);
#endif
+ /*
+ * 0. Initialize the RNG and the session data
+ */
+ mbedtls_net_init(&server_fd);
+ mbedtls_ssl_init(&ssl);
+ mbedtls_ssl_config_init(&conf);
+ mbedtls_x509_crt_init(&cacert);
+ mbedtls_ctr_drbg_init(&ctr_drbg);
+ mbedtls_entropy_init(&entropy);
+
#if defined(MBEDTLS_USE_PSA_CRYPTO)
psa_status_t status = psa_crypto_init();
if (status != PSA_SUCCESS) {
@@ -92,19 +102,10 @@
}
#endif /* MBEDTLS_USE_PSA_CRYPTO */
- /*
- * 0. Initialize the RNG and the session data
- */
- mbedtls_net_init(&server_fd);
- mbedtls_ssl_init(&ssl);
- mbedtls_ssl_config_init(&conf);
- mbedtls_x509_crt_init(&cacert);
- mbedtls_ctr_drbg_init(&ctr_drbg);
-
mbedtls_printf("\n . Seeding the random number generator...");
fflush(stdout);
- mbedtls_entropy_init(&entropy);
+
if ((ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
(const unsigned char *) pers,
strlen(pers))) != 0) {