diff --git a/cmake/cpu.cmake b/cmake/cpu.cmake index 14b17763..6a406b07 100644 --- a/cmake/cpu.cmake +++ b/cmake/cpu.cmake @@ -9,6 +9,8 @@ if (NOT CMAKE_SYSTEM_PROCESSOR) message(WARNING "CMAKE_SYSTEM_PROCESSOR not defined") endif() +message(STATUS "XMRIG_64_BIT\t= ${XMRIG_64_BIT} (${CMAKE_SYSTEM_PROCESSOR})") + if (XMRIG_64_BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") add_definitions(-DRAPIDJSON_SSE2) else() diff --git a/cmake/flags.cmake b/cmake/flags.cmake index ff5943a1..aeb73275 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -1,6 +1,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 14) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) @@ -10,7 +10,7 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "") endif() if (CMAKE_BUILD_TYPE STREQUAL "Release") - add_definitions(/DNDEBUG) + add_definitions(-DNDEBUG) endif() include(CheckSymbolExists) @@ -32,7 +32,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") - add_definitions(/DHAVE_ROTR) + add_definitions(-DHAVE_ROTR) endif() if (WIN32) @@ -49,16 +49,14 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") endif() - add_definitions(/D_GNU_SOURCE) + add_definitions(-D_GNU_SOURCE) if (${CMAKE_VERSION} VERSION_LESS "3.1.0") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") endif() - #set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-2") - - add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE) + add_definitions(-DHAVE_BUILTIN_CLEAR_CACHE) elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC) set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Oi /DNDEBUG /GL") @@ -67,10 +65,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC) set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Ob1 /Zi /DRELWITHDEBINFO") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Ob1 /Zi /DRELWITHDEBINFO") - add_definitions(/D_CRT_SECURE_NO_WARNINGS) - add_definitions(/D_CRT_NONSTDC_NO_WARNINGS) - add_definitions(/DNOMINMAX) - add_definitions(/DHAVE_ROTR) + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -DNOMINMAX -DHAVE_ROTR) elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) @@ -92,7 +87,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) check_symbol_exists("_rotr" "x86intrin.h" HAVE_ROTR) if (HAVE_ROTR) - add_definitions(/DHAVE_ROTR) + add_definitions(-DHAVE_ROTR) endif() endif() @@ -105,6 +100,6 @@ endif() if (NOT WIN32) check_symbol_exists("__builtin___clear_cache" "stdlib.h" HAVE_BUILTIN_CLEAR_CACHE) if (HAVE_BUILTIN_CLEAR_CACHE) - add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE) + add_definitions(-DHAVE_BUILTIN_CLEAR_CACHE) endif() endif() diff --git a/cmake/os.cmake b/cmake/os.cmake index 02a787df..40443bfb 100644 --- a/cmake/os.cmake +++ b/cmake/os.cmake @@ -50,3 +50,5 @@ endif() if (WITH_SECURE_JIT) add_definitions(-DXMRIG_SECURE_JIT) endif() + +message(STATUS "WITH_SECURE_JIT\t= ${WITH_SECURE_JIT}") diff --git a/src/3rdparty/cryptonote/LICENSE b/src/3rdparty/cryptonote/LICENSE new file mode 100644 index 00000000..72da9414 --- /dev/null +++ b/src/3rdparty/cryptonote/LICENSE @@ -0,0 +1,41 @@ +Copyright (c) 2014-2021, The Monero Project + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Parts of the project are originally copyright (c) 2012-2013 The Cryptonote +developers + +Parts of the project are originally copyright (c) 2014 The Boolberry +developers, distributed under the MIT licence: + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/base/tools/cryptonote/crypto-ops-data.c b/src/3rdparty/cryptonote/crypto-ops-data.c similarity index 100% rename from src/base/tools/cryptonote/crypto-ops-data.c rename to src/3rdparty/cryptonote/crypto-ops-data.c diff --git a/src/base/tools/cryptonote/crypto-ops.c b/src/3rdparty/cryptonote/crypto-ops.c similarity index 100% rename from src/base/tools/cryptonote/crypto-ops.c rename to src/3rdparty/cryptonote/crypto-ops.c diff --git a/src/base/tools/cryptonote/crypto-ops.h b/src/3rdparty/cryptonote/crypto-ops.h similarity index 100% rename from src/base/tools/cryptonote/crypto-ops.h rename to src/3rdparty/cryptonote/crypto-ops.h diff --git a/src/base/api/requests/ApiRequest.cpp b/src/base/api/requests/ApiRequest.cpp index 4f0bd044..841cd6a3 100644 --- a/src/base/api/requests/ApiRequest.cpp +++ b/src/base/api/requests/ApiRequest.cpp @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/api/requests/ApiRequest.h" diff --git a/src/base/api/requests/ApiRequest.h b/src/base/api/requests/ApiRequest.h index c87e822c..92f357b3 100644 --- a/src/base/api/requests/ApiRequest.h +++ b/src/base/api/requests/ApiRequest.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +16,6 @@ * along with this program. If not, see . */ - #ifndef XMRIG_APIREQUEST_H #define XMRIG_APIREQUEST_H diff --git a/src/base/api/requests/HttpApiRequest.cpp b/src/base/api/requests/HttpApiRequest.cpp index de43f752..c0138780 100644 --- a/src/base/api/requests/HttpApiRequest.cpp +++ b/src/base/api/requests/HttpApiRequest.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/api/requests/HttpApiRequest.h" #include "3rdparty/llhttp/llhttp.h" #include "3rdparty/rapidjson/error/en.h" diff --git a/src/base/api/requests/HttpApiRequest.h b/src/base/api/requests/HttpApiRequest.h index cb159757..a1de5d86 100644 --- a/src/base/api/requests/HttpApiRequest.h +++ b/src/base/api/requests/HttpApiRequest.h @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #ifndef XMRIG_HTTPAPIREQUEST_H #define XMRIG_HTTPAPIREQUEST_H diff --git a/src/base/base.cmake b/src/base/base.cmake index 3246d6f9..09138cea 100644 --- a/src/base/base.cmake +++ b/src/base/base.cmake @@ -75,7 +75,7 @@ set(HEADERS_BASE src/base/tools/Chrono.h src/base/tools/cryptonote/BlobReader.h src/base/tools/cryptonote/BlockTemplate.h - src/base/tools/cryptonote/crypto-ops.h + src/3rdparty/cryptonote/crypto-ops.h src/base/tools/cryptonote/Signatures.h src/base/tools/cryptonote/umul128.h src/base/tools/cryptonote/WalletAddress.h @@ -133,8 +133,8 @@ set(SOURCES_BASE src/base/net/tools/NetBuffer.cpp src/base/tools/Arguments.cpp src/base/tools/cryptonote/BlockTemplate.cpp - src/base/tools/cryptonote/crypto-ops-data.c - src/base/tools/cryptonote/crypto-ops.c + src/3rdparty/cryptonote/crypto-ops-data.c + src/3rdparty/cryptonote/crypto-ops.c src/base/tools/cryptonote/Signatures.cpp src/base/tools/cryptonote/WalletAddress.cpp src/base/tools/Cvt.cpp diff --git a/src/base/crypto/keccak.cpp b/src/base/crypto/keccak.cpp index 6d7f093f..58fb3c5d 100644 --- a/src/base/crypto/keccak.cpp +++ b/src/base/crypto/keccak.cpp @@ -1,13 +1,7 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2011 Markku-Juhani O. Saarinen - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2011 Markku-Juhani O. Saarinen + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +17,6 @@ * along with this program. If not, see . */ - #include diff --git a/src/base/crypto/keccak.h b/src/base/crypto/keccak.h index 2b039c90..6a07a1ff 100644 --- a/src/base/crypto/keccak.h +++ b/src/base/crypto/keccak.h @@ -1,13 +1,7 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2011 Markku-Juhani O. Saarinen - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2011 Markku-Juhani O. Saarinen + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +17,6 @@ * along with this program. If not, see . */ - #ifndef XMRIG_KECCAK_H #define XMRIG_KECCAK_H diff --git a/src/base/io/Async.cpp b/src/base/io/Async.cpp index 255be8c0..c50cdf6e 100644 --- a/src/base/io/Async.cpp +++ b/src/base/io/Async.cpp @@ -1,8 +1,8 @@ /* XMRig * Copyright (c) 2015-2020 libuv project contributors. * Copyright (c) 2020 cohcho - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/io/Async.h b/src/base/io/Async.h index 19491082..823eea1d 100644 --- a/src/base/io/Async.h +++ b/src/base/io/Async.h @@ -1,8 +1,8 @@ /* XMRig * Copyright (c) 2015-2020 libuv project contributors. * Copyright (c) 2020 cohcho - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/io/Signals.cpp b/src/base/io/Signals.cpp index dfe4a89b..e9f89f9d 100644 --- a/src/base/io/Signals.cpp +++ b/src/base/io/Signals.cpp @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,10 +17,10 @@ */ +#include "base/io/Signals.h" #include "base/kernel/interfaces/ISignalListener.h" #include "base/io/log/Log.h" #include "base/io/log/Tags.h" -#include "base/io/Signals.h" #include "base/tools/Handle.h" diff --git a/src/base/io/Signals.h b/src/base/io/Signals.h index 56be5889..84b46107 100644 --- a/src/base/io/Signals.h +++ b/src/base/io/Signals.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/io/Watcher.cpp b/src/base/io/Watcher.cpp index f5ce9647..893e9449 100644 --- a/src/base/io/Watcher.cpp +++ b/src/base/io/Watcher.cpp @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright (c) 2016-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,12 +16,11 @@ * along with this program. If not, see . */ - #include -#include "base/kernel/interfaces/IWatcherListener.h" #include "base/io/Watcher.h" +#include "base/kernel/interfaces/IWatcherListener.h" #include "base/tools/Handle.h" #include "base/tools/Timer.h" diff --git a/src/base/io/Watcher.h b/src/base/io/Watcher.h index 6438cb7a..fab9d1ef 100644 --- a/src/base/io/Watcher.h +++ b/src/base/io/Watcher.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright (c) 2016-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/io/log/FileLogWriter.cpp b/src/base/io/log/FileLogWriter.cpp index b41f7f39..132b15b7 100644 --- a/src/base/io/log/FileLogWriter.cpp +++ b/src/base/io/log/FileLogWriter.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/io/log/FileLogWriter.h" #include "base/io/Env.h" diff --git a/src/base/io/log/backends/SysLog.cpp b/src/base/io/log/backends/SysLog.cpp index bd333908..127db20b 100644 --- a/src/base/io/log/backends/SysLog.cpp +++ b/src/base/io/log/backends/SysLog.cpp @@ -1,7 +1,7 @@ /* XMRig * Copyright (c) 2019 Spudz76 - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #include diff --git a/src/base/io/log/backends/SysLog.h b/src/base/io/log/backends/SysLog.h index 447ad006..8bab4957 100644 --- a/src/base/io/log/backends/SysLog.h +++ b/src/base/io/log/backends/SysLog.h @@ -1,7 +1,7 @@ /* XMRig * Copyright (c) 2019 Spudz76 - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/kernel/Base.cpp b/src/base/kernel/Base.cpp index 0e012186..4dda9b2e 100644 --- a/src/base/kernel/Base.cpp +++ b/src/base/kernel/Base.cpp @@ -34,7 +34,7 @@ #include "base/net/tools/NetBuffer.h" #include "core/config/Config.h" #include "core/config/ConfigTransform.h" -#include "version.h" +#include "../version.h" #ifdef HAVE_SYSLOG_H diff --git a/src/base/kernel/Entry.cpp b/src/base/kernel/Entry.cpp index 4fedbca9..9c59e37e 100644 --- a/src/base/kernel/Entry.cpp +++ b/src/base/kernel/Entry.cpp @@ -36,7 +36,7 @@ #include "base/kernel/Entry.h" #include "base/kernel/Process.h" #include "core/config/usage.h" -#include "version.h" +#include "../version.h" namespace xmrig { diff --git a/src/base/kernel/Platform.cpp b/src/base/kernel/Platform.cpp index ef2b67eb..518b9a94 100644 --- a/src/base/kernel/Platform.cpp +++ b/src/base/kernel/Platform.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/kernel/Platform.h" diff --git a/src/base/kernel/Platform_hwloc.cpp b/src/base/kernel/Platform_hwloc.cpp index 8d9d9f59..36910162 100644 --- a/src/base/kernel/Platform_hwloc.cpp +++ b/src/base/kernel/Platform_hwloc.cpp @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/kernel/Platform.h" #include "backend/cpu/platform/HwlocCpuInfo.h" #include "backend/cpu/Cpu.h" diff --git a/src/base/kernel/Platform_mac.cpp b/src/base/kernel/Platform_mac.cpp index d07e925d..70a4e840 100644 --- a/src/base/kernel/Platform_mac.cpp +++ b/src/base/kernel/Platform_mac.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include #include #include @@ -28,7 +27,7 @@ #include "base/kernel/Platform.h" -#include "version.h" +#include "../version.h" char *xmrig::Platform::createUserAgent() diff --git a/src/base/kernel/Platform_unix.cpp b/src/base/kernel/Platform_unix.cpp index f5bbc193..dc1cb961 100644 --- a/src/base/kernel/Platform_unix.cpp +++ b/src/base/kernel/Platform_unix.cpp @@ -38,7 +38,7 @@ #include "base/kernel/Platform.h" -#include "version.h" +#include "../version.h" #ifdef __FreeBSD__ diff --git a/src/base/kernel/Platform_win.cpp b/src/base/kernel/Platform_win.cpp index 76d81ae5..2b67ec70 100644 --- a/src/base/kernel/Platform_win.cpp +++ b/src/base/kernel/Platform_win.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include #include #include @@ -25,7 +24,7 @@ #include "base/kernel/Platform.h" -#include "version.h" +#include "../version.h" static inline OSVERSIONINFOEX winOsVersion() diff --git a/src/base/kernel/Process.h b/src/base/kernel/Process.h index 9af498f5..6201b0c1 100644 --- a/src/base/kernel/Process.h +++ b/src/base/kernel/Process.h @@ -33,7 +33,7 @@ namespace xmrig { -class Process +class [[deprecated]] Process { public: enum Location { diff --git a/src/base/kernel/config/BaseConfig.cpp b/src/base/kernel/config/BaseConfig.cpp index 37982999..12dc4a9a 100644 --- a/src/base/kernel/config/BaseConfig.cpp +++ b/src/base/kernel/config/BaseConfig.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/kernel/config/BaseConfig.h" #include "3rdparty/rapidjson/document.h" #include "base/io/json/Json.h" diff --git a/src/base/kernel/config/BaseConfig.h b/src/base/kernel/config/BaseConfig.h index fae6d981..a7f57781 100644 --- a/src/base/kernel/config/BaseConfig.h +++ b/src/base/kernel/config/BaseConfig.h @@ -37,7 +37,7 @@ namespace xmrig { class IJsonReader; -class BaseConfig : public IConfig +class [[deprecated]] BaseConfig : public IConfig { public: static const char *kApi; diff --git a/src/base/kernel/config/BaseTransform.h b/src/base/kernel/config/BaseTransform.h index 0ddcebc8..df06d33f 100644 --- a/src/base/kernel/config/BaseTransform.h +++ b/src/base/kernel/config/BaseTransform.h @@ -36,7 +36,7 @@ class JsonChain; class Process; -class BaseTransform : public IConfigTransform +class [[deprecated]] BaseTransform : public IConfigTransform { public: static void load(JsonChain &chain, Process *process, IConfigTransform &transform); diff --git a/src/base/kernel/config/Title.cpp b/src/base/kernel/config/Title.cpp index 030aa727..f2d3fd45 100644 --- a/src/base/kernel/config/Title.cpp +++ b/src/base/kernel/config/Title.cpp @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/kernel/config/Title.h" #include "3rdparty/rapidjson/document.h" #include "base/io/Env.h" diff --git a/src/base/kernel/config/Title.h b/src/base/kernel/config/Title.h index 452869dc..28a84cdf 100644 --- a/src/base/kernel/config/Title.h +++ b/src/base/kernel/config/Title.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/kernel/interfaces/IAsyncListener.h b/src/base/kernel/interfaces/IAsyncListener.h index 868646fe..d5a19d4d 100644 --- a/src/base/kernel/interfaces/IAsyncListener.h +++ b/src/base/kernel/interfaces/IAsyncListener.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/kernel/interfaces/IBaseListener.h b/src/base/kernel/interfaces/IBaseListener.h index 80120ab8..4dbb40dd 100644 --- a/src/base/kernel/interfaces/IBaseListener.h +++ b/src/base/kernel/interfaces/IBaseListener.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright 2018-2021 SChernykh - * Copyright 2016-2021 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/kernel/interfaces/IClientListener.h b/src/base/kernel/interfaces/IClientListener.h index 4f2be302..5165d02f 100644 --- a/src/base/kernel/interfaces/IClientListener.h +++ b/src/base/kernel/interfaces/IClientListener.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,6 +24,7 @@ #include "3rdparty/rapidjson/fwd.h" +#include "base/tools/Object.h" namespace xmrig { @@ -44,7 +39,10 @@ class SubmitResult; class IClientListener { public: - virtual ~IClientListener() = default; + XMRIG_DISABLE_COPY_MOVE(IClientListener) + + IClientListener() = default; + virtual ~IClientListener() = default; virtual void onClose(IClient *client, int failures) = 0; virtual void onJobReceived(IClient *client, const Job &job, const rapidjson::Value ¶ms) = 0; diff --git a/src/base/kernel/interfaces/IConfig.h b/src/base/kernel/interfaces/IConfig.h index bc460786..bf76df10 100644 --- a/src/base/kernel/interfaces/IConfig.h +++ b/src/base/kernel/interfaces/IConfig.h @@ -21,6 +21,7 @@ #include "3rdparty/rapidjson/fwd.h" +#include "base/tools/Object.h" namespace xmrig { @@ -33,6 +34,8 @@ class String; class IConfig { public: + XMRIG_DISABLE_COPY_MOVE(IConfig) + enum Keys { // common AlgorithmKey = 'a', @@ -166,7 +169,8 @@ public: HealthPrintTimeKey = 1210, }; - virtual ~IConfig() = default; + IConfig() = default; + virtual ~IConfig() = default; virtual bool isWatch() const = 0; virtual bool read(const IJsonReader &reader, const char *fileName) = 0; diff --git a/src/base/kernel/interfaces/IConfigListener.h b/src/base/kernel/interfaces/IConfigListener.h index a6fa835f..3cff03a2 100644 --- a/src/base/kernel/interfaces/IConfigListener.h +++ b/src/base/kernel/interfaces/IConfigListener.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +20,9 @@ #define XMRIG_ICONFIGLISTENER_H +#include "base/tools/Object.h" + + namespace xmrig { @@ -35,7 +32,10 @@ class IConfig; class IConfigListener { public: - virtual ~IConfigListener() = default; + XMRIG_DISABLE_COPY_MOVE(IConfigListener) + + IConfigListener() = default; + virtual ~IConfigListener() = default; virtual void onNewConfig(IConfig *config) = 0; }; diff --git a/src/base/kernel/interfaces/IConfigTransform.h b/src/base/kernel/interfaces/IConfigTransform.h index c8ada0b8..2f022925 100644 --- a/src/base/kernel/interfaces/IConfigTransform.h +++ b/src/base/kernel/interfaces/IConfigTransform.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +21,7 @@ #include "3rdparty/rapidjson/fwd.h" +#include "base/tools/Object.h" namespace xmrig { @@ -39,6 +34,9 @@ class String; class IConfigTransform { public: + XMRIG_DISABLE_COPY_MOVE(IConfigTransform) + + IConfigTransform() = default; virtual ~IConfigTransform() = default; virtual void finalize(rapidjson::Document &doc) = 0; diff --git a/src/base/kernel/interfaces/IConsoleListener.h b/src/base/kernel/interfaces/IConsoleListener.h index 69433210..194bc72f 100644 --- a/src/base/kernel/interfaces/IConsoleListener.h +++ b/src/base/kernel/interfaces/IConsoleListener.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/kernel/interfaces/IHttpListener.h b/src/base/kernel/interfaces/IHttpListener.h index 931d1933..0588412e 100644 --- a/src/base/kernel/interfaces/IHttpListener.h +++ b/src/base/kernel/interfaces/IHttpListener.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/kernel/interfaces/ILineListener.h b/src/base/kernel/interfaces/ILineListener.h index a7d34901..bd8fb10d 100644 --- a/src/base/kernel/interfaces/ILineListener.h +++ b/src/base/kernel/interfaces/ILineListener.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/kernel/interfaces/ISignalListener.h b/src/base/kernel/interfaces/ISignalListener.h index 75f47cf0..0c3e990f 100644 --- a/src/base/kernel/interfaces/ISignalListener.h +++ b/src/base/kernel/interfaces/ISignalListener.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/kernel/interfaces/IStrategy.h b/src/base/kernel/interfaces/IStrategy.h index fc34521d..690cf543 100644 --- a/src/base/kernel/interfaces/IStrategy.h +++ b/src/base/kernel/interfaces/IStrategy.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,6 +23,9 @@ #include +#include "base/tools/Object.h" + + namespace xmrig { @@ -41,7 +38,10 @@ class ProxyUrl; class IStrategy { public: - virtual ~IStrategy() = default; + XMRIG_DISABLE_COPY_MOVE(IStrategy) + + IStrategy() = default; + virtual ~IStrategy() = default; virtual bool isActive() const = 0; virtual IClient *client() const = 0; diff --git a/src/base/kernel/interfaces/IStrategyListener.h b/src/base/kernel/interfaces/IStrategyListener.h index 605d15a9..60d54d74 100644 --- a/src/base/kernel/interfaces/IStrategyListener.h +++ b/src/base/kernel/interfaces/IStrategyListener.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/kernel/interfaces/ITcpServerListener.h b/src/base/kernel/interfaces/ITcpServerListener.h index 3cb1576e..28b747a6 100644 --- a/src/base/kernel/interfaces/ITcpServerListener.h +++ b/src/base/kernel/interfaces/ITcpServerListener.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,10 +20,13 @@ #define XMRIG_ITCPSERVERLISTENER_H -#include +#include -typedef struct uv_stream_s uv_stream_t; +#include "base/tools/Object.h" + + +using uv_stream_t = struct uv_stream_s; namespace xmrig { @@ -41,7 +38,10 @@ class String; class ITcpServerListener { public: - virtual ~ITcpServerListener() = default; + XMRIG_DISABLE_COPY_MOVE(ITcpServerListener) + + ITcpServerListener() = default; + virtual ~ITcpServerListener() = default; virtual void onConnection(uv_stream_t *stream, uint16_t port) = 0; }; diff --git a/src/base/kernel/interfaces/IWatcherListener.h b/src/base/kernel/interfaces/IWatcherListener.h index a62b4b53..110e67db 100644 --- a/src/base/kernel/interfaces/IWatcherListener.h +++ b/src/base/kernel/interfaces/IWatcherListener.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +20,9 @@ #define XMRIG_IWATCHERLISTENER_H +#include "base/tools/Object.h" + + namespace xmrig { @@ -35,6 +32,9 @@ class String; class IWatcherListener { public: + XMRIG_DISABLE_COPY_MOVE(IWatcherListener) + + IWatcherListener() = default; virtual ~IWatcherListener() = default; virtual void onFileChanged(const String &fileName) = 0; diff --git a/src/base/net/dns/Dns.cpp b/src/base/net/dns/Dns.cpp index 85590bb7..6cc24bab 100644 --- a/src/base/net/dns/Dns.cpp +++ b/src/base/net/dns/Dns.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/net/dns/Dns.h" #include "base/net/dns/DnsUvBackend.h" diff --git a/src/base/net/dns/DnsRecord.cpp b/src/base/net/dns/DnsRecord.cpp index bfa84613..4ff1acf8 100644 --- a/src/base/net/dns/DnsRecord.cpp +++ b/src/base/net/dns/DnsRecord.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include diff --git a/src/base/net/dns/DnsUvBackend.cpp b/src/base/net/dns/DnsUvBackend.cpp index cb1c0c3e..8e181b27 100644 --- a/src/base/net/dns/DnsUvBackend.cpp +++ b/src/base/net/dns/DnsUvBackend.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include diff --git a/src/base/net/http/Fetch.h b/src/base/net/http/Fetch.h index 6c02e348..99d48a4f 100644 --- a/src/base/net/http/Fetch.h +++ b/src/base/net/http/Fetch.h @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #ifndef XMRIG_FETCH_H #define XMRIG_FETCH_H diff --git a/src/base/net/http/HttpApiResponse.cpp b/src/base/net/http/HttpApiResponse.cpp index e6758df9..3d48fb47 100644 --- a/src/base/net/http/HttpApiResponse.cpp +++ b/src/base/net/http/HttpApiResponse.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #include "base/net/http/HttpApiResponse.h" #include "3rdparty/rapidjson/prettywriter.h" #include "3rdparty/rapidjson/stringbuffer.h" diff --git a/src/base/net/http/HttpClient.cpp b/src/base/net/http/HttpClient.cpp index 3b1e5ad3..e34bb82e 100644 --- a/src/base/net/http/HttpClient.cpp +++ b/src/base/net/http/HttpClient.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #include "base/net/http/HttpClient.h" #include "3rdparty/llhttp/llhttp.h" #include "base/io/log/Log.h" diff --git a/src/base/net/http/HttpClient.h b/src/base/net/http/HttpClient.h index ccda2e56..1520936b 100644 --- a/src/base/net/http/HttpClient.h +++ b/src/base/net/http/HttpClient.h @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #ifndef XMRIG_HTTPCLIENT_H #define XMRIG_HTTPCLIENT_H diff --git a/src/base/net/http/HttpContext.cpp b/src/base/net/http/HttpContext.cpp index 948873c9..1a1b7e1d 100644 --- a/src/base/net/http/HttpContext.cpp +++ b/src/base/net/http/HttpContext.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #include "base/net/http/HttpContext.h" #include "3rdparty/llhttp/llhttp.h" #include "base/kernel/interfaces/IHttpListener.h" diff --git a/src/base/net/http/HttpContext.h b/src/base/net/http/HttpContext.h index 9178cf7c..af180172 100644 --- a/src/base/net/http/HttpContext.h +++ b/src/base/net/http/HttpContext.h @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #ifndef XMRIG_HTTPCONTEXT_H #define XMRIG_HTTPCONTEXT_H diff --git a/src/base/net/http/HttpData.cpp b/src/base/net/http/HttpData.cpp index b243118c..50e44043 100644 --- a/src/base/net/http/HttpData.cpp +++ b/src/base/net/http/HttpData.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #include "base/net/http/HttpData.h" #include "3rdparty/llhttp/llhttp.h" #include "3rdparty/rapidjson/document.h" diff --git a/src/base/net/http/HttpData.h b/src/base/net/http/HttpData.h index 3337999a..19b85f64 100644 --- a/src/base/net/http/HttpData.h +++ b/src/base/net/http/HttpData.h @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #ifndef XMRIG_HTTPDATA_H #define XMRIG_HTTPDATA_H diff --git a/src/base/net/http/HttpListener.cpp b/src/base/net/http/HttpListener.cpp index 695e0f82..93b26ffe 100644 --- a/src/base/net/http/HttpListener.cpp +++ b/src/base/net/http/HttpListener.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/net/http/HttpListener.h" #include "3rdparty/llhttp/llhttp.h" #include "base/io/log/Log.h" diff --git a/src/base/net/http/HttpResponse.cpp b/src/base/net/http/HttpResponse.cpp index 216e3e51..15820f18 100644 --- a/src/base/net/http/HttpResponse.cpp +++ b/src/base/net/http/HttpResponse.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #include "base/net/http/HttpResponse.h" #include "3rdparty/llhttp/llhttp.h" #include "base/io/log/Log.h" diff --git a/src/base/net/http/HttpServer.cpp b/src/base/net/http/HttpServer.cpp index aab75003..b440731c 100644 --- a/src/base/net/http/HttpServer.cpp +++ b/src/base/net/http/HttpServer.cpp @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #include #include diff --git a/src/base/net/https/HttpsClient.cpp b/src/base/net/https/HttpsClient.cpp index e901b1e0..9d389671 100644 --- a/src/base/net/https/HttpsClient.cpp +++ b/src/base/net/https/HttpsClient.cpp @@ -1,7 +1,7 @@ /* XMRig * Copyright (c) 2014-2019 heapwolf - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #include #include #include diff --git a/src/base/net/https/HttpsClient.h b/src/base/net/https/HttpsClient.h index bd0c65ff..aa32cb99 100644 --- a/src/base/net/https/HttpsClient.h +++ b/src/base/net/https/HttpsClient.h @@ -1,7 +1,7 @@ /* XMRig * Copyright (c) 2014-2019 heapwolf - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #ifndef XMRIG_HTTPSCLIENT_H #define XMRIG_HTTPSCLIENT_H diff --git a/src/base/net/https/HttpsContext.h b/src/base/net/https/HttpsContext.h index ff060f02..17b2259b 100644 --- a/src/base/net/https/HttpsContext.h +++ b/src/base/net/https/HttpsContext.h @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #ifndef XMRIG_HTTPSCONTEXT_H #define XMRIG_HTTPSCONTEXT_H diff --git a/src/base/net/stratum/DaemonClient.cpp b/src/base/net/stratum/DaemonClient.cpp index 57a8d6f0..5aa7fcc0 100644 --- a/src/base/net/stratum/DaemonClient.cpp +++ b/src/base/net/stratum/DaemonClient.cpp @@ -1,13 +1,7 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2019 Howard Chu - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2019 Howard Chu + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +17,6 @@ * along with this program. If not, see . */ - #include diff --git a/src/base/net/stratum/EthStratumClient.cpp b/src/base/net/stratum/EthStratumClient.cpp index 94d85635..e1c0d335 100644 --- a/src/base/net/stratum/EthStratumClient.cpp +++ b/src/base/net/stratum/EthStratumClient.cpp @@ -35,7 +35,6 @@ #include "net/JobResult.h" - xmrig::EthStratumClient::EthStratumClient(int id, const char *agent, IClientListener *listener) : Client(id, agent, listener) { diff --git a/src/base/net/stratum/Job.cpp b/src/base/net/stratum/Job.cpp index 81816011..9c6c4fbd 100644 --- a/src/base/net/stratum/Job.cpp +++ b/src/base/net/stratum/Job.cpp @@ -1,14 +1,8 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018 Lee Clagett - * Copyright 2019 Howard Chu - * Copyright 2018-2021 SChernykh - * Copyright 2016-2021 XMRig , + * Copyright (c) 2018 Lee Clagett + * Copyright (c) 2019 Howard Chu + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +18,6 @@ * along with this program. If not, see . */ - #include #include diff --git a/src/base/net/stratum/Job.h b/src/base/net/stratum/Job.h index 414da8fe..4e66be86 100644 --- a/src/base/net/stratum/Job.h +++ b/src/base/net/stratum/Job.h @@ -1,14 +1,8 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018 Lee Clagett - * Copyright 2019 Howard Chu - * Copyright 2018-2021 SChernykh - * Copyright 2016-2021 XMRig , + * Copyright (c) 2018 Lee Clagett + * Copyright (c) 2019 Howard Chu + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/stratum/Pools.cpp b/src/base/net/stratum/Pools.cpp index d70075ac..3211c661 100644 --- a/src/base/net/stratum/Pools.cpp +++ b/src/base/net/stratum/Pools.cpp @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2021 SChernykh - * Copyright 2016-2021 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/net/stratum/Pools.h" #include "3rdparty/rapidjson/document.h" #include "base/io/log/Log.h" diff --git a/src/base/net/stratum/Pools.h b/src/base/net/stratum/Pools.h index b3f6b081..42f37e81 100644 --- a/src/base/net/stratum/Pools.h +++ b/src/base/net/stratum/Pools.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2021 SChernykh - * Copyright 2016-2021 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/stratum/ProxyUrl.cpp b/src/base/net/stratum/ProxyUrl.cpp index ad4542bc..48d80414 100644 --- a/src/base/net/stratum/ProxyUrl.cpp +++ b/src/base/net/stratum/ProxyUrl.cpp @@ -1,6 +1,6 @@ /* XMRig - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/net/stratum/ProxyUrl.h" #include "3rdparty/rapidjson/document.h" diff --git a/src/base/net/stratum/ProxyUrl.h b/src/base/net/stratum/ProxyUrl.h index 0604dd9d..f4ab2edb 100644 --- a/src/base/net/stratum/ProxyUrl.h +++ b/src/base/net/stratum/ProxyUrl.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/stratum/SelfSelectClient.cpp b/src/base/net/stratum/SelfSelectClient.cpp index a902e252..bedba51f 100644 --- a/src/base/net/stratum/SelfSelectClient.cpp +++ b/src/base/net/stratum/SelfSelectClient.cpp @@ -18,7 +18,6 @@ * along with this program. If not, see . */ - #include "base/net/stratum/SelfSelectClient.h" #include "3rdparty/rapidjson/document.h" #include "3rdparty/rapidjson/error/en.h" diff --git a/src/base/net/stratum/Socks5.cpp b/src/base/net/stratum/Socks5.cpp index d61aa329..a89087a0 100644 --- a/src/base/net/stratum/Socks5.cpp +++ b/src/base/net/stratum/Socks5.cpp @@ -1,6 +1,6 @@ /* XMRig - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/net/stratum/Socks5.h" diff --git a/src/base/net/stratum/Socks5.h b/src/base/net/stratum/Socks5.h index 286ae183..36707ce0 100644 --- a/src/base/net/stratum/Socks5.h +++ b/src/base/net/stratum/Socks5.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/stratum/SubmitResult.h b/src/base/net/stratum/SubmitResult.h index a180f6fa..b98869f4 100644 --- a/src/base/net/stratum/SubmitResult.h +++ b/src/base/net/stratum/SubmitResult.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/stratum/strategies/FailoverStrategy.cpp b/src/base/net/stratum/strategies/FailoverStrategy.cpp index 604f5596..60c0568f 100644 --- a/src/base/net/stratum/strategies/FailoverStrategy.cpp +++ b/src/base/net/stratum/strategies/FailoverStrategy.cpp @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/net/stratum/strategies/FailoverStrategy.h" #include "3rdparty/rapidjson/document.h" #include "base/kernel/interfaces/IClient.h" diff --git a/src/base/net/stratum/strategies/FailoverStrategy.h b/src/base/net/stratum/strategies/FailoverStrategy.h index a25c82b7..e0bfc0a5 100644 --- a/src/base/net/stratum/strategies/FailoverStrategy.h +++ b/src/base/net/stratum/strategies/FailoverStrategy.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/stratum/strategies/SinglePoolStrategy.cpp b/src/base/net/stratum/strategies/SinglePoolStrategy.cpp index fc0fc562..3c1f30c7 100644 --- a/src/base/net/stratum/strategies/SinglePoolStrategy.cpp +++ b/src/base/net/stratum/strategies/SinglePoolStrategy.cpp @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/net/stratum/strategies/SinglePoolStrategy.h" #include "3rdparty/rapidjson/document.h" #include "base/kernel/interfaces/IClient.h" diff --git a/src/base/net/stratum/strategies/SinglePoolStrategy.h b/src/base/net/stratum/strategies/SinglePoolStrategy.h index 90b85c7d..bdedd743 100644 --- a/src/base/net/stratum/strategies/SinglePoolStrategy.h +++ b/src/base/net/stratum/strategies/SinglePoolStrategy.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/stratum/strategies/StrategyProxy.h b/src/base/net/stratum/strategies/StrategyProxy.h index 2c0fc235..505d5071 100644 --- a/src/base/net/stratum/strategies/StrategyProxy.h +++ b/src/base/net/stratum/strategies/StrategyProxy.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/tls/ServerTls.cpp b/src/base/net/tls/ServerTls.cpp index abae315d..338777c7 100644 --- a/src/base/net/tls/ServerTls.cpp +++ b/src/base/net/tls/ServerTls.cpp @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/net/tls/ServerTls.h" diff --git a/src/base/net/tls/ServerTls.h b/src/base/net/tls/ServerTls.h index 20337eb6..d1751975 100644 --- a/src/base/net/tls/ServerTls.h +++ b/src/base/net/tls/ServerTls.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #ifndef XMRIG_SERVERTLS_H #define XMRIG_SERVERTLS_H diff --git a/src/base/net/tools/LineReader.cpp b/src/base/net/tools/LineReader.cpp index 07d0f1dc..e811547b 100644 --- a/src/base/net/tools/LineReader.cpp +++ b/src/base/net/tools/LineReader.cpp @@ -1,7 +1,7 @@ /* XMRig * Copyright (c) 2020 cohcho - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,6 @@ * along with this program. If not, see . */ - #include "base/net/tools/LineReader.h" #include "base/kernel/constants.h" #include "base/kernel/interfaces/ILineListener.h" diff --git a/src/base/net/tools/LineReader.h b/src/base/net/tools/LineReader.h index da6e6967..e84853b6 100644 --- a/src/base/net/tools/LineReader.h +++ b/src/base/net/tools/LineReader.h @@ -1,7 +1,7 @@ /* XMRig * Copyright (c) 2020 cohcho - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/tools/MemPool.h b/src/base/net/tools/MemPool.h index 8a0a126b..196c67fc 100644 --- a/src/base/net/tools/MemPool.h +++ b/src/base/net/tools/MemPool.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/tools/NetBuffer.cpp b/src/base/net/tools/NetBuffer.cpp index 8931f06e..f597ca3a 100644 --- a/src/base/net/tools/NetBuffer.cpp +++ b/src/base/net/tools/NetBuffer.cpp @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/net/tools/NetBuffer.h" #include "base/kernel/constants.h" #include "base/net/tools/MemPool.h" diff --git a/src/base/net/tools/NetBuffer.h b/src/base/net/tools/NetBuffer.h index a7a2ee05..93616601 100644 --- a/src/base/net/tools/NetBuffer.h +++ b/src/base/net/tools/NetBuffer.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/net/tools/TcpServer.cpp b/src/base/net/tools/TcpServer.cpp index 06d4033a..9e516a00 100644 --- a/src/base/net/tools/TcpServer.cpp +++ b/src/base/net/tools/TcpServer.cpp @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +16,6 @@ * along with this program. If not, see . */ - #include "base/kernel/interfaces/ITcpServerListener.h" #include "base/net/tools/TcpServer.h" #include "base/tools/Handle.h" diff --git a/src/base/net/tools/TcpServer.h b/src/base/net/tools/TcpServer.h index de464d37..24ae42d6 100644 --- a/src/base/net/tools/TcpServer.h +++ b/src/base/net/tools/TcpServer.h @@ -1,12 +1,6 @@ /* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/base/tools/cryptonote/Signatures.cpp b/src/base/tools/cryptonote/Signatures.cpp index 93571258..da5dd617 100644 --- a/src/base/tools/cryptonote/Signatures.cpp +++ b/src/base/tools/cryptonote/Signatures.cpp @@ -1,8 +1,8 @@ /* XMRig - * Copyright 2012-2013 The Cryptonote developers - * Copyright 2014-2021 The Monero Project - * Copyright 2018-2021 SChernykh - * Copyright 2016-2021 XMRig , + * Copyright (c) 2012-2013 The Cryptonote developers + * Copyright (c) 2014-2021 The Monero Project + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,49 +18,50 @@ * along with this program. If not, see . */ - #include "base/crypto/keccak.h" #include "base/tools/cryptonote/Signatures.h" +#include "base/tools/Cvt.h" extern "C" { -#include "base/tools/cryptonote/crypto-ops.h" +#include "3rdparty/cryptonote/crypto-ops.h" } -#include "base/tools/Cvt.h" - -#ifdef XMRIG_PROXY_PROJECT -#define PROFILE_SCOPE(x) +#if defined(XMRIG_PROXY_PROJECT) || !defined(XMRIG_PROFILER_H) +# define PROFILE_SCOPE(x) #else -#include "crypto/rx/Profiler.h" +# include "crypto/rx/Profiler.h" #endif -struct ec_scalar { char data[32]; }; -struct hash { char data[32]; }; -struct ec_point { char data[32]; }; -struct signature { ec_scalar c, r; }; -struct s_comm { hash h; ec_point key; ec_point comm; }; +namespace xmrig { -static inline void random_scalar(ec_scalar& res) +struct ec_scalar { uint8_t data[32]; }; +struct hash { uint8_t data[32]; }; +struct ec_point { uint8_t data[32]; }; +struct signature { ec_scalar c, r; }; +struct s_comm { hash h; ec_point key; ec_point comm; }; + + +static inline void random_scalar(ec_scalar &res) { // Don't care about bias or possible 0 after reduce: probability ~10^-76, not happening in this universe. // Performance matters more. It's a miner after all. - xmrig::Cvt::randomBytes(res.data, sizeof(res.data)); - sc_reduce32((uint8_t*) res.data); + Cvt::randomBytes(res.data, sizeof(res.data)); + sc_reduce32(res.data); } -static void hash_to_scalar(const void* data, size_t length, ec_scalar& res) +static void hash_to_scalar(const void* data, size_t length, ec_scalar &res) { - xmrig::keccak((const uint8_t*) data, length, (uint8_t*) &res, sizeof(res)); - sc_reduce32((uint8_t*) &res); + keccak(reinterpret_cast(data), length, res.data, sizeof(res)); + sc_reduce32(res.data); } -static void derivation_to_scalar(const uint8_t* derivation, size_t output_index, ec_scalar& res) +static void derivation_to_scalar(const uint8_t *derivation, size_t output_index, ec_scalar &res) { struct { uint8_t derivation[32]; @@ -81,10 +82,11 @@ static void derivation_to_scalar(const uint8_t* derivation, size_t output_index, } -namespace xmrig { +} // namespace xmrig -void generate_signature(const uint8_t* prefix_hash, const uint8_t* pub, const uint8_t* sec, uint8_t* sig_bytes) +// NOLINTNEXTLINE(readability-non-const-parameter) +void xmrig::generate_signature(const uint8_t *prefix_hash, const uint8_t *pub, const uint8_t *sec, uint8_t *sig_bytes) { PROFILE_SCOPE(GenerateSignature); @@ -95,24 +97,24 @@ void generate_signature(const uint8_t* prefix_hash, const uint8_t* pub, const ui memcpy(buf.h.data, prefix_hash, sizeof(buf.h.data)); memcpy(buf.key.data, pub, sizeof(buf.key.data)); - signature& sig = *reinterpret_cast(sig_bytes); + signature &sig = *reinterpret_cast(sig_bytes); do { random_scalar(k); - ge_scalarmult_base(&tmp3, (unsigned char*)&k); - ge_p3_tobytes((unsigned char*)&buf.comm, &tmp3); + ge_scalarmult_base(&tmp3, k.data); + ge_p3_tobytes(buf.comm.data, &tmp3); hash_to_scalar(&buf, sizeof(s_comm), sig.c); - if (!sc_isnonzero((const unsigned char*)sig.c.data)) { + if (!sc_isnonzero(sig.c.data)) { continue; } - sc_mulsub((unsigned char*)&sig.r, (unsigned char*)&sig.c, sec, (unsigned char*)&k); - } while (!sc_isnonzero((const unsigned char*)sig.r.data)); + sc_mulsub(sig.r.data, sig.c.data, sec, k.data); + } while (!sc_isnonzero(sig.r.data)); } -bool check_signature(const uint8_t* prefix_hash, const uint8_t* pub, const uint8_t* sig_bytes) +bool xmrig::check_signature(const uint8_t *prefix_hash, const uint8_t *pub, const uint8_t *sig_bytes) { ge_p2 tmp2; ge_p3 tmp3; @@ -126,14 +128,14 @@ bool check_signature(const uint8_t* prefix_hash, const uint8_t* pub, const uint8 return false; } - const signature& sig = *reinterpret_cast(sig_bytes); + const signature &sig = *reinterpret_cast(sig_bytes); - if (sc_check((const uint8_t*)&sig.c) != 0 || sc_check((const uint8_t*)&sig.r) != 0 || !sc_isnonzero((const uint8_t*)&sig.c)) { + if (sc_check(sig.c.data) != 0 || sc_check(sig.r.data) != 0 || !sc_isnonzero(sig.c.data)) { return false; } - ge_double_scalarmult_base_vartime(&tmp2, (const uint8_t*)&sig.c, &tmp3, (const uint8_t*)&sig.r); - ge_tobytes((uint8_t*)&buf.comm, &tmp2); + ge_double_scalarmult_base_vartime(&tmp2, sig.c.data, &tmp3, sig.r.data); + ge_tobytes(buf.comm.data, &tmp2); static const ec_point infinity = { { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; if (memcmp(&buf.comm, &infinity, 32) == 0) { @@ -141,13 +143,13 @@ bool check_signature(const uint8_t* prefix_hash, const uint8_t* pub, const uint8 } hash_to_scalar(&buf, sizeof(s_comm), c); - sc_sub((uint8_t*)&c, (uint8_t*)&c, (const uint8_t*)&sig.c); + sc_sub(c.data, c.data, sig.c.data); - return sc_isnonzero((uint8_t*)&c) == 0; + return sc_isnonzero(c.data) == 0; } -bool generate_key_derivation(const uint8_t* key1, const uint8_t* key2, uint8_t* derivation) +bool xmrig::generate_key_derivation(const uint8_t *key1, const uint8_t *key2, uint8_t *derivation) { ge_p3 point; ge_p2 point2; @@ -166,16 +168,16 @@ bool generate_key_derivation(const uint8_t* key1, const uint8_t* key2, uint8_t* } -void derive_secret_key(const uint8_t* derivation, size_t output_index, const uint8_t* base, uint8_t* derived_key) +void xmrig::derive_secret_key(const uint8_t *derivation, size_t output_index, const uint8_t *base, uint8_t *derived_key) { ec_scalar scalar; derivation_to_scalar(derivation, output_index, scalar); - sc_add(derived_key, base, (uint8_t*) &scalar); + sc_add(derived_key, base, scalar.data); } -bool derive_public_key(const uint8_t* derivation, size_t output_index, const uint8_t* base, uint8_t* derived_key) +bool xmrig::derive_public_key(const uint8_t *derivation, size_t output_index, const uint8_t *base, uint8_t *derived_key) { ec_scalar scalar; ge_p3 point1; @@ -189,7 +191,7 @@ bool derive_public_key(const uint8_t* derivation, size_t output_index, const uin } derivation_to_scalar(derivation, output_index, scalar); - ge_scalarmult_base(&point2, (uint8_t*) &scalar); + ge_scalarmult_base(&point2, scalar.data); ge_p3_to_cached(&point3, &point2); ge_add(&point4, &point1, &point3); ge_p1p1_to_p2(&point5, &point4); @@ -199,14 +201,14 @@ bool derive_public_key(const uint8_t* derivation, size_t output_index, const uin } -void derive_view_secret_key(const uint8_t* spend_secret_key, uint8_t* view_secret_key) +void xmrig::derive_view_secret_key(const uint8_t *spend_secret_key, uint8_t *view_secret_key) { keccak(spend_secret_key, 32, view_secret_key, 32); sc_reduce32(view_secret_key); } -void generate_keys(uint8_t* pub, uint8_t* sec) +void xmrig::generate_keys(uint8_t *pub, uint8_t *sec) { random_scalar(*((ec_scalar*)sec)); @@ -216,7 +218,7 @@ void generate_keys(uint8_t* pub, uint8_t* sec) } -bool secret_key_to_public_key(const uint8_t* sec, uint8_t* pub) +bool xmrig::secret_key_to_public_key(const uint8_t *sec, uint8_t *pub) { if (sc_check(sec) != 0) { return false; @@ -228,6 +230,3 @@ bool secret_key_to_public_key(const uint8_t* sec, uint8_t* pub) return true; } - - -} /* namespace xmrig */ diff --git a/src/base/tools/cryptonote/Signatures.h b/src/base/tools/cryptonote/Signatures.h index 04813313..da9d657d 100644 --- a/src/base/tools/cryptonote/Signatures.h +++ b/src/base/tools/cryptonote/Signatures.h @@ -1,8 +1,8 @@ /* XMRig - * Copyright 2012-2013 The Cryptonote developers - * Copyright 2014-2021 The Monero Project - * Copyright 2018-2021 SChernykh - * Copyright 2016-2021 XMRig , + * Copyright (c) 2012-2013 The Cryptonote developers + * Copyright (c) 2014-2021 The Monero Project + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,17 +28,17 @@ namespace xmrig { -void generate_signature(const uint8_t* prefix_hash, const uint8_t* pub, const uint8_t* sec, uint8_t* sig); -bool check_signature(const uint8_t* prefix_hash, const uint8_t* pub, const uint8_t* sig); +void generate_signature(const uint8_t *prefix_hash, const uint8_t *pub, const uint8_t *sec, uint8_t *sig); +bool check_signature(const uint8_t *prefix_hash, const uint8_t *pub, const uint8_t *sig_bytes); -bool generate_key_derivation(const uint8_t* key1, const uint8_t* key2, uint8_t* derivation); -void derive_secret_key(const uint8_t* derivation, size_t output_index, const uint8_t* base, uint8_t* derived_key); -bool derive_public_key(const uint8_t* derivation, size_t output_index, const uint8_t* base, uint8_t* derived_key); +bool generate_key_derivation(const uint8_t *key1, const uint8_t *key2, uint8_t *derivation); +void derive_secret_key(const uint8_t *derivation, size_t output_index, const uint8_t *base, uint8_t *derived_key); +bool derive_public_key(const uint8_t *derivation, size_t output_index, const uint8_t *base, uint8_t *derived_key); -void derive_view_secret_key(const uint8_t* spend_secret_key, uint8_t* view_secret_key); +void derive_view_secret_key(const uint8_t *spend_secret_key, uint8_t *view_secret_key); -void generate_keys(uint8_t* pub, uint8_t* sec); -bool secret_key_to_public_key(const uint8_t* sec, uint8_t* pub); +void generate_keys(uint8_t *pub, uint8_t *sec); +bool secret_key_to_public_key(const uint8_t *sec, uint8_t *pub); } /* namespace xmrig */ diff --git a/src/base/tools/cryptonote/WalletAddress.cpp b/src/base/tools/cryptonote/WalletAddress.cpp index f05dec9f..f84f7ece 100644 --- a/src/base/tools/cryptonote/WalletAddress.cpp +++ b/src/base/tools/cryptonote/WalletAddress.cpp @@ -86,7 +86,7 @@ bool xmrig::WalletAddress::decode(const char *address, size_t size) } uint64_t hi; - const uint64_t tmp = num + __umul128(order, static_cast(digit), &hi); + const uint64_t tmp = num + xmrig_umul128(order, static_cast(digit), &hi); if ((tmp < num) || hi) { return false; } diff --git a/src/base/tools/cryptonote/umul128.h b/src/base/tools/cryptonote/umul128.h index a6e77da6..521c2280 100644 --- a/src/base/tools/cryptonote/umul128.h +++ b/src/base/tools/cryptonote/umul128.h @@ -21,27 +21,28 @@ * */ -#pragma once +#ifndef XMRIG_UMUL128_H +#define XMRIG_UMUL128_H #include + #ifdef XMRIG_64_BIT -# ifdef _MSC_VER +# if defined(_MSC_VER) # include # pragma intrinsic(_umul128) -# define __umul128 _umul128 -# elif defined __GNUC__ - static inline uint64_t _umul128(uint64_t a, uint64_t b, uint64_t* hi) +# define xmrig_umul128 _umul128 +# elif defined(__GNUC__) + static inline uint64_t xmrig_umul128(uint64_t a, uint64_t b, uint64_t* hi) { unsigned __int128 r = (unsigned __int128) a * (unsigned __int128) b; *hi = r >> 64; return (uint64_t) r; } -# define __umul128 _umul128 # endif #else -static inline uint64_t __umul128(uint64_t multiplier, uint64_t multiplicand, uint64_t *product_hi) { +static inline uint64_t xmrig_umul128(uint64_t multiplier, uint64_t multiplicand, uint64_t *product_hi) { // multiplier = ab = a * 2^32 + b // multiplicand = cd = c * 2^32 + d // ab * cd = a * c * 2^64 + (a * d + b * c) * 2^32 + b * d @@ -66,3 +67,6 @@ static inline uint64_t __umul128(uint64_t multiplier, uint64_t multiplicand, uin return product_lo; } #endif + + +#endif // XMRIG_UMUL128_H diff --git a/src/crypto/cn/CryptoNight_arm.h b/src/crypto/cn/CryptoNight_arm.h index 443f06ec..dda37621 100644 --- a/src/crypto/cn/CryptoNight_arm.h +++ b/src/crypto/cn/CryptoNight_arm.h @@ -487,7 +487,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si } } - lo = __umul128(idx0, cl, &hi); + lo = xmrig_umul128(idx0, cl, &hi); if (BASE == Algorithm::CN_2) { if (ALGO == Algorithm::CN_R) { @@ -663,7 +663,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si } } - lo = __umul128(idx0, cl, &hi); + lo = xmrig_umul128(idx0, cl, &hi); if (BASE == Algorithm::CN_2) { if (ALGO == Algorithm::CN_R) { @@ -723,7 +723,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si } } - lo = __umul128(idx1, cl, &hi); + lo = xmrig_umul128(idx1, cl, &hi); if (BASE == Algorithm::CN_2) { if (ALGO == Algorithm::CN_R) { diff --git a/src/crypto/cn/CryptoNight_x86.h b/src/crypto/cn/CryptoNight_x86.h index e5cfe452..08cd2f4c 100644 --- a/src/crypto/cn/CryptoNight_x86.h +++ b/src/crypto/cn/CryptoNight_x86.h @@ -678,7 +678,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si } } - lo = __umul128(idx0, cl, &hi); + lo = xmrig_umul128(idx0, cl, &hi); if (BASE == Algorithm::CN_2) { if (ALGO == Algorithm::CN_R) { @@ -1115,7 +1115,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si } } - lo = __umul128(idx0, cl, &hi); + lo = xmrig_umul128(idx0, cl, &hi); if (BASE == Algorithm::CN_2) { if (ALGO == Algorithm::CN_R) { @@ -1173,7 +1173,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si } } - lo = __umul128(idx1, cl, &hi); + lo = xmrig_umul128(idx1, cl, &hi); if (BASE == Algorithm::CN_2) { if (ALGO == Algorithm::CN_R) { @@ -1284,7 +1284,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si VARIANT2_INTEGER_MATH(part, cl##part, c); \ } \ } \ - lo = __umul128(idx, cl##part, &hi); \ + lo = xmrig_umul128(idx, cl##part, &hi); \ if (BASE == Algorithm::CN_2) { \ if (ALGO == Algorithm::CN_R) { \ VARIANT2_SHUFFLE(l, idx & MASK, a, b0, b1, c, 0); \