mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Free psa crypto at the end of programs when initialized
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
@ -334,12 +334,12 @@ exit:
|
||||
#endif
|
||||
|
||||
mbedtls_net_free(&server_fd);
|
||||
|
||||
mbedtls_x509_crt_free(&cacert);
|
||||
mbedtls_ssl_free(&ssl);
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" + Press Enter to exit this program.\n");
|
||||
|
@ -404,6 +404,7 @@ exit:
|
||||
#endif
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
printf(" Press Enter to exit this program.\n");
|
||||
|
@ -274,7 +274,6 @@ int main(void)
|
||||
|
||||
exit:
|
||||
mbedtls_net_free(&server_fd);
|
||||
|
||||
mbedtls_ssl_free(&ssl);
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
@ -282,6 +281,7 @@ exit:
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
mbedtls_x509_crt_free(&ca);
|
||||
#endif
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
mbedtls_exit(ret);
|
||||
}
|
||||
|
@ -284,12 +284,12 @@ exit:
|
||||
#endif
|
||||
|
||||
mbedtls_net_free(&server_fd);
|
||||
|
||||
mbedtls_x509_crt_free(&cacert);
|
||||
mbedtls_ssl_free(&ssl);
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" + Press Enter to exit this program.\n");
|
||||
|
@ -1017,6 +1017,8 @@ int main(int argc, char *argv[])
|
||||
printf("Finished. No valid base64 code found\n");
|
||||
}
|
||||
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -378,13 +378,13 @@ int main(void)
|
||||
exit:
|
||||
mbedtls_net_free(&client_fd);
|
||||
mbedtls_net_free(&listen_fd);
|
||||
|
||||
mbedtls_x509_crt_free(&srvcert);
|
||||
mbedtls_pk_free(&pkey);
|
||||
mbedtls_ssl_free(&ssl);
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" Press Enter to exit this program.\n");
|
||||
|
@ -801,6 +801,7 @@ exit:
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" + Press Enter to exit this program.\n");
|
||||
|
@ -487,14 +487,12 @@ exit:
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
|
||||
mbedtls_net_free(&listen_fd);
|
||||
|
||||
mbedtls_mutex_free(&debug_mutex);
|
||||
|
||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
|
||||
mbedtls_memory_buffer_alloc_free();
|
||||
#endif
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" Press Enter to exit this program.\n");
|
||||
|
@ -357,7 +357,6 @@ exit:
|
||||
|
||||
mbedtls_net_free(&client_fd);
|
||||
mbedtls_net_free(&listen_fd);
|
||||
|
||||
mbedtls_x509_crt_free(&srvcert);
|
||||
mbedtls_pk_free(&pkey);
|
||||
mbedtls_ssl_free(&ssl);
|
||||
@ -367,6 +366,7 @@ exit:
|
||||
#endif
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" Press Enter to exit this program.\n");
|
||||
|
@ -461,6 +461,7 @@ exit:
|
||||
#endif
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" + Press Enter to exit this program.\n");
|
||||
|
@ -374,6 +374,7 @@ exit:
|
||||
mbedtls_pk_free(&key);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" + Press Enter to exit this program.\n");
|
||||
|
@ -726,6 +726,7 @@ exit:
|
||||
mbedtls_mpi_free(&serial);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" + Press Enter to exit this program.\n");
|
||||
|
@ -136,6 +136,7 @@ usage:
|
||||
|
||||
exit:
|
||||
mbedtls_x509_crl_free(&crl);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" + Press Enter to exit this program.\n");
|
||||
|
@ -127,11 +127,6 @@ int main(int argc, char *argv[])
|
||||
struct mbedtls_timing_hr_time timer;
|
||||
unsigned long ms;
|
||||
|
||||
if (argc <= 1) {
|
||||
mbedtls_printf(USAGE);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
psa_status_t status = psa_crypto_init();
|
||||
if (status != PSA_SUCCESS) {
|
||||
@ -141,6 +136,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
if (argc <= 1) {
|
||||
mbedtls_printf(USAGE);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
opt.filenames = NULL;
|
||||
opt.iterations = DFL_ITERATIONS;
|
||||
opt.prime_cache = DFL_PRIME_CACHE;
|
||||
@ -200,6 +200,7 @@ int main(int argc, char *argv[])
|
||||
exit_code = MBEDTLS_EXIT_SUCCESS;
|
||||
|
||||
exit:
|
||||
mbedtls_psa_crypto_free();
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
#endif /* necessary configuration */
|
||||
|
@ -136,6 +136,7 @@ usage:
|
||||
|
||||
exit:
|
||||
mbedtls_x509_csr_free(&csr);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
#if defined(_WIN32)
|
||||
mbedtls_printf(" + Press Enter to exit this program.\n");
|
||||
|
Reference in New Issue
Block a user