From c23cbc275f4f4704fd325f739f0b487688b8966b Mon Sep 17 00:00:00 2001 From: Arron Nelson Date: Thu, 22 May 2025 17:34:09 -0700 Subject: [PATCH] Backup. --- Assembly.def | 26 ++++++++++++++++++++++++++ CMakeLists.txt | 9 ++++----- include/ehs/HRNG.h | 2 +- include/ehs/SHA256.h | 2 +- include/ehs/io/socket/TCP_W32.h | 2 ++ include/ehs/system/AVX2.h | 2 +- include/ehs/system/AVX512.h | 2 +- src/io/socket/SSL.cpp | 23 +++++++++++++++++++++-- src/io/socket/TCP_W32.cpp | 4 ++++ 9 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 Assembly.def diff --git a/Assembly.def b/Assembly.def new file mode 100644 index 0000000..6207d84 --- /dev/null +++ b/Assembly.def @@ -0,0 +1,26 @@ +LIBRARY EHS_Dyn +EXPORTS + ?GenerateSeed_u64@HRNG@ehs@@SA_KXZ + ?Generate_u64@HRNG@ehs@@SA_K_K0@Z + ?Generate_u64@HRNG@ehs@@SA_KXZ + ?GenerateSeed_s64@HRNG@ehs@@SA_JXZ + ?Generate_s64@HRNG@ehs@@SA_J_J0@Z + ?Generate_s64@HRNG@ehs@@SA_JXZ + ?GenerateSeed_u32@HRNG@ehs@@SAIXZ + ?Generate_u32@HRNG@ehs@@SAIII@Z + ?Generate_u32@HRNG@ehs@@SAIXZ + ?GenerateSeed_s32@HRNG@ehs@@SAHXZ + ?Generate_s32@HRNG@ehs@@SAHHH@Z + ?Generate_s32@HRNG@ehs@@SAHXZ + ?GenerateSeed_u16@HRNG@ehs@@SAIXZ + ?Generate_u16@HRNG@ehs@@SAGGG@Z + ?Generate_u16@HRNG@ehs@@SAGXZ + ?GenerateSeed_s16@HRNG@ehs@@SAFXZ + ?Generate_s16@HRNG@ehs@@SAFFF@Z + ?Generate_s16@HRNG@ehs@@SAFXZ + ?GenerateSeed_u8@HRNG@ehs@@SAEXZ + ?Generate_u8@HRNG@ehs@@SAEEE@Z + ?Generate_u8@HRNG@ehs@@SAEXZ + ?GenerateSeed_s8@HRNG@ehs@@SACXZ + ?Generate_s8@HRNG@ehs@@SACCC@Z + ?Generate_s8@HRNG@ehs@@SACXZ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 19d2a95..8957e8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.25.1) +cmake_minimum_required(VERSION 3.30.4) set(IS_OS_WINDOWS FALSE) set(IS_OS_LINUX FALSE) @@ -11,6 +11,8 @@ set(IS_ARCH_ARM FALSE) project(EHS CXX C) +set(CMAKE_VERBOSE_MAKEFILE ON) + if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") set(IS_OS_WINDOWS TRUE) set(USER_HOME_DIRECTORY "$ENV{USERPROFILE}") @@ -262,11 +264,8 @@ elseif (IS_OS_LINUX) endif () endif() -#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") -#message("${CMAKE_CXX_FLAGS}") - add_library(EHS_Stc STATIC ${EHS_SOURCES}) -add_library(EHS_Dyn SHARED ${EHS_SOURCES}) +add_library(EHS_Dyn SHARED ${EHS_SOURCES} Assembly.def) add_executable(StrToHash src/StrToHash.cpp) target_compile_definitions(EHS_Dyn PRIVATE EHS_LIB_EXPORT) diff --git a/include/ehs/HRNG.h b/include/ehs/HRNG.h index 3a0a203..f95e38a 100644 --- a/include/ehs/HRNG.h +++ b/include/ehs/HRNG.h @@ -5,7 +5,7 @@ namespace ehs { - class EHS_LIB_IO HRNG + class HRNG { public: static UInt_64 GenerateSeed_u64(); diff --git a/include/ehs/SHA256.h b/include/ehs/SHA256.h index a823d23..b5d9a46 100644 --- a/include/ehs/SHA256.h +++ b/include/ehs/SHA256.h @@ -3,7 +3,7 @@ namespace ehs { - class SHA256 + class EHS_LIB_IO SHA256 { private: static UInt_32 ROTR(UInt_32 x, UInt_32 n); diff --git a/include/ehs/io/socket/TCP_W32.h b/include/ehs/io/socket/TCP_W32.h index 09ae2eb..605259d 100644 --- a/include/ehs/io/socket/TCP_W32.h +++ b/include/ehs/io/socket/TCP_W32.h @@ -84,6 +84,8 @@ namespace ehs bool IsIPv6Only() const override; + void SetReuse(const bool &value) override; + bool IsValid() const override; private: diff --git a/include/ehs/system/AVX2.h b/include/ehs/system/AVX2.h index 7744cad..9ea0a5d 100644 --- a/include/ehs/system/AVX2.h +++ b/include/ehs/system/AVX2.h @@ -4,7 +4,7 @@ namespace ehs { - class AVX2 + class EHS_LIB_IO AVX2 { public: /// Compares two unaligned 4 element vectors using 64-bit integers. diff --git a/include/ehs/system/AVX512.h b/include/ehs/system/AVX512.h index 73e256d..7dcb53f 100644 --- a/include/ehs/system/AVX512.h +++ b/include/ehs/system/AVX512.h @@ -4,7 +4,7 @@ namespace ehs { - class AVX512 + class EHS_LIB_IO AVX512 { public: /// Compares two unaligned 8 element vectors using 64-bit integers. diff --git a/src/io/socket/SSL.cpp b/src/io/socket/SSL.cpp index 6c4134f..f5a604e 100644 --- a/src/io/socket/SSL.cpp +++ b/src/io/socket/SSL.cpp @@ -1,4 +1,5 @@ #include "ehs/io/socket/SSL.h" +#include "ehs/io/Console.h" #include #include @@ -163,10 +164,16 @@ namespace ehs OpenSSL_add_ssl_algorithms(); SSL_load_error_strings(); + if (!OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, nullptr)) + { + EHS_LOG_INT(LogType::ERR, 0, "Failed to initialize OpenSSL."); + return; + } + ctx = SSL_CTX_new(TLS_client_method()); if (!ctx) { - EHS_LOG_INT(LogType::ERR, 0, "Failed to creat SSL context."); + EHS_LOG_INT(LogType::ERR, 1, "Failed to creat SSL context."); return; } @@ -182,7 +189,19 @@ namespace ehs SInt_32 rc = SSL_connect(sslHdl); if (rc != 1) { - EHS_LOG_INT(LogType::ERR, 1, "Failed to connect with error #" + Str_8::FromNum(SSL_get_error(sslHdl, rc)) + "."); + SInt_32 err = SSL_get_error(sslHdl, rc); + if (err == SSL_ERROR_SSL) + { + UInt_32 e; + while ((e = ERR_get_error()) != 0) + { + char buf[256]; + ERR_error_string_n(e, buf, sizeof(buf)); + Console::Write_8(Str_8(buf)); + } + } + + EHS_LOG_INT(LogType::ERR, 2, "Failed to connect with error #" + Str_8::FromNum(err) + "."); return; } diff --git a/src/io/socket/TCP_W32.cpp b/src/io/socket/TCP_W32.cpp index e2b2344..2f3ec99 100644 --- a/src/io/socket/TCP_W32.cpp +++ b/src/io/socket/TCP_W32.cpp @@ -406,6 +406,10 @@ namespace ehs return result; } + void TCP::SetReuse(const bool &value) + { + } + bool TCP::IsValid() const { return hdl != EHS_INVALID_SOCKET;