mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-30 09:36:47 +01:00
Added: mbedtls errors log
This commit is contained in:
parent
529ca245d7
commit
4dfad8896a
@ -3,6 +3,7 @@
|
|||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <mbedtls/error.h>
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
@ -314,6 +315,12 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
|||||||
{
|
{
|
||||||
mbedtls_ssl_context* ctx = &CWII_IPC_HLE_Device_net_ssl::_SSL[sslID].ctx;
|
mbedtls_ssl_context* ctx = &CWII_IPC_HLE_Device_net_ssl::_SSL[sslID].ctx;
|
||||||
int ret = mbedtls_ssl_handshake(ctx);
|
int ret = mbedtls_ssl_handshake(ctx);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
char error_buffer[256] = "";
|
||||||
|
mbedtls_strerror(ret, error_buffer, sizeof(error_buffer));
|
||||||
|
ERROR_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_DOHANDSHAKE: %s", error_buffer);
|
||||||
|
}
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -331,21 +338,26 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
|||||||
break;
|
break;
|
||||||
case MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:
|
case MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:
|
||||||
{
|
{
|
||||||
int flags = ctx->session_negotiate->verify_result;
|
char error_buffer[256] = "";
|
||||||
if (flags & MBEDTLS_X509_BADCERT_CN_MISMATCH)
|
int res = mbedtls_ssl_get_verify_result(ctx);
|
||||||
ret = SSL_ERR_VCOMMONNAME;
|
mbedtls_x509_crt_verify_info(error_buffer, sizeof(error_buffer), "", res);
|
||||||
else if (flags & MBEDTLS_X509_BADCERT_NOT_TRUSTED)
|
ERROR_LOG(WII_IPC_SSL, "MBEDTLS_ERR_X509_CERT_VERIFY_FAILED (verify_result = %d): %s",
|
||||||
ret = SSL_ERR_VROOTCA;
|
res, error_buffer);
|
||||||
else if (flags & MBEDTLS_X509_BADCERT_REVOKED)
|
|
||||||
ret = SSL_ERR_VCHAIN;
|
if (res & MBEDTLS_X509_BADCERT_CN_MISMATCH)
|
||||||
else if (flags & MBEDTLS_X509_BADCERT_EXPIRED ||
|
res = SSL_ERR_VCOMMONNAME;
|
||||||
flags & MBEDTLS_X509_BADCERT_FUTURE)
|
else if (res & MBEDTLS_X509_BADCERT_NOT_TRUSTED)
|
||||||
ret = SSL_ERR_VDATE;
|
res = SSL_ERR_VROOTCA;
|
||||||
|
else if (res & MBEDTLS_X509_BADCERT_REVOKED)
|
||||||
|
res = SSL_ERR_VCHAIN;
|
||||||
|
else if (res & MBEDTLS_X509_BADCERT_EXPIRED || res & MBEDTLS_X509_BADCERT_FUTURE)
|
||||||
|
res = SSL_ERR_VDATE;
|
||||||
else
|
else
|
||||||
ret = SSL_ERR_FAILED;
|
res = SSL_ERR_FAILED;
|
||||||
Memory::Write_U32(ret, BufferIn);
|
|
||||||
|
Memory::Write_U32(res, BufferIn);
|
||||||
if (!nonBlock)
|
if (!nonBlock)
|
||||||
ReturnValue = ret;
|
ReturnValue = res;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user