Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WolfSSL: Use a custom UTF-8 aware _stat on Windows #11378

Merged
merged 2 commits into from Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty/curl/CMakeLists.txt
Expand Up @@ -7,7 +7,7 @@ if(USE_SYSTEM_CURL)
target_link_libraries(libcurl INTERFACE CURL::libcurl)
else()
message("-- RPCS3: building libcurl + wolfssl submodules")
add_compile_definitions(HAVE_SNI)
add_compile_definitions(HAVE_SNI OPENSSL_EXTRA)
option(BUILD_CURL_EXE "Set to ON to build curl executable." OFF)
option(CMAKE_USE_WOLFSSL "enable wolfSSL for SSL/TLS" ON)
option(HTTP_ONLY "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)" ON)
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/curl/libcurl.vcxproj
Expand Up @@ -43,8 +43,8 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>curl\include;curl\lib;extra;$(SolutionDir)3rdparty\wolfssl\wolfssl\wolfssl;$(SolutionDir)3rdparty\wolfssl\wolfssl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_SNI;NDEBUG;BUILDING_LIBCURL;CURL_STATICLIB;USE_WOLFSSL;USE_IPV6;SIZEOF_LONG=4;SIZEOF_LONG_LONG=8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>curl\include;curl\lib;extra;$(SolutionDir)3rdparty\wolfssl\wolfssl\wolfssl;$(SolutionDir)3rdparty\wolfssl\wolfssl;$(SolutionDir)3rdparty\wolfssl\extra\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_SNI;NDEBUG;BUILDING_LIBCURL;CURL_STATICLIB;USE_WOLFSSL;WOLFSSL_USER_SETTINGS;USE_IPV6;SIZEOF_LONG=4;SIZEOF_LONG_LONG=8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level4</WarningLevel>
Expand Down
4 changes: 3 additions & 1 deletion 3rdparty/wolfssl/extra/win32/user_settings.h
Expand Up @@ -67,7 +67,9 @@ extern FILE* wolfSSL_fopen_utf8(const char* name, const char* mode);
#define XFFLUSH fflush

#include <sys/stat.h>
#define XSTAT _stat
extern int wolfSSL_stat_utf8(const char* path, struct _stat* buffer);
#define XSTAT wolfSSL_stat_utf8
#define XSTAT_TYPE struct _stat
#define XS_ISREG(s) (s & _S_IFREG)
#define SEPARATOR_CHAR ';'

Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/wolfssl/wolfssl
Submodule wolfssl updated 688 files
5 changes: 2 additions & 3 deletions 3rdparty/wolfssl/wolfssl.vcxproj
Expand Up @@ -101,9 +101,7 @@
<ClCompile Include="wolfssl\wolfcrypt\src\ge_low_mem.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\ge_operations.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\hash.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\hc128.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\hmac.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\idea.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\integer.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\kdf.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\logging.c" />
Expand All @@ -115,10 +113,11 @@
<ClCompile Include="wolfssl\wolfcrypt\src\pkcs12.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\poly1305.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\pwdbased.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\rabbit.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\random.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\rc2.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\ripemd.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\rsa.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\sakke.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\sha.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\sha256.c" />
<ClCompile Include="wolfssl\wolfcrypt\src\sha3.c" />
Expand Down
14 changes: 12 additions & 2 deletions rpcs3/rpcs3qt/curl_handle.cpp
Expand Up @@ -67,9 +67,19 @@ std::string curl_handle::get_verbose_error(CURLcode code)
}

#ifdef _WIN32
// Function exported from our user_settings.h in WolfSSL, implemented in RPCS3
extern "C" FILE* wolfSSL_fopen_utf8(const char* name, const char* mode)
// Functions exported from our user_settings.h in WolfSSL, implemented in RPCS3
extern "C"
{

FILE* wolfSSL_fopen_utf8(const char* name, const char* mode)
{
return _wfopen(utf8_to_wchar(name).c_str(), utf8_to_wchar(mode).c_str());
}

int wolfSSL_stat_utf8(const char* path, struct _stat* buffer)
{
return _wstat(utf8_to_wchar(path).c_str(), buffer);
}

}
#endif