mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 07:58:36 +02:00
mbedTLS: missing init and free fixed
This commit is contained in:
parent
1af3b51fa7
commit
99a741b4e2
@ -41,13 +41,16 @@ CWII_IPC_HLE_Device_net_ssl::~CWII_IPC_HLE_Device_net_ssl()
|
|||||||
if (ssl.active)
|
if (ssl.active)
|
||||||
{
|
{
|
||||||
mbedtls_ssl_close_notify(&ssl.ctx);
|
mbedtls_ssl_close_notify(&ssl.ctx);
|
||||||
mbedtls_ssl_session_free(&ssl.session);
|
|
||||||
mbedtls_ssl_free(&ssl.ctx);
|
|
||||||
mbedtls_ssl_config_free(&ssl.config);
|
|
||||||
|
|
||||||
mbedtls_x509_crt_free(&ssl.cacert);
|
mbedtls_x509_crt_free(&ssl.cacert);
|
||||||
mbedtls_x509_crt_free(&ssl.clicert);
|
mbedtls_x509_crt_free(&ssl.clicert);
|
||||||
|
|
||||||
|
mbedtls_ssl_session_free(&ssl.session);
|
||||||
|
mbedtls_ssl_free(&ssl.ctx);
|
||||||
|
mbedtls_ssl_config_free(&ssl.config);
|
||||||
|
mbedtls_ctr_drbg_free(&ssl.ctr_drbg);
|
||||||
|
mbedtls_entropy_free(&ssl.entropy);
|
||||||
|
|
||||||
ssl.hostname.clear();
|
ssl.hostname.clear();
|
||||||
|
|
||||||
ssl.active = false;
|
ssl.active = false;
|
||||||
@ -163,13 +166,14 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
|
|||||||
WII_SSL* ssl = &_SSL[sslID];
|
WII_SSL* ssl = &_SSL[sslID];
|
||||||
mbedtls_ssl_init(&ssl->ctx);
|
mbedtls_ssl_init(&ssl->ctx);
|
||||||
mbedtls_entropy_init(&ssl->entropy);
|
mbedtls_entropy_init(&ssl->entropy);
|
||||||
const char* pers = "dolphin-emu";
|
static constexpr const char* pers = "dolphin-emu";
|
||||||
mbedtls_ctr_drbg_init(&ssl->ctr_drbg);
|
mbedtls_ctr_drbg_init(&ssl->ctr_drbg);
|
||||||
int ret = mbedtls_ctr_drbg_seed(&ssl->ctr_drbg, mbedtls_entropy_func, &ssl->entropy,
|
int ret = mbedtls_ctr_drbg_seed(&ssl->ctr_drbg, mbedtls_entropy_func, &ssl->entropy,
|
||||||
(const unsigned char*)pers, strlen(pers));
|
(const unsigned char*)pers, strlen(pers));
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
mbedtls_ssl_free(&ssl->ctx);
|
mbedtls_ssl_free(&ssl->ctx);
|
||||||
|
mbedtls_ctr_drbg_free(&ssl->ctr_drbg);
|
||||||
mbedtls_entropy_free(&ssl->entropy);
|
mbedtls_entropy_free(&ssl->entropy);
|
||||||
goto _SSL_NEW_ERROR;
|
goto _SSL_NEW_ERROR;
|
||||||
}
|
}
|
||||||
@ -218,16 +222,18 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
|
|||||||
if (SSLID_VALID(sslID))
|
if (SSLID_VALID(sslID))
|
||||||
{
|
{
|
||||||
WII_SSL* ssl = &_SSL[sslID];
|
WII_SSL* ssl = &_SSL[sslID];
|
||||||
mbedtls_ssl_close_notify(&ssl->ctx);
|
|
||||||
mbedtls_ssl_session_free(&ssl->session);
|
|
||||||
mbedtls_ssl_free(&ssl->ctx);
|
|
||||||
mbedtls_ssl_config_free(&ssl->config);
|
|
||||||
|
|
||||||
mbedtls_entropy_free(&ssl->entropy);
|
mbedtls_ssl_close_notify(&ssl->ctx);
|
||||||
|
|
||||||
mbedtls_x509_crt_free(&ssl->cacert);
|
mbedtls_x509_crt_free(&ssl->cacert);
|
||||||
mbedtls_x509_crt_free(&ssl->clicert);
|
mbedtls_x509_crt_free(&ssl->clicert);
|
||||||
|
|
||||||
|
mbedtls_ssl_session_free(&ssl->session);
|
||||||
|
mbedtls_ssl_free(&ssl->ctx);
|
||||||
|
mbedtls_ssl_config_free(&ssl->config);
|
||||||
|
mbedtls_ctr_drbg_free(&ssl->ctr_drbg);
|
||||||
|
mbedtls_entropy_free(&ssl->entropy);
|
||||||
|
|
||||||
ssl->hostname.clear();
|
ssl->hostname.clear();
|
||||||
|
|
||||||
ssl->active = false;
|
ssl->active = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user