Skip to content

Commit

Permalink
Merge branch 'xmrig:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
moreoronce authored Mar 24, 2023
2 parents 626d2af + 6e856ca commit 29e2f33
Show file tree
Hide file tree
Showing 20 changed files with 125 additions and 68 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v6.19.1
- Resolved deprecated methods warnings with OpenSSL 3.0.
- [#3213](https://github.com/xmrig/xmrig/pull/3213) Fixed build with 32-bit clang 15.
- [#3218](https://github.com/xmrig/xmrig/pull/3218) Fixed: `--randomx-wrmsr=-1` worked only on Intel.
- [#3228](https://github.com/xmrig/xmrig/pull/3228) Fixed build with gcc 13.

# v6.19.0
- [#3144](https://github.com/xmrig/xmrig/pull/3144) Update to latest `sse2neon.h`.
- [#3161](https://github.com/xmrig/xmrig/pull/3161) MSVC build: enabled parallel compilation.
Expand Down
24 changes: 6 additions & 18 deletions cmake/flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -49,16 +49,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
endif()

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(-D_GNU_SOURCE -DHAVE_BUILTIN_CLEAR_CACHE)

elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_C_FLAGS_RELEASE "/MP /MT /O2 /Oi /DNDEBUG /GL")
Expand All @@ -67,10 +58,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MP /Ob1 /Zi /DRELWITHDEBINFO")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MP /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)

Expand All @@ -92,7 +80,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()

Expand All @@ -105,6 +93,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()
3 changes: 3 additions & 0 deletions src/backend/opencl/runners/OclBaseRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
*/


#include <stdexcept>


#include "backend/opencl/runners/OclBaseRunner.h"
#include "backend/opencl/cl/OclSource.h"
#include "backend/opencl/OclCache.h"
Expand Down
3 changes: 3 additions & 0 deletions src/backend/opencl/runners/OclCnRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdexcept>


#include "backend/opencl/runners/OclCnRunner.h"
#include "backend/opencl/kernels/Cn0Kernel.h"
#include "backend/opencl/kernels/Cn1Kernel.h"
Expand Down
3 changes: 3 additions & 0 deletions src/backend/opencl/runners/OclKawPowRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdexcept>


#include "backend/opencl/runners/OclKawPowRunner.h"
#include "backend/common/Tags.h"
#include "3rdparty/libethash/ethash_internal.h"
Expand Down
3 changes: 3 additions & 0 deletions src/backend/opencl/runners/OclRxJitRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdexcept>


#include "backend/opencl/runners/OclRxJitRunner.h"
#include "backend/opencl/cl/rx/randomx_run_gfx803.h"
#include "backend/opencl/cl/rx/randomx_run_gfx900.h"
Expand Down
10 changes: 6 additions & 4 deletions src/base/kernel/Platform.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <[email protected]>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <[email protected]>
*
* 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
Expand All @@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#include "base/kernel/Platform.h"


Expand All @@ -42,9 +41,12 @@ void xmrig::Platform::init(const char *userAgent)
# ifdef XMRIG_FEATURE_TLS
SSL_library_init();
SSL_load_error_strings();

# if OPENSSL_VERSION_NUMBER < 0x30000000L || defined(LIBRESSL_VERSION_NUMBER)
ERR_load_BIO_strings();
ERR_load_crypto_strings();
SSL_load_error_strings();
# endif

OpenSSL_add_all_digests();
# endif

Expand Down
8 changes: 4 additions & 4 deletions src/base/net/dns/DnsRecord.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <[email protected]>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <[email protected]>
*
* 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
Expand Down Expand Up @@ -46,11 +46,11 @@ xmrig::String xmrig::DnsRecord::ip() const

if (m_type == AAAA) {
buf = new char[45]();
uv_ip6_name(reinterpret_cast<sockaddr_in6*>(m_data), buf, 45);
uv_ip6_name(reinterpret_cast<const sockaddr_in6*>(m_data), buf, 45);
}
else {
buf = new char[16]();
uv_ip4_name(reinterpret_cast<sockaddr_in*>(m_data), buf, 16);
uv_ip4_name(reinterpret_cast<const sockaddr_in*>(m_data), buf, 16);
}

return buf;
Expand Down
29 changes: 18 additions & 11 deletions src/base/net/dns/DnsUvBackend.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <[email protected]>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <[email protected]>
*
* 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
Expand Down Expand Up @@ -28,18 +28,19 @@

namespace xmrig {

static Storage<DnsUvBackend>* storage = nullptr;

Storage<DnsUvBackend>& DnsUvBackend::getStorage()
static Storage<DnsUvBackend> *storage = nullptr;


Storage<DnsUvBackend> &DnsUvBackend::getStorage()
{
if (storage == nullptr) storage = new Storage<DnsUvBackend>();
if (storage == nullptr) {
storage = new Storage<DnsUvBackend>();
}

return *storage;
}

void DnsUvBackend::releaseStorage()
{
delete storage;
}

static addrinfo hints{};

Expand All @@ -61,8 +62,14 @@ xmrig::DnsUvBackend::DnsUvBackend()

xmrig::DnsUvBackend::~DnsUvBackend()
{
getStorage().release(m_key);
releaseStorage();
assert(storage);

storage->release(m_key);

if (storage->isEmpty()) {
delete storage;
storage = nullptr;
}
}


Expand Down
1 change: 1 addition & 0 deletions src/base/net/http/HttpResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define XMRIG_HTTPRESPONSE_H


#include <cstdint>
#include <map>
#include <string>

Expand Down
36 changes: 34 additions & 2 deletions src/base/net/tls/TlsContext.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* XMRig
* Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <[email protected]>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <[email protected]>
*
* 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
Expand Down Expand Up @@ -45,6 +45,7 @@ namespace xmrig {


// https://wiki.openssl.org/index.php/Diffie-Hellman_parameters
#if OPENSSL_VERSION_NUMBER < 0x30000000L || defined(LIBRESSL_VERSION_NUMBER)
static DH *get_dh2048()
{
static unsigned char dhp_2048[] = {
Expand Down Expand Up @@ -96,6 +97,8 @@ static DH *get_dh2048()

return dh;
}
#endif


} // namespace xmrig

Expand Down Expand Up @@ -191,6 +194,7 @@ bool xmrig::TlsContext::setCipherSuites(const char *ciphersuites)

bool xmrig::TlsContext::setDH(const char *dhparam)
{
# if OPENSSL_VERSION_NUMBER < 0x30000000L || defined(LIBRESSL_VERSION_NUMBER)
DH *dh = nullptr;

if (dhparam != nullptr) {
Expand Down Expand Up @@ -225,6 +229,34 @@ bool xmrig::TlsContext::setDH(const char *dhparam)

return false;
}
# else
if (dhparam != nullptr) {
EVP_PKEY *dh = nullptr;
BIO *bio = BIO_new_file(Env::expand(dhparam), "r");

if (bio) {
dh = PEM_read_bio_Parameters(bio, nullptr);
BIO_free(bio);
}

if (!dh) {
LOG_ERR("PEM_read_bio_Parameters(\"%s\") failed.", dhparam);

return false;
}

if (SSL_CTX_set0_tmp_dh_pkey(m_ctx, dh) != 1) {
EVP_PKEY_free(dh);

LOG_ERR("SSL_CTX_set0_tmp_dh_pkey(\"%s\") failed.", dhparam);

return false;
}
}
else {
SSL_CTX_set_dh_auto(m_ctx, 1);
}
# endif

return true;
}
Expand Down
12 changes: 5 additions & 7 deletions src/base/net/tls/TlsContext.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* XMRig
* Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <[email protected]>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <[email protected]>
*
* 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
Expand All @@ -24,9 +24,6 @@
#include "base/tools/Object.h"


#include <cstdint>


using SSL_CTX = struct ssl_ctx_st;


Expand Down Expand Up @@ -60,6 +57,7 @@ class TlsContext
};


} /* namespace xmrig */
} // namespace xmrig


#endif /* XMRIG_TLSCONTEXT_H */
#endif // XMRIG_TLSCONTEXT_H
8 changes: 6 additions & 2 deletions src/base/net/tls/TlsGen.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <[email protected]>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <[email protected]>
*
* 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
Expand Down Expand Up @@ -33,6 +33,7 @@ static const char *kLocalhost = "localhost";

static EVP_PKEY *generate_pkey()
{
# if OPENSSL_VERSION_NUMBER < 0x30000000L || defined(LIBRESSL_VERSION_NUMBER)
auto pkey = EVP_PKEY_new();
if (!pkey) {
return nullptr;
Expand All @@ -53,6 +54,9 @@ static EVP_PKEY *generate_pkey()
BN_free(exponent);

return pkey;
# else
return EVP_RSA_gen(2048);
# endif
}


Expand Down
8 changes: 4 additions & 4 deletions src/base/net/tls/TlsGen.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <[email protected]>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <[email protected]>
*
* 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
Expand Down Expand Up @@ -55,7 +55,7 @@ class TlsGen
};


} /* namespace xmrig */
} // namespace xmrig


#endif /* XMRIG_TLSGEN_H */
#endif // XMRIG_TLSGEN_H
Loading

0 comments on commit 29e2f33

Please sign in to comment.