mbedtls: move the crypto init into the vtls init function

Follow-up to 3a305831d1

Closes #19108
This commit is contained in:
Daniel Stenberg 2025-10-17 22:47:28 +02:00
parent d6c39cd2cb
commit e29706d6e2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 5 additions and 29 deletions

View file

@ -80,10 +80,6 @@
#include "easy_lock.h"
#ifdef USE_MBEDTLS
#include <psa/crypto.h>
#endif
/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
@ -141,24 +137,6 @@ curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;
static char *leakpointer;
#endif
static CURLcode crypto_init(void)
{
#ifdef USE_MBEDTLS
psa_status_t status;
status = psa_crypto_init();
if(status != PSA_SUCCESS)
return CURLE_FAILED_INIT;
#endif
return CURLE_OK;
}
static void crypto_cleanup(void)
{
#ifdef USE_MBEDTLS
mbedtls_psa_crypto_free();
#endif
}
/**
* curl_global_init() globally initializes curl given a bitwise set of the
* different features of what to initialize.
@ -182,11 +160,6 @@ static CURLcode global_init(long flags, bool memoryfuncs)
goto fail;
}
if(crypto_init()) {
DEBUGF(curl_mfprintf(stderr, "Error: crypto_init failed\n"));
goto fail;
}
if(!Curl_ssl_init()) {
DEBUGF(curl_mfprintf(stderr, "Error: Curl_ssl_init failed\n"));
goto fail;
@ -325,8 +298,6 @@ void curl_global_cleanup(void)
Curl_ssh_cleanup();
crypto_cleanup();
#ifdef DEBUGBUILD
free(leakpointer);
#endif