Merge pull request #216 from wowario/upstream

Upstream
This commit is contained in:
jw 2019-06-14 05:46:17 -07:00 committed by GitHub
commit 94390f8364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 56 additions and 38 deletions

View File

@ -690,8 +690,11 @@ else()
add_cxx_flag_if_supported(-fstack-clash-protection CXX_SECURITY_FLAGS)
endif()
add_c_flag_if_supported(-mmitigate-rop C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-mmitigate-rop CXX_SECURITY_FLAGS)
# Removed in GCC 9.1 (or before ?), but still accepted, so spams the output
if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1))
add_c_flag_if_supported(-mmitigate-rop C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-mmitigate-rop CXX_SECURITY_FLAGS)
endif()
# linker
if (NOT WIN32)

View File

@ -29,7 +29,7 @@
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
# Check what commit we're on
execute_process(COMMAND "${GIT}" rev-parse --short HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${GIT}" rev-parse --short=9 HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
if(RET)
# Something went wrong, set the version tag to -unknown
@ -38,6 +38,7 @@ if(RET)
set(VERSIONTAG "unknown")
configure_file("src/version.cpp.in" "${TO}")
else()
string(SUBSTRING ${COMMIT} 0 9 COMMIT)
message(STATUS "You are currently on commit ${COMMIT}")
# Get all the tags

View File

@ -1,8 +1,8 @@
package=openssl
$(package)_version=1.0.2q
$(package)_version=1.0.2r
$(package)_download_path=https://www.openssl.org/source
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684
$(package)_sha256_hash=ae51d08bba8a83958e894946f15303ff894d75c2b8bbd44a852b64e3fe11d0d6
define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"

View File

@ -1,4 +1,4 @@
packages:=boost openssl zeromq cppzmq expat ldns cppzmq readline libiconv hidapi protobuf libusb
packages:=boost openssl zeromq cppzmq expat ldns readline libiconv hidapi protobuf libusb
native_packages := native_ccache native_protobuf
darwin_native_packages = native_biplist native_ds_store native_mac_alias

View File

@ -8,6 +8,7 @@ OPTION(BUILD_TESTS "Build tests." OFF)
SET(STATIC ON)
SET(UNBOUND_STATIC ON)
SET(ARCH "default")
SET(BUILD_TESTS @build_tests@)
SET(TREZOR_DEBUG @build_tests@)

View File

@ -193,7 +193,6 @@ namespace net_utils
return CONNECT_FAILURE;
}
}
m_ssl_options.support = ssl_support_t::e_ssl_support_enabled;
}
return CONNECT_SUCCESS;
}else
@ -223,7 +222,6 @@ namespace net_utils
return false;
if (m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_autodetect)
{
m_ssl_options.support = epee::net_utils::ssl_support_t::e_ssl_support_enabled;
if (try_connect_result == CONNECT_NO_SSL)
{
MERROR("SSL handshake failed on an autodetect connection, reconnecting without SSL");
@ -396,7 +394,7 @@ namespace net_utils
if (!m_connected || !m_ssl_socket->next_layer().is_open())
return false;
if (ssl)
*ssl = m_ssl_options.support == ssl_support_t::e_ssl_support_enabled;
*ssl = m_ssl_options.support != ssl_support_t::e_ssl_support_disabled;
return true;
}
@ -651,7 +649,7 @@ namespace net_utils
bool write(const void* data, size_t sz, boost::system::error_code& ec)
{
bool success;
if(m_ssl_options.support == ssl_support_t::e_ssl_support_enabled)
if(m_ssl_options.support != ssl_support_t::e_ssl_support_disabled)
success = boost::asio::write(*m_ssl_socket, boost::asio::buffer(data, sz), ec);
else
success = boost::asio::write(m_ssl_socket->next_layer(), boost::asio::buffer(data, sz), ec);
@ -660,7 +658,7 @@ namespace net_utils
void async_write(const void* data, size_t sz, boost::system::error_code& ec)
{
if(m_ssl_options.support == ssl_support_t::e_ssl_support_enabled)
if(m_ssl_options.support != ssl_support_t::e_ssl_support_disabled)
boost::asio::async_write(*m_ssl_socket, boost::asio::buffer(data, sz), boost::lambda::var(ec) = boost::lambda::_1);
else
boost::asio::async_write(m_ssl_socket->next_layer(), boost::asio::buffer(data, sz), boost::lambda::var(ec) = boost::lambda::_1);
@ -668,7 +666,7 @@ namespace net_utils
void async_read(char* buff, size_t sz, boost::asio::detail::transfer_at_least_t transfer_at_least, handler_obj& hndlr)
{
if(m_ssl_options.support != ssl_support_t::e_ssl_support_enabled)
if(m_ssl_options.support == ssl_support_t::e_ssl_support_disabled)
boost::asio::async_read(m_ssl_socket->next_layer(), boost::asio::buffer(buff, sz), transfer_at_least, hndlr);
else
boost::asio::async_read(*m_ssl_socket, boost::asio::buffer(buff, sz), transfer_at_least, hndlr);

View File

@ -294,6 +294,11 @@ namespace net_utils
m_max_speed_up(0)
{}
connection_context_base(const connection_context_base& a): connection_context_base()
{
set_details(a.m_connection_id, a.m_remote_address, a.m_is_income, a.m_ssl);
}
connection_context_base& operator=(const connection_context_base& a)
{
set_details(a.m_connection_id, a.m_remote_address, a.m_is_income, a.m_ssl);

View File

@ -129,6 +129,7 @@ script: |
chmod +x ${WRAP_DIR}/${prog}
done
git config --global core.abbrev 9
cd monero
BASEPREFIX=`pwd`/contrib/depends
# Build dependencies for each host
@ -153,7 +154,7 @@ script: |
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=ON
make
make ${MAKEOPTS}
DISTNAME=monero-${i}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}.tar.gz

View File

@ -77,6 +77,7 @@ script: |
create_per-host_faketime_wrappers "2000-01-01 12:00:00"
export PATH=${WRAP_DIR}:${PATH}
git config --global core.abbrev 9
cd monero
BASEPREFIX=`pwd`/contrib/depends
@ -100,7 +101,7 @@ script: |
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake
make
make ${MAKEOPTS}
DISTNAME=monero-${i}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}.tar.gz

View File

@ -100,6 +100,7 @@ script: |
create_per-host_linker_wrapper "2000-01-01 12:00:00"
export PATH=${WRAP_DIR}:${PATH}
git config --global core.abbrev 9
cd monero
BASEPREFIX=`pwd`/contrib/depends
# Build dependencies for each host
@ -125,7 +126,7 @@ script: |
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake
make
make ${MAKEOPTS}
DISTNAME=monero-${i}
mv bin ${DISTNAME}
find ${DISTNAME}/ | sort | zip -X@ ${OUTDIR}/${DISTNAME}.zip

2
external/miniupnp vendored

@ -1 +1 @@
Subproject commit 6b9b73a567e351b844f96c077f7b752ea92e298a
Subproject commit 4c700e09526a7d546394e85628c57e9490feefa0

View File

@ -126,7 +126,7 @@ namespace cryptonote
m_miner_extra_sleep(BACKGROUND_MINING_DEFAULT_MINER_EXTRA_SLEEP_MILLIS),
m_block_reward(0)
{
m_attrs.set_stack_size(THREAD_STACK_SIZE);
}
//-----------------------------------------------------------------------------------------------------
miner::~miner()
@ -363,7 +363,7 @@ namespace cryptonote
return m_threads_total;
}
//-----------------------------------------------------------------------------------------------------
bool miner::start(const account_public_address& adr, size_t threads_count, const boost::thread::attributes& attrs, bool do_background, bool ignore_battery)
bool miner::start(const account_public_address& adr, size_t threads_count, bool do_background, bool ignore_battery)
{
m_block_reward = 0;
m_mine_address = adr;
@ -374,7 +374,6 @@ namespace cryptonote
m_threads_autodetect.push_back({epee::misc_utils::get_ns_count(), m_total_hashes});
m_threads_total = 1;
}
m_attrs = attrs;
m_starter_nonce = crypto::rand<uint32_t>();
CRITICAL_REGION_LOCAL(m_threads_lock);
if(is_mining())
@ -398,7 +397,7 @@ namespace cryptonote
for(size_t i = 0; i != m_threads_total; i++)
{
m_threads.push_back(boost::thread(attrs, boost::bind(&miner::worker_thread, this)));
m_threads.push_back(boost::thread(m_attrs, boost::bind(&miner::worker_thread, this)));
}
if (threads_count == 0)
@ -408,7 +407,7 @@ namespace cryptonote
if( get_is_background_mining_enabled() )
{
m_background_mining_thread = boost::thread(attrs, boost::bind(&miner::background_worker_thread, this));
m_background_mining_thread = boost::thread(m_attrs, boost::bind(&miner::background_worker_thread, this));
LOG_PRINT_L0("Background mining controller thread started" );
}
@ -490,10 +489,7 @@ namespace cryptonote
{
if(m_do_mining)
{
boost::thread::attributes attrs;
attrs.set_stack_size(THREAD_STACK_SIZE);
start(m_mine_address, m_threads_total, attrs, get_is_background_mining_enabled(), get_ignore_battery());
start(m_mine_address, m_threads_total, get_is_background_mining_enabled(), get_ignore_battery());
}
}
//-----------------------------------------------------------------------------------------------------

View File

@ -66,7 +66,7 @@ namespace cryptonote
static void init_options(boost::program_options::options_description& desc);
bool set_block_template(const block& bl, const difficulty_type& diffic, uint64_t height, uint64_t block_reward);
bool on_block_chain_update();
bool start(const account_public_address& adr, size_t threads_count, const boost::thread::attributes& attrs, bool do_background = false, bool ignore_battery = false);
bool start(const account_public_address& adr, size_t threads_count, bool do_background = false, bool ignore_battery = false);
uint64_t get_speed() const;
uint32_t get_threads_count() const;
void send_stop_signal();

View File

@ -90,6 +90,20 @@ namespace hw {
AKout = keys.AKout;
}
ABPkeys &ABPkeys::operator=(const ABPkeys& keys) {
if (&keys == this)
return *this;
Aout = keys.Aout;
Bout = keys.Bout;
is_subaddress = keys.is_subaddress;
is_change_address = keys.is_change_address;
additional_key = keys.additional_key;
index = keys.index;
Pout = keys.Pout;
AKout = keys.AKout;
return *this;
}
bool Keymap::find(const rct::key& P, ABPkeys& keys) const {
size_t sz = ABP.size();
for (size_t i=0; i<sz; i++) {

View File

@ -77,6 +77,7 @@ namespace hw {
ABPkeys(const rct::key& A, const rct::key& B, const bool is_subaddr, bool is_subaddress, bool is_change_address, size_t index, const rct::key& P,const rct::key& AK);
ABPkeys(const ABPkeys& keys) ;
ABPkeys() {index=0;is_subaddress=false;is_subaddress=false;is_change_address=false;}
ABPkeys &operator=(const ABPkeys &keys);
};
class Keymap {

View File

@ -134,10 +134,11 @@ namespace boost
a & port;
a & length;
if (length > net::tor_address::buffer_size())
const size_t buffer_size = net::tor_address::buffer_size();
if (length > buffer_size)
MONERO_THROW(net::error::invalid_tor_address, "Tor address too long");
char host[net::tor_address::buffer_size()] = {0};
char host[buffer_size] = {0};
a.load_binary(host, length);
host[sizeof(host) - 1] = 0;
@ -155,10 +156,11 @@ namespace boost
a & port;
a & length;
if (length > net::i2p_address::buffer_size())
const size_t buffer_size = net::i2p_address::buffer_size();
if (length > buffer_size)
MONERO_THROW(net::error::invalid_i2p_address, "i2p address too long");
char host[net::i2p_address::buffer_size()] = {0};
char host[buffer_size] = {0};
a.load_binary(host, length);
host[sizeof(host) - 1] = 0;

View File

@ -905,16 +905,13 @@ namespace cryptonote
return true;
}
boost::thread::attributes attrs;
attrs.set_stack_size(THREAD_STACK_SIZE);
cryptonote::miner &miner= m_core.get_miner();
if (miner.is_mining())
{
res.status = "Already mining";
return true;
}
if(!miner.start(info.address, static_cast<size_t>(req.threads_count), attrs, req.do_background_mining, req.ignore_battery))
if(!miner.start(info.address, static_cast<size_t>(req.threads_count), req.do_background_mining, req.ignore_battery))
{
res.status = "Failed, mining not started";
LOG_PRINT_L0(res.status);

View File

@ -408,10 +408,7 @@ namespace rpc
return;
}
boost::thread::attributes attrs;
attrs.set_stack_size(THREAD_STACK_SIZE);
if(!m_core.get_miner().start(info.address, static_cast<size_t>(req.threads_count), attrs, req.do_background_mining, req.ignore_battery))
if(!m_core.get_miner().start(info.address, static_cast<size_t>(req.threads_count), req.do_background_mining, req.ignore_battery))
{
res.error_details = "Failed, mining not started";
LOG_PRINT_L0(res.error_details);