Init PSA in ssl and x509 programs
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
diff --git a/programs/x509/cert_app.c b/programs/x509/cert_app.c
index b14b084..5fc1370 100644
--- a/programs/x509/cert_app.c
+++ b/programs/x509/cert_app.c
@@ -149,6 +149,15 @@
char *p, *q;
const char *pers = "cert_app";
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+ psa_status_t status = psa_crypto_init();
+ if (status != PSA_SUCCESS) {
+ mbedtls_fprintf(stderr, "Failed to initialize PSA Crypto implementation: %d\n",
+ (int) status);
+ goto exit;
+ }
+#endif /* MBEDTLS_USE_PSA_CRYPTO */
+
/*
* Set to sane values
*/
diff --git a/programs/x509/cert_req.c b/programs/x509/cert_req.c
index d7818d7..2f4bd0e 100644
--- a/programs/x509/cert_req.c
+++ b/programs/x509/cert_req.c
@@ -155,6 +155,15 @@
mbedtls_ctr_drbg_context ctr_drbg;
const char *pers = "csr example app";
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+ psa_status_t status = psa_crypto_init();
+ if (status != PSA_SUCCESS) {
+ mbedtls_fprintf(stderr, "Failed to initialize PSA Crypto implementation: %d\n",
+ (int) status);
+ goto exit;
+ }
+#endif /* MBEDTLS_USE_PSA_CRYPTO */
+
/*
* Set to sane values
*/
diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c
index ea20144..18a05ca 100644
--- a/programs/x509/cert_write.c
+++ b/programs/x509/cert_write.c
@@ -226,6 +226,15 @@
mbedtls_ctr_drbg_context ctr_drbg;
const char *pers = "crt example app";
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+ psa_status_t status = psa_crypto_init();
+ if (status != PSA_SUCCESS) {
+ mbedtls_fprintf(stderr, "Failed to initialize PSA Crypto implementation: %d\n",
+ (int) status);
+ goto exit;
+ }
+#endif /* MBEDTLS_USE_PSA_CRYPTO */
+
/*
* Set to sane values
*/
diff --git a/programs/x509/crl_app.c b/programs/x509/crl_app.c
index b00f9f3..5a07963 100644
--- a/programs/x509/crl_app.c
+++ b/programs/x509/crl_app.c
@@ -67,6 +67,15 @@
int i;
char *p, *q;
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+ psa_status_t status = psa_crypto_init();
+ if (status != PSA_SUCCESS) {
+ mbedtls_fprintf(stderr, "Failed to initialize PSA Crypto implementation: %d\n",
+ (int) status);
+ goto exit;
+ }
+#endif /* MBEDTLS_USE_PSA_CRYPTO */
+
/*
* Set to sane values
*/
diff --git a/programs/x509/load_roots.c b/programs/x509/load_roots.c
index faf4ba9..87187e6 100644
--- a/programs/x509/load_roots.c
+++ b/programs/x509/load_roots.c
@@ -132,6 +132,15 @@
goto exit;
}
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+ psa_status_t status = psa_crypto_init();
+ if (status != PSA_SUCCESS) {
+ mbedtls_fprintf(stderr, "Failed to initialize PSA Crypto implementation: %d\n",
+ (int) status);
+ goto exit;
+ }
+#endif /* MBEDTLS_USE_PSA_CRYPTO */
+
opt.filenames = NULL;
opt.iterations = DFL_ITERATIONS;
opt.prime_cache = DFL_PRIME_CACHE;
diff --git a/programs/x509/req_app.c b/programs/x509/req_app.c
index dd7fac7..a5fb1b6 100644
--- a/programs/x509/req_app.c
+++ b/programs/x509/req_app.c
@@ -67,6 +67,15 @@
int i;
char *p, *q;
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+ psa_status_t status = psa_crypto_init();
+ if (status != PSA_SUCCESS) {
+ mbedtls_fprintf(stderr, "Failed to initialize PSA Crypto implementation: %d\n",
+ (int) status);
+ goto exit;
+ }
+#endif /* MBEDTLS_USE_PSA_CRYPTO */
+
/*
* Set to sane values
*/