1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-12-24 17:41:01 +03:00

Move psa_crypto_init() after other init calls

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemek Stekiel
2023-04-17 11:10:05 +02:00
parent 6260ee9cab
commit a0a1c1eab5
13 changed files with 119 additions and 118 deletions

View File

@@ -172,6 +172,15 @@ int main(int argc, char *argv[])
const char *pers = "csr example app";
mbedtls_x509_san_list *cur, *prev;
/*
* Set to sane values
*/
mbedtls_x509write_csr_init(&req);
mbedtls_pk_init(&key);
mbedtls_ctr_drbg_init(&ctr_drbg);
memset(buf, 0, sizeof(buf));
mbedtls_entropy_init(&entropy);
#if defined(MBEDTLS_USE_PSA_CRYPTO)
psa_status_t status = psa_crypto_init();
if (status != PSA_SUCCESS) {
@@ -181,14 +190,6 @@ int main(int argc, char *argv[])
}
#endif /* MBEDTLS_USE_PSA_CRYPTO */
/*
* Set to sane values
*/
mbedtls_x509write_csr_init(&req);
mbedtls_pk_init(&key);
mbedtls_ctr_drbg_init(&ctr_drbg);
memset(buf, 0, sizeof(buf));
if (argc < 2) {
usage:
mbedtls_printf(USAGE);
@@ -397,7 +398,6 @@ usage:
mbedtls_printf(" . 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) {