mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-24 13:32:46 -05:00
Compare commits
5 Commits
2a58db5622
...
3a473e3659
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a473e3659 | ||
|
|
71209d4cd7 | ||
|
|
0a3313cb76 | ||
|
|
f0f6d1666c | ||
|
|
0399b6b6bb |
@@ -32,6 +32,7 @@ option(WITH_VAES "Enable VAES instructions for Cryptonight" ON)
|
|||||||
option(WITH_BENCHMARK "Enable builtin RandomX benchmark and stress test" ON)
|
option(WITH_BENCHMARK "Enable builtin RandomX benchmark and stress test" ON)
|
||||||
option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
|
option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
|
||||||
option(WITH_DMI "Enable DMI/SMBIOS reader" ON)
|
option(WITH_DMI "Enable DMI/SMBIOS reader" ON)
|
||||||
|
option(WITH_BUNDLED_FMT "Force use of bundled fmt library" ON)
|
||||||
|
|
||||||
option(BUILD_STATIC "Build static binary" OFF)
|
option(BUILD_STATIC "Build static binary" OFF)
|
||||||
option(ARM_V8 "Force ARMv8 (64 bit) architecture, use with caution if automatic detection fails, but you sure it may work" OFF)
|
option(ARM_V8 "Force ARMv8 (64 bit) architecture, use with caution if automatic detection fails, but you sure it may work" OFF)
|
||||||
@@ -198,6 +199,7 @@ add_definitions(-D__STDC_FORMAT_MACROS -DUNICODE -D_FILE_OFFSET_BITS=64)
|
|||||||
find_package(UV REQUIRED)
|
find_package(UV REQUIRED)
|
||||||
|
|
||||||
include(cmake/flags.cmake)
|
include(cmake/flags.cmake)
|
||||||
|
include(cmake/fmt.cmake)
|
||||||
include(cmake/randomx.cmake)
|
include(cmake/randomx.cmake)
|
||||||
include(cmake/argon2.cmake)
|
include(cmake/argon2.cmake)
|
||||||
include(cmake/kawpow.cmake)
|
include(cmake/kawpow.cmake)
|
||||||
@@ -229,7 +231,7 @@ include(src/hw/api/api.cmake)
|
|||||||
include(src/hw/dmi/dmi.cmake)
|
include(src/hw/dmi/dmi.cmake)
|
||||||
|
|
||||||
include_directories(src)
|
include_directories(src)
|
||||||
include_directories(src/3rdparty)
|
include_directories(src/3rdparty/CL)
|
||||||
include_directories(${UV_INCLUDE_DIR})
|
include_directories(${UV_INCLUDE_DIR})
|
||||||
|
|
||||||
if (WITH_DEBUG_LOG)
|
if (WITH_DEBUG_LOG)
|
||||||
@@ -237,7 +239,7 @@ if (WITH_DEBUG_LOG)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
|
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB} ${ARGON2_LIBRARY} ${ETHASH_LIBRARY} ${GHOSTRIDER_LIBRARY})
|
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB} ${ARGON2_LIBRARY} ${ETHASH_LIBRARY} ${GHOSTRIDER_LIBRARY} ${FMT_LIBRARY})
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/bin/WinRing0/WinRing0x64.sys" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/bin/WinRing0/WinRing0x64.sys" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||||
|
|||||||
13
cmake/fmt.cmake
Normal file
13
cmake/fmt.cmake
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# SPDX-FileCopyrightText: © 2023 Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
|
||||||
|
if(WITH_BUNDLED_FMT)
|
||||||
|
add_library(fmt INTERFACE)
|
||||||
|
target_sources(fmt INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/fmt/format.cc)
|
||||||
|
target_include_directories(fmt INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/fmt)
|
||||||
|
else()
|
||||||
|
set(FMT_LIBRARY fmt)
|
||||||
|
find_package(fmt REQUIRED)
|
||||||
|
set(FMT_LIBRARY fmt::fmt)
|
||||||
|
endif()
|
||||||
2
src/3rdparty/cl.h
vendored
2
src/3rdparty/cl.h
vendored
@@ -29,7 +29,7 @@
|
|||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
# include <OpenCL/cl.h>
|
# include <OpenCL/cl.h>
|
||||||
#else
|
#else
|
||||||
# include "3rdparty/CL/cl.h"
|
# include <CL/cl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
//
|
//
|
||||||
// For the license information refer to format.h.
|
// For the license information refer to format.h.
|
||||||
|
|
||||||
#include "3rdparty/fmt/format-inl.h"
|
#include "fmt/format-inl.h"
|
||||||
|
|
||||||
FMT_BEGIN_NAMESPACE
|
FMT_BEGIN_NAMESPACE
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@@ -18,11 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "base/tools/String.h"
|
#include "base/tools/String.h"
|
||||||
#include "3rdparty/fmt/core.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "backend/opencl/wrappers/AdlLib.h"
|
#include "backend/opencl/wrappers/AdlLib.h"
|
||||||
#include "3rdparty/fmt/core.h"
|
|
||||||
#include "backend/opencl/wrappers/OclDevice.h"
|
#include "backend/opencl/wrappers/OclDevice.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -31,6 +30,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ set(HEADERS_BASE
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCES_BASE
|
set(SOURCES_BASE
|
||||||
src/3rdparty/fmt/format.cc
|
|
||||||
src/base/crypto/Algorithm.cpp
|
src/base/crypto/Algorithm.cpp
|
||||||
src/base/crypto/Coin.cpp
|
src/base/crypto/Coin.cpp
|
||||||
src/base/crypto/keccak.cpp
|
src/base/crypto/keccak.cpp
|
||||||
|
|||||||
@@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "base/kernel/Process.h"
|
#include "base/kernel/Process.h"
|
||||||
#include "3rdparty/fmt/core.h"
|
|
||||||
#include "base/tools/Chrono.h"
|
#include "base/tools/Chrono.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
#ifdef XMRIG_OS_WIN
|
#ifdef XMRIG_OS_WIN
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "base/net/stratum/BaseClient.h"
|
#include "base/net/stratum/BaseClient.h"
|
||||||
#include "3rdparty/fmt/core.h"
|
|
||||||
#include "3rdparty/rapidjson/document.h"
|
#include "3rdparty/rapidjson/document.h"
|
||||||
#include "base/io/Env.h"
|
#include "base/io/Env.h"
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
@@ -25,6 +24,8 @@
|
|||||||
#include "base/kernel/interfaces/IClientListener.h"
|
#include "base/kernel/interfaces/IClientListener.h"
|
||||||
#include "base/net/stratum/SubmitResult.h"
|
#include "base/net/stratum/SubmitResult.h"
|
||||||
|
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ void xmrig::Client::handshake()
|
|||||||
if (isTLS()) {
|
if (isTLS()) {
|
||||||
m_expire = Chrono::steadyMSecs() + kResponseTimeout;
|
m_expire = Chrono::steadyMSecs() + kResponseTimeout;
|
||||||
|
|
||||||
m_tls->handshake();
|
m_tls->handshake(m_pool.isSNI() ? m_pool.host().data() : nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ const char *Pool::kSelfSelect = "self-select";
|
|||||||
const char *Pool::kSOCKS5 = "socks5";
|
const char *Pool::kSOCKS5 = "socks5";
|
||||||
const char *Pool::kSubmitToOrigin = "submit-to-origin";
|
const char *Pool::kSubmitToOrigin = "submit-to-origin";
|
||||||
const char *Pool::kTls = "tls";
|
const char *Pool::kTls = "tls";
|
||||||
|
const char *Pool::kSni = "sni";
|
||||||
const char *Pool::kUrl = "url";
|
const char *Pool::kUrl = "url";
|
||||||
const char *Pool::kUser = "user";
|
const char *Pool::kUser = "user";
|
||||||
const char *Pool::kSpendSecretKey = "spend-secret-key";
|
const char *Pool::kSpendSecretKey = "spend-secret-key";
|
||||||
@@ -137,6 +138,7 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
|
|||||||
m_flags.set(FLAG_ENABLED, Json::getBool(object, kEnabled, true));
|
m_flags.set(FLAG_ENABLED, Json::getBool(object, kEnabled, true));
|
||||||
m_flags.set(FLAG_NICEHASH, Json::getBool(object, kNicehash) || m_url.host().contains(kNicehashHost));
|
m_flags.set(FLAG_NICEHASH, Json::getBool(object, kNicehash) || m_url.host().contains(kNicehashHost));
|
||||||
m_flags.set(FLAG_TLS, Json::getBool(object, kTls) || m_url.isTLS());
|
m_flags.set(FLAG_TLS, Json::getBool(object, kTls) || m_url.isTLS());
|
||||||
|
m_flags.set(FLAG_SNI, Json::getBool(object, kSni));
|
||||||
|
|
||||||
setKeepAlive(Json::getValue(object, kKeepalive));
|
setKeepAlive(Json::getValue(object, kKeepalive));
|
||||||
|
|
||||||
@@ -299,6 +301,7 @@ rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
|
|||||||
|
|
||||||
obj.AddMember(StringRef(kEnabled), m_flags.test(FLAG_ENABLED), allocator);
|
obj.AddMember(StringRef(kEnabled), m_flags.test(FLAG_ENABLED), allocator);
|
||||||
obj.AddMember(StringRef(kTls), isTLS(), allocator);
|
obj.AddMember(StringRef(kTls), isTLS(), allocator);
|
||||||
|
obj.AddMember(StringRef(kSni), isSNI(), allocator);
|
||||||
obj.AddMember(StringRef(kFingerprint), m_fingerprint.toJSON(), allocator);
|
obj.AddMember(StringRef(kFingerprint), m_fingerprint.toJSON(), allocator);
|
||||||
obj.AddMember(StringRef(kDaemon), m_mode == MODE_DAEMON, allocator);
|
obj.AddMember(StringRef(kDaemon), m_mode == MODE_DAEMON, allocator);
|
||||||
obj.AddMember(StringRef(kSOCKS5), m_proxy.toJSON(doc), allocator);
|
obj.AddMember(StringRef(kSOCKS5), m_proxy.toJSON(doc), allocator);
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public:
|
|||||||
static const char *kSOCKS5;
|
static const char *kSOCKS5;
|
||||||
static const char *kSubmitToOrigin;
|
static const char *kSubmitToOrigin;
|
||||||
static const char *kTls;
|
static const char *kTls;
|
||||||
|
static const char* kSni;
|
||||||
static const char *kUrl;
|
static const char *kUrl;
|
||||||
static const char *kUser;
|
static const char *kUser;
|
||||||
static const char* kSpendSecretKey;
|
static const char* kSpendSecretKey;
|
||||||
@@ -95,6 +96,7 @@ public:
|
|||||||
|
|
||||||
inline bool isNicehash() const { return m_flags.test(FLAG_NICEHASH); }
|
inline bool isNicehash() const { return m_flags.test(FLAG_NICEHASH); }
|
||||||
inline bool isTLS() const { return m_flags.test(FLAG_TLS) || m_url.isTLS(); }
|
inline bool isTLS() const { return m_flags.test(FLAG_TLS) || m_url.isTLS(); }
|
||||||
|
inline bool isSNI() const { return m_flags.test(FLAG_SNI); }
|
||||||
inline bool isValid() const { return m_url.isValid(); }
|
inline bool isValid() const { return m_url.isValid(); }
|
||||||
inline const Algorithm &algorithm() const { return m_algorithm; }
|
inline const Algorithm &algorithm() const { return m_algorithm; }
|
||||||
inline const Coin &coin() const { return m_coin; }
|
inline const Coin &coin() const { return m_coin; }
|
||||||
@@ -138,6 +140,7 @@ private:
|
|||||||
FLAG_ENABLED,
|
FLAG_ENABLED,
|
||||||
FLAG_NICEHASH,
|
FLAG_NICEHASH,
|
||||||
FLAG_TLS,
|
FLAG_TLS,
|
||||||
|
FLAG_SNI,
|
||||||
FLAG_MAX
|
FLAG_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ xmrig::Client::Tls::~Tls()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool xmrig::Client::Tls::handshake()
|
bool xmrig::Client::Tls::handshake(const char* servername)
|
||||||
{
|
{
|
||||||
m_ssl = SSL_new(m_ctx);
|
m_ssl = SSL_new(m_ctx);
|
||||||
assert(m_ssl != nullptr);
|
assert(m_ssl != nullptr);
|
||||||
@@ -69,6 +69,10 @@ bool xmrig::Client::Tls::handshake()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (servername) {
|
||||||
|
SSL_set_tlsext_host_name(m_ssl, servername);
|
||||||
|
}
|
||||||
|
|
||||||
SSL_set_connect_state(m_ssl);
|
SSL_set_connect_state(m_ssl);
|
||||||
SSL_set_bio(m_ssl, m_read, m_write);
|
SSL_set_bio(m_ssl, m_read, m_write);
|
||||||
SSL_do_handshake(m_ssl);
|
SSL_do_handshake(m_ssl);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
Tls(Client *client);
|
Tls(Client *client);
|
||||||
~Tls();
|
~Tls();
|
||||||
|
|
||||||
bool handshake();
|
bool handshake(const char* servername);
|
||||||
bool send(const char *data, size_t size);
|
bool send(const char *data, size_t size);
|
||||||
const char *fingerprint() const;
|
const char *fingerprint() const;
|
||||||
const char *version() const;
|
const char *version() const;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "base/net/stratum/benchmark/BenchClient.h"
|
#include "base/net/stratum/benchmark/BenchClient.h"
|
||||||
#include "3rdparty/fmt/core.h"
|
|
||||||
#include "3rdparty/rapidjson/document.h"
|
#include "3rdparty/rapidjson/document.h"
|
||||||
#include "backend/common/benchmark/BenchState.h"
|
#include "backend/common/benchmark/BenchState.h"
|
||||||
#include "backend/common/interfaces/IBackend.h"
|
#include "backend/common/interfaces/IBackend.h"
|
||||||
@@ -39,6 +38,8 @@
|
|||||||
# include "hw/dmi/DmiReader.h"
|
# include "hw/dmi/DmiReader.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
|
|
||||||
xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, IClientListener* listener) :
|
xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, IClientListener* listener) :
|
||||||
m_listener(listener),
|
m_listener(listener),
|
||||||
|
|||||||
@@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "base/net/stratum/benchmark/BenchConfig.h"
|
#include "base/net/stratum/benchmark/BenchConfig.h"
|
||||||
#include "3rdparty/fmt/core.h"
|
|
||||||
#include "3rdparty/rapidjson/document.h"
|
#include "3rdparty/rapidjson/document.h"
|
||||||
#include "base/io/json/Json.h"
|
#include "base/io/json/Json.h"
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|||||||
@@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "crypto/common/LinuxMemory.h"
|
#include "crypto/common/LinuxMemory.h"
|
||||||
#include "3rdparty/fmt/core.h"
|
|
||||||
#include "crypto/common/VirtualMemory.h"
|
#include "crypto/common/VirtualMemory.h"
|
||||||
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <fmt/core.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "hw/dmi/DmiMemory.h"
|
#include "hw/dmi/DmiMemory.h"
|
||||||
#include "3rdparty/fmt/format.h"
|
|
||||||
#include "3rdparty/rapidjson/document.h"
|
#include "3rdparty/rapidjson/document.h"
|
||||||
#include "hw/dmi/DmiTools.h"
|
#include "hw/dmi/DmiTools.h"
|
||||||
|
|
||||||
@@ -28,6 +27,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|||||||
@@ -19,10 +19,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hw/dmi/DmiReader.h"
|
#include "hw/dmi/DmiReader.h"
|
||||||
#include "3rdparty/fmt/core.h"
|
|
||||||
#include "3rdparty/rapidjson/document.h"
|
#include "3rdparty/rapidjson/document.h"
|
||||||
#include "hw/dmi/DmiTools.h"
|
#include "hw/dmi/DmiTools.h"
|
||||||
|
|
||||||
|
#include <fmt/core.h>
|
||||||
|
|
||||||
|
|
||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "hw/msr/Msr.h"
|
#include "hw/msr/Msr.h"
|
||||||
#include "3rdparty/fmt/core.h"
|
|
||||||
#include "backend/cpu/Cpu.h"
|
#include "backend/cpu/Cpu.h"
|
||||||
#include "base/io/log/Log.h"
|
#include "base/io/log/Log.h"
|
||||||
|
|
||||||
@@ -29,6 +28,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <fmt/core.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user