summaryrefslogtreecommitdiff
path: root/src/core/hle/service/ssl
diff options
context:
space:
mode:
authorGravatar comex2023-06-25 17:00:05 -0700
committerGravatar comex2023-06-25 17:06:57 -0700
commitac939f08a4c116b6a38978358b667b1fa0c51ef9 (patch)
treed056a56751a46f31b2b4f8e2d7b0de31fc5de1db /src/core/hle/service/ssl
parentssl: fix compatibility with OpenSSL 1.1.1 (diff)
downloadyuzu-ac939f08a4c116b6a38978358b667b1fa0c51ef9.tar.gz
yuzu-ac939f08a4c116b6a38978358b667b1fa0c51ef9.tar.xz
yuzu-ac939f08a4c116b6a38978358b667b1fa0c51ef9.zip
Fix more Windows build errors
I did test this beforehand, but not on MinGW, and the error that showed up on the msvc builder didn't happen for me...
Diffstat (limited to 'src/core/hle/service/ssl')
-rw-r--r--src/core/hle/service/ssl/ssl_backend_schannel.cpp49
1 files changed, 28 insertions, 21 deletions
diff --git a/src/core/hle/service/ssl/ssl_backend_schannel.cpp b/src/core/hle/service/ssl/ssl_backend_schannel.cpp
index 0a326b536..92b2dddaa 100644
--- a/src/core/hle/service/ssl/ssl_backend_schannel.cpp
+++ b/src/core/hle/service/ssl/ssl_backend_schannel.cpp
@@ -12,29 +12,31 @@
12 12
13#include <mutex> 13#include <mutex>
14 14
15namespace {
16
17// These includes are inside the namespace to avoid a conflict on MinGW where
18// the headers define an enum containing Network and Service as enumerators
19// (which clash with the correspondingly named namespaces).
15#define SECURITY_WIN32 20#define SECURITY_WIN32
16#include <Security.h> 21#include <security.h>
17#include <schnlsp.h> 22#include <schnlsp.h>
18 23
19namespace {
20
21std::once_flag one_time_init_flag; 24std::once_flag one_time_init_flag;
22bool one_time_init_success = false; 25bool one_time_init_success = false;
23 26
24SCHANNEL_CRED schannel_cred{ 27SCHANNEL_CRED schannel_cred{};
25 .dwVersion = SCHANNEL_CRED_VERSION, 28CredHandle cred_handle;
26 .dwFlags = SCH_USE_STRONG_CRYPTO | // don't allow insecure protocols 29
27 SCH_CRED_AUTO_CRED_VALIDATION | // validate certs 30static void OneTimeInit() {
28 SCH_CRED_NO_DEFAULT_CREDS, // don't automatically present a client certificate 31 schannel_cred.dwVersion = SCHANNEL_CRED_VERSION;
32 schannel_cred.dwFlags = SCH_USE_STRONG_CRYPTO | // don't allow insecure protocols
33 SCH_CRED_AUTO_CRED_VALIDATION | // validate certs
34 SCH_CRED_NO_DEFAULT_CREDS; // don't automatically present a client certificate
29 // ^ I'm assuming that nobody would want to connect Yuzu to a 35 // ^ I'm assuming that nobody would want to connect Yuzu to a
30 // service that requires some OS-provided corporate client 36 // service that requires some OS-provided corporate client
31 // certificate, and presenting one to some arbitrary server 37 // certificate, and presenting one to some arbitrary server
32 // might be a privacy concern? Who knows, though. 38 // might be a privacy concern? Who knows, though.
33};
34
35CredHandle cred_handle;
36 39
37static void OneTimeInit() {
38 SECURITY_STATUS ret = 40 SECURITY_STATUS ret =
39 AcquireCredentialsHandle(nullptr, const_cast<LPTSTR>(UNISP_NAME), SECPKG_CRED_OUTBOUND, 41 AcquireCredentialsHandle(nullptr, const_cast<LPTSTR>(UNISP_NAME), SECPKG_CRED_OUTBOUND,
40 nullptr, &schannel_cred, nullptr, nullptr, &cred_handle, nullptr); 42 nullptr, &schannel_cred, nullptr, nullptr, &cred_handle, nullptr);
@@ -179,15 +181,21 @@ public:
179 // [1] (will be replaced by SECBUFFER_MISSING when SEC_E_INCOMPLETE_MESSAGE is 181 // [1] (will be replaced by SECBUFFER_MISSING when SEC_E_INCOMPLETE_MESSAGE is
180 // returned, or SECBUFFER_EXTRA when SEC_E_CONTINUE_NEEDED is returned if the 182 // returned, or SECBUFFER_EXTRA when SEC_E_CONTINUE_NEEDED is returned if the
181 // whole buffer wasn't used) 183 // whole buffer wasn't used)
184 .cbBuffer = 0,
182 .BufferType = SECBUFFER_EMPTY, 185 .BufferType = SECBUFFER_EMPTY,
186 .pvBuffer = nullptr,
183 }, 187 },
184 }}; 188 }};
185 std::array<SecBuffer, 2> output_buffers{{ 189 std::array<SecBuffer, 2> output_buffers{{
186 { 190 {
191 .cbBuffer = 0,
187 .BufferType = SECBUFFER_TOKEN, 192 .BufferType = SECBUFFER_TOKEN,
193 .pvBuffer = nullptr,
188 }, // [0] 194 }, // [0]
189 { 195 {
196 .cbBuffer = 0,
190 .BufferType = SECBUFFER_ALERT, 197 .BufferType = SECBUFFER_ALERT,
198 .pvBuffer = nullptr,
191 }, // [1] 199 }, // [1]
192 }}; 200 }};
193 SecBufferDesc input_desc{ 201 SecBufferDesc input_desc{
@@ -299,21 +307,20 @@ public:
299 return read_size; 307 return read_size;
300 } 308 }
301 if (!ciphertext_read_buf_.empty()) { 309 if (!ciphertext_read_buf_.empty()) {
310 SecBuffer empty{
311 .cbBuffer = 0,
312 .BufferType = SECBUFFER_EMPTY,
313 .pvBuffer = nullptr,
314 };
302 std::array<SecBuffer, 5> buffers{{ 315 std::array<SecBuffer, 5> buffers{{
303 { 316 {
304 .cbBuffer = static_cast<unsigned long>(ciphertext_read_buf_.size()), 317 .cbBuffer = static_cast<unsigned long>(ciphertext_read_buf_.size()),
305 .BufferType = SECBUFFER_DATA, 318 .BufferType = SECBUFFER_DATA,
306 .pvBuffer = ciphertext_read_buf_.data(), 319 .pvBuffer = ciphertext_read_buf_.data(),
307 }, 320 },
308 { 321 empty,
309 .BufferType = SECBUFFER_EMPTY, 322 empty,
310 }, 323 empty,
311 {
312 .BufferType = SECBUFFER_EMPTY,
313 },
314 {
315 .BufferType = SECBUFFER_EMPTY,
316 },
317 }}; 324 }};
318 ASSERT_OR_EXECUTE_MSG( 325 ASSERT_OR_EXECUTE_MSG(
319 buffers[0].cbBuffer == ciphertext_read_buf_.size(), 326 buffers[0].cbBuffer == ciphertext_read_buf_.size(),