summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorSepalani <sepalani@hotmail.fr>2021-02-11 17:27:35 +0400
committerSepalani <sepalani@hotmail.fr>2021-02-14 20:24:28 +0400
commitd3dd830e8f8c5db9d6e8cedfe13744339f1a07cf (patch)
tree0e340ca20ef0e9e1cb0107c8f2d95d636156ce39 /Source/Core
parent2f85b80b7bf75434072c1245904587ee8c15fbe2 (diff)
PCAP: Add raw SSL packets logging support
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/IOS/Network/SSL.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/Core/Core/IOS/Network/SSL.cpp b/Source/Core/Core/IOS/Network/SSL.cpp
index 0041cac59f..e9a27d34d8 100644
--- a/Source/Core/Core/IOS/Network/SSL.cpp
+++ b/Source/Core/Core/IOS/Network/SSL.cpp
@@ -20,6 +20,7 @@
#include "Core/Core.h"
#include "Core/HW/Memmap.h"
#include "Core/IOS/Network/Socket.h"
+#include "Core/PowerPC/PowerPC.h"
namespace IOS::HLE
{
@@ -54,17 +55,30 @@ namespace
int SSLSendWithoutSNI(void* ctx, const unsigned char* buf, size_t len)
{
auto* ssl = static_cast<WII_SSL*>(ctx);
+ auto* fd = &ssl->hostfd;
if (ssl->ctx.state == MBEDTLS_SSL_SERVER_HELLO)
mbedtls_ssl_set_hostname(&ssl->ctx, ssl->hostname.c_str());
- return mbedtls_net_send(&ssl->hostfd, buf, len);
+ const int ret = mbedtls_net_send(fd, buf, len);
+
+ // Log raw SSL packets if we don't dump unencrypted SSL writes
+ if (!Config::Get(Config::MAIN_NETWORK_SSL_DUMP_WRITE) && ret > 0)
+ PowerPC::debug_interface.NetworkLogger()->LogWrite(buf, ret, *fd, nullptr);
+
+ return ret;
}
int SSLRecv(void* ctx, unsigned char* buf, size_t len)
{
auto* ssl = static_cast<WII_SSL*>(ctx);
+ auto* fd = &ssl->hostfd;
+ const int ret = mbedtls_net_recv(fd, buf, len);
+
+ // Log raw SSL packets if we don't dump unencrypted SSL reads
+ if (!Config::Get(Config::MAIN_NETWORK_SSL_DUMP_READ) && ret > 0)
+ PowerPC::debug_interface.NetworkLogger()->LogRead(buf, ret, *fd, nullptr);
- return mbedtls_net_recv(&ssl->hostfd, buf, len);
+ return ret;
}
} // namespace