Compare commits

..

85 Commits

Author SHA1 Message Date
luigi1111
7bd1ed03dd Merge pull request #6737
0325474 epee: further defending against exceptions in command handlers (moneromooo-monero)
2020-08-03 08:45:47 -05:00
luigi1111
9006119fba Merge pull request #6734
3aae649 Tweak format, add option for difficulty (hyc)
e416f56 Add options to print daily coin emission and fees (hyc)
2f481da Don't forget size of prunable txn part (hyc)
2020-08-03 08:43:09 -05:00
Howard Chu
3aae649738 Tweak format, add option for difficulty
Set input, output, ringsize averages to 2 decimal places precision
Add option to show min/max/av per-block difficulty
2020-08-02 18:31:22 +01:00
moneromooo-monero
03254742e5 epee: further defending against exceptions in command handlers 2020-08-02 00:23:13 +00:00
Howard Chu
e416f56f31 Add options to print daily coin emission and fees
Closes #6735
2020-08-01 20:49:48 +01:00
Howard Chu
2f481da900 Don't forget size of prunable txn part
Fixes #6732
2020-08-01 17:14:29 +01:00
luigi1111
c9aad8a38b Merge pull request #6729
f370093 build: prepare v0.16.0.3 release (selsta)
2020-07-31 15:06:09 -05:00
luigi1111
7f8fe816f4 Merge pull request #6728
870a7b5 rpc: reject wrong sized txid (moneromooo-monero)
5b761d0 easylogging++: fix crash with reentrant logging (moneromooo-monero)
c02d762 epee: guard against exceptions in RPC handlers (moneromooo-monero)
0678fc1 blockchain: guard against exceptions in add_new_block/children (moneromooo-monero)
2020-07-31 15:05:03 -05:00
moneromooo-monero
870a7b5201 rpc: reject wrong sized txid
Reporter requested credit to be given to Decred
2020-07-30 22:51:57 +00:00
moneromooo-monero
5b761d0186 easylogging++: fix crash with reentrant logging 2020-07-30 22:51:56 +00:00
moneromooo-monero
c02d7621a4 epee: guard against exceptions in RPC handlers 2020-07-30 22:51:56 +00:00
moneromooo-monero
0678fc1f97 blockchain: guard against exceptions in add_new_block/children
Reporter requested credit to be given to Decred
2020-07-30 22:51:51 +00:00
selsta
f37009364a build: prepare v0.16.0.3 release 2020-07-30 16:01:21 +02:00
luigi1111
a498a1b4ce Merge pull request #6672
fa199f2 build: prepare v0.16.0.1 release (selsta)
2020-06-23 13:57:23 -05:00
luigi1111
4627b0f3e2 Merge pull request #6681
19bb72d add trezor support to sweep_single (ph4r05)
2020-06-22 14:27:12 -05:00
luigi1111
829cbfd700 Merge pull request #6678
cc19397 updates: mac gui .tar.bz2 -> .dmg (selsta)
2020-06-22 14:26:08 -05:00
luigi1111
efe1bfe7a1 Merge pull request #6676
8eaf0e1 epee: fix array underflow in unicode parsing (moneromooo-monero)
2020-06-22 14:25:19 -05:00
luigi1111
cd9acb3a5b Merge pull request #6671
bca61e4 tx_pool: mine stem txes in fake chain mode (moneromooo-monero)
2020-06-22 14:23:41 -05:00
luigi1111
b0a470d18f Merge pull request #6665
94befec fix typo in pick_preferred_rct_inputs (Parean)
2020-06-22 14:22:42 -05:00
luigi1111
fcac8f5aff Merge pull request #6651
a67c634 blockchain: fix timestamp/difficulty cache getting out of sync (moneromooo-monero)
2020-06-22 14:21:16 -05:00
Dusan Klinec
19bb72d020 add trezor support to sweep_single 2020-06-22 10:59:32 +02:00
selsta
cc19397b48 updates: mac gui .tar.bz2 -> .dmg 2020-06-22 02:53:46 +02:00
moneromooo-monero
8eaf0e189f epee: fix array underflow in unicode parsing
Reported by minerscan

Also independently found by OSS-Fuzz just recently
2020-06-21 18:23:03 +00:00
selsta
fa199f20af build: prepare v0.16.0.1 release 2020-06-21 16:41:46 +02:00
moneromooo-monero
bca61e4fa6 tx_pool: mine stem txes in fake chain mode
This fixes the functional tests, since txes would not be mined
after being sent to the daemon (they'd be waiting for the
dandelion timeout first)
2020-06-20 15:44:23 +00:00
luigi1111
f0ada2f22b Merge pull request #6648
3b390fb Fix D++ block template check (vtnerd)
2020-06-19 16:10:12 -05:00
luigi1111
8a850ed742 Merge pull request #6646
b7812d1 blockchain: fix total_height in getblocks.bin response (moneromooo-monero)
2020-06-19 16:09:28 -05:00
luigi1111
44e3875190 Merge pull request #6645
0a19785 rpc: fix loading rpc payment data from file (moneromooo-monero)
2020-06-19 16:07:45 -05:00
luigi1111
d825252b7d Merge pull request #6644
0569e63 rpc: fix comparison of seconds vs microseconds (moneromooo-monero)
2020-06-19 16:06:33 -05:00
luigi1111
1336992a5b Merge pull request #6643
23df29d functional_tests: add simple relay_tx test (moneromooo-monero)
e306834 rpc: fix relay_tx error return mixup (moneromooo-monero)
2020-06-19 16:05:03 -05:00
luigi1111
e78387936e Merge pull request #6642
96b7697 daemon: remove time based 'update needed' status string (moneromooo-monero)
2020-06-19 16:01:37 -05:00
luigi1111
8e0435876c Merge pull request #6641
5285ecc rpc: don't display invalid json errors on default log level (moneromooo-monero)
2020-06-19 16:00:43 -05:00
luigi1111
79f4af310e Merge pull request #6594
4e6d587 Fix incorrect lenght of command INS_PREFIX_HASH (grydz)
2020-06-19 15:59:50 -05:00
moneromooo-monero
a67c634f89 blockchain: fix timestamp/difficulty cache getting out of sync
The cache is discarded when a block is popped, but then gets
rebuilt when the difficulty for next block is requested.
While this is all properly locked, it does not take into account
the delay caused by a database transaction being only committed
(and thus its effects made visible to other threads) later on,
which means another thread could request difficulty between
the pop and the commit, which would end up using stale database
view to build the cache, but that cache would not be invalidated
again when the transaction gets committed, which would cause the
cache to not match the new database data.

To fix this, we now keep track of when the cache is invalidated
so we can invalidate it again upon database transaction commit
to ensure it gets calculated again with fresh data next time it
is nedeed.
2020-06-13 15:42:09 +00:00
Lee Clagett
3b390fba9c Fix D++ block template check 2020-06-12 22:42:17 -04:00
moneromooo-monero
b7812d1674 blockchain: fix total_height in getblocks.bin response 2020-06-11 12:51:06 +00:00
moneromooo-monero
0a19785e99 rpc: fix loading rpc payment data from file
Got broken after making one of those micro optimizations requested on review..
2020-06-11 12:49:58 +00:00
moneromooo-monero
0569e635cf rpc: fix comparison of seconds vs microseconds 2020-06-11 12:48:48 +00:00
moneromooo-monero
23df29d8d6 functional_tests: add simple relay_tx test 2020-06-11 12:47:29 +00:00
moneromooo-monero
e3068346ee rpc: fix relay_tx error return mixup 2020-06-11 12:47:28 +00:00
moneromooo-monero
96b7697177 daemon: remove time based "update needed" status string 2020-06-11 12:44:57 +00:00
moneromooo-monero
5285ecc3d6 rpc: don't display invalid json errors on default log level
It's not something the user needs to know, and will display
attacker controlled data
2020-06-11 12:43:13 +00:00
François Colas
4e6d587275 Fix incorrect lenght of command INS_PREFIX_HASH
buffer_send[4] (LC) is an unsigned char, len should not
exceed 254 (255 - 1 for the option).
2020-05-27 17:07:48 +02:00
luigi1111
25419b4bfb Merge pull request #6579
f50a6c5 version: update name (selsta)
2020-05-21 12:47:48 -05:00
selsta
f50a6c5aed version: update name 2020-05-21 19:41:04 +02:00
luigi1111
cf4add7899 Merge pull request #6575
ada8172 rpc: lock access to the rpc payment object (moneromooo-monero)
2020-05-21 11:54:52 -05:00
luigi1111
e28d291330 Merge pull request #6577
0d92fe5 rpc: add a sanity limit to a few RPC in restricted mode (moneromooo-monero)
2020-05-21 03:07:04 -05:00
luigi1111
4f6dbcd00e Merge pull request #6572
438b846 ByteSlice: Fix persisting ptr to std::moved SSO buffer (Doy-lee)
2020-05-21 03:06:15 -05:00
luigi1111
062cf63959 Merge pull request #6569
99d702e cryptonote_core: remove 'We are most likely forked' message (moneromooo-monero)
2020-05-21 03:05:16 -05:00
luigi1111
343acd3025 Merge pull request #6548
c5c8592 [release-v0.16] MMS: New 'config_checksum' subcommand (rbrunner7)
2020-05-21 03:03:45 -05:00
moneromooo-monero
0d92fe5234 rpc: add a sanity limit to a few RPC in restricted mode 2020-05-20 19:18:02 +00:00
moneromooo-monero
ada8172b46 rpc: lock access to the rpc payment object 2020-05-20 18:43:24 +00:00
rbrunner7
c5c85925e2 [release-v0.16] MMS: New 'config_checksum' subcommand 2020-05-20 12:05:21 +02:00
Doyle
438b84690e ByteSlice: Fix persisting ptr to std::moved SSO buffer
The Bug:
1. Construct `byte_slice.portion_` with `epee::span(buffer)` which copies a pointer to the SSO buffer to `byte_slice.portion_`
2. It constructs `byte_slice.storage_` with `std::move(buffer)` (normally this swap pointers, but SSO means a memcpy and clear on the original SSO buffer)
3. `slice.data()` returns a pointer from `slice.portion_` that points to the original SSO cleared buffer, `slice.storage_` has the actual string.
2020-05-20 10:21:21 +10:00
luigi1111
eed8a4e8a6 Merge pull request #6554
f01d529 cryptonote_protocol: reject requests/notifications before handshake (moneromooo-monero)
bbab044 cryptonote_protocol: stricter limit to number of objects requested (moneromooo-monero)
2020-05-19 17:51:03 -05:00
luigi1111
b82af557f5 Merge pull request #6567
cef39dc protocol: move the 'peer claims higher version' warning to debug (moneromooo-monero)
2020-05-19 17:38:34 -05:00
luigi1111
0161cb79a1 Merge pull request #6562
705c78b wallet2: fix multisig data clearing stomping on a vector (moneromooo-monero)
2020-05-19 17:36:58 -05:00
luigi1111
f28026b86f Merge pull request #6560
4291344 serialization: fix bad rapidjson api usage (moneromooo-monero)
2020-05-19 17:34:17 -05:00
luigi1111
cb75003642 Merge pull request #6545
bb4d95c blockchain: detect and log bad difficulty calculations (moneromooo-monero)
2020-05-19 17:30:37 -05:00
luigi1111
8fb0d7e0b4 Merge pull request #6543
44e3782 protocol: don't drop a connection if we can't get a compatible chain (moneromooo-monero)
2020-05-19 17:29:46 -05:00
luigi1111
3578ce9fb6 Merge pull request #6541
4a9c3a Revert 'simplewallet: noob-friendly help menu' (selsta)
7633ba0 simplewallet: help_advanced -> help (selsta)
2020-05-19 17:26:28 -05:00
luigi1111
f8642bf95c Merge pull request #6540
7209db8 epee: use memwipe rather than memset for md5 secrets (moneromooo-monero)
2020-05-19 17:13:24 -05:00
luigi1111
da04c5fb48 Merge pull request #6532
f35ced6 build: fix boost 1.73 compatibility (selsta)
2020-05-19 17:11:05 -05:00
luigi1111
278f78e877 Merge pull request #6551
f526977 easylogging++: sanitize log payload (moneromooo-monero)
2020-05-19 17:08:15 -05:00
moneromooo-monero
99d702e28b cryptonote_core: remove "We are most likely forked" message
It's time based and we don't have forks every 6 months anymore
2020-05-19 16:27:38 +00:00
moneromooo-monero
cef39dc313 protocol: move the "peer claims higher version" warning to debug
Because there's a neverending supply of cunts claiming a wrong
version just to say "look at me" I guess
2020-05-19 16:15:08 +00:00
moneromooo-monero
705c78b797 wallet2: fix multisig data clearing stomping on a vector 2020-05-19 12:24:50 +00:00
moneromooo-monero
4291344f80 serialization: fix bad rapidjson api usage 2020-05-19 12:23:03 +00:00
moneromooo-monero
bbab044c92 cryptonote_protocol: stricter limit to number of objects requested
Reported by xnbya
2020-05-19 10:34:05 +00:00
moneromooo-monero
f01d529bdb cryptonote_protocol: reject requests/notifications before handshake
Reported by xnbya
2020-05-19 10:34:04 +00:00
moneromooo-monero
f52697729d easylogging++: sanitize log payload
Some of it might be coming from untrusted sources

Reported by itsunixiknowthis
2020-05-19 10:31:51 +00:00
moneromooo-monero
bb4d95c98f blockchain: detect and log bad difficulty calculations 2020-05-17 12:45:06 +00:00
moneromooo-monero
44e3782b4d protocol: don't drop a connection if we can't get a compatible chain
This can now happen if:
- we have a pruned db
- we have not connected to the monero network for a while
- we connect to a node
- that node asks us for history
- we only have a pruned version of the most recent common block

In that case, it's better to not reply but keep the connection alive,
so we can sync off it.
2020-05-16 20:25:29 +00:00
selsta
7633ba059c simplewallet: help_advanced -> help 2020-05-16 21:27:19 +02:00
selsta
4a9c3aca03 Revert "simplewallet: noob-friendly help menu"
This reverts commit 67b4a19edf.
2020-05-16 21:26:11 +02:00
moneromooo-monero
7209db839c epee: use memwipe rather than memset for md5 secrets
That's used by HTTP auth now
2020-05-16 18:14:58 +00:00
luigi1111
4987161fa6 Merge pull request #6527
1b48f32 simplewallet: don't complain about incoming payment ids on change (moneromooo-monero)
2020-05-14 16:12:43 -05:00
luigi1111
a67a9fc9c4 Merge pull request #6524
cc40ce1 Fixed bugs for take_slice and byte_stream->byte_slice (vtnerd)
2020-05-14 16:10:59 -05:00
luigi1111
87490c541f Merge pull request #6520
ab44293 trezor: add new firmware version support (ph4r05)
2020-05-14 16:09:56 -05:00
luigi1111
a763ea7cf8 Merge pull request #6518
82afc5f [release-v0.16]: Update gitian yml files (iDunk5400)
2020-05-14 16:08:54 -05:00
moneromooo-monero
1b48f325b8 simplewallet: don't complain about incoming payment ids on change 2020-05-13 23:29:10 +00:00
Lee Clagett
cc40ce1b3f Fixed bugs for take_slice and byte_stream->byte_slice 2020-05-12 19:07:41 -04:00
iDunk5400
82afc5ff13 [release-v0.16]: Update gitian yml files 2020-05-12 12:34:12 +02:00
luigi1111
309211fd6a Merge pull request #6515
08a45c5 build: prepare v0.16.0.0 release (selsta)
2020-05-11 16:27:21 -05:00
selsta
08a45c51a0 build: prepare v0.16.0.0 release 2020-05-09 15:23:37 +02:00
740 changed files with 5540 additions and 19251 deletions

2
.github/FUNDING.yml vendored
View File

@@ -1 +1 @@
custom: https://www.getmonero.org/get-started/contributing/ custom: https://web.getmonero.org/get-started/contributing/

View File

@@ -10,25 +10,23 @@ jobs:
with: with:
submodules: recursive submodules: recursive
- name: update brew and install dependencies - name: update brew and install dependencies
run: brew update && brew install boost hidapi openssl zmq libpgm miniupnpc ldns expat libunwind-headers protobuf run: brew update && brew install boost hidapi zmq libpgm miniupnpc ldns expat libunwind-headers protobuf
- name: build - name: build
run: make -j3 run: make -j3
build-windows: build-windows:
runs-on: windows-latest runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
with: with:
submodules: recursive submodules: recursive
- uses: msys2/setup-msys2@v2 - uses: numworks/setup-msys2@v1
with: - name: update pacman
update: true run: msys2do pacman -Syu --noconfirm
install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb git - name: install monero dependencies
run: msys2do pacman -S --noconfirm mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb git
- name: build - name: build
run: make release-static-win64 -j2 run: msys2do make release-static-win64 -j2
build-ubuntu: build-ubuntu:
runs-on: ubuntu-latest runs-on: ubuntu-latest

7
.gitmodules vendored
View File

@@ -4,7 +4,8 @@
branch = monero branch = monero
[submodule "external/miniupnp"] [submodule "external/miniupnp"]
path = external/miniupnp path = external/miniupnp
url = https://github.com/miniupnp/miniupnp url = https://github.com/monero-project/miniupnp
branch = monero
[submodule "external/rapidjson"] [submodule "external/rapidjson"]
path = external/rapidjson path = external/rapidjson
url = https://github.com/Tencent/rapidjson url = https://github.com/Tencent/rapidjson
@@ -14,7 +15,3 @@
[submodule "external/randomx"] [submodule "external/randomx"]
path = external/randomx path = external/randomx
url = https://github.com/tevador/RandomX url = https://github.com/tevador/RandomX
[submodule "external/supercop"]
path = external/supercop
url = https://github.com/monero-project/supercop
branch = monero

View File

@@ -25,7 +25,7 @@ env:
# ARM v8 # ARM v8
- HOST=aarch64-linux-gnu PACKAGES="python3 gperf g++-aarch64-linux-gnu" - HOST=aarch64-linux-gnu PACKAGES="python3 gperf g++-aarch64-linux-gnu"
# i686 Win # i686 Win
- HOST=i686-w64-mingw32 DEP_OPTS="NO_QT=1" PACKAGES="python3 g++-mingw-w64-i686 qttools5-dev-tools" MAKEJOBS=-j2 - HOST=i686-w64-mingw32 DEP_OPTS="NO_QT=1" PACKAGES="python3 g++-mingw-w64-i686 qttools5-dev-tools"
# i686 Linux # i686 Linux
- HOST=i686-pc-linux-gnu PACKAGES="gperf cmake g++-multilib python3-zmq" - HOST=i686-pc-linux-gnu PACKAGES="gperf cmake g++-multilib python3-zmq"
# Win64 # Win64

View File

@@ -36,6 +36,10 @@ with additional exclusive IPv4 address(es).
## Usage ## Usage
Anonymity networks have no seed nodes (the feature is still considered
experimental), so a user must specify an address. If configured properly,
additional peers can be found through typical p2p peerlist sharing.
### Outbound Connections ### Outbound Connections
Connecting to an anonymous address requires the command line option Connecting to an anonymous address requires the command line option
@@ -50,9 +54,8 @@ separate process. On most systems the configuration will look like:
which tells `monerod` that ".onion" p2p addresses can be forwarded to a socks which tells `monerod` that ".onion" p2p addresses can be forwarded to a socks
proxy at IP 127.0.0.1 port 9050 with a max of 10 outgoing connections and proxy at IP 127.0.0.1 port 9050 with a max of 10 outgoing connections and
".b32.i2p" p2p addresses can be forwarded to a socks proxy at IP 127.0.0.1 port ".b32.i2p" p2p addresses can be forwarded to a socks proxy at IP 127.0.0.1 port
9000 with the default max outgoing connections. 9000 with the default max outgoing connections. Since there are no seed nodes
for anonymity connections, peers must be manually specified:
If desired, peers can be manually specified:
``` ```
--add-exclusive-node rveahdfho7wo4b2m.onion:28083 --add-exclusive-node rveahdfho7wo4b2m.onion:28083

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020, The Monero Project # Copyright (c) 2014-2019, The Monero Project
# #
# All rights reserved. # All rights reserved.
# #
@@ -31,7 +31,7 @@
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
list(INSERT CMAKE_MODULE_PATH 0 list(INSERT CMAKE_MODULE_PATH 0
"${CMAKE_CURRENT_SOURCE_DIR}/cmake") "${CMAKE_SOURCE_DIR}/cmake")
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
include(CheckLinkerFlag) include(CheckLinkerFlag)
@@ -43,28 +43,15 @@ if (IOS)
INCLUDE(CmakeLists_IOS.txt) INCLUDE(CmakeLists_IOS.txt)
endif() endif()
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 2.8.7)
message(STATUS "CMake version ${CMAKE_VERSION}") message(STATUS "CMake version ${CMAKE_VERSION}")
project(monero) project(monero)
option (USE_CCACHE "Use ccache if a usable instance is found" ON) include(FindCcache) # Has to be included after the project() macro, to be able to read the CXX variable.
if (USE_CCACHE)
include(FindCcache) # Has to be included after the project() macro, to be able to read the CXX variable.
else()
message(STATUS "ccache deselected")
endif()
enable_language(C ASM) enable_language(C ASM)
# Require C11/C++11 and disable extensions for all targets
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
function (die msg) function (die msg)
if (NOT WIN32) if (NOT WIN32)
string(ASCII 27 Esc) string(ASCII 27 Esc)
@@ -79,18 +66,16 @@ function (die msg)
endfunction () endfunction ()
function (add_c_flag_if_supported flag var) function (add_c_flag_if_supported flag var)
set(TMP "-Werror ${flag}") string(REPLACE "-" "_" supported ${flag}_c)
string(REGEX REPLACE "[- ]" "_" supported ${TMP}_c) check_c_compiler_flag(${flag} ${supported})
check_c_compiler_flag(${TMP} ${supported})
if(${${supported}}) if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE) set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif() endif()
endfunction() endfunction()
function (add_cxx_flag_if_supported flag var) function (add_cxx_flag_if_supported flag var)
set(TMP "-Werror ${flag}") string(REPLACE "-" "_" supported ${flag}_cxx)
string(REGEX REPLACE "[- ]" "_" supported ${TMP}_cxx) check_cxx_compiler_flag(${flag} ${supported})
check_cxx_compiler_flag(${TMP} ${supported})
if(${${supported}}) if(${${supported}})
set(${var} "${${var}} ${flag}" PARENT_SCOPE) set(${var} "${${var}} ${flag}" PARENT_SCOPE)
endif() endif()
@@ -121,66 +106,6 @@ function (add_definition_if_library_exists library function header var)
endif() endif()
endfunction() endfunction()
# Function to forbid undefined symbols and also verify
# 1) Test project with all types of libraries and without undefined symbols can compile successfully
# 2) Test project with all types of libraries and undefined symbols can not compile successfully
function(forbid_undefined_symbols)
unset(TMP)
# https://www.unix.com/man-page/linux/1/ld, --no-undefined, Report unresolved symbol references from regular object files.
add_linker_flag_if_supported(-Wl,--no-undefined TMP)
# https://www.unix.com/man-page/osx/1/ld/, -undefined, Specifies how undefined symbols are to be treated.
add_linker_flag_if_supported(-Wl,-undefined,error TMP)
string(APPEND CMAKE_SHARED_LINKER_FLAGS ${TMP})
string(APPEND CMAKE_MODULE_LINKER_FLAGS ${TMP})
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} PARENT_SCOPE)
set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS} PARENT_SCOPE)
set(TEST_PROJECT "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_project")
foreach(EXPECT IN ITEMS TRUE FALSE)
file(REMOVE_RECURSE "${TEST_PROJECT}")
file(MAKE_DIRECTORY "${TEST_PROJECT}")
file(WRITE "${TEST_PROJECT}/CMakeLists.txt"
[=[
cmake_minimum_required(VERSION 3.1)
project(test)
option(EXPECT_SUCCESS "" ON)
file(WRITE "${CMAKE_SOURCE_DIR}/incorrect_source.cpp" "void undefined_symbol(); void symbol() { undefined_symbol(); }")
if (EXPECT_SUCCESS)
file(APPEND "${CMAKE_SOURCE_DIR}/incorrect_source.cpp" " void undefined_symbol() {}; ")
endif()
add_library(l0 SHARED incorrect_source.cpp)
add_library(l1 MODULE incorrect_source.cpp)
add_library(l2 STATIC incorrect_source.cpp)
add_library(l3 OBJECT incorrect_source.cpp)
]=]
)
try_compile(SUCCESS "${TEST_PROJECT}/build" "${TEST_PROJECT}" test
CMAKE_FLAGS
"-DCMAKE_SHARED_LINKER_FLAGS=${CMAKE_SHARED_LINKER_FLAGS}"
"-DCMAKE_MODULE_LINKER_FLAGS=${CMAKE_MODULE_LINKER_FLAGS}"
"-DEXPECT_SUCCESS=${EXPECT}"
)
if (NOT ${SUCCESS} STREQUAL ${EXPECT})
message(FATAL_ERROR "Undefined symbols test failure: expect(${EXPECT}), success(${SUCCESS})")
endif()
file(REMOVE_RECURSE "${TEST_PROJECT}")
endforeach()
endfunction()
if (NOT (CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*"))
forbid_undefined_symbols()
endif()
if (MINGW)
function(export_all_symbols)
unset(TMP)
add_linker_flag_if_supported(-Wl,--export-all-symbols TMP)
string(APPEND CMAKE_SHARED_LINKER_FLAGS ${TMP})
string(APPEND CMAKE_MODULE_LINKER_FLAGS ${TMP})
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} PARENT_SCOPE)
set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS} PARENT_SCOPE)
endfunction()
export_all_symbols()
endif()
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}") message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}")
@@ -280,7 +205,6 @@ if(NOT MANUAL_SUBMODULES)
check_submodule(external/rapidjson) check_submodule(external/rapidjson)
check_submodule(external/trezor-common) check_submodule(external/trezor-common)
check_submodule(external/randomx) check_submodule(external/randomx)
check_submodule(external/supercop)
endif() endif()
endif() endif()
@@ -338,12 +262,6 @@ else()
endif() endif()
option(BUILD_DEBUG_UTILITIES "Build debug utilities." DEFAULT_BUILD_DEBUG_UTILITIES) option(BUILD_DEBUG_UTILITIES "Build debug utilities." DEFAULT_BUILD_DEBUG_UTILITIES)
if(OSSFUZZ)
message(STATUS "Using OSS-Fuzz fuzzing system")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOSSFUZZ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOSSFUZZ")
endif()
# Check whether we're on a 32-bit or 64-bit system # Check whether we're on a 32-bit or 64-bit system
if(CMAKE_SIZEOF_VOID_P EQUAL "8") if(CMAKE_SIZEOF_VOID_P EQUAL "8")
set(DEFAULT_BUILD_64 ON) set(DEFAULT_BUILD_64 ON)
@@ -382,7 +300,7 @@ endif()
# elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*") # elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
# set(BSDI TRUE) # set(BSDI TRUE)
include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external external/supercop/include) include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external)
if(APPLE) if(APPLE)
include_directories(SYSTEM /usr/include/malloc) include_directories(SYSTEM /usr/include/malloc)
@@ -501,8 +419,8 @@ if (CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
endif () endif ()
if (APPLE AND NOT IOS) if (APPLE AND NOT IOS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11")
if (NOT OPENSSL_ROOT_DIR) if (NOT OpenSSL_DIR)
EXECUTE_PROCESS(COMMAND brew --prefix openssl EXECUTE_PROCESS(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR OUTPUT_VARIABLE OPENSSL_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -519,10 +437,6 @@ if(STATIC AND NOT IOS)
endif() endif()
endif() endif()
if (WIN32)
list(APPEND OPENSSL_LIBRARIES ws2_32 crypt32)
endif()
find_package(HIDAPI) find_package(HIDAPI)
add_definition_if_library_exists(c memset_s "string.h" HAVE_MEMSET_S) add_definition_if_library_exists(c memset_s "string.h" HAVE_MEMSET_S)
@@ -531,9 +445,6 @@ add_definition_if_function_found(strptime HAVE_STRPTIME)
add_definitions(-DAUTO_INITIALIZE_EASYLOGGINGPP) add_definitions(-DAUTO_INITIALIZE_EASYLOGGINGPP)
set(MONERO_GENERATED_HEADERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated_include")
include_directories(${MONERO_GENERATED_HEADERS_DIR})
# Generate header for embedded translations # Generate header for embedded translations
# Generate header for embedded translations, use target toolchain if depends, otherwise use the # Generate header for embedded translations, use target toolchain if depends, otherwise use the
# lrelease and lupdate binaries from the host # lrelease and lupdate binaries from the host
@@ -575,17 +486,6 @@ endif()
# Trezor support check # Trezor support check
include(CheckTrezor) include(CheckTrezor)
# As of OpenBSD 6.8, -march=<anything> breaks the build
function(set_default_arch)
if (OPENBSD)
set(ARCH default)
else()
set(ARCH native)
endif()
set(ARCH ${ARCH} CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
endfunction()
if(MSVC) if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__") add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline") # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
@@ -599,7 +499,7 @@ if(MSVC)
else() else()
include(TestCXXAcceptsFlag) include(TestCXXAcceptsFlag)
if (NOT ARCH) if (NOT ARCH)
set_default_arch() set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
endif() endif()
message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}") message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}")
if(ARCH STREQUAL "default") if(ARCH STREQUAL "default")
@@ -662,7 +562,7 @@ else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAG}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAG}")
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized") set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized")
if(CMAKE_C_COMPILER_ID MATCHES "Clang") if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(ARM) if(ARM)
set(WARNINGS "${WARNINGS} -Wno-error=inline-asm") set(WARNINGS "${WARNINGS} -Wno-error=inline-asm")
endif() endif()
@@ -683,14 +583,14 @@ else()
endif() endif()
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes") set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes")
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers") set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
try_compile(STATIC_ASSERT_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.c" CMAKE_FLAGS -DCMAKE_C_STANDARD=11) try_compile(STATIC_ASSERT_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.c" COMPILE_DEFINITIONS "-std=c11")
if(STATIC_ASSERT_RES) if(STATIC_ASSERT_RES)
set(STATIC_ASSERT_FLAG "") set(STATIC_ASSERT_FLAG "")
else() else()
set(STATIC_ASSERT_FLAG "-Dstatic_assert=_Static_assert") set(STATIC_ASSERT_FLAG "-Dstatic_assert=_Static_assert")
endif() endif()
try_compile(STATIC_ASSERT_CPP_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.cpp" CMAKE_FLAGS -DCMAKE_CXX_STANDARD=11) try_compile(STATIC_ASSERT_CPP_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.cpp" COMPILE_DEFINITIONS "-std=c++11")
if(STATIC_ASSERT_CPP_RES) if(STATIC_ASSERT_CPP_RES)
set(STATIC_ASSERT_CPP_FLAG "") set(STATIC_ASSERT_CPP_FLAG "")
else() else()
@@ -746,8 +646,7 @@ else()
endif() endif()
# linker # linker
if (NOT SANITIZE AND NOT OSSFUZZ AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1))) if (NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1)))
# PIE executables randomly crash at startup with ASAN
# Windows binaries die on startup with PIE when compiled with GCC <9.x # Windows binaries die on startup with PIE when compiled with GCC <9.x
add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS) add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS)
endif() endif()
@@ -779,8 +678,8 @@ else()
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}") message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}") message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${COVERAGE_FLAGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${COVERAGE_FLAGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${COVERAGE_FLAGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${COVERAGE_FLAGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${LD_BACKCOMPAT_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${LD_BACKCOMPAT_FLAGS}")
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that # With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
@@ -869,8 +768,7 @@ else()
endif(ARM) endif(ARM)
# random crash on startup when asan is on if pie is enabled if(ANDROID AND NOT BUILD_GUI_DEPS STREQUAL "ON" OR IOS)
if(NOT SANITIZE AND ANDROID AND NOT BUILD_GUI_DEPS STREQUAL "ON" OR IOS)
#From Android 5: "only position independent executables (PIE) are supported" #From Android 5: "only position independent executables (PIE) are supported"
message(STATUS "Enabling PIE executable") message(STATUS "Enabling PIE executable")
set(PIC_FLAG "") set(PIC_FLAG "")
@@ -898,7 +796,7 @@ else()
endif() endif()
set(USE_LTO ${USE_LTO_DEFAULT} CACHE BOOL "Use Link-Time Optimization (Release mode only)") set(USE_LTO ${USE_LTO_DEFAULT} CACHE BOOL "Use Link-Time Optimization (Release mode only)")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# There is a clang bug that does not allow to compile code that uses AES-NI intrinsics if -flto is enabled, so explicitly disable # There is a clang bug that does not allow to compile code that uses AES-NI intrinsics if -flto is enabled, so explicitly disable
set(USE_LTO false) set(USE_LTO false)
endif() endif()
@@ -1005,12 +903,10 @@ list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED) if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
if (APPLE) if (APPLE)
if(DEPENDS) if(DEPENDS)
list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework AppKit -framework IOKit") list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework IOKit")
else() else()
find_library(COREFOUNDATION CoreFoundation) find_library(COREFOUNDATION CoreFoundation)
find_library(APPKIT AppKit)
find_library(IOKIT IOKit) find_library(IOKIT IOKit)
list(APPEND EXTRA_LIBRARIES ${APPKIT})
list(APPEND EXTRA_LIBRARIES ${IOKIT}) list(APPEND EXTRA_LIBRARIES ${IOKIT})
list(APPEND EXTRA_LIBRARIES ${COREFOUNDATION}) list(APPEND EXTRA_LIBRARIES ${COREFOUNDATION})
endif() endif()
@@ -1045,7 +941,7 @@ if(ANDROID)
set(ATOMIC libatomic.a) set(ATOMIC libatomic.a)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=user-defined-warnings") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=user-defined-warnings")
endif() endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS AND NOT FREEBSD) if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS AND NOT FREEBSD)
find_library(ATOMIC atomic) find_library(ATOMIC atomic)
if (ATOMIC_FOUND) if (ATOMIC_FOUND)
list(APPEND EXTRA_LIBRARIES ${ATOMIC}) list(APPEND EXTRA_LIBRARIES ${ATOMIC})
@@ -1056,7 +952,6 @@ find_path(ZMQ_INCLUDE_PATH zmq.h)
find_library(ZMQ_LIB zmq) find_library(ZMQ_LIB zmq)
find_library(PGM_LIBRARY pgm) find_library(PGM_LIBRARY pgm)
find_library(NORM_LIBRARY norm) find_library(NORM_LIBRARY norm)
find_library(GSSAPI_LIBRARY gssapi_krb5)
find_library(PROTOLIB_LIBRARY protolib) find_library(PROTOLIB_LIBRARY protolib)
find_library(SODIUM_LIBRARY sodium) find_library(SODIUM_LIBRARY sodium)
@@ -1072,9 +967,6 @@ endif()
if(NORM_LIBRARY) if(NORM_LIBRARY)
set(ZMQ_LIB "${ZMQ_LIB};${NORM_LIBRARY}") set(ZMQ_LIB "${ZMQ_LIB};${NORM_LIBRARY}")
endif() endif()
if(GSSAPI_LIBRARY)
set(ZMQ_LIB "${ZMQ_LIB};${GSSAPI_LIBRARY}")
endif()
if(PROTOLIB_LIBRARY) if(PROTOLIB_LIBRARY)
set(ZMQ_LIB "${ZMQ_LIB};${PROTOLIB_LIBRARY}") set(ZMQ_LIB "${ZMQ_LIB};${PROTOLIB_LIBRARY}")
endif() endif()
@@ -1082,7 +974,6 @@ if(SODIUM_LIBRARY)
set(ZMQ_LIB "${ZMQ_LIB};${SODIUM_LIBRARY}") set(ZMQ_LIB "${ZMQ_LIB};${SODIUM_LIBRARY}")
endif() endif()
include(external/supercop/functions.cmake) # place after setting flags and before src directory inclusion
add_subdirectory(contrib) add_subdirectory(contrib)
add_subdirectory(src) add_subdirectory(src)
@@ -1130,6 +1021,8 @@ option(BUILD_GUI_DEPS "Build GUI dependencies." OFF)
option(INSTALL_VENDORED_LIBUNBOUND "Install libunbound binary built from source vendored with this repo." OFF) option(INSTALL_VENDORED_LIBUNBOUND "Install libunbound binary built from source vendored with this repo." OFF)
CHECK_C_COMPILER_FLAG(-std=c11 HAVE_C11)
find_package(PythonInterp) find_package(PythonInterp)
find_program(iwyu_tool_path NAMES iwyu_tool.py iwyu_tool) find_program(iwyu_tool_path NAMES iwyu_tool.py iwyu_tool)
if (iwyu_tool_path AND PYTHONINTERP_FOUND) if (iwyu_tool_path AND PYTHONINTERP_FOUND)

View File

@@ -1,4 +1,4 @@
# Portions Copyright (c) 2017-2020, The Monero Project # Portions Copyright (c) 2017-2019, The Monero Project
# This file is based off of the https://code.google.com/archive/p/ios-cmake/ # This file is based off of the https://code.google.com/archive/p/ios-cmake/
# It has been altered for Monero iOS development # It has been altered for Monero iOS development
# #

View File

@@ -46,7 +46,7 @@ ARG BOOST_VERSION=1_70_0
ARG BOOST_VERSION_DOT=1.70.0 ARG BOOST_VERSION_DOT=1.70.0
ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
RUN set -ex \ RUN set -ex \
&& curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION_DOT}/boost_${BOOST_VERSION}.tar.bz2 \ && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
&& tar -xvf boost_${BOOST_VERSION}.tar.bz2 \ && tar -xvf boost_${BOOST_VERSION}.tar.bz2 \
&& cd boost_${BOOST_VERSION} \ && cd boost_${BOOST_VERSION} \

View File

@@ -1,4 +1,4 @@
Copyright (c) 2014-2020, The Monero Project Copyright (c) 2014-2019, The Monero Project
All rights reserved. All rights reserved.

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020, The Monero Project # Copyright (c) 2014-2019, The Monero Project
# #
# All rights reserved. # All rights reserved.
# #

111
README.md
View File

@@ -1,6 +1,6 @@
# Monero # Monero
Copyright (c) 2014-2020 The Monero Project. Copyright (c) 2014-2019 The Monero Project.
Portions Copyright (c) 2012-2013 The Cryptonote developers. Portions Copyright (c) 2012-2013 The Cryptonote developers.
## Table of Contents ## Table of Contents
@@ -22,7 +22,6 @@ Portions Copyright (c) 2012-2013 The Cryptonote developers.
- [Dependencies](#dependencies) - [Dependencies](#dependencies)
- [Internationalization](#Internationalization) - [Internationalization](#Internationalization)
- [Using Tor](#using-tor) - [Using Tor](#using-tor)
- [Pruning](#Pruning)
- [Debugging](#Debugging) - [Debugging](#Debugging)
- [Known issues](#known-issues) - [Known issues](#known-issues)
@@ -73,11 +72,11 @@ Monero is a private, secure, untraceable, decentralised digital currency. You ar
**Privacy:** Monero uses a cryptographically sound system to allow you to send and receive funds without your transactions being easily revealed on the blockchain (the ledger of transactions that everyone has). This ensures that your purchases, receipts, and all transfers remain absolutely private by default. **Privacy:** Monero uses a cryptographically sound system to allow you to send and receive funds without your transactions being easily revealed on the blockchain (the ledger of transactions that everyone has). This ensures that your purchases, receipts, and all transfers remain absolutely private by default.
**Security:** Using the power of a distributed peer-to-peer consensus network, every transaction on the network is cryptographically secured. Individual wallets have a 25-word mnemonic seed that is only displayed once and can be written down to backup the wallet. Wallet files are encrypted with a passphrase to ensure they are useless if stolen. **Security:** Using the power of a distributed peer-to-peer consensus network, every transaction on the network is cryptographically secured. Individual wallets have a 25 word mnemonic seed that is only displayed once, and can be written down to backup the wallet. Wallet files are encrypted with a passphrase to ensure they are useless if stolen.
**Untraceability:** By taking advantage of ring signatures, a special property of a certain type of cryptography, Monero is able to ensure that transactions are not only untraceable but have an optional measure of ambiguity that ensures that transactions cannot easily be tied back to an individual user or computer. **Untraceability:** By taking advantage of ring signatures, a special property of a certain type of cryptography, Monero is able to ensure that transactions are not only untraceable, but have an optional measure of ambiguity that ensures that transactions cannot easily be tied back to an individual user or computer.
**Decentralization:** The utility of Monero depends on its decentralised peer-to-peer consensus network - anyone should be able to run the monero software, validate the integrity of the blockchain, and participate in all aspects of the monero network using consumer-grade commodity hardware. Decentralization of the monero network is maintained by software development that minimizes the costs of running the monero software and inhibits the proliferation of specialized, non-commodity hardware. **Decentralization:** The utility of monero depends on its decentralised peer-to-peer consensus network - anyone should be able to run the monero software, validate the integrity of the blockchain, and participate in all aspects of the monero network using consumer-grade commodity hardware. Decentralization of the monero network is maintained by software development that minimizes the costs of running the monero software and inhibits the proliferation of specialized, non-commodity hardware.
## About this project ## About this project
@@ -85,13 +84,13 @@ This is the core implementation of Monero. It is open source and completely free
As with many development projects, the repository on Github is considered to be the "staging" area for the latest changes. Before changes are merged into that branch on the main repository, they are tested by individual developers in their own branches, submitted as a pull request, and then subsequently tested by contributors who focus on testing and code reviews. That having been said, the repository should be carefully considered before using it in a production environment, unless there is a patch in the repository for a particular show-stopping issue you are experiencing. It is generally a better idea to use a tagged release for stability. As with many development projects, the repository on Github is considered to be the "staging" area for the latest changes. Before changes are merged into that branch on the main repository, they are tested by individual developers in their own branches, submitted as a pull request, and then subsequently tested by contributors who focus on testing and code reviews. That having been said, the repository should be carefully considered before using it in a production environment, unless there is a patch in the repository for a particular show-stopping issue you are experiencing. It is generally a better idea to use a tagged release for stability.
**Anyone is welcome to contribute to Monero's codebase!** If you have a fix or code change, feel free to submit it as a pull request directly to the "master" branch. In cases where the change is relatively small or does not affect other parts of the codebase, it may be merged in immediately by any one of the collaborators. On the other hand, if the change is particularly large or complex, it is expected that it will be discussed at length either well in advance of the pull request being submitted, or even directly on the pull request. **Anyone is welcome to contribute to Monero's codebase!** If you have a fix or code change, feel free to submit it as a pull request directly to the "master" branch. In cases where the change is relatively small or does not affect other parts of the codebase it may be merged in immediately by any one of the collaborators. On the other hand, if the change is particularly large or complex, it is expected that it will be discussed at length either well in advance of the pull request being submitted, or even directly on the pull request.
## Supporting the project ## Supporting the project
Monero is a 100% community-sponsored endeavor. If you want to join our efforts, the easiest thing you can do is support the project financially. Both Monero and Bitcoin donations can be made to **donate.getmonero.org** if using a client that supports the [OpenAlias](https://openalias.org) standard. Alternatively, you can send XMR to the Monero donation address via the `donate` command (type `help` in the command-line wallet for details). Monero is a 100% community-sponsored endeavor. If you want to join our efforts, the easiest thing you can do is support the project financially. Both Monero and Bitcoin donations can be made to **donate.getmonero.org** if using a client that supports the [OpenAlias](https://openalias.org) standard. Alternatively you can send XMR to the Monero donation address via the `donate` command (type `help` in the command-line wallet for details).
The Monero donation address is: `888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H` (viewkey: `f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501`) The Monero donation address is: `44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A` (viewkey: `f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501`)
The Bitcoin donation address is: `1KTexdemPdxSBcG55heUuTjDRYqbC5ZL8H` The Bitcoin donation address is: `1KTexdemPdxSBcG55heUuTjDRYqbC5ZL8H`
@@ -133,9 +132,7 @@ Dates are provided in the format YYYY-MM-DD.
| 1686275 | 2018-10-19 | v9 | v0.13.0.0 | v0.13.0.4 | bulletproofs required | 1686275 | 2018-10-19 | v9 | v0.13.0.0 | v0.13.0.4 | bulletproofs required
| 1788000 | 2019-03-09 | v10 | v0.14.0.0 | v0.14.1.2 | New PoW based on Cryptonight-R, new block weight algorithm, slightly more efficient RingCT format | 1788000 | 2019-03-09 | v10 | v0.14.0.0 | v0.14.1.2 | New PoW based on Cryptonight-R, new block weight algorithm, slightly more efficient RingCT format
| 1788720 | 2019-03-10 | v11 | v0.14.0.0 | v0.14.1.2 | forbid old RingCT transaction format | 1788720 | 2019-03-10 | v11 | v0.14.0.0 | v0.14.1.2 | forbid old RingCT transaction format
| 1978433 | 2019-11-30 | v12 | v0.15.0.0 | v0.16.0.0 | New PoW based on RandomX, only allow >= 2 outputs, change to the block median used to calculate penalty, v1 coinbases are forbidden, rct sigs in coinbase forbidden, 10 block lock time for incoming outputs | 1978433 | 2019-11-30* | v12 | v0.15.0.0 | v0.16.0.3 | New PoW based on RandomX, only allow >= 2 outputs, change to the block median used to calculate penalty, v1 coinbases are forbidden, rct sigs in coinbase forbidden, 10 block lock time for incoming outputs
| 2210000 | 2020-10-17 | v13 | v0.17.0.0 | v0.17.3.2 | New CLSAG transaction format
| 2210720 | 2020-10-18 | v14 | v0.17.1.1 | v0.17.3.2 | forbid old MLSAG transaction format
| XXXXXXX | XXX-XX-XX | XXX | vX.XX.X.X | vX.XX.X.X | XXX | | XXXXXXX | XXX-XX-XX | XXX | vX.XX.X.X | vX.XX.X.X | XXX |
X's indicate that these details have not been determined as of commit date. X's indicate that these details have not been determined as of commit date.
@@ -152,7 +149,7 @@ Approximately three months prior to a scheduled software upgrade, a branch from
The following table summarizes the tools and libraries required to build. A The following table summarizes the tools and libraries required to build. A
few of the libraries are also included in this repository (marked as few of the libraries are also included in this repository (marked as
"Vendored"). By default, the build uses the library installed on the system "Vendored"). By default, the build uses the library installed on the system,
and ignores the vendored sources. However, if no library is found installed on and ignores the vendored sources. However, if no library is found installed on
the system, then the vendored source will be built and used. The vendored the system, then the vendored source will be built and used. The vendored
sources are also used for statically-linked builds because distribution sources are also used for statically-linked builds because distribution
@@ -161,7 +158,7 @@ library archives (`.a`).
| Dep | Min. version | Vendored | Debian/Ubuntu pkg | Arch pkg | Void pkg | Fedora pkg | Optional | Purpose | | Dep | Min. version | Vendored | Debian/Ubuntu pkg | Arch pkg | Void pkg | Fedora pkg | Optional | Purpose |
| ------------ | ------------- | -------- | -------------------- | ------------ | ------------------ | ------------------- | -------- | --------------- | | ------------ | ------------- | -------- | -------------------- | ------------ | ------------------ | ------------------- | -------- | --------------- |
| GCC | 5 | NO | `build-essential` | `base-devel` | `base-devel` | `gcc` | NO | | | GCC | 4.7.3 | NO | `build-essential` | `base-devel` | `base-devel` | `gcc` | NO | |
| CMake | 3.5 | NO | `cmake` | `cmake` | `cmake` | `cmake` | NO | | | CMake | 3.5 | NO | `cmake` | `cmake` | `cmake` | `cmake` | NO | |
| pkg-config | any | NO | `pkg-config` | `base-devel` | `base-devel` | `pkgconf` | NO | | | pkg-config | any | NO | `pkg-config` | `base-devel` | `base-devel` | `pkgconf` | NO | |
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries | | Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries |
@@ -181,10 +178,10 @@ library archives (`.a`).
| Graphviz | any | NO | `graphviz` | `graphviz` | `graphviz` | `graphviz` | YES | Documentation | | Graphviz | any | NO | `graphviz` | `graphviz` | `graphviz` | `graphviz` | YES | Documentation |
| lrelease | ? | NO | `qttools5-dev-tools` | `qt5-tools` | `qt5-tools` | `qt5-linguist` | YES | Translations | | lrelease | ? | NO | `qttools5-dev-tools` | `qt5-tools` | `qt5-tools` | `qt5-linguist` | YES | Translations |
| libhidapi | ? | NO | `libhidapi-dev` | `hidapi` | `hidapi-devel` | `hidapi-devel` | YES | Hardware wallet | | libhidapi | ? | NO | `libhidapi-dev` | `hidapi` | `hidapi-devel` | `hidapi-devel` | YES | Hardware wallet |
| libusb | ? | NO | `libusb-1.0-0-dev` | `libusb` | `libusb-devel` | `libusbx-devel` | YES | Hardware wallet | | libusb | ? | NO | `libusb-dev` | `libusb` | `libusb-devel` | `libusb-devel` | YES | Hardware wallet |
| libprotobuf | ? | NO | `libprotobuf-dev` | `protobuf` | `protobuf-devel` | `protobuf-devel` | YES | Hardware wallet | | libprotobuf | ? | NO | `libprotobuf-dev` | `protobuf` | `protobuf-devel` | `protobuf-devel` | YES | Hardware wallet |
| protoc | ? | NO | `protobuf-compiler` | `protobuf` | `protobuf` | `protobuf-compiler` | YES | Hardware wallet | | protoc | ? | NO | `protobuf-compiler` | `protobuf` | `protobuf` | `protobuf-compiler` | YES | Hardware wallet |
| libudev | ? | No | `libudev-dev` | `systemd` | `eudev-libudev-devel` | `systemd-devel` | YES | Hardware wallet |
[1] On Debian/Ubuntu `libgtest-dev` only includes sources and headers. You must [1] On Debian/Ubuntu `libgtest-dev` only includes sources and headers. You must
build the library binary manually. This can be done with the following command ```sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libg* /usr/lib/ ``` build the library binary manually. This can be done with the following command ```sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libg* /usr/lib/ ```
@@ -192,13 +189,13 @@ build the library binary manually. This can be done with the following command `
Install all dependencies at once on Debian/Ubuntu: Install all dependencies at once on Debian/Ubuntu:
``` sudo apt update && sudo apt install build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev doxygen graphviz libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev``` ``` sudo apt update && sudo apt install build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev doxygen graphviz libpgm-dev qttools5-dev-tools libhidapi-dev libusb-dev libprotobuf-dev protobuf-compiler ```
Install all dependencies at once on macOS with the provided Brewfile: Install all dependencies at once on macOS with the provided Brewfile:
``` brew update && brew bundle --file=contrib/brew/Brewfile ``` ``` brew update && brew bundle --file=contrib/brew/Brewfile ```
FreeBSD 12.1 one-liner required to build dependencies: FreeBSD one liner for required to build dependencies
```pkg install git gmake cmake pkgconf boost-libs libzmq4 libsodium``` ```pkg install git gmake cmake pkgconf boost-libs libzmq libsodium```
### Cloning the repository ### Cloning the repository
@@ -222,7 +219,7 @@ invokes cmake commands as needed.
```bash ```bash
cd monero cd monero
git checkout release-v0.17 git checkout release-v0.16
make make
``` ```
@@ -290,12 +287,12 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (
* If using an external hard disk without an external power supply, ensure it gets enough power to avoid hardware issues when syncing, by adding the line "max_usb_current=1" to /boot/config.txt * If using an external hard disk without an external power supply, ensure it gets enough power to avoid hardware issues when syncing, by adding the line "max_usb_current=1" to /boot/config.txt
* Clone Monero and checkout the most recent release version: * Clone monero and checkout the most recent release version:
```bash ```bash
git clone https://github.com/monero-project/monero.git git clone https://github.com/monero-project/monero.git
cd monero cd monero
git checkout tags/v0.17.3.2 git checkout tags/v0.16.0.3
``` ```
* Build: * Build:
@@ -316,7 +313,7 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (
#### *Note for Raspbian Jessie users:* #### *Note for Raspbian Jessie users:*
If you are using the older Raspbian Jessie image, compiling Monero is a bit more complicated. The version of Boost available in the Debian Jessie repositories is too old to use with Monero, and thus you must compile a newer version yourself. The following explains the extra steps and has been tested on a Raspberry Pi 2 with a clean install of minimal Raspbian Jessie. If you are using the older Raspbian Jessie image, compiling Monero is a bit more complicated. The version of Boost available in the Debian Jessie repositories is too old to use with Monero, and thus you must compile a newer version yourself. The following explains the extra steps, and has been tested on a Raspberry Pi 2 with a clean install of minimal Raspbian Jessie.
* As before, `apt-get update && apt-get upgrade` to install all of the latest software, and increase the system swap size * As before, `apt-get update && apt-get upgrade` to install all of the latest software, and increase the system swap size
@@ -328,7 +325,7 @@ If you are using the older Raspbian Jessie image, compiling Monero is a bit more
``` ```
* Then, install the dependencies for Monero except for `libunwind` and `libboost-all-dev` * Then, install the dependencies for Monero except `libunwind` and `libboost-all-dev`
* Install the latest version of boost (this may first require invoking `apt-get remove --purge libboost*-dev` to remove a previous version if you're not using a clean install): * Install the latest version of boost (this may first require invoking `apt-get remove --purge libboost*-dev` to remove a previous version if you're not using a clean install):
@@ -349,7 +346,7 @@ If you are using the older Raspbian Jessie image, compiling Monero is a bit more
* Wait ~4 hours * Wait ~4 hours
* From here, follow the [general Raspberry Pi instructions](#on-the-raspberry-pi) from the "Clone Monero and checkout most recent release version" step. * From here, follow the [general Raspberry Pi instructions](#on-the-raspberry-pi) from the "Clone monero and checkout most recent release version" step.
#### On Windows: #### On Windows:
@@ -412,10 +409,10 @@ application.
cd monero cd monero
``` ```
* If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.17.3.2'. If you don't care about the version and just want binaries from master, skip this step: * If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.16.0.3'. If you don't care about the version and just want binaries from master, skip this step:
```bash ```bash
git checkout v0.17.3.2 git checkout v0.16.0.3
``` ```
* If you are on a 64-bit system, run: * If you are on a 64-bit system, run:
@@ -449,7 +446,7 @@ application.
### On FreeBSD: ### On FreeBSD:
The project can be built from scratch by following instructions for Linux above(but use `gmake` instead of `make`). The project can be built from scratch by following instructions for Linux above(but use `gmake` instead of `make`).
If you are running Monero in a jail, you need to add `sysvsem="new"` to your jail configuration, otherwise lmdb will throw the error message: `Failed to open lmdb environment: Function not implemented`. If you are running monero in a jail, you need to add `sysvsem="new"` to your jail configuration, otherwise lmdb will throw the error message: `Failed to open lmdb environment: Function not implemented`.
Monero is also available as a port or package as 'monero-cli`. Monero is also available as a port or package as 'monero-cli`.
@@ -462,7 +459,7 @@ Running the test suite also requires `py-requests` package.
Build monero: `env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local gmake release-static` Build monero: `env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local gmake release-static`
Note: you may encounter the following error when compiling the latest version of Monero as a normal user: Note: you may encounter the following error, when compiling the latest version of monero as a normal user:
``` ```
LLVM ERROR: out of memory LLVM ERROR: out of memory
@@ -471,14 +468,6 @@ c++: error: unable to execute command: Abort trap (core dumped)
Then you need to increase the data ulimit size to 2GB and try again: `ulimit -d 2000000` Then you need to increase the data ulimit size to 2GB and try again: `ulimit -d 2000000`
### On NetBSD:
Check that the dependencies are present: `pkg_info -c libexecinfo boost-headers boost-libs protobuf readline libusb1 zeromq git-base pkgconf gmake cmake | more`, and install any that are reported missing, using `pkg_add` or from your pkgsrc tree. Readline is optional but worth having.
Third-party dependencies are usually under `/usr/pkg/`, but if you have a custom setup, adjust the "/usr/pkg" (below) accordingly.
Clone the monero repository recursively and checkout the most recent release as described above. Then build monero: `gmake BOOST_ROOT=/usr/pkg LDFLAGS="-Wl,-R/usr/pkg/lib" release`. The resulting executables can be found in `build/NetBSD/[Release version]/Release/bin/`.
### On Solaris: ### On Solaris:
The default Solaris linker can't be used, you have to install GNU ld, then run cmake manually with the path to your copy of GNU ld: The default Solaris linker can't be used, you have to install GNU ld, then run cmake manually with the path to your copy of GNU ld:
@@ -554,10 +543,6 @@ The produced binaries still link libc dynamically. If the binary is compiled on
Packages are available for Packages are available for
* Debian Buster
See the [instructions in the whonix/monero-gui repository](https://gitlab.com/whonix/monero-gui#how-to-install-monero-using-apt-get)
* Debian Bullseye and Sid * Debian Bullseye and Sid
```bash ```bash
@@ -565,8 +550,9 @@ Packages are available for
``` ```
More info and versions in the [Debian package tracker](https://tracker.debian.org/pkg/monero). More info and versions in the [Debian package tracker](https://tracker.debian.org/pkg/monero).
* Arch Linux (via Community packages): * Arch Linux (via [AUR](https://aur.archlinux.org/)):
[`monero`](https://www.archlinux.org/packages/community/x86_64/monero/) - Stable release: [`monero`](https://aur.archlinux.org/packages/monero)
- Bleeding edge: [`monero-git`](https://aur.archlinux.org/packages/monero-git)
* Void Linux: * Void Linux:
@@ -580,33 +566,18 @@ More info and versions in the [Debian package tracker](https://tracker.debian.or
guix package -i monero guix package -i monero
``` ```
* Gentoo [Monero overlay](https://github.com/gentoo-monero/gentoo-monero)
```bash
emerge --noreplace eselect-repository
eselect repository enable monero
emaint sync -r monero
echo '*/*::monero ~amd64' >> /etc/portage/package.accept_keywords
emerge net-p2p/monero
```
* macOS (homebrew)
```bash
brew install monero
```
* Docker * Docker
```bash ```bash
# Build using all available cores # Build using all available cores
docker build -t monero . docker build -t monero .
# or build using a specific number of cores (reduce RAM requirement) # or build using a specific number of cores (reduce RAM requirement)
docker build --build-arg NPROC=1 -t monero . docker build --build-arg NPROC=1 -t monero .
# either run in foreground # either run in foreground
docker run -it -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero docker run -it -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero
# or in background # or in background
docker run -it -d -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero docker run -it -d -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero
``` ```
@@ -619,7 +590,7 @@ Packaging for your favorite distribution would be a welcome contribution!
## Running monerod ## Running monerod
The build places the binary in `bin/` sub-directory within the build directory The build places the binary in `bin/` sub-directory within the build directory
from which cmake was invoked (repository root by default). To run in the from which cmake was invoked (repository root by default). To run in
foreground: foreground:
```bash ```bash
@@ -630,7 +601,7 @@ To list all available options, run `./bin/monerod --help`. Options can be
specified either on the command line or in a configuration file passed by the specified either on the command line or in a configuration file passed by the
`--config-file` argument. To specify an option in the configuration file, add `--config-file` argument. To specify an option in the configuration file, add
a line with the syntax `argumentname=value`, where `argumentname` is the name a line with the syntax `argumentname=value`, where `argumentname` is the name
of the argument without the leading dashes, for example, `log-level=1`. of the argument without the leading dashes, for example `log-level=1`.
To run in background: To run in background:
@@ -655,7 +626,7 @@ See [README.i18n.md](README.i18n.md).
## Using Tor ## Using Tor
> There is a new, still experimental, [integration with Tor](ANONYMITY_NETWORKS.md). The > There is a new, still experimental, [integration with Tor](ANONYMITY_NETWORKS.md). The
> feature allows connecting over IPv4 and Tor simultaneously - IPv4 is used for > feature allows connecting over IPv4 and Tor simulatenously - IPv4 is used for
> relaying blocks and relaying transactions received by peers whereas Tor is > relaying blocks and relaying transactions received by peers whereas Tor is
> used solely for relaying transactions received over local RPC. This provides > used solely for relaying transactions received over local RPC. This provides
> privacy and better protection against surrounding node (sybil) attacks. > privacy and better protection against surrounding node (sybil) attacks.
@@ -700,16 +671,6 @@ DNS_PUBLIC=tcp torsocks ./monerod --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip
--data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain --data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain
``` ```
## Pruning
As of May 2020, the full Monero blockchain file is about 80 GB. One can store a pruned blockchain, which is about 28 GB.
A pruned blockchain can only serve part of the historical chain data to other peers, but is otherwise identical in
functionality to the full blockchain.
To use a pruned blockchain, it is best to start the initial sync with --prune-blockchain. However, it is also possible
to prune an existing blockchain using the monero-blockchain-prune tool or using the --prune-blockchain monerod option
with an existing chain. If an existing chain exists, pruning will temporarily require disk space to store both the full
and pruned blockchains.
## Debugging ## Debugging
This section contains general instructions for debugging failed installs or problems encountered with Monero. First, ensure you are running the latest version built from the Github repo. This section contains general instructions for debugging failed installs or problems encountered with Monero. First, ensure you are running the latest version built from the Github repo.
@@ -754,7 +715,7 @@ Print the stack trace with `bt`
coredumpctl -1 gdb coredumpctl -1 gdb
``` ```
#### To run Monero within gdb: #### To run monero within gdb:
Type `gdb /path/to/monerod` Type `gdb /path/to/monerod`

63
ZMQ.md
View File

@@ -1,63 +0,0 @@
# The Current/Future Status of ZMQ in Monero
## ZMQ Pub/Sub
Client `ZMQ_SUB` sockets must "subscribe" to topics before it receives any data.
This allows filtering on the server side, so network traffic is reduced. Monero
allows for filtering on: (1) format, (2) context, and (3) event.
* **format** refers to the _wire_ format (i.e. JSON) used to send event
information.
* **context** allows for a reduction in fields for the event, so the
daemon doesn't waste cycles serializing fields that get ignored.
* **event** refers to status changes occurring within the daemon (i.e. new
block to main chain).
* Formats:
* `json`
* Contexts:
* `full` - the entire block or transaction is transmitted (the hash can be
computed remotely).
* `minimal` - the bare minimum for a remote client to react to an event is
sent.
* Events:
* `chain_main` - changes to the primary/main blockchain.
* `txpool_add` - new _publicly visible_ transactions in the mempool.
Includes previously unseen transactions in a block but _not_ the
`miner_tx`. Does not "re-publish" after a reorg. Includes `do_not_relay`
transactions.
* `miner_data` - provides the necessary data to create a custom block template
Available only in the `full` context.
The subscription topics are formatted as `format-context-event`, with prefix
matching supported by both Monero and ZMQ. The `format`, `context` and `event`
will _never_ have hyphens or colons in their name. For example, subscribing to
`json-minimal-chain_main` will send minimal information in JSON when changes
to the main/primary blockchain occur. Whereas, subscribing to `json-minimal`
will send minimal information in JSON on all available events supported by the
daemon.
The Monero daemon will ensure that events prefixed by `chain` will be sent in
"chain-order" - the `prev_id` (hash) field will _always_ refer to a previous
block. On rollbacks/reorgs, the event will reference an earlier block in the
chain instead of the last block. The Monero daemon also ensures that
`txpool_add` events are sent before `chain_*` events - the `chain_*` messages
will only serialize miner transactions since the other transactions were
previously published via `txpool_add`. This prevents transactions from being
serialized twice, even when the transaction was first observed in a block.
ZMQ Pub/Sub will drop messages if the network is congested, so the above rules
for send order are used for detecting lost messages. A missing gap in `height`
or `prev_id` for `chain_*` events indicates a lost pub message. Missing
`txpool_add` messages can only be detected at the next `chain_` message.
Since blockchain events can be dropped, clients will likely want to have a
timeout against `chain_main` events. The `GetLastBlockHeader` RPC is useful
for checking the current chain state. Dropped messages should be rare in most
conditions.
The Monero daemon will send a `txpool_add` pub exactly once for each
transaction, even after a reorg or restarts. Clients should use the
`GetTransactionPool` after a reorg to get all transactions that have been put
back into the tx pool or been invalidated due to a double-spend.

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020, The Monero Project # Copyright (c) 2014-2019, The Monero Project
# #
# All rights reserved. # All rights reserved.
# #

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020, The Monero Project # Copyright (c) 2014-2019, The Monero Project
# #
# All rights reserved. # All rights reserved.
# #

View File

@@ -91,7 +91,7 @@ endif()
# Protobuf compilation test # Protobuf compilation test
if(Protobuf_FOUND AND USE_DEVICE_TREZOR AND TREZOR_PYTHON) if(Protobuf_FOUND AND USE_DEVICE_TREZOR AND TREZOR_PYTHON)
execute_process(COMMAND ${Protobuf_PROTOC_EXECUTABLE} -I "${CMAKE_CURRENT_LIST_DIR}" -I "${Protobuf_INCLUDE_DIR}" "${CMAKE_CURRENT_LIST_DIR}/test-protobuf.proto" --cpp_out ${CMAKE_BINARY_DIR} RESULT_VARIABLE RET OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR) execute_process(COMMAND ${Protobuf_PROTOC_EXECUTABLE} -I "${CMAKE_SOURCE_DIR}/cmake" -I "${Protobuf_INCLUDE_DIR}" "${CMAKE_SOURCE_DIR}/cmake/test-protobuf.proto" --cpp_out ${CMAKE_BINARY_DIR} RESULT_VARIABLE RET OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR)
if(RET) if(RET)
message(STATUS "Protobuf test generation failed: ${OUT} ${ERR}") message(STATUS "Protobuf test generation failed: ${OUT} ${ERR}")
endif() endif()
@@ -100,7 +100,7 @@ if(Protobuf_FOUND AND USE_DEVICE_TREZOR AND TREZOR_PYTHON)
"${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}"
SOURCES SOURCES
"${CMAKE_BINARY_DIR}/test-protobuf.pb.cc" "${CMAKE_BINARY_DIR}/test-protobuf.pb.cc"
"${CMAKE_CURRENT_LIST_DIR}/test-protobuf.cpp" "${CMAKE_SOURCE_DIR}/cmake/test-protobuf.cpp"
CMAKE_FLAGS CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${Protobuf_INCLUDE_DIR};${CMAKE_BINARY_DIR}" "-DINCLUDE_DIRECTORIES=${Protobuf_INCLUDE_DIR};${CMAKE_BINARY_DIR}"
"-DCMAKE_CXX_STANDARD=11" "-DCMAKE_CXX_STANDARD=11"

View File

@@ -41,27 +41,17 @@
find_program(CCACHE_FOUND ccache) find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND) if (CCACHE_FOUND)
# Try to compile a test program with ccache, in order to verify if it really works. (needed on exotic setups) set(TEMP_CPP_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test-program.cpp")
set(TEST_PROJECT "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp") file(WRITE "${TEMP_CPP_FILE}" "int main() { return 0; }")
file(WRITE "${TEST_PROJECT}/CMakeLists.txt" [=[ execute_process(COMMAND "${CCACHE_FOUND}" "${CMAKE_CXX_COMPILER}" "${TEMP_CPP_FILE}" RESULT_VARIABLE RET)
cmake_minimum_required(VERSION 3.5) if (${RET} EQUAL 0)
project(test) message("found usable ccache: ${CCACHE_FOUND}")
option (CCACHE "")
file(WRITE "${CMAKE_SOURCE_DIR}/test.cpp" "int main() { return 0; }")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE}")
add_executable(main test.cpp)
]=])
try_compile(RET "${TEST_PROJECT}/build" "${TEST_PROJECT}" "test" CMAKE_FLAGS -DCCACHE="${CCACHE_FOUND}")
unset(TEST_PROJECT)
if (${RET})
# Success
message(STATUS "Found usable ccache: ${CCACHE_FOUND}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}") set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_FOUND}") set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_FOUND}")
else() else()
message(STATUS "Found ccache ${CCACHE_FOUND}, but is UNUSABLE! Return code: ${RET}") message("found ccache ${CCACHE_FOUND}, but is UNUSABLE! Return code: ${RET}")
endif() endif()
else() else()
message(STATUS "ccache NOT found! Please install it for faster rebuilds.") message("ccache NOT found!")
endif() endif()

View File

@@ -134,7 +134,7 @@ if ( LibUSB_FOUND )
try_compile(LibUSB_COMPILE_TEST_PASSED try_compile(LibUSB_COMPILE_TEST_PASSED
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
"${CMAKE_CURRENT_LIST_DIR}/test-libusb-version.c" "${CMAKE_SOURCE_DIR}/cmake/test-libusb-version.c"
CMAKE_FLAGS CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES=${LibUSB_INCLUDE_DIRS}" "-DINCLUDE_DIRECTORIES=${LibUSB_INCLUDE_DIRS}"
"-DLINK_DIRECTORIES=${LibUSB_LIBRARIES}" "-DLINK_DIRECTORIES=${LibUSB_LIBRARIES}"

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020, The Monero Project # Copyright (c) 2014-2019, The Monero Project
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without modification, are # Redistribution and use in source and binary forms, with or without modification, are

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020, The Monero Project # Copyright (c) 2014-2019, The Monero Project
# #
# All rights reserved. # All rights reserved.
# #
@@ -32,7 +32,7 @@
function (get_version_tag_from_git GIT) function (get_version_tag_from_git GIT)
execute_process(COMMAND "${GIT}" rev-parse --short=9 HEAD execute_process(COMMAND "${GIT}" rev-parse --short=9 HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RET RESULT_VARIABLE RET
OUTPUT_VARIABLE COMMIT OUTPUT_VARIABLE COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -48,21 +48,29 @@ function (get_version_tag_from_git GIT)
message(STATUS "You are currently on commit ${COMMIT}") message(STATUS "You are currently on commit ${COMMIT}")
# Get all the tags # Get all the tags
execute_process(COMMAND "${GIT}" tag -l --points-at HEAD execute_process(COMMAND "${GIT}" rev-list --tags --max-count=1 --abbrev-commit
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RET RESULT_VARIABLE RET
OUTPUT_VARIABLE TAG OUTPUT_VARIABLE TAGGEDCOMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
# Check if we're building that tagged commit or a different one if(NOT TAGGEDCOMMIT)
if(TAG) message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.")
message(STATUS "You are building a tagged release")
set(VERSIONTAG "release")
set(VERSION_IS_RELEASE "true")
else()
message(STATUS "You are ahead of or behind a tagged release")
set(VERSIONTAG "${COMMIT}") set(VERSIONTAG "${COMMIT}")
set(VERSION_IS_RELEASE "false") set(VERSION_IS_RELEASE "false")
else()
message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}")
# Check if we're building that tagged commit or a different one
if(COMMIT STREQUAL TAGGEDCOMMIT)
message(STATUS "You are building a tagged release")
set(VERSIONTAG "release")
set(VERSION_IS_RELEASE "true")
else()
message(STATUS "You are ahead of or behind a tagged release")
set(VERSIONTAG "${COMMIT}")
set(VERSION_IS_RELEASE "false")
endif()
endif() endif()
endif() endif()

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020, The Monero Project # Copyright (c) 2014-2019, The Monero Project
# #
# All rights reserved. # All rights reserved.
# #
@@ -28,7 +28,7 @@
function (write_version tag) function (write_version tag)
set(VERSIONTAG "${tag}" CACHE STRING "The tag portion of the Monero software version" FORCE) set(VERSIONTAG "${tag}" CACHE STRING "The tag portion of the Monero software version" FORCE)
configure_file("${CMAKE_CURRENT_LIST_DIR}/../src/version.cpp.in" "${CMAKE_BINARY_DIR}/version.cpp") configure_file("${CMAKE_SOURCE_DIR}/src/version.cpp.in" "${CMAKE_BINARY_DIR}/version.cpp")
endfunction () endfunction ()
find_package(Git QUIET) find_package(Git QUIET)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020, The Monero Project # Copyright (c) 2014-2019, The Monero Project
# #
# All rights reserved. # All rights reserved.
# #

View File

@@ -0,0 +1,18 @@
version: '1.0'
steps:
init_submodules:
title: Init Submodules
commands:
- git submodule update --init --recursive
image: codefreshio/git-image:latest
working_directory: ${{main_clone}}
BuildingDockerImage:
title: Building Docker Image
type: build
image_name: monero
working_directory: ./
tag: '${{CF_BRANCH_TAG_NORMALIZED}}'
dockerfile: Dockerfile
build_arguments:
- NPROC=1

View File

@@ -3,7 +3,7 @@
SOURCES_PATH ?= $(BASEDIR)/sources SOURCES_PATH ?= $(BASEDIR)/sources
BASE_CACHE ?= $(BASEDIR)/built BASE_CACHE ?= $(BASEDIR)/built
SDK_PATH ?= $(BASEDIR)/SDKs SDK_PATH ?= $(BASEDIR)/SDKs
FALLBACK_DOWNLOAD_PATH ?= https://downloads.getmonero.org/depends-sources FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
BUILD = $(shell ./config.guess) BUILD = $(shell ./config.guess)
HOST ?= $(BUILD) HOST ?= $(BUILD)

View File

@@ -32,7 +32,7 @@ endef
define fetch_file define fetch_file
( test -f $$($(1)_source_dir)/$(4) || \ ( test -f $$($(1)_source_dir)/$(4) || \
( $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5)) || \ ( $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5)) || \
$(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(4),$(4),$(5)))) $(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(3),$(4),$(5))))
endef endef
define int_get_build_recipe_hash define int_get_build_recipe_hash
@@ -133,11 +133,6 @@ $(1)_config_env+=$($(1)_config_env_$(host_arch)) $($(1)_config_env_$(host_arch)_
$(1)_config_env+=$($(1)_config_env_$(host_os)) $($(1)_config_env_$(host_os)_$(release_type)) $(1)_config_env+=$($(1)_config_env_$(host_os)) $($(1)_config_env_$(host_os)_$(release_type))
$(1)_config_env+=$($(1)_config_env_$(host_arch)_$(host_os)) $($(1)_config_env_$(host_arch)_$(host_os)_$(release_type)) $(1)_config_env+=$($(1)_config_env_$(host_arch)_$(host_os)) $($(1)_config_env_$(host_arch)_$(host_os)_$(release_type))
$(1)_build_env+=$$($(1)_build_env_$(release_type))
$(1)_build_env+=$($(1)_build_env_$(host_arch)) $($(1)_build_env_$(host_arch)_$(release_type))
$(1)_build_env+=$($(1)_build_env_$(host_os)) $($(1)_build_env_$(host_os)_$(release_type))
$(1)_build_env+=$($(1)_build_env_$(host_arch)_$(host_os)) $($(1)_build_env_$(host_arch)_$(host_os)_$(release_type))
$(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig $(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig
$(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig $(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig
$(1)_config_env+=PATH="$(build_prefix)/bin:$(PATH)" $(1)_config_env+=PATH="$(build_prefix)/bin:$(PATH)"

View File

@@ -1,6 +1,6 @@
package=boost package=boost
$(package)_version=1_64_0 $(package)_version=1_64_0
$(package)_download_path=https://downloads.sourceforge.net/project/boost/boost/1.64.0/ $(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/
$(package)_file_name=$(package)_$($(package)_version).tar.bz2 $(package)_file_name=$(package)_$($(package)_version).tar.bz2
$(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332 $(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332
$(package)_dependencies=libiconv $(package)_dependencies=libiconv

View File

@@ -1,8 +1,7 @@
package=eudev package=eudev
$(package)_version=v3.2.6 $(package)_version=v3.2.6
$(package)_download_path=https://github.com/gentoo/eudev/archive/ $(package)_download_path=https://github.com/gentoo/eudev/archive/
$(package)_download_file=$($(package)_version).tar.gz $(package)_file_name=$($(package)_version).tar.gz
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=a96ecb8637667897b8bd4dee4c22c7c5f08b327be45186e912ce6bc768385852 $(package)_sha256_hash=a96ecb8637667897b8bd4dee4c22c7c5f08b327be45186e912ce6bc768385852
define $(package)_set_vars define $(package)_set_vars

View File

@@ -1,6 +1,6 @@
package=expat package=expat
$(package)_version=2.2.4 $(package)_version=2.2.4
$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_2_2_4 $(package)_download_path=https://downloads.sourceforge.net/project/expat/expat/$($(package)_version)
$(package)_file_name=$(package)-$($(package)_version).tar.bz2 $(package)_file_name=$(package)-$($(package)_version).tar.bz2
$(package)_sha256_hash=03ad85db965f8ab2d27328abcf0bc5571af6ec0a414874b2066ee3fdd372019e $(package)_sha256_hash=03ad85db965f8ab2d27328abcf0bc5571af6ec0a414874b2066ee3fdd372019e

View File

@@ -1,8 +1,7 @@
package=gtest package=gtest
$(package)_version=1.8.1 $(package)_version=1.8.1
$(package)_download_path=https://github.com/google/googletest/archive/ $(package)_download_path=https://github.com/google/googletest/archive/
$(package)_download_file=release-$($(package)_version).tar.gz $(package)_file_name=release-$($(package)_version).tar.gz
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c $(package)_sha256_hash=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
$(package)_cxxflags=-std=c++11 $(package)_cxxflags=-std=c++11
$(package)_cxxflags_linux=-fPIC $(package)_cxxflags_linux=-fPIC

View File

@@ -1,10 +1,9 @@
package=hidapi package=hidapi
$(package)_version=0.11.0 $(package)_version=0.9.0
$(package)_download_path=https://github.com/libusb/hidapi/archive $(package)_download_path=https://github.com/libusb/hidapi/archive
$(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=391d8e52f2d6a5cf76e2b0c079cfefe25497ba1d4659131297081fc0cd744632 $(package)_sha256_hash=630ee1834bdd5c5761ab079fd04f463a89585df8fcae51a7bfe4229b1e02a652
$(package)_linux_dependencies=libusb eudev $(package)_linux_dependencies=libusb eudev
$(package)_patches=missing_win_include.patch
define $(package)_set_vars define $(package)_set_vars
$(package)_config_opts=--enable-static --disable-shared $(package)_config_opts=--enable-static --disable-shared
@@ -17,10 +16,6 @@ $(package)_config_opts_linux+=libusb_CFLAGS=-I$(host_prefix)/include/libusb-1.0
$(package)_config_opts_linux+=--with-pic $(package)_config_opts_linux+=--with-pic
endef endef
define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/missing_win_include.patch
endef
define $(package)_config_cmds define $(package)_config_cmds
./bootstrap &&\ ./bootstrap &&\
$($(package)_autoconf) $($(package)_config_opts) AR_FLAGS=$($(package)_arflags) $($(package)_autoconf) $($(package)_config_opts) AR_FLAGS=$($(package)_arflags)

View File

@@ -1,8 +1,7 @@
package=native_cctools package=native_cctools
$(package)_version=807d6fd1be5d2224872e381870c0a75387fe05e6 $(package)_version=807d6fd1be5d2224872e381870c0a75387fe05e6
$(package)_download_path=https://github.com/theuni/cctools-port/archive $(package)_download_path=https://github.com/theuni/cctools-port/archive
$(package)_download_file=$($(package)_version).tar.gz $(package)_file_name=$($(package)_version).tar.gz
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=a09c9ba4684670a0375e42d9d67e7f12c1f62581a27f28f7c825d6d7032ccc6a $(package)_sha256_hash=a09c9ba4684670a0375e42d9d67e7f12c1f62581a27f28f7c825d6d7032ccc6a
$(package)_build_subdir=cctools $(package)_build_subdir=cctools
$(package)_clang_version=3.7.1 $(package)_clang_version=3.7.1

View File

@@ -1,9 +1,9 @@
package=native_ds_store package=native_ds_store
$(package)_version=1.1.0 $(package)_version=1.1.0
$(package)_download_path=https://github.com/al45tair/ds_store/archive/ $(package)_download_path=https://bitbucket.org/al45tair/ds_store/get
$(package)_download_file=v$($(package)_version).tar.gz $(package)_download_file=v$($(package)_version).tar.bz2
$(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_file_name=$(package)-$($(package)_version).tar.bz2
$(package)_sha256_hash=a9f4c0755c6be7224ff7029e188dd262e830bb81e801424841db9eb0780ec8ed $(package)_sha256_hash=921596764d71d1bbd3297a90ef6d286f718794d667e4f81d91d14053525d64c1
$(package)_install_libdir=$(build_prefix)/lib/python/dist-packages $(package)_install_libdir=$(build_prefix)/lib/python/dist-packages
$(package)_dependencies=native_biplist $(package)_dependencies=native_biplist

View File

@@ -1,9 +1,9 @@
package=native_mac_alias package=native_mac_alias
$(package)_version=1.1.0 $(package)_version=1.1.0
$(package)_download_path=https://github.com/al45tair/mac_alias/archive/ $(package)_download_path=https://bitbucket.org/al45tair/mac_alias/get
$(package)_download_file=v$($(package)_version).tar.gz $(package)_download_file=v$($(package)_version).tar.bz2
$(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_file_name=$(package)-$($(package)_version).tar.bz2
$(package)_sha256_hash=b10cb44ecb64fc25283fae7a9cf365d2829377d84e37b9c21100aca8757509be $(package)_sha256_hash=87ad827e66790028361e43fc754f68ed041a9bdb214cca03c853f079b04fb120
$(package)_install_libdir=$(build_prefix)/lib/python/dist-packages $(package)_install_libdir=$(build_prefix)/lib/python/dist-packages
$(package)_patches=python3.patch $(package)_patches=python3.patch

View File

@@ -1,30 +1,36 @@
package=openssl package=openssl
$(package)_version=1.1.1l $(package)_version=1.0.2r
$(package)_download_path=https://www.openssl.org/source $(package)_download_path=https://ftp.openssl.org/source/old/1.0.2
$(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1 $(package)_sha256_hash=ae51d08bba8a83958e894946f15303ff894d75c2b8bbd44a852b64e3fe11d0d6
$(package)_patches=fix_darwin.patch $(package)_patches=fix_arflags.patch
define $(package)_set_vars define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" ARFLAGS=$($(package)_arflags) RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" $(package)_config_env=AR="$($(package)_ar)" ARFLAGS=$($(package)_arflags) RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
$(package)_config_env_android=ANDROID_NDK_HOME="$(host_prefix)/native" PATH="$(host_prefix)/native/bin" CC=clang AR=ar RANLIB=ranlib
$(package)_build_env_android=ANDROID_NDK_HOME="$(host_prefix)/native"
$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl $(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl
$(package)_config_opts+=no-capieng $(package)_config_opts+=no-capieng
$(package)_config_opts+=no-dso $(package)_config_opts+=no-dso
$(package)_config_opts+=no-dtls1 $(package)_config_opts+=no-dtls1
$(package)_config_opts+=no-ec_nistp_64_gcc_128 $(package)_config_opts+=no-ec_nistp_64_gcc_128
$(package)_config_opts+=no-gost $(package)_config_opts+=no-gost
$(package)_config_opts+=no-gmp
$(package)_config_opts+=no-heartbeats $(package)_config_opts+=no-heartbeats
$(package)_config_opts+=no-jpake
$(package)_config_opts+=no-krb5
$(package)_config_opts+=no-libunbound
$(package)_config_opts+=no-md2 $(package)_config_opts+=no-md2
$(package)_config_opts+=no-rc5 $(package)_config_opts+=no-rc5
$(package)_config_opts+=no-rdrand $(package)_config_opts+=no-rdrand
$(package)_config_opts+=no-rfc3779 $(package)_config_opts+=no-rfc3779
$(package)_config_opts+=no-rsax
$(package)_config_opts+=no-sctp $(package)_config_opts+=no-sctp
$(package)_config_opts+=no-sha0
$(package)_config_opts+=no-shared $(package)_config_opts+=no-shared
$(package)_config_opts+=no-ssl-trace $(package)_config_opts+=no-ssl-trace
$(package)_config_opts+=no-ssl2 $(package)_config_opts+=no-ssl2
$(package)_config_opts+=no-ssl3 $(package)_config_opts+=no-ssl3
$(package)_config_opts+=no-static_engine
$(package)_config_opts+=no-store
$(package)_config_opts+=no-unit-test $(package)_config_opts+=no-unit-test
$(package)_config_opts+=no-weak-ssl-ciphers $(package)_config_opts+=no-weak-ssl-ciphers
$(package)_config_opts+=no-zlib $(package)_config_opts+=no-zlib
@@ -36,8 +42,8 @@ $(package)_config_opts_x86_64_linux=linux-x86_64
$(package)_config_opts_i686_linux=linux-generic32 $(package)_config_opts_i686_linux=linux-generic32
$(package)_config_opts_arm_linux=linux-generic32 $(package)_config_opts_arm_linux=linux-generic32
$(package)_config_opts_aarch64_linux=linux-generic64 $(package)_config_opts_aarch64_linux=linux-generic64
$(package)_config_opts_arm_android=--static android-arm $(package)_config_opts_arm_android=--static android-armv7 no-asm
$(package)_config_opts_aarch64_android=--static android-arm64 $(package)_config_opts_aarch64_android=--static android no-asm
$(package)_config_opts_riscv64_linux=linux-generic64 $(package)_config_opts_riscv64_linux=linux-generic64
$(package)_config_opts_mipsel_linux=linux-generic32 $(package)_config_opts_mipsel_linux=linux-generic32
$(package)_config_opts_mips_linux=linux-generic32 $(package)_config_opts_mips_linux=linux-generic32
@@ -49,8 +55,10 @@ $(package)_config_opts_x86_64_freebsd=BSD-x86_64
endef endef
define $(package)_preprocess_cmds define $(package)_preprocess_cmds
sed -i.old 's|"engines", "apps", "test", "util", "tools", "fuzz"|"engines", "tools"|' Configure && \ sed -i.old "/define DATE/d" util/mkbuildinf.pl && \
patch -p1 < $($(package)_patch_dir)/fix_darwin.patch sed -i.old "s|engines apps test|engines|" Makefile.org && \
sed -i -e "s/-mandroid //" Configure && \
patch < $($(package)_patch_dir)/fix_arflags.patch
endef endef
define $(package)_config_cmds define $(package)_config_cmds
@@ -58,11 +66,11 @@ define $(package)_config_cmds
endef endef
define $(package)_build_cmds define $(package)_build_cmds
$(MAKE) build_libs $(MAKE) -j1 build_libs libcrypto.pc libssl.pc openssl.pc
endef endef
define $(package)_stage_cmds define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install_sw $(MAKE) INSTALL_PREFIX=$($(package)_staging_dir) -j1 install_sw
endef endef
define $(package)_postprocess_cmds define $(package)_postprocess_cmds

View File

@@ -1,9 +1,6 @@
packages:=boost openssl zeromq libiconv packages:=boost openssl zeromq libiconv
# ccache is useless in gitian builds
ifneq ($(GITIAN),1)
native_packages := native_ccache native_packages := native_ccache
endif
hardware_packages := hidapi protobuf libusb hardware_packages := hidapi protobuf libusb
hardware_native_packages := native_protobuf hardware_native_packages := native_protobuf
@@ -11,8 +8,8 @@ hardware_native_packages := native_protobuf
android_native_packages = android_ndk android_native_packages = android_ndk
android_packages = ncurses readline sodium android_packages = ncurses readline sodium
darwin_native_packages = $(hardware_native_packages) darwin_native_packages = native_biplist native_ds_store native_mac_alias $(hardware_native_packages)
darwin_packages = ncurses readline sodium $(hardware_packages) darwin_packages = sodium ncurses readline $(hardware_packages)
# not really native... # not really native...
freebsd_native_packages = freebsd_base freebsd_native_packages = freebsd_base
@@ -34,6 +31,6 @@ mingw32_packages = icu4c sodium $(hardware_packages)
mingw32_native_packages = $(hardware_native_packages) mingw32_native_packages = $(hardware_native_packages)
ifneq ($(build_os),darwin) ifneq ($(build_os),darwin)
darwin_native_packages += native_cctools darwin_native_packages += native_cctools native_cdrkit native_libdmg-hfsplus
endif endif

View File

@@ -1,18 +1,18 @@
PACKAGE=qt PACKAGE=qt
$(package)_version=5.15.1 $(package)_version=5.7.1
$(package)_download_path=https://download.qt.io/official_releases/qt/5.15/$($(package)_version)/submodules $(package)_download_path=http://linorg.usp.br/Qt/archive/qt/5.7/5.7.1/submodules
$(package)_suffix=everywhere-src-$($(package)_version).tar.xz $(package)_suffix=opensource-src-$($(package)_version).tar.gz
$(package)_file_name=qtbase-$($(package)_suffix) $(package)_file_name=qtbase-$($(package)_suffix)
$(package)_sha256_hash=33960404d579675b7210de103ed06a72613bfc4305443e278e2d32a3eb1f3d8c $(package)_sha256_hash=95f83e532d23b3ddbde7973f380ecae1bac13230340557276f75f2e37984e410
$(package)_build_subdir=qtbase $(package)_build_subdir=qtbase
$(package)_qt_libs=corelib $(package)_qt_libs=corelib
$(package)_patches=fix_qt_pkgconfig.patch fix_no_printer.patch fix_rcc_determinism.patch no-xlib.patch $(package)_patches=pidlist_absolute.patch fix_qt_pkgconfig.patch qfixed-coretext.patch
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix) $(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
$(package)_qttranslations_sha256_hash=46e0c0e3a511fbcc803a4146204062e47f6ed43b34d98a3c27372a03b8746bd8 $(package)_qttranslations_sha256_hash=3a15aebd523c6d89fb97b2d3df866c94149653a26d27a00aac9b6d3020bc5a1d
$(package)_qttools_file_name=qttools-$($(package)_suffix) $(package)_qttools_file_name=qttools-$($(package)_suffix)
$(package)_qttools_sha256_hash=c98ee5f0f980bf68cbf0c94d62434816a92441733de50bd9adbe9b9055f03498 $(package)_qttools_sha256_hash=22d67de915cb8cd93e16fdd38fa006224ad9170bd217c2be1e53045a8dd02f0f
$(package)_extra_sources = $($(package)_qttranslations_file_name) $(package)_extra_sources = $($(package)_qttranslations_file_name)
$(package)_extra_sources += $($(package)_qttools_file_name) $(package)_extra_sources += $($(package)_qttools_file_name)
@@ -24,26 +24,28 @@ $(package)_config_opts += -bindir $(build_prefix)/bin
$(package)_config_opts += -c++std c++11 $(package)_config_opts += -c++std c++11
$(package)_config_opts += -confirm-license $(package)_config_opts += -confirm-license
$(package)_config_opts += -dbus-runtime $(package)_config_opts += -dbus-runtime
$(package)_config_opts += -hostprefix $(build_prefix) $(package)_config_opts += -no-alsa
$(package)_config_opts += -no-compile-examples $(package)_config_opts += -no-audio-backend
$(package)_config_opts += -no-cups $(package)_config_opts += -no-cups
$(package)_config_opts += -no-egl $(package)_config_opts += -no-egl
$(package)_config_opts += -no-eglfs $(package)_config_opts += -no-eglfs
$(package)_config_opts += -no-evdev $(package)_config_opts += -no-feature-style-windowsmobile
$(package)_config_opts += -no-gui $(package)_config_opts += -no-feature-style-windowsce
$(package)_config_opts += -no-freetype $(package)_config_opts += -no-freetype
$(package)_config_opts += -no-gif $(package)_config_opts += -no-gif
$(package)_config_opts += -no-glib $(package)_config_opts += -no-glib
$(package)_config_opts += -no-gstreamer
$(package)_config_opts += -no-icu $(package)_config_opts += -no-icu
$(package)_config_opts += -no-ico
$(package)_config_opts += -no-iconv $(package)_config_opts += -no-iconv
$(package)_config_opts += -no-kms $(package)_config_opts += -no-kms
$(package)_config_opts += -no-linuxfb $(package)_config_opts += -no-linuxfb
$(package)_config_opts += -no-libjpeg
$(package)_config_opts += -no-libudev $(package)_config_opts += -no-libudev
$(package)_config_opts += -no-mitshm
$(package)_config_opts += -no-mtdev $(package)_config_opts += -no-mtdev
$(package)_config_opts += -no-pulseaudio
$(package)_config_opts += -no-openvg $(package)_config_opts += -no-openvg
$(package)_config_opts += -no-reduce-relocations $(package)_config_opts += -no-reduce-relocations
$(package)_config_opts += -no-qml-debug
$(package)_config_opts += -no-sql-db2 $(package)_config_opts += -no-sql-db2
$(package)_config_opts += -no-sql-ibase $(package)_config_opts += -no-sql-ibase
$(package)_config_opts += -no-sql-oci $(package)_config_opts += -no-sql-oci
@@ -54,6 +56,8 @@ $(package)_config_opts += -no-sql-psql
$(package)_config_opts += -no-sql-sqlite $(package)_config_opts += -no-sql-sqlite
$(package)_config_opts += -no-sql-sqlite2 $(package)_config_opts += -no-sql-sqlite2
$(package)_config_opts += -no-use-gold-linker $(package)_config_opts += -no-use-gold-linker
$(package)_config_opts += -no-xinput2
$(package)_config_opts += -no-xrender
$(package)_config_opts += -nomake examples $(package)_config_opts += -nomake examples
$(package)_config_opts += -nomake tests $(package)_config_opts += -nomake tests
$(package)_config_opts += -opensource $(package)_config_opts += -opensource
@@ -61,46 +65,25 @@ $(package)_config_opts += -no-openssl
$(package)_config_opts += -optimized-qmake $(package)_config_opts += -optimized-qmake
$(package)_config_opts += -pch $(package)_config_opts += -pch
$(package)_config_opts += -pkg-config $(package)_config_opts += -pkg-config
$(package)_config_opts += -prefix $(host_prefix)
$(package)_config_opts += -no-libpng $(package)_config_opts += -no-libpng
$(package)_config_opts += -no-libjpeg
$(package)_config_opts += -qt-pcre $(package)_config_opts += -qt-pcre
$(package)_config_opts += -qt-harfbuzz
$(package)_config_opts += -no-zlib $(package)_config_opts += -no-zlib
$(package)_config_opts += -reduce-exports
$(package)_config_opts += -static $(package)_config_opts += -static
$(package)_config_opts += -silent $(package)_config_opts += -silent
$(package)_config_opts += -v $(package)_config_opts += -v
$(package)_config_opts += -no-feature-bearermanagement
$(package)_config_opts += -no-feature-colordialog
$(package)_config_opts += -no-feature-dial
$(package)_config_opts += -no-feature-filesystemwatcher
$(package)_config_opts += -no-feature-fontcombobox
$(package)_config_opts += -no-feature-ftp
$(package)_config_opts += -no-feature-image_heuristic_mask
$(package)_config_opts += -no-feature-keysequenceedit
$(package)_config_opts += -no-feature-lcdnumber
$(package)_config_opts += -no-feature-pdf
$(package)_config_opts += -no-feature-printdialog
$(package)_config_opts += -no-feature-printer $(package)_config_opts += -no-feature-printer
$(package)_config_opts += -no-feature-printpreviewdialog $(package)_config_opts += -no-feature-printdialog
$(package)_config_opts += -no-feature-printpreviewwidget $(package)_config_opts += -no-gui
$(package)_config_opts += -no-feature-sessionmanager $(package)_config_opts += -no-freetype
$(package)_config_opts += -no-feature-sql $(package)_config_opts += -no-sm
$(package)_config_opts += -no-feature-statemachine $(package)_config_opts += -no-fontconfig
$(package)_config_opts += -no-feature-syntaxhighlighter $(package)_config_opts += -no-opengl
$(package)_config_opts += -no-feature-textbrowser $(package)_config_opts += -no-xkb
$(package)_config_opts += -no-feature-textodfwriter $(package)_config_opts += -no-xcb
$(package)_config_opts += -no-feature-topleveldomain $(package)_config_opts += -no-xshape
$(package)_config_opts += -no-feature-udpsocket $(package)_build_env = QT_RCC_TEST=1
$(package)_config_opts += -no-feature-undocommand
$(package)_config_opts += -no-feature-undogroup
$(package)_config_opts += -no-feature-undostack
$(package)_config_opts += -no-feature-undoview
$(package)_config_opts += -no-feature-vnc
$(package)_config_opts += -no-feature-wizard
$(package)_config_opts_linux = -no-fontconfig
$(package)_config_opts_linux += -no-opengl
$(package)_config_opts_linux += -no-xcb
$(package)_config_opts_linux += -no-feature-xlib
endef endef
define $(package)_fetch_cmds define $(package)_fetch_cmds
@@ -125,24 +108,14 @@ endef
define $(package)_preprocess_cmds define $(package)_preprocess_cmds
sed -i.old "s|FT_Get_Font_Format|FT_Get_X11_Font_Format|" qtbase/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp && \
sed -i.old "s|updateqm.commands = \$$$$\$$$$LRELEASE|updateqm.commands = $($(package)_extract_dir)/qttools/bin/lrelease|" qttranslations/translations/translations.pro && \ sed -i.old "s|updateqm.commands = \$$$$\$$$$LRELEASE|updateqm.commands = $($(package)_extract_dir)/qttools/bin/lrelease|" qttranslations/translations/translations.pro && \
sed -i.old "/updateqm.depends =/d" qttranslations/translations/translations.pro && \ sed -i.old "/updateqm.depends =/d" qttranslations/translations/translations.pro && \
sed -i.old "s/src_plugins.depends = src_sql src_network/src_plugins.depends = src_network/" qtbase/src/src.pro && \ patch -p1 < $($(package)_patch_dir)/pidlist_absolute.patch && \
cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \ patch -p1 < $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \
sed -i.old "s/arm-linux-gnueabi-/$(host)-/g" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \ patch -p1 < $($(package)_patch_dir)/qfixed-coretext.patch && \
patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \
patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch && \
echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf
patch -p1 -i $($(package)_patch_dir)/no-xlib.patch && \
echo "QMAKE_LINK_OBJECT_MAX = 10" >> qtbase/mkspecs/win32-g++/qmake.conf && \
echo "QMAKE_LINK_OBJECT_SCRIPT = object_script" >> qtbase/mkspecs/win32-g++/qmake.conf && \
sed -i.old "s|QMAKE_CFLAGS += |!host_build: QMAKE_CFLAGS = $($(package)_cflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \
sed -i.old "s|QMAKE_CXXFLAGS += |!host_build: QMAKE_CXXFLAGS = $($(package)_cxxflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \
sed -i.old "0,/^QMAKE_LFLAGS_/s|^QMAKE_LFLAGS_|!host_build: QMAKE_LFLAGS = $($(package)_ldflags)\n&|" qtbase/mkspecs/win32-g++/qmake.conf && \
sed -i.old "s/LIBRARY_PATH/(CROSS_)?\0/g" qtbase/mkspecs/features/toolchain.prf
endef endef
define $(package)_config_cmds define $(package)_config_cmds

View File

@@ -1,8 +1,8 @@
package=unwind package=unwind
$(package)_version=1.5.0 $(package)_version=1.2
$(package)_download_path=https://download.savannah.nongnu.org/releases/libunwind $(package)_download_path=https://download.savannah.nongnu.org/releases/libunwind
$(package)_file_name=lib$(package)-$($(package)_version).tar.gz $(package)_file_name=lib$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=90337653d92d4a13de590781371c604f9031cdb50520366aa1e3a91e1efb1017 $(package)_sha256_hash=1de38ffbdc88bd694d10081865871cd2bfbb02ad8ef9e1606aee18d65532b992
$(package)_patches=fix_obj_order.patch $(package)_patches=fix_obj_order.patch
define $(package)_preprocess_cmds define $(package)_preprocess_cmds
@@ -12,7 +12,7 @@ endef
define $(package)_config_cmds define $(package)_config_cmds
cp -f $(BASEDIR)/config.guess config/config.guess &&\ cp -f $(BASEDIR)/config.guess config/config.guess &&\
cp -f $(BASEDIR)/config.sub config/config.sub &&\ cp -f $(BASEDIR)/config.sub config/config.sub &&\
$($(package)_autoconf) --disable-shared --enable-static --disable-tests --disable-documentation AR_FLAGS=$($(package)_arflags) $($(package)_autoconf) --disable-shared --enable-static AR_FLAGS=$($(package)_arflags)
endef endef
define $(package)_build_cmds define $(package)_build_cmds

View File

@@ -1,9 +1,9 @@
package=zeromq package=zeromq
$(package)_version=4.3.4 $(package)_version=4.1.7
$(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/ $(package)_download_path=https://github.com/zeromq/zeromq4-1/releases/download/v$($(package)_version)/
$(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=c593001a89f5a85dd2ddf564805deb860e02471171b3f204944857336295c3e5 $(package)_sha256_hash=31c383cfcd3be1dc8a66e448c403029e793687e70473b89c4cc0bd626e7da299
$(package)_patches=06aba27b04c5822cb88a69677382a0f053367143.patch $(package)_patches=9114d3957725acd34aa8b8d011585812f3369411.patch 9e6745c12e0b100cd38acecc16ce7db02905e27c.patch ffe62d3398d5e0191f554f61049aa7ec9fc892ae.patch
define $(package)_set_vars define $(package)_set_vars
$(package)_config_opts=--without-documentation --disable-shared --without-libsodium --disable-curve $(package)_config_opts=--without-documentation --disable-shared --without-libsodium --disable-curve
@@ -13,7 +13,10 @@ define $(package)_set_vars
endef endef
define $(package)_preprocess_cmds define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/06aba27b04c5822cb88a69677382a0f053367143.patch patch -p1 < $($(package)_patch_dir)/9114d3957725acd34aa8b8d011585812f3369411.patch && \
patch -p1 < $($(package)_patch_dir)/9e6745c12e0b100cd38acecc16ce7db02905e27c.patch && \
patch -p1 < $($(package)_patch_dir)/ffe62d3398d5e0191f554f61049aa7ec9fc892ae.patch && \
./autogen.sh
endef endef
define $(package)_config_cmds define $(package)_config_cmds
@@ -21,7 +24,7 @@ define $(package)_config_cmds
endef endef
define $(package)_build_cmds define $(package)_build_cmds
$(MAKE) src/libzmq.la $(MAKE) libzmq.la
endef endef
define $(package)_stage_cmds define $(package)_stage_cmds

View File

@@ -1,21 +0,0 @@
From a77b066311da42ed7654e39c0356a3b951b2e296 Mon Sep 17 00:00:00 2001
From: selsta <selsta@sent.at>
Date: Wed, 10 Nov 2021 02:28:54 +0100
Subject: [PATCH] windows: add missing include for mingw32
---
windows/hid.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/windows/hid.c b/windows/hid.c
index 24756a4..6d8394c 100644
--- a/windows/hid.c
+++ b/windows/hid.c
@@ -33,6 +33,7 @@ typedef LONG NTSTATUS;
#endif
#ifdef __MINGW32__
+#include <devpropdef.h>
#include <ntdef.h>
#include <winbase.h>
#endif

View File

@@ -0,0 +1,24 @@
--- Makefile.org.O 2019-02-26 14:20:20.000000000 +0000
+++ Makefile.org 2019-11-15 13:05:54.370086856 +0000
@@ -63,8 +63,8 @@
PEX_LIBS=
EX_LIBS=
EXE_EXT=
-ARFLAGS=
-AR=ar $(ARFLAGS) r
+ARFLAGS= r
+AR=ar $(ARFLAGS)
RANLIB= ranlib
RC= windres
NM= nm
--- Configure.O 2019-02-26 14:20:20.000000000 +0000
+++ Configure 2019-11-16 07:43:14.933990774 +0000
@@ -1251,7 +1251,7 @@
my $shared_extension = $fields[$idx_shared_extension];
my $ranlib = $ENV{'RANLIB'} || $fields[$idx_ranlib];
my $ar = $ENV{'AR'} || "ar";
-my $arflags = $fields[$idx_arflags];
+my $arflags = $ENV{'ARFLAGS'} || $fields[$idx_arflags];
my $windres = $ENV{'RC'} || $ENV{'WINDRES'} || "windres";
my $multilib = $fields[$idx_multilib];

View File

@@ -1,60 +0,0 @@
From 96ac8f13f4d0ee96baf5724d9f96c44c34b8606c Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Tue, 24 Aug 2021 22:40:14 +0100
Subject: [PATCH] Darwin platform allows to build on releases before
Yosemite/ios 8.
issue #16407 #16408
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16409)
---
crypto/rand/rand_unix.c | 5 +----
include/crypto/rand.h | 10 ++++++++++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index 43f1069d151d..0f4525106af7 100644
--- a/crypto/rand/rand_unix.c
+++ b/crypto/rand/rand_unix.c
@@ -34,9 +34,6 @@
#if defined(__OpenBSD__)
# include <sys/param.h>
#endif
-#if defined(__APPLE__)
-# include <CommonCrypto/CommonRandom.h>
-#endif
#if defined(OPENSSL_SYS_UNIX) || defined(__DJGPP__)
# include <sys/types.h>
@@ -381,7 +378,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
if (errno != ENOSYS)
return -1;
}
-# elif defined(__APPLE__)
+# elif defined(OPENSSL_APPLE_CRYPTO_RANDOM)
if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
return (ssize_t)buflen;
diff --git a/include/crypto/rand.h b/include/crypto/rand.h
index 5350d3a93119..674f840fd13c 100644
--- a/include/crypto/rand.h
+++ b/include/crypto/rand.h
@@ -20,6 +20,16 @@
# include <openssl/rand.h>
+# if defined(__APPLE__) && !defined(OPENSSL_NO_APPLE_CRYPTO_RANDOM)
+# include <Availability.h>
+# if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000) || \
+ (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000)
+# define OPENSSL_APPLE_CRYPTO_RANDOM 1
+# include <CommonCrypto/CommonCryptoError.h>
+# include <CommonCrypto/CommonRandom.h>
+# endif
+# endif
+
/* forward declaration */
typedef struct rand_pool_st RAND_POOL;

View File

@@ -1,19 +0,0 @@
--- x/qtbase/src/plugins/platforms/cocoa/qprintengine_mac_p.h
+++ y/qtbase/src/plugins/platforms/cocoa/qprintengine_mac_p.h
@@ -52,6 +52,7 @@
//
#include <QtCore/qglobal.h>
+#include <qpa/qplatformprintdevice.h>
#ifndef QT_NO_PRINTER
--- x/qtbase/src/plugins/plugins.pro
+++ y/qtbase/src/plugins/plugins.pro
@@ -9,6 +9,3 @@ qtHaveModule(gui) {
!android:qtConfig(library): SUBDIRS *= generic
}
qtHaveModule(widgets): SUBDIRS += styles
-
-!winrt:qtHaveModule(printsupport): \
- SUBDIRS += printsupport

View File

@@ -1,11 +1,11 @@
--- old/qtbase/mkspecs/features/qt_module.prf --- old/qtbase/mkspecs/features/qt_module.prf
+++ new/qtbase/mkspecs/features/qt_module.prf +++ new/qtbase/mkspecs/features/qt_module.prf
@@ -269,7 +269,7 @@ load(qt_installs) @@ -245,7 +245,7 @@
load(qt_targets) load(qt_targets)
# this builds on top of qt_common # this builds on top of qt_common
-!internal_module:if(unix|mingw):!if(darwin:debug_and_release:CONFIG(debug, debug|release)) { -!internal_module:!lib_bundle:if(unix|mingw) {
+if(unix|mingw):!if(darwin:debug_and_release:CONFIG(debug, debug|release)) { +unix|mingw {
CONFIG += create_pc CONFIG += create_pc
QMAKE_PKGCONFIG_DESTDIR = pkgconfig QMAKE_PKGCONFIG_DESTDIR = pkgconfig
host_build: \ host_build: \

View File

@@ -1,15 +0,0 @@
--- old/qtbase/src/tools/rcc/rcc.cpp
+++ new/qtbase/src/tools/rcc/rcc.cpp
@@ -207,7 +207,11 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
if (lib.formatVersion() >= 2) {
// last modified time stamp
const QDateTime lastModified = m_fileInfo.lastModified();
- lib.writeNumber8(quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0));
+ quint64 lastmod = quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0);
+ static const quint64 sourceDate = 1000 * qgetenv("QT_RCC_SOURCE_DATE_OVERRIDE").toULongLong();
+ if (sourceDate != 0)
+ lastmod = sourceDate;
+ lib.writeNumber8(lastmod);
if (text || pass1)
lib.writeChar('\n');
}

View File

@@ -1,69 +0,0 @@
From 9563cef873ae82e06f60708d706d054717e801ce Mon Sep 17 00:00:00 2001
From: Carl Dong <contact@carldong.me>
Date: Thu, 18 Jul 2019 17:22:05 -0400
Subject: [PATCH] Wrap xlib related code blocks in #if's
They are not necessary to compile QT.
---
qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
index 7c62c2e2b3..c05c6c0a07 100644
--- a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -49,7 +49,9 @@
#include <QtGui/QWindow>
#include <QtGui/QBitmap>
#include <QtGui/private/qguiapplication_p.h>
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
#include <X11/cursorfont.h>
+#endif
#include <xcb/xfixes.h>
#include <xcb/xcb_image.h>
@@ -391,6 +393,7 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *window)
xcb_flush(xcb_connection());
}
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
static int cursorIdForShape(int cshape)
{
int cursorId = 0;
@@ -444,6 +447,7 @@ static int cursorIdForShape(int cshape)
}
return cursorId;
}
+#endif
xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape)
{
@@ -556,7 +560,9 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape)
xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
{
xcb_connection_t *conn = xcb_connection();
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
int cursorId = cursorIdForShape(cshape);
+#endif
xcb_cursor_t cursor = XCB_NONE;
// Try Xcursor first
@@ -586,6 +592,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
// Non-standard X11 cursors are created from bitmaps
cursor = createNonStandardCursor(cshape);
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
// Create a glpyh cursor if everything else failed
if (!cursor && cursorId) {
cursor = xcb_generate_id(conn);
@@ -593,6 +600,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
cursorId, cursorId + 1,
0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0);
}
+#endif
if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) {
const char *name = cursorNames[cshape].front();
---
2.22.0

View File

@@ -0,0 +1,37 @@
diff -dur old/qtbase/src/plugins/platforms/windows/qwindowscontext.h new/qtbase/src/plugins/platforms/windows/qwindowscontext.h
--- old/qtbase/src/plugins/platforms/windows/qwindowscontext.h
+++ new/qtbase/src/plugins/platforms/windows/qwindowscontext.h
@@ -136,10 +136,18 @@
inline void init();
typedef HRESULT (WINAPI *SHCreateItemFromParsingName)(PCWSTR, IBindCtx *, const GUID&, void **);
+#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3)
+ typedef HRESULT (WINAPI *SHGetKnownFolderIDList)(const GUID &, DWORD, HANDLE, ITEMIDLIST **);
+#else
typedef HRESULT (WINAPI *SHGetKnownFolderIDList)(const GUID &, DWORD, HANDLE, PIDLIST_ABSOLUTE *);
+#endif
typedef HRESULT (WINAPI *SHGetStockIconInfo)(int , int , _SHSTOCKICONINFO *);
typedef HRESULT (WINAPI *SHGetImageList)(int, REFIID , void **);
+#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3)
+ typedef HRESULT (WINAPI *SHCreateItemFromIDList)(const ITEMIDLIST *, REFIID, void **);
+#else
typedef HRESULT (WINAPI *SHCreateItemFromIDList)(PCIDLIST_ABSOLUTE, REFIID, void **);
+#endif
SHCreateItemFromParsingName sHCreateItemFromParsingName;
SHGetKnownFolderIDList sHGetKnownFolderIDList;
diff -dur old/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp new/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
--- old/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ new/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -1016,7 +1016,11 @@
qWarning() << __FUNCTION__ << ": Invalid CLSID: " << url.path();
return Q_NULLPTR;
}
+#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3)
+ ITEMIDLIST *idList;
+#else
PIDLIST_ABSOLUTE idList;
+#endif
HRESULT hr = QWindowsContext::shell32dll.sHGetKnownFolderIDList(uuid, 0, 0, &idList);
if (FAILED(hr)) {
qErrnoWarning("%s: SHGetKnownFolderIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString()));

View File

@@ -0,0 +1,34 @@
From dbdd5f0ffbce52c8b789ed09f1aa3f1da6c02e23 Mon Sep 17 00:00:00 2001
From: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Date: Fri, 30 Mar 2018 11:58:16 -0700
Subject: [PATCH] QCoreTextFontEngine: Fix build with Xcode 9.3
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Error message:
.../qfontengine_coretext.mm:827:20: error: qualified reference to
'QFixed' is a constructor name rather than a type in this context
return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
Change-Id: Iebe26b3b087a16b10664208fc8851cbddb47f043
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
---
src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git old/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm new/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 25ff69d877d..98b753eff96 100644
--- old/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ new/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -824,7 +824,7 @@ void QCoreTextFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, gl
QFixed QCoreTextFontEngine::emSquareSize() const
{
- return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
+ return QFixed(int(CTFontGetUnitsPerEm(ctfont)));
}
QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const
--
2.16.3

View File

@@ -1,9 +1,9 @@
--- config/ltmain.sh.0 2020-11-10 17:25:26.000000000 +0100 --- config/ltmain.sh.O 2017-01-13 16:00:54.000000000 +0000
+++ config/ltmain.sh 2021-09-11 19:39:36.000000000 +0200 +++ config/ltmain.sh 2019-11-17 06:46:51.994402494 +0000
@@ -10768,6 +10768,8 @@ @@ -7957,6 +7957,8 @@
esac
done
fi fi
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
tool_oldlib=$func_to_tool_file_result
+ oldobjs=`for obj in $oldobjs; do echo $obj; done | sort` + oldobjs=`for obj in $oldobjs; do echo $obj; done | sort`
+ oldobjs=" `echo $oldobjs`" + oldobjs=" `echo $oldobjs`"
eval cmds=\"$old_archive_cmds\" eval cmds=\"$old_archive_cmds\"

View File

@@ -1,22 +0,0 @@
From 06aba27b04c5822cb88a69677382a0f053367143 Mon Sep 17 00:00:00 2001
From: sabotagebeats <27985126+sabotagebeats@users.noreply.github.com>
Date: Thu, 22 Jul 2021 21:53:19 -0700
Subject: [PATCH] fix: building libzmq fails with error src/clock.cpp:131:16:
error: unused variable 'nsecs_per_usec'
---
src/clock.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/clock.cpp b/src/clock.cpp
index 93da90a8e..63c0100a5 100644
--- a/src/clock.cpp
+++ b/src/clock.cpp
@@ -195,6 +195,7 @@ uint64_t zmq::clock_t::now_us ()
#else
+ LIBZMQ_UNUSED (nsecs_per_usec);
// Use POSIX gettimeofday function to get precise time.
struct timeval tv;
int rc = gettimeofday (&tv, NULL);

View File

@@ -0,0 +1,22 @@
From 9114d3957725acd34aa8b8d011585812f3369411 Mon Sep 17 00:00:00 2001
From: Jeroen Ooms <jeroenooms@gmail.com>
Date: Tue, 20 Oct 2015 13:10:38 +0200
Subject: [PATCH] enable static libraries on mingw
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 393505b..e92131a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -265,7 +265,7 @@ case "${host_os}" in
libzmq_dso_visibility="no"
if test "x$enable_static" = "xyes"; then
- AC_MSG_ERROR([Building static libraries is not supported under MinGW32])
+ CPPFLAGS="-DZMQ_STATIC"
fi
# Set FD_SETSIZE to 1024

View File

@@ -0,0 +1,22 @@
From 9e6745c12e0b100cd38acecc16ce7db02905e27c Mon Sep 17 00:00:00 2001
From: David Millard <dmillard10@gmail.com>
Date: Tue, 10 May 2016 13:53:53 -0700
Subject: [PATCH] Fix autotools for static MinGW builds
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 5a0fa14..def6ea7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -259,7 +259,7 @@ case "${host_os}" in
libzmq_dso_visibility="no"
if test "x$enable_static" = "xyes"; then
- CPPFLAGS="-DZMQ_STATIC"
+ CPPFLAGS="-DZMQ_STATIC $CPPFLAGS"
fi
# Set FD_SETSIZE to 1024

View File

@@ -0,0 +1,38 @@
From ffe62d3398d5e0191f554f61049aa7ec9fc892ae Mon Sep 17 00:00:00 2001
From: Gregory Lemercier <greglemercier@free.fr>
Date: Sun, 7 Oct 2018 18:06:54 +0200
Subject: [PATCH] Fix build on arm64 architectures with some strict compilers
This patch fixes an issue that occurs on 64-bit architetures under
strict compiler rules. The code initially checked that the received
size stored in 'uint64_t' was not bigger than the max value of a
'size_t' variable, which is legitimate on 32-bit architectures where
'size_t' variables are stored on 32 bits. On 64-bit architectures,
this test no longer makes sense since 'uint64_t' and 'size_t' types
have the same size. The issue is fixed by ignoring this portion
of code when built for arm64.
---
src/v1_decoder.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/v1_decoder.cpp b/src/v1_decoder.cpp
index b002dc9d..2c8c97a7 100644
--- a/src/v1_decoder.cpp
+++ b/src/v1_decoder.cpp
@@ -114,11 +114,13 @@ int zmq::v1_decoder_t::eight_byte_size_ready ()
return -1;
}
+#ifndef __aarch64__
// Message size must fit within range of size_t data type.
if (payload_length - 1 > std::numeric_limits <size_t>::max ()) {
errno = EMSGSIZE;
return -1;
}
+#endif
const size_t msg_size = static_cast <size_t> (payload_length - 1);
--
2.20.1

View File

@@ -1,6 +1,5 @@
# Set the system name to one of Android, Darwin, FreeBSD, Linux, or Windows # Set the system name to one of Android, Darwin, FreeBSD, Linux, or Windows
SET(CMAKE_SYSTEM_NAME @depends@) SET(CMAKE_SYSTEM_NAME @depends@)
SET(CMAKE_SYSTEM_PROCESSOR @arch@)
SET(CMAKE_BUILD_TYPE @release_type@) SET(CMAKE_BUILD_TYPE @release_type@)
OPTION(STATIC "Link libraries statically" ON) OPTION(STATIC "Link libraries statically" ON)
@@ -56,7 +55,7 @@ SET(Boost_NO_SYSTEM_PATHS ON)
SET(Boost_USE_STATIC_LIBS ON) SET(Boost_USE_STATIC_LIBS ON)
SET(Boost_USE_STATIC_RUNTIME ON) SET(Boost_USE_STATIC_RUNTIME ON)
SET(OPENSSL_ROOT_DIR @prefix@) SET(OpenSSL_DIR @prefix@/lib)
SET(ARCHITECTURE @arch@) SET(ARCHITECTURE @arch@)
# for libraries and headers in the target directories # for libraries and headers in the target directories
@@ -64,14 +63,14 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR} CACHE STRING "" FORCE)
# specify the cross compiler to be used. Darwin uses clang provided by the SDK. # specify the cross compiler to be used. Darwin uses clang provided by the SDK.
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(CMAKE_C_COMPILER @prefix@/native/bin/clang) SET(CMAKE_C_COMPILER @prefix@/native/bin/clang)
SET(CMAKE_C_COMPILER_TARGET x86_64-apple-darwin11) SET(CMAKE_C_COMPILER_TARGET x86_64-apple-darwin11)
SET(CMAKE_CXX_COMPILER @prefix@/native/bin/clang++ -stdlib=libc++) SET(CMAKE_CXX_COMPILER @prefix@/native/bin/clang++ -stdlib=libc++)
SET(CMAKE_CXX_COMPILER_TARGET x86_64-apple-darwin11) SET(CMAKE_CXX_COMPILER_TARGET x86_64-apple-darwin11)
SET(CMAKE_ASM_COMPILER_TARGET x86_64-apple-darwin11)
SET(CMAKE_ASM-ATT_COMPILER_TARGET x86_64-apple-darwin11)
SET(_CMAKE_TOOLCHAIN_PREFIX x86_64-apple-darwin11-) SET(_CMAKE_TOOLCHAIN_PREFIX x86_64-apple-darwin11-)
SET(APPLE True) SET(APPLE True)
SET(BUILD_TAG "mac-x64") SET(BUILD_TAG "mac-x64")
@@ -80,7 +79,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(PORT OFF) SET(PORT OFF)
SET(CMAKE_OSX_SYSROOT "@sdk@/MacOSX10.11.sdk/") SET(CMAKE_OSX_SYSROOT "@sdk@/MacOSX10.11.sdk/")
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.08") SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.08")
SET(CMAKE_CXX_STANDARD 14) SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_OSX_ARCHITECTURES "x86_64") SET(CMAKE_OSX_ARCHITECTURES "x86_64")
SET(LLVM_ENABLE_PIC OFF) SET(LLVM_ENABLE_PIC OFF)
SET(LLVM_ENABLE_PIE OFF) SET(LLVM_ENABLE_PIE OFF)

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020, The Monero Project # Copyright (c) 2014-2019, The Monero Project
# #
# All rights reserved. # All rights reserved.
# #

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 2.8)
set(Boost_USE_MULTITHREADED ON) set(Boost_USE_MULTITHREADED ON)
#set(Boost_DEBUG 1) #set(Boost_DEBUG 1)
find_package(Boost COMPONENTS system filesystem thread date_time chrono regex ) find_package(Boost COMPONENTS system filesystem thread date_time chrono regex )

View File

@@ -117,9 +117,6 @@ namespace epee
check(more); check(more);
} }
//! Reset write position, but do not release internal memory. \post `size() == 0`.
void clear() noexcept { next_write_ = buffer_.get(); }
/*! Copy `length` bytes starting at `ptr` to end of stream. /*! Copy `length` bytes starting at `ptr` to end of stream.
\throw std::range_error If exceeding max size_t value. \throw std::range_error If exceeding max size_t value.
\throw std::bad_alloc If allocation fails. */ \throw std::bad_alloc If allocation fails. */
@@ -188,7 +185,7 @@ namespace epee
void put_n(const std::uint8_t ch, const std::size_t count) void put_n(const std::uint8_t ch, const std::size_t count)
{ {
check(count); check(count);
std::memset(tellp(), ch, count); std::memset(tellp(), count, ch);
next_write_ += count; next_write_ += count;
} }

View File

@@ -465,7 +465,7 @@ eof:
bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "") bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
{ {
async_console_handler console_handler; async_console_handler console_handler;
return console_handler.run(ptsrv, std::bind<bool>(no_srv_param_adapter<t_server, t_handler>, std::placeholders::_1, std::placeholders::_2, handlr), prompt, usage); return console_handler.run(ptsrv, boost::bind<bool>(no_srv_param_adapter<t_server, t_handler>, boost::placeholders::_1, boost::placeholders::_2, handlr), prompt, usage);
} }
template<class t_server, class t_handler> template<class t_server, class t_handler>
@@ -543,31 +543,6 @@ eof:
return it->second.second; return it->second.second;
} }
std::vector<std::string> get_command_list(const std::vector<std::string>& keywords = std::vector<std::string>())
{
std::vector<std::string> list;
list.reserve(m_command_handlers.size());
for(auto const& x:m_command_handlers)
{
bool take = true;
for(auto const& y:keywords)
{
bool in_usage = x.second.second.first.find(y) != std::string::npos;
bool in_description = x.second.second.second.find(y) != std::string::npos;
if (!(in_usage || in_description))
{
take = false;
break;
}
}
if (take)
{
list.push_back(x.first);
}
}
return list;
}
void set_handler(const std::string& cmd, const callback& hndlr, const std::string& usage = "", const std::string& description = "") void set_handler(const std::string& cmd, const callback& hndlr, const std::string& usage = "", const std::string& description = "")
{ {
lookup::mapped_type & vt = m_command_handlers[cmd]; lookup::mapped_type & vt = m_command_handlers[cmd];
@@ -659,7 +634,7 @@ eof:
bool run_handling(std::function<std::string(void)> prompt, const std::string& usage_string, std::function<void(void)> exit_handler = NULL) bool run_handling(std::function<std::string(void)> prompt, const std::string& usage_string, std::function<void(void)> exit_handler = NULL)
{ {
return m_console_handler.run(std::bind(&console_handlers_binder::process_command_str, this, std::placeholders::_1), prompt, usage_string, exit_handler); return m_console_handler.run(boost::bind(&console_handlers_binder::process_command_str, this, boost::placeholders::_1), prompt, usage_string, exit_handler);
} }
void print_prompt() void print_prompt()

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2017-2020, The Monero Project // Copyright (c) 2017-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -106,14 +106,6 @@ namespace misc_utils
return true; return true;
} }
template <typename T>
T get_mid(const T &a, const T &b)
{
//returns the average of two numbers; overflow safe and works with at least all integral and floating point types
//(a+b)/2 = (a/2) + (b/2) + ((a - 2*(a/2)) + (b - 2*(b/2)))/2
return (a/2) + (b/2) + ((a - 2*(a/2)) + (b - 2*(b/2)))/2;
}
template<class type_vec_type> template<class type_vec_type>
type_vec_type median(std::vector<type_vec_type> &v) type_vec_type median(std::vector<type_vec_type> &v)
{ {
@@ -130,7 +122,7 @@ namespace misc_utils
return v[n]; return v[n];
}else }else
{//2, 4, 6... {//2, 4, 6...
return get_mid<type_vec_type>(v[n-1],v[n]); return (v[n-1] + v[n])/2;
} }
} }

View File

@@ -64,7 +64,6 @@ namespace http
abstract_http_client() {} abstract_http_client() {}
virtual ~abstract_http_client() {} virtual ~abstract_http_client() {}
bool set_server(const std::string& address, boost::optional<login> user, ssl_options_t ssl_options = ssl_support_t::e_ssl_support_autodetect); bool set_server(const std::string& address, boost::optional<login> user, ssl_options_t ssl_options = ssl_support_t::e_ssl_support_autodetect);
virtual bool set_proxy(const std::string& address);
virtual void set_server(std::string host, std::string port, boost::optional<login> user, ssl_options_t ssl_options = ssl_support_t::e_ssl_support_autodetect) = 0; virtual void set_server(std::string host, std::string port, boost::optional<login> user, ssl_options_t ssl_options = ssl_support_t::e_ssl_support_autodetect) = 0;
virtual void set_auto_connect(bool auto_connect) = 0; virtual void set_auto_connect(bool auto_connect) = 0;
virtual bool connect(std::chrono::milliseconds timeout) = 0; virtual bool connect(std::chrono::milliseconds timeout) = 0;

View File

@@ -48,9 +48,12 @@
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/asio/ssl.hpp> #include <boost/asio/ssl.hpp>
#include <boost/array.hpp> #include <boost/array.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp> //! \TODO Convert to std::shared_ptr
#include <boost/enable_shared_from_this.hpp> #include <boost/enable_shared_from_this.hpp>
#include <boost/interprocess/detail/atomic.hpp> #include <boost/interprocess/detail/atomic.hpp>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <memory>
#include "byte_slice.h" #include "byte_slice.h"
#include "net_utils_base.h" #include "net_utils_base.h"
#include "syncobj.h" #include "syncobj.h"

View File

@@ -32,6 +32,7 @@
#include <boost/bind.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/uuid/random_generator.hpp> #include <boost/uuid/random_generator.hpp>
#include <boost/chrono.hpp> #include <boost/chrono.hpp>
@@ -207,16 +208,17 @@ PRAGMA_WARNING_DISABLE_VS(4355)
buffer_ssl_init_fill = 0; buffer_ssl_init_fill = 0;
if (is_income && m_ssl_support != epee::net_utils::ssl_support_t::e_ssl_support_disabled) if (is_income && m_ssl_support != epee::net_utils::ssl_support_t::e_ssl_support_disabled)
socket().async_receive(boost::asio::buffer(buffer_), socket().async_receive(boost::asio::buffer(buffer_),
boost::asio::socket_base::message_peek,
strand_.wrap( strand_.wrap(
std::bind(&connection<t_protocol_handler>::handle_receive, self, boost::bind(&connection<t_protocol_handler>::handle_receive, self,
std::placeholders::_1, boost::asio::placeholders::error,
std::placeholders::_2))); boost::asio::placeholders::bytes_transferred)));
else else
async_read_some(boost::asio::buffer(buffer_), async_read_some(boost::asio::buffer(buffer_),
strand_.wrap( strand_.wrap(
std::bind(&connection<t_protocol_handler>::handle_read, self, boost::bind(&connection<t_protocol_handler>::handle_read, self,
std::placeholders::_1, boost::asio::placeholders::error,
std::placeholders::_2))); boost::asio::placeholders::bytes_transferred)));
#if !defined(_WIN32) || !defined(__i686) #if !defined(_WIN32) || !defined(__i686)
// not supported before Windows7, too lazy for runtime check // not supported before Windows7, too lazy for runtime check
// Just exclude for 32bit windows builds // Just exclude for 32bit windows builds
@@ -269,6 +271,8 @@ PRAGMA_WARNING_DISABLE_VS(4355)
//_dbg3("[sock " << socket().native_handle() << "] add_ref, m_peer_number=" << mI->m_peer_number); //_dbg3("[sock " << socket().native_handle() << "] add_ref, m_peer_number=" << mI->m_peer_number);
CRITICAL_REGION_LOCAL(self->m_self_refs_lock); CRITICAL_REGION_LOCAL(self->m_self_refs_lock);
//_dbg3("[sock " << socket().native_handle() << "] add_ref 2, m_peer_number=" << mI->m_peer_number); //_dbg3("[sock " << socket().native_handle() << "] add_ref 2, m_peer_number=" << mI->m_peer_number);
if(m_was_shutdown)
return false;
++m_reference_count; ++m_reference_count;
m_self_ref = std::move(self); m_self_ref = std::move(self);
return true; return true;
@@ -331,9 +335,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
TRY_ENTRY(); TRY_ENTRY();
//_info("[sock " << socket().native_handle() << "] Async read calledback."); //_info("[sock " << socket().native_handle() << "] Async read calledback.");
if (m_was_shutdown)
return;
if (!e) if (!e)
{ {
double current_speed_down; double current_speed_down;
@@ -360,9 +361,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
CRITICAL_REGION_LOCAL( epee::net_utils::network_throttle_manager::m_lock_get_global_throttle_in ); CRITICAL_REGION_LOCAL( epee::net_utils::network_throttle_manager::m_lock_get_global_throttle_in );
delay = epee::net_utils::network_throttle_manager::get_global_throttle_in().get_sleep_time_after_tick( bytes_transferred ); delay = epee::net_utils::network_throttle_manager::get_global_throttle_in().get_sleep_time_after_tick( bytes_transferred );
} }
if (m_was_shutdown)
return;
delay *= 0.5; delay *= 0.5;
long int ms = (long int)(delay * 100); long int ms = (long int)(delay * 100);
@@ -434,9 +432,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
std::size_t bytes_transferred) std::size_t bytes_transferred)
{ {
TRY_ENTRY(); TRY_ENTRY();
if (m_was_shutdown) return;
if (e) if (e)
{ {
// offload the error case // offload the error case
@@ -444,11 +439,13 @@ PRAGMA_WARNING_DISABLE_VS(4355)
return; return;
} }
reset_timer(get_timeout_from_bytes_read(bytes_transferred), false);
buffer_ssl_init_fill += bytes_transferred; buffer_ssl_init_fill += bytes_transferred;
MTRACE("we now have " << buffer_ssl_init_fill << "/" << get_ssl_magic_size() << " bytes needed to detect SSL"); if (buffer_ssl_init_fill <= get_ssl_magic_size())
if (buffer_ssl_init_fill < get_ssl_magic_size())
{ {
socket().async_receive(boost::asio::buffer(buffer_.data() + buffer_ssl_init_fill, buffer_.size() - buffer_ssl_init_fill), socket().async_receive(boost::asio::buffer(buffer_.data() + buffer_ssl_init_fill, buffer_.size() - buffer_ssl_init_fill),
boost::asio::socket_base::message_peek,
strand_.wrap( strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_receive, connection<t_protocol_handler>::shared_from_this(), boost::bind(&connection<t_protocol_handler>::handle_receive, connection<t_protocol_handler>::shared_from_this(),
boost::asio::placeholders::error, boost::asio::placeholders::error,
@@ -474,7 +471,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
if (m_ssl_support == epee::net_utils::ssl_support_t::e_ssl_support_enabled) if (m_ssl_support == epee::net_utils::ssl_support_t::e_ssl_support_enabled)
{ {
// Handshake // Handshake
if (!handshake(boost::asio::ssl::stream_base::server, boost::asio::const_buffer(buffer_.data(), buffer_ssl_init_fill))) if (!handshake(boost::asio::ssl::stream_base::server))
{ {
MERROR("SSL handshake failed"); MERROR("SSL handshake failed");
boost::interprocess::ipcdetail::atomic_write32(&m_want_close_connection, 1); boost::interprocess::ipcdetail::atomic_write32(&m_want_close_connection, 1);
@@ -489,11 +486,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
return; return;
} }
} }
else
{
handle_read(e, buffer_ssl_init_fill);
return;
}
async_read_some(boost::asio::buffer(buffer_), async_read_some(boost::asio::buffer(buffer_),
strand_.wrap( strand_.wrap(
@@ -560,7 +552,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
{ // LOCK: chunking { // LOCK: chunking
epee::critical_region_t<decltype(m_chunking_lock)> send_guard(m_chunking_lock); // *** critical *** epee::critical_region_t<decltype(m_chunking_lock)> send_guard(m_chunking_lock); // *** critical ***
MDEBUG("do_send() will SPLIT into small chunks, from packet="<<message_size<<" B for ptr="<<(const void*)message_data); MDEBUG("do_send() will SPLIT into small chunks, from packet="<<message_size<<" B for ptr="<<message_data);
// 01234567890 // 01234567890
// ^^^^ (pos=0, len=4) ; pos:=pos+len, pos=4 // ^^^^ (pos=0, len=4) ; pos:=pos+len, pos=4
// ^^^^ (pos=4, len=4) ; pos:=pos+len, pos=8 // ^^^^ (pos=4, len=4) ; pos:=pos+len, pos=8
@@ -573,14 +565,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
while (!message.empty()) { while (!message.empty()) {
byte_slice chunk = message.take_slice(chunksize_good); byte_slice chunk = message.take_slice(chunksize_good);
MDEBUG("chunk_start="<<(void*)chunk.data()<<" ptr="<<(const void*)message_data<<" pos="<<(chunk.data() - message_data)); MDEBUG("chunk_start="<<(void*)chunk.data()<<" ptr="<<message_data<<" pos="<<(chunk.data() - message_data));
MDEBUG("part of " << message.size() << ": pos="<<(chunk.data() - message_data) << " len="<<chunk.size()); MDEBUG("part of " << message.size() << ": pos="<<(chunk.data() - message_data) << " len="<<chunk.size());
bool ok = do_send_chunk(std::move(chunk)); // <====== *** bool ok = do_send_chunk(std::move(chunk)); // <====== ***
all_ok = all_ok && ok; all_ok = all_ok && ok;
if (!all_ok) { if (!all_ok) {
MDEBUG("do_send() DONE ***FAILED*** from packet="<<message_size<<" B for ptr="<<(const void*)message_data); MDEBUG("do_send() DONE ***FAILED*** from packet="<<message_size<<" B for ptr="<<message_data);
MDEBUG("do_send() SEND was aborted in middle of big package - this is mostly harmless " MDEBUG("do_send() SEND was aborted in middle of big package - this is mostly harmless "
<< " (e.g. peer closed connection) but if it causes trouble tell us at #monero-dev. " << message_size); << " (e.g. peer closed connection) but if it causes trouble tell us at #monero-dev. " << message_size);
return false; // partial failure in sending return false; // partial failure in sending
@@ -588,7 +580,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
// (in catch block, or uniq pointer) delete buf; // (in catch block, or uniq pointer) delete buf;
} // each chunk } // each chunk
MDEBUG("do_send() DONE SPLIT from packet="<<message_size<<" B for ptr="<<(const void*)message_data); MDEBUG("do_send() DONE SPLIT from packet="<<message_size<<" B for ptr="<<message_data);
MDEBUG("do_send() m_connection_type = " << m_connection_type); MDEBUG("do_send() m_connection_type = " << m_connection_type);
@@ -660,8 +652,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) ); boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) );
m_send_que_lock.lock(); m_send_que_lock.lock();
_dbg1("sleep for queue: " << ms); _dbg1("sleep for queue: " << ms);
if (m_was_shutdown)
return false;
if (retry > retry_limit) { if (retry > retry_limit) {
MWARNING("send que size is more than ABSTRACT_SERVER_SEND_QUE_MAX_COUNT(" << ABSTRACT_SERVER_SEND_QUE_MAX_COUNT << "), shutting down connection"); MWARNING("send que size is more than ABSTRACT_SERVER_SEND_QUE_MAX_COUNT(" << ABSTRACT_SERVER_SEND_QUE_MAX_COUNT << "), shutting down connection");
@@ -698,7 +688,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
reset_timer(get_default_timeout(), false); reset_timer(get_default_timeout(), false);
async_write(boost::asio::buffer(m_send_que.front().data(), size_now ) , async_write(boost::asio::buffer(m_send_que.front().data(), size_now ) ,
strand_.wrap( strand_.wrap(
std::bind(&connection<t_protocol_handler>::handle_write, self, std::placeholders::_1, std::placeholders::_2) boost::bind(&connection<t_protocol_handler>::handle_write, self, _1, _2)
) )
); );
//_dbg3("(chunk): " << size_now); //_dbg3("(chunk): " << size_now);
@@ -759,8 +749,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
template<class t_protocol_handler> template<class t_protocol_handler>
void connection<t_protocol_handler>::reset_timer(boost::posix_time::milliseconds ms, bool add) void connection<t_protocol_handler>::reset_timer(boost::posix_time::milliseconds ms, bool add)
{ {
const auto tms = ms.total_milliseconds(); if (ms.total_milliseconds() < 0)
if (tms < 0 || (add && tms == 0))
{ {
MWARNING("Ignoring negative timeout " << ms); MWARNING("Ignoring negative timeout " << ms);
return; return;
@@ -903,7 +892,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), void(), "Unexpected queue size"); CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), void(), "Unexpected queue size");
async_write(boost::asio::buffer(m_send_que.front().data(), size_now) , async_write(boost::asio::buffer(m_send_que.front().data(), size_now) ,
strand_.wrap( strand_.wrap(
std::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), std::placeholders::_1, std::placeholders::_2) boost::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), _1, _2)
) )
); );
//_dbg3("(normal)" << size_now); //_dbg3("(normal)" << size_now);
@@ -1413,7 +1402,7 @@ POP_WARNINGS
shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->cond.notify_one(); shared_context->connect_mut.unlock(); shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->cond.notify_one(); shared_context->connect_mut.unlock();
}; };
sock_.async_connect(remote_endpoint, std::bind<void>(connect_callback, std::placeholders::_1, local_shared_context)); sock_.async_connect(remote_endpoint, boost::bind<void>(connect_callback, _1, local_shared_context));
while(local_shared_context->ec == boost::asio::error::would_block) while(local_shared_context->ec == boost::asio::error::would_block)
{ {
bool r = local_shared_context->cond.timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(conn_timeout)); bool r = local_shared_context->cond.timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(conn_timeout));

View File

@@ -8,7 +8,7 @@
// ! (how ever if in some wonderful juristdictions that is not the case, then why not make another sub-class withat that members and licence it as epee part) // ! (how ever if in some wonderful juristdictions that is not the case, then why not make another sub-class withat that members and licence it as epee part)
// ! Working on above premise, IF this is valid in your juristdictions, then consider this code as released as: // ! Working on above premise, IF this is valid in your juristdictions, then consider this code as released as:
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -132,10 +132,10 @@ class connection_basic { // not-templated base class for rapid developmet of som
ssl_support_t get_ssl_support() const { return m_ssl_support; } ssl_support_t get_ssl_support() const { return m_ssl_support; }
void disable_ssl() { m_ssl_support = epee::net_utils::ssl_support_t::e_ssl_support_disabled; } void disable_ssl() { m_ssl_support = epee::net_utils::ssl_support_t::e_ssl_support_disabled; }
bool handshake(boost::asio::ssl::stream_base::handshake_type type, boost::asio::const_buffer buffer = {}) bool handshake(boost::asio::ssl::stream_base::handshake_type type)
{ {
//m_state != nullptr verified in constructor //m_state != nullptr verified in constructor
return m_state->ssl_options().handshake(socket_, type, buffer); return m_state->ssl_options().handshake(socket_, type);
} }
template<typename MutableBufferSequence, typename ReadHandler> template<typename MutableBufferSequence, typename ReadHandler>

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -885,6 +885,14 @@ namespace net_utils
} }
}; };
typedef http_simple_client_template<blocked_mode_client> http_simple_client; typedef http_simple_client_template<blocked_mode_client> http_simple_client;
class http_simple_client_factory : public http_client_factory
{
public:
std::unique_ptr<abstract_http_client> create() override {
return std::unique_ptr<epee::net_utils::http::abstract_http_client>(new epee::net_utils::http::http_simple_client());
}
};
} }
} }
} }

View File

@@ -56,7 +56,6 @@ namespace net_utils
std::string m_folder; std::string m_folder;
std::vector<std::string> m_access_control_origins; std::vector<std::string> m_access_control_origins;
boost::optional<login> m_user; boost::optional<login> m_user;
size_t m_max_content_length{std::numeric_limits<size_t>::max()};
critical_section m_lock; critical_section m_lock;
}; };
@@ -143,7 +142,6 @@ namespace net_utils
config_type& m_config; config_type& m_config;
bool m_want_close; bool m_want_close;
size_t m_newlines; size_t m_newlines;
size_t m_bytes_read;
protected: protected:
i_service_endpoint* m_psnd_hndlr; i_service_endpoint* m_psnd_hndlr;
t_connection_context& m_conn_context; t_connection_context& m_conn_context;

View File

@@ -206,7 +206,6 @@ namespace net_utils
m_config(config), m_config(config),
m_want_close(false), m_want_close(false),
m_newlines(0), m_newlines(0),
m_bytes_read(0),
m_psnd_hndlr(psnd_hndlr), m_psnd_hndlr(psnd_hndlr),
m_conn_context(conn_context) m_conn_context(conn_context)
{ {
@@ -222,7 +221,6 @@ namespace net_utils
m_query_info.clear(); m_query_info.clear();
m_len_summary = 0; m_len_summary = 0;
m_newlines = 0; m_newlines = 0;
m_bytes_read = 0;
return true; return true;
} }
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
@@ -245,14 +243,6 @@ namespace net_utils
size_t ndel; size_t ndel;
m_bytes_read += buf.size();
if (m_bytes_read > m_config.m_max_content_length)
{
LOG_ERROR("simple_http_connection_handler::handle_buff_in: Too much data: got " << m_bytes_read);
m_state = http_state_error;
return false;
}
if(m_cache.size()) if(m_cache.size())
m_cache += buf; m_cache += buf;
else else
@@ -678,7 +668,7 @@ namespace net_utils
// Cross-origin resource sharing // Cross-origin resource sharing
if(m_query_info.m_header_info.m_origin.size()) if(m_query_info.m_header_info.m_origin.size())
{ {
if (std::binary_search(m_config.m_access_control_origins.begin(), m_config.m_access_control_origins.end(), "*") || std::binary_search(m_config.m_access_control_origins.begin(), m_config.m_access_control_origins.end(), m_query_info.m_header_info.m_origin)) if (std::binary_search(m_config.m_access_control_origins.begin(), m_config.m_access_control_origins.end(), m_query_info.m_header_info.m_origin))
{ {
buf += "Access-Control-Allow-Origin: "; buf += "Access-Control-Allow-Origin: ";
buf += m_query_info.m_header_info.m_origin; buf += m_query_info.m_header_info.m_origin;

View File

@@ -31,7 +31,7 @@
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/bind/bind.hpp> #include <boost/bind.hpp>
#include "net/abstract_tcp_server2.h" #include "net/abstract_tcp_server2.h"
#include "http_protocol_handler.h" #include "http_protocol_handler.h"

View File

@@ -72,8 +72,7 @@ namespace levin
#define LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED 0 #define LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED 0
#define LEVIN_INITIAL_MAX_PACKET_SIZE 256*1024 // 256 KiB before handshake #define LEVIN_DEFAULT_MAX_PACKET_SIZE 100000000 //100MB by default
#define LEVIN_DEFAULT_MAX_PACKET_SIZE 100000000 //100MB by default after handshake
#define LEVIN_PACKET_REQUEST 0x00000001 #define LEVIN_PACKET_REQUEST 0x00000001
#define LEVIN_PACKET_RESPONSE 0x00000002 #define LEVIN_PACKET_RESPONSE 0x00000002

View File

@@ -84,8 +84,7 @@ class async_protocol_handler_config
public: public:
typedef t_connection_context connection_context; typedef t_connection_context connection_context;
uint64_t m_initial_max_packet_size; uint64_t m_max_packet_size;
uint64_t m_max_packet_size;
uint64_t m_invoke_timeout; uint64_t m_invoke_timeout;
int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, boost::uuids::uuid connection_id); int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, boost::uuids::uuid connection_id);
@@ -106,7 +105,7 @@ public:
size_t get_in_connections_count(); size_t get_in_connections_count();
void set_handler(levin_commands_handler<t_connection_context>* handler, void (*destroy)(levin_commands_handler<t_connection_context>*) = NULL); void set_handler(levin_commands_handler<t_connection_context>* handler, void (*destroy)(levin_commands_handler<t_connection_context>*) = NULL);
async_protocol_handler_config():m_pcommands_handler(NULL), m_pcommands_handler_destroy(NULL), m_initial_max_packet_size(LEVIN_INITIAL_MAX_PACKET_SIZE), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_invoke_timeout(LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED) async_protocol_handler_config():m_pcommands_handler(NULL), m_pcommands_handler_destroy(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_invoke_timeout(LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
{} {}
~async_protocol_handler_config() { set_handler(NULL, NULL); } ~async_protocol_handler_config() { set_handler(NULL, NULL); }
void del_out_connections(size_t count); void del_out_connections(size_t count);
@@ -163,7 +162,6 @@ public:
net_utils::i_service_endpoint* m_pservice_endpoint; net_utils::i_service_endpoint* m_pservice_endpoint;
config_type& m_config; config_type& m_config;
t_connection_context& m_connection_context; t_connection_context& m_connection_context;
std::atomic<uint64_t> m_max_packet_size;
net_utils::buffer m_cache_in_buffer; net_utils::buffer m_cache_in_buffer;
stream_state m_state; stream_state m_state;
@@ -291,8 +289,7 @@ public:
m_current_head(bucket_head2()), m_current_head(bucket_head2()),
m_pservice_endpoint(psnd_hndlr), m_pservice_endpoint(psnd_hndlr),
m_config(config), m_config(config),
m_connection_context(conn_context), m_connection_context(conn_context),
m_max_packet_size(config.m_initial_max_packet_size),
m_cache_in_buffer(4 * 1024), m_cache_in_buffer(4 * 1024),
m_state(stream_state_head) m_state(stream_state_head)
{ {
@@ -402,14 +399,13 @@ public:
} }
// these should never fail, but do runtime check for safety // these should never fail, but do runtime check for safety
const uint64_t max_packet_size = m_max_packet_size; CHECK_AND_ASSERT_MES(m_config.m_max_packet_size >= m_cache_in_buffer.size(), false, "Bad m_cache_in_buffer.size()");
CHECK_AND_ASSERT_MES(max_packet_size >= m_cache_in_buffer.size(), false, "Bad m_cache_in_buffer.size()"); CHECK_AND_ASSERT_MES(m_config.m_max_packet_size - m_cache_in_buffer.size() >= m_fragment_buffer.size(), false, "Bad m_cache_in_buffer.size() + m_fragment_buffer.size()");
CHECK_AND_ASSERT_MES(max_packet_size - m_cache_in_buffer.size() >= m_fragment_buffer.size(), false, "Bad m_cache_in_buffer.size() + m_fragment_buffer.size()");
// flipped to subtraction; prevent overflow since m_max_packet_size is variable and public // flipped to subtraction; prevent overflow since m_max_packet_size is variable and public
if(cb > max_packet_size - m_cache_in_buffer.size() - m_fragment_buffer.size()) if(cb > m_config.m_max_packet_size - m_cache_in_buffer.size() - m_fragment_buffer.size())
{ {
MWARNING(m_connection_context << "Maximum packet size exceed!, m_max_packet_size = " << max_packet_size MWARNING(m_connection_context << "Maximum packet size exceed!, m_max_packet_size = " << m_config.m_max_packet_size
<< ", packet received " << m_cache_in_buffer.size() + cb << ", packet received " << m_cache_in_buffer.size() + cb
<< ", connection will be closed."); << ", connection will be closed.");
return false; return false;
@@ -434,7 +430,7 @@ public:
//async call scenario //async call scenario
boost::shared_ptr<invoke_response_handler_base> response_handler = m_invoke_response_handlers.front(); boost::shared_ptr<invoke_response_handler_base> response_handler = m_invoke_response_handlers.front();
response_handler->reset_timer(); response_handler->reset_timer();
MDEBUG(m_connection_context << "LEVIN_PACKET partial msg received. len=" << cb << ", current total " << m_cache_in_buffer.size() << "/" << m_current_head.m_cb << " (" << (100.0f * m_cache_in_buffer.size() / (m_current_head.m_cb ? m_current_head.m_cb : 1)) << "%)"); MDEBUG(m_connection_context << "LEVIN_PACKET partial msg received. len=" << cb);
} }
} }
break; break;
@@ -469,14 +465,6 @@ public:
temp = std::move(m_fragment_buffer); temp = std::move(m_fragment_buffer);
m_fragment_buffer.clear(); m_fragment_buffer.clear();
std::memcpy(std::addressof(m_current_head), std::addressof(temp[0]), sizeof(bucket_head2)); std::memcpy(std::addressof(m_current_head), std::addressof(temp[0]), sizeof(bucket_head2));
const size_t max_bytes = m_connection_context.get_max_bytes(m_current_head.m_command);
if(m_current_head.m_cb > std::min<size_t>(max_packet_size, max_bytes))
{
MERROR(m_connection_context << "Maximum packet size exceed!, m_max_packet_size = " << std::min<size_t>(max_packet_size, max_bytes)
<< ", packet header received " << m_current_head.m_cb << ", command " << m_current_head.m_command
<< ", connection will be closed.");
return false;
}
buff_to_invoke = {reinterpret_cast<const uint8_t*>(temp.data()) + sizeof(bucket_head2), temp.size() - sizeof(bucket_head2)}; buff_to_invoke = {reinterpret_cast<const uint8_t*>(temp.data()) + sizeof(bucket_head2), temp.size() - sizeof(bucket_head2)};
} }
@@ -531,10 +519,6 @@ public:
m_current_head.m_command, buff_to_invoke, return_buff, m_connection_context m_current_head.m_command, buff_to_invoke, return_buff, m_connection_context
); );
// peer_id remains unset if dropped
if (m_current_head.m_command == m_connection_context.handshake_command() && m_connection_context.handshake_complete())
m_max_packet_size = m_config.m_max_packet_size;
bucket_head2 head = make_header(m_current_head.m_command, return_buff.size(), LEVIN_PACKET_RESPONSE, false); bucket_head2 head = make_header(m_current_head.m_command, return_buff.size(), LEVIN_PACKET_RESPONSE, false);
head.m_return_code = SWAP32LE(return_code); head.m_return_code = SWAP32LE(return_code);
return_buff.insert(0, reinterpret_cast<const char*>(&head), sizeof(head)); return_buff.insert(0, reinterpret_cast<const char*>(&head), sizeof(head));
@@ -593,11 +577,10 @@ public:
m_cache_in_buffer.erase(sizeof(bucket_head2)); m_cache_in_buffer.erase(sizeof(bucket_head2));
m_state = stream_state_body; m_state = stream_state_body;
m_oponent_protocol_ver = m_current_head.m_protocol_version; m_oponent_protocol_ver = m_current_head.m_protocol_version;
const size_t max_bytes = m_connection_context.get_max_bytes(m_current_head.m_command); if(m_current_head.m_cb > m_config.m_max_packet_size)
if(m_current_head.m_cb > std::min<size_t>(max_packet_size, max_bytes))
{ {
LOG_ERROR_CC(m_connection_context, "Maximum packet size exceed!, m_max_packet_size = " << std::min<size_t>(max_packet_size, max_bytes) LOG_ERROR_CC(m_connection_context, "Maximum packet size exceed!, m_max_packet_size = " << m_config.m_max_packet_size
<< ", packet header received " << m_current_head.m_cb << ", command " << m_current_head.m_command << ", packet header received " << m_current_head.m_cb
<< ", connection will be closed."); << ", connection will be closed.");
return false; return false;
} }
@@ -651,9 +634,6 @@ public:
boost::interprocess::ipcdetail::atomic_write32(&m_invoke_buf_ready, 0); boost::interprocess::ipcdetail::atomic_write32(&m_invoke_buf_ready, 0);
CRITICAL_REGION_BEGIN(m_invoke_response_handlers_lock); CRITICAL_REGION_BEGIN(m_invoke_response_handlers_lock);
if (command == m_connection_context.handshake_command())
m_max_packet_size = m_config.m_max_packet_size;
if(!send_message(command, in_buff, LEVIN_PACKET_REQUEST, true)) if(!send_message(command, in_buff, LEVIN_PACKET_REQUEST, true))
{ {
LOG_ERROR_CC(m_connection_context, "Failed to do_send"); LOG_ERROR_CC(m_connection_context, "Failed to do_send");
@@ -695,9 +675,6 @@ public:
boost::interprocess::ipcdetail::atomic_write32(&m_invoke_buf_ready, 0); boost::interprocess::ipcdetail::atomic_write32(&m_invoke_buf_ready, 0);
if (command == m_connection_context.handshake_command())
m_max_packet_size = m_config.m_max_packet_size;
if (!send_message(command, in_buff, LEVIN_PACKET_REQUEST, true)) if (!send_message(command, in_buff, LEVIN_PACKET_REQUEST, true))
{ {
LOG_ERROR_CC(m_connection_context, "Failed to send request"); LOG_ERROR_CC(m_connection_context, "Failed to send request");
@@ -800,32 +777,36 @@ void async_protocol_handler_config<t_connection_context>::del_connection(async_p
template<class t_connection_context> template<class t_connection_context>
void async_protocol_handler_config<t_connection_context>::delete_connections(size_t count, bool incoming) void async_protocol_handler_config<t_connection_context>::delete_connections(size_t count, bool incoming)
{ {
std::vector<typename connections_map::mapped_type> connections; std::vector <boost::uuids::uuid> connections;
auto scope_exit_handler = misc_utils::create_scope_leave_handler([&connections]{
for (auto &aph: connections)
aph->finish_outer_call();
});
CRITICAL_REGION_BEGIN(m_connects_lock); CRITICAL_REGION_BEGIN(m_connects_lock);
for (auto& c: m_connects) for (auto& c: m_connects)
{ {
if (c.second->m_connection_context.m_is_income == incoming) if (c.second->m_connection_context.m_is_income == incoming)
if (c.second->start_outer_call()) connections.push_back(c.first);
connections.push_back(c.second);
} }
// close random connections from the provided set // close random connections from the provided set
// TODO or better just keep removing random elements (performance) // TODO or better just keep removing random elements (performance)
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
shuffle(connections.begin(), connections.end(), std::default_random_engine(seed)); shuffle(connections.begin(), connections.end(), std::default_random_engine(seed));
for (size_t i = 0; i < connections.size() && i < count; ++i) while (count > 0 && connections.size() > 0)
m_connects.erase(connections[i]->get_connection_id()); {
try
{
auto i = connections.end() - 1;
async_protocol_handler<t_connection_context> *conn = m_connects.at(*i);
del_connection(conn);
conn->close();
connections.erase(i);
}
catch (const std::out_of_range &e)
{
MWARNING("Connection not found in m_connects, continuing");
}
--count;
}
CRITICAL_REGION_END(); CRITICAL_REGION_END();
for (size_t i = 0; i < connections.size() && i < count; ++i)
connections[i]->close();
} }
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
template<class t_connection_context> template<class t_connection_context>
@@ -887,35 +868,23 @@ int async_protocol_handler_config<t_connection_context>::invoke_async(int comman
template<class t_connection_context> template<class callback_t> template<class t_connection_context> template<class callback_t>
bool async_protocol_handler_config<t_connection_context>::foreach_connection(const callback_t &cb) bool async_protocol_handler_config<t_connection_context>::foreach_connection(const callback_t &cb)
{ {
std::vector<typename connections_map::mapped_type> conn; CRITICAL_REGION_LOCAL(m_connects_lock);
for(auto& c: m_connects)
auto scope_exit_handler = misc_utils::create_scope_leave_handler([&conn]{ {
for (auto &aph: conn) async_protocol_handler<t_connection_context>* aph = c.second;
aph->finish_outer_call(); if(!cb(aph->get_context_ref()))
});
CRITICAL_REGION_BEGIN(m_connects_lock);
conn.reserve(m_connects.size());
for (auto &e: m_connects)
if (e.second->start_outer_call())
conn.push_back(e.second);
CRITICAL_REGION_END()
for (auto &aph: conn)
if (!cb(aph->get_context_ref()))
return false; return false;
}
return true; return true;
} }
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
template<class t_connection_context> template<class callback_t> template<class t_connection_context> template<class callback_t>
bool async_protocol_handler_config<t_connection_context>::for_connection(const boost::uuids::uuid &connection_id, const callback_t &cb) bool async_protocol_handler_config<t_connection_context>::for_connection(const boost::uuids::uuid &connection_id, const callback_t &cb)
{ {
async_protocol_handler<t_connection_context>* aph = nullptr; CRITICAL_REGION_LOCAL(m_connects_lock);
if (find_and_lock_connection(connection_id, aph) != LEVIN_OK) async_protocol_handler<t_connection_context>* aph = find_connection(connection_id);
if (!aph)
return false; return false;
auto scope_exit_handler = misc_utils::create_scope_leave_handler(
boost::bind(&async_protocol_handler<t_connection_context>::finish_outer_call, aph));
if(!cb(aph->get_context_ref())) if(!cb(aph->get_context_ref()))
return false; return false;
return true; return true;
@@ -978,14 +947,12 @@ int async_protocol_handler_config<t_connection_context>::send(byte_slice message
template<class t_connection_context> template<class t_connection_context>
bool async_protocol_handler_config<t_connection_context>::close(boost::uuids::uuid connection_id) bool async_protocol_handler_config<t_connection_context>::close(boost::uuids::uuid connection_id)
{ {
async_protocol_handler<t_connection_context>* aph = nullptr; CRITICAL_REGION_LOCAL(m_connects_lock);
if (find_and_lock_connection(connection_id, aph) != LEVIN_OK) async_protocol_handler<t_connection_context>* aph = find_connection(connection_id);
if (!aph)
return false; return false;
auto scope_exit_handler = misc_utils::create_scope_leave_handler(
boost::bind(&async_protocol_handler<t_connection_context>::finish_outer_call, aph));
if (!aph->close()) if (!aph->close())
return false; return false;
CRITICAL_REGION_LOCAL(m_connects_lock);
m_connects.erase(connection_id); m_connects.erase(connection_id);
return true; return true;
} }

View File

@@ -28,6 +28,8 @@
#pragma once #pragma once
#include <string> #include <string>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/ip/address_v6.hpp>
#include "int-util.h" #include "int-util.h"
// IP addresses are kept in network byte order // IP addresses are kept in network byte order
@@ -38,6 +40,30 @@ namespace epee
{ {
namespace net_utils namespace net_utils
{ {
inline
bool is_ipv6_local(const std::string& ip)
{
auto addr = boost::asio::ip::address_v6::from_string(ip);
// ipv6 link-local unicast addresses are fe80::/10
bool is_link_local = addr.is_link_local();
auto addr_bytes = addr.to_bytes();
// ipv6 unique local unicast addresses start with fc00::/7 -- (fcXX or fdXX)
bool is_unique_local_unicast = (addr_bytes[0] == 0xfc || addr_bytes[0] == 0xfd);
return is_link_local || is_unique_local_unicast;
}
inline
bool is_ipv6_loopback(const std::string& ip)
{
// ipv6 loopback is ::1
return boost::asio::ip::address_v6::from_string(ip).is_loopback();
}
inline inline
bool is_ip_local(uint32_t ip) bool is_ip_local(uint32_t ip)
{ {

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2020, The Monero Project // Copyright (c) 2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -178,7 +178,7 @@ namespace net_utils
// SSL Options // SSL Options
if (m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_enabled || m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_autodetect) if (m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_enabled || m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_autodetect)
{ {
if (!m_ssl_options.handshake(*m_ssl_socket, boost::asio::ssl::stream_base::client, {}, addr, timeout)) if (!m_ssl_options.handshake(*m_ssl_socket, boost::asio::ssl::stream_base::client, addr, timeout))
{ {
if (m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_autodetect) if (m_ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_autodetect)
{ {

View File

@@ -132,7 +132,6 @@ namespace net_utils
bool handshake( bool handshake(
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> &socket, boost::asio::ssl::stream<boost::asio::ip::tcp::socket> &socket,
boost::asio::ssl::stream_base::handshake_type type, boost::asio::ssl::stream_base::handshake_type type,
boost::asio::const_buffer buffer = {},
const std::string& host = {}, const std::string& host = {},
std::chrono::milliseconds timeout = std::chrono::seconds(15)) const; std::chrono::milliseconds timeout = std::chrono::seconds(15)) const;
}; };

View File

@@ -236,7 +236,6 @@ namespace net_utils
virtual address_type get_type_id() const = 0; virtual address_type get_type_id() const = 0;
virtual zone get_zone() const = 0; virtual zone get_zone() const = 0;
virtual bool is_blockable() const = 0; virtual bool is_blockable() const = 0;
virtual std::uint16_t port() const = 0;
}; };
template<typename T> template<typename T>
@@ -267,7 +266,6 @@ namespace net_utils
virtual address_type get_type_id() const override { return value.get_type_id(); } virtual address_type get_type_id() const override { return value.get_type_id(); }
virtual zone get_zone() const override { return value.get_zone(); } virtual zone get_zone() const override { return value.get_zone(); }
virtual bool is_blockable() const override { return value.is_blockable(); } virtual bool is_blockable() const override { return value.is_blockable(); }
virtual std::uint16_t port() const override { return value.port(); }
}; };
std::shared_ptr<interface> self; std::shared_ptr<interface> self;
@@ -314,7 +312,6 @@ namespace net_utils
address_type get_type_id() const { return self ? self->get_type_id() : address_type::invalid; } address_type get_type_id() const { return self ? self->get_type_id() : address_type::invalid; }
zone get_zone() const { return self ? self->get_zone() : zone::invalid; } zone get_zone() const { return self ? self->get_zone() : zone::invalid; }
bool is_blockable() const { return self ? self->is_blockable() : false; } bool is_blockable() const { return self ? self->is_blockable() : false; }
std::uint16_t port() const { return self ? self->port() : 0; }
template<typename Type> const Type &as() const { return as_mutable<const Type>(); } template<typename Type> const Type &as() const { return as_mutable<const Type>(); }
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()

View File

@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project) /// @author rfree (current maintainer in monero.cc project)
/// @brief implementaion for throttling of connection (count and rate-limit speed etc) /// @brief implementaion for throttling of connection (count and rate-limit speed etc)
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project) /// @author rfree (current maintainer in monero.cc project)
/// @brief interface for throttling of connection (count and rate-limit speed etc) /// @brief interface for throttling of connection (count and rate-limit speed etc)
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -44,7 +44,10 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <atomic> #include <atomic>
#include <boost/asio.hpp>
#include <boost/array.hpp> #include <boost/array.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp> #include <boost/enable_shared_from_this.hpp>
#include <boost/interprocess/detail/atomic.hpp> #include <boost/interprocess/detail/atomic.hpp>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
@@ -60,6 +63,7 @@
#include <boost/utility/value_init.hpp> #include <boost/utility/value_init.hpp>
#include <boost/asio/deadline_timer.hpp> #include <boost/asio/deadline_timer.hpp>
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread/thread.hpp>
#include "misc_language.h" #include "misc_language.h"
#include "pragma_comp_defs.h" #include "pragma_comp_defs.h"
#include <sstream> #include <sstream>

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2020, The Monero Project // Copyright (c) 2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -34,8 +34,6 @@
#pragma once #pragma once
#include "misc_language.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@@ -141,6 +139,7 @@ public:
rolling_median_t(rolling_median_t &&m) rolling_median_t(rolling_median_t &&m)
{ {
free(data);
memcpy(this, &m, sizeof(rolling_median_t)); memcpy(this, &m, sizeof(rolling_median_t));
m.data = NULL; m.data = NULL;
} }
@@ -227,7 +226,7 @@ public:
Item v = data[heap[0]]; Item v = data[heap[0]];
if (minCt < maxCt) if (minCt < maxCt)
{ {
v = get_mid<Item>(v, data[heap[-1]]); v = (v + data[heap[-1]]) / 2;
} }
return v; return v;
} }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2017-2020, The Monero Project // Copyright (c) 2017-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -1,7 +1,6 @@
#include <math.h> #include <math.h>
#include <limits> #include <limits>
#include <algorithm> #include <algorithm>
#include "misc_language.h"
#include "stats.h" #include "stats.h"
enum enum
@@ -87,7 +86,7 @@ Tpod Stats<T, Tpod>::get_median() const
} }
else else
{ {
median = epee::misc_utils::get_mid(sorted[(sorted.size() - 1) / 2], sorted[sorted.size() / 2]); median = (sorted[(sorted.size() - 1) / 2] + sorted[sorted.size() / 2]) / 2;
} }
set_cached(bit_median); set_cached(bit_median);
} }

View File

@@ -97,12 +97,7 @@ namespace epee
return false; return false;
} }
static const constexpr epee::serialization::portable_storage::limits_t default_http_bin_limits = { return serialization::load_t_from_binary(result_struct, epee::strspan<uint8_t>(pri->m_body));
65536 * 3, // objects
65536 * 3, // fields
65536 * 3, // strings
};
return serialization::load_t_from_binary(result_struct, epee::strspan<uint8_t>(pri->m_body), &default_http_bin_limits);
} }
template<class t_request, class t_response, class t_transport> template<class t_request, class t_response, class t_transport>

View File

@@ -28,7 +28,6 @@
#include "portable_storage_template_helper.h" #include "portable_storage_template_helper.h"
#include <boost/utility/value_init.hpp> #include <boost/utility/value_init.hpp>
#include <functional>
#include "span.h" #include "span.h"
#include "net/levin_base.h" #include "net/levin_base.h"
@@ -50,11 +49,6 @@ namespace
snprintf(buf, sizeof(buf), "command-%u", command); snprintf(buf, sizeof(buf), "command-%u", command);
return on_levin_traffic(context, initiator, sent, error, bytes, buf); return on_levin_traffic(context, initiator, sent, error, bytes, buf);
} }
static const constexpr epee::serialization::portable_storage::limits_t default_levin_limits = {
8192, // objects
16384, // fields
16384, // strings
};
} }
namespace epee namespace epee
@@ -80,7 +74,7 @@ namespace epee
return false; return false;
} }
serialization::portable_storage stg_ret; serialization::portable_storage stg_ret;
if(!stg_ret.load_from_binary(buff_to_recv, &default_levin_limits)) if(!stg_ret.load_from_binary(buff_to_recv))
{ {
LOG_ERROR("Failed to load_from_binary on command " << command); LOG_ERROR("Failed to load_from_binary on command " << command);
return false; return false;
@@ -126,7 +120,7 @@ namespace epee
return false; return false;
} }
typename serialization::portable_storage stg_ret; typename serialization::portable_storage stg_ret;
if(!stg_ret.load_from_binary(buff_to_recv, &default_levin_limits)) if(!stg_ret.load_from_binary(buff_to_recv))
{ {
on_levin_traffic(context, true, false, true, buff_to_recv.size(), command); on_levin_traffic(context, true, false, true, buff_to_recv.size(), command);
LOG_ERROR("Failed to load_from_binary on command " << command); LOG_ERROR("Failed to load_from_binary on command " << command);
@@ -157,7 +151,7 @@ namespace epee
return false; return false;
} }
serialization::portable_storage stg_ret; serialization::portable_storage stg_ret;
if(!stg_ret.load_from_binary(buff, &default_levin_limits)) if(!stg_ret.load_from_binary(buff))
{ {
on_levin_traffic(context, true, false, true, buff.size(), command); on_levin_traffic(context, true, false, true, buff.size(), command);
LOG_ERROR("Failed to load_from_binary on command " << command); LOG_ERROR("Failed to load_from_binary on command " << command);
@@ -207,7 +201,7 @@ namespace epee
int buff_to_t_adapter(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, callback_t cb, t_context& context ) int buff_to_t_adapter(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, callback_t cb, t_context& context )
{ {
serialization::portable_storage strg; serialization::portable_storage strg;
if(!strg.load_from_binary(in_buff, &default_levin_limits)) if(!strg.load_from_binary(in_buff))
{ {
on_levin_traffic(context, false, false, true, in_buff.size(), command); on_levin_traffic(context, false, false, true, in_buff.size(), command);
LOG_ERROR("Failed to load_from_binary in command " << command); LOG_ERROR("Failed to load_from_binary in command " << command);
@@ -241,7 +235,7 @@ namespace epee
int buff_to_t_adapter(t_owner* powner, int command, const epee::span<const uint8_t> in_buff, callback_t cb, t_context& context) int buff_to_t_adapter(t_owner* powner, int command, const epee::span<const uint8_t> in_buff, callback_t cb, t_context& context)
{ {
serialization::portable_storage strg; serialization::portable_storage strg;
if(!strg.load_from_binary(in_buff, &default_levin_limits)) if(!strg.load_from_binary(in_buff))
{ {
on_levin_traffic(context, false, false, true, in_buff.size(), command); on_levin_traffic(context, false, false, true, in_buff.size(), command);
LOG_ERROR("Failed to load_from_binary in notify " << command); LOG_ERROR("Failed to load_from_binary in notify " << command);
@@ -301,20 +295,20 @@ namespace epee
#define HANDLE_INVOKE2(command_id, func, type_name_in, typename_out) \ #define HANDLE_INVOKE2(command_id, func, type_name_in, typename_out) \
if(!is_notify && command_id == command) \ if(!is_notify && command_id == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in, typename_out>(this, command, in_buff, buff_out, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), context);} {handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in, typename_out>(this, command, in_buff, buff_out, boost::bind(func, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4), context);}
#define HANDLE_INVOKE_T2(COMMAND, func) \ #define HANDLE_INVOKE_T2(COMMAND, func) \
if(!is_notify && COMMAND::ID == command) \ if(!is_notify && COMMAND::ID == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename COMMAND::request, typename COMMAND::response>(command, in_buff, buff_out, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), context);} {handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename COMMAND::request, typename COMMAND::response>(command, in_buff, buff_out, boost::bind(func, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4), context);}
#define HANDLE_NOTIFY2(command_id, func, type_name_in) \ #define HANDLE_NOTIFY2(command_id, func, type_name_in) \
if(is_notify && command_id == command) \ if(is_notify && command_id == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in>(this, command, in_buff, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), context);} {handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in>(this, command, in_buff, boost::bind(func, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3), context);}
#define HANDLE_NOTIFY_T2(NOTIFY, func) \ #define HANDLE_NOTIFY_T2(NOTIFY, func) \
if(is_notify && NOTIFY::ID == command) \ if(is_notify && NOTIFY::ID == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename NOTIFY::request>(this, command, in_buff, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), context);} {handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename NOTIFY::request>(this, command, in_buff, boost::bind(func, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3), context);}
#define CHAIN_INVOKE_MAP2(func) \ #define CHAIN_INVOKE_MAP2(func) \

View File

@@ -40,8 +40,6 @@
#include "span.h" #include "span.h"
#include "int-util.h" #include "int-util.h"
#include <boost/mpl/contains.hpp>
namespace epee namespace epee
{ {
namespace serialization namespace serialization
@@ -56,13 +54,6 @@ namespace epee
typedef epee::serialization::harray harray; typedef epee::serialization::harray harray;
typedef storage_entry meta_entry; typedef storage_entry meta_entry;
struct limits_t
{
size_t n_objects;
size_t n_fields;
size_t n_strings; // not counting field names
};
portable_storage(){} portable_storage(){}
virtual ~portable_storage(){} virtual ~portable_storage(){}
hsection open_section(const std::string& section_name, hsection hparent_section, bool create_if_notexist = false); hsection open_section(const std::string& section_name, hsection hparent_section, bool create_if_notexist = false);
@@ -93,8 +84,8 @@ namespace epee
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
bool store_to_binary(binarybuffer& target); bool store_to_binary(binarybuffer& target);
bool load_from_binary(const epee::span<const uint8_t> target, const limits_t *limits = NULL); bool load_from_binary(const epee::span<const uint8_t> target);
bool load_from_binary(const std::string& target, const limits_t *limits = NULL) { return load_from_binary(epee::strspan<uint8_t>(target), limits); } bool load_from_binary(const std::string& target) { return load_from_binary(epee::strspan<uint8_t>(target)); }
template<class trace_policy> template<class trace_policy>
bool dump_as_xml(std::string& targetObj, const std::string& root_name = ""); bool dump_as_xml(std::string& targetObj, const std::string& root_name = "");
bool dump_as_json(std::string& targetObj, size_t indent = 0, bool insert_newlines = true); bool dump_as_json(std::string& targetObj, size_t indent = 0, bool insert_newlines = true);
@@ -159,7 +150,7 @@ namespace epee
CATCH_ENTRY("portable_storage::store_to_binary", false) CATCH_ENTRY("portable_storage::store_to_binary", false)
} }
inline inline
bool portable_storage::load_from_binary(const epee::span<const uint8_t> source, const limits_t *limits) bool portable_storage::load_from_binary(const epee::span<const uint8_t> source)
{ {
m_root.m_entries.clear(); m_root.m_entries.clear();
if(source.size() < sizeof(storage_block_header)) if(source.size() < sizeof(storage_block_header))
@@ -182,8 +173,6 @@ namespace epee
} }
TRY_ENTRY(); TRY_ENTRY();
throwable_buffer_reader buf_reader(source.data()+sizeof(storage_block_header), source.size()-sizeof(storage_block_header)); throwable_buffer_reader buf_reader(source.data()+sizeof(storage_block_header), source.size()-sizeof(storage_block_header));
if (limits)
buf_reader.set_limits(limits->n_objects, limits->n_fields, limits->n_strings);
buf_reader.read(m_root); buf_reader.read(m_root);
return true;//TODO: return true;//TODO:
CATCH_ENTRY("portable_storage::load_from_binary", false); CATCH_ENTRY("portable_storage::load_from_binary", false);
@@ -293,7 +282,6 @@ namespace epee
static_assert(std::is_rvalue_reference<entry_type&&>(), "unexpected copy of value"); static_assert(std::is_rvalue_reference<entry_type&&>(), "unexpected copy of value");
TRY_ENTRY(); TRY_ENTRY();
CHECK_AND_ASSERT(psection, nullptr); CHECK_AND_ASSERT(psection, nullptr);
CHECK_AND_ASSERT(!pentry_name.empty(), nullptr);
auto ins_res = psection->m_entries.emplace(pentry_name, std::forward<entry_type>(entry)); auto ins_res = psection->m_entries.emplace(pentry_name, std::forward<entry_type>(entry));
return &ins_res.first->second; return &ins_res.first->second;
CATCH_ENTRY("portable_storage::insert_new_entry_get_storage_entry", nullptr); CATCH_ENTRY("portable_storage::insert_new_entry_get_storage_entry", nullptr);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2020, The Monero Project // Copyright (c) 2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -42,24 +42,6 @@ namespace epee
{ {
namespace serialization namespace serialization
{ {
template<typename T>
struct ps_min_bytes {
static constexpr const size_t strict = 4096; // actual low bound
};
template<> struct ps_min_bytes<uint64_t> { static constexpr const size_t strict = 8; };
template<> struct ps_min_bytes<int64_t> { static constexpr const size_t strict = 8; };
template<> struct ps_min_bytes<uint32_t> { static constexpr const size_t strict = 4; };
template<> struct ps_min_bytes<int32_t> { static constexpr const size_t strict = 4; };
template<> struct ps_min_bytes<uint16_t> { static constexpr const size_t strict = 2; };
template<> struct ps_min_bytes<int16_t> { static constexpr const size_t strict = 2; };
template<> struct ps_min_bytes<uint8_t> { static constexpr const size_t strict = 1; };
template<> struct ps_min_bytes<int8_t> { static constexpr const size_t strict = 1; };
template<> struct ps_min_bytes<double> { static constexpr const size_t strict = 8; };
template<> struct ps_min_bytes<bool> { static constexpr const size_t strict = 1; };
template<> struct ps_min_bytes<std::string> { static constexpr const size_t strict = 2; };
template<> struct ps_min_bytes<section> { static constexpr const size_t strict = 1; };
template<> struct ps_min_bytes<array_entry> { static constexpr const size_t strict = 1; };
struct throwable_buffer_reader struct throwable_buffer_reader
{ {
throwable_buffer_reader(const void* ptr, size_t sz); throwable_buffer_reader(const void* ptr, size_t sz);
@@ -79,9 +61,6 @@ namespace epee
void read(section& sec); void read(section& sec);
void read(std::string& str); void read(std::string& str);
void read(array_entry &ae); void read(array_entry &ae);
template<class t_type>
size_t min_bytes() const;
void set_limits(size_t objects, size_t fields, size_t strings);
private: private:
struct recursuion_limitation_guard struct recursuion_limitation_guard
{ {
@@ -102,13 +81,6 @@ namespace epee
const uint8_t* m_ptr; const uint8_t* m_ptr;
size_t m_count; size_t m_count;
size_t m_recursion_count; size_t m_recursion_count;
size_t m_objects;
size_t m_fields;
size_t m_strings;
size_t max_objects;
size_t max_fields;
size_t max_strings;
}; };
inline throwable_buffer_reader::throwable_buffer_reader(const void* ptr, size_t sz) inline throwable_buffer_reader::throwable_buffer_reader(const void* ptr, size_t sz)
@@ -120,12 +92,6 @@ namespace epee
m_ptr = (uint8_t*)ptr; m_ptr = (uint8_t*)ptr;
m_count = sz; m_count = sz;
m_recursion_count = 0; m_recursion_count = 0;
m_objects = 0;
m_fields = 0;
m_strings = 0;
max_objects = std::numeric_limits<size_t>::max();
max_fields = std::numeric_limits<size_t>::max();
max_strings = std::numeric_limits<size_t>::max();
} }
inline inline
void throwable_buffer_reader::read(void* target, size_t count) void throwable_buffer_reader::read(void* target, size_t count)
@@ -142,7 +108,6 @@ namespace epee
RECURSION_LIMITATION(); RECURSION_LIMITATION();
uint8_t name_len = 0; uint8_t name_len = 0;
read(name_len); read(name_len);
CHECK_AND_ASSERT_THROW_MES(name_len > 0, "Section name is missing");
sce_name.resize(name_len); sce_name.resize(name_len);
read((void*)sce_name.data(), name_len); read((void*)sce_name.data(), name_len);
} }
@@ -173,18 +138,7 @@ namespace epee
//for pod types //for pod types
array_entry_t<type_name> sa; array_entry_t<type_name> sa;
size_t size = read_varint(); size_t size = read_varint();
CHECK_AND_ASSERT_THROW_MES(size <= m_count / ps_min_bytes<type_name>::strict, "Size sanity check failed"); CHECK_AND_ASSERT_THROW_MES(size <= m_count, "Size sanity check failed");
if (std::is_same<type_name, section>())
{
CHECK_AND_ASSERT_THROW_MES(size <= max_objects - m_objects, "Too many objects");
m_objects += size;
}
else if (std::is_same<type_name, std::string>())
{
CHECK_AND_ASSERT_THROW_MES(size <= max_strings - m_strings, "Too many strings");
m_strings += size;
}
sa.reserve(size); sa.reserve(size);
//TODO: add some optimization here later //TODO: add some optimization here later
while(size--) while(size--)
@@ -250,8 +204,6 @@ namespace epee
inline storage_entry throwable_buffer_reader::read_se<std::string>() inline storage_entry throwable_buffer_reader::read_se<std::string>()
{ {
RECURSION_LIMITATION(); RECURSION_LIMITATION();
CHECK_AND_ASSERT_THROW_MES(m_strings + 1 <= max_strings, "Too many strings");
m_strings += 1;
return storage_entry(read<std::string>()); return storage_entry(read<std::string>());
} }
@@ -260,8 +212,6 @@ namespace epee
inline storage_entry throwable_buffer_reader::read_se<section>() inline storage_entry throwable_buffer_reader::read_se<section>()
{ {
RECURSION_LIMITATION(); RECURSION_LIMITATION();
CHECK_AND_ASSERT_THROW_MES(m_objects < max_objects, "Too many objects");
++m_objects;
section s;//use extra variable due to vs bug, line "storage_entry se(section()); " can't be compiled in visual studio section s;//use extra variable due to vs bug, line "storage_entry se(section()); " can't be compiled in visual studio
storage_entry se(std::move(s)); storage_entry se(std::move(s));
section& section_entry = boost::get<section>(se); section& section_entry = boost::get<section>(se);
@@ -313,16 +263,12 @@ namespace epee
RECURSION_LIMITATION(); RECURSION_LIMITATION();
sec.m_entries.clear(); sec.m_entries.clear();
size_t count = read_varint(); size_t count = read_varint();
CHECK_AND_ASSERT_THROW_MES(count <= max_fields - m_fields, "Too many object fields");
m_fields += count;
while(count--) while(count--)
{ {
//read section name string //read section name string
std::string sec_name; std::string sec_name;
read_sec_name(sec_name); read_sec_name(sec_name);
const auto insert_loc = sec.m_entries.lower_bound(sec_name); sec.m_entries.emplace(std::move(sec_name), load_storage_entry());
CHECK_AND_ASSERT_THROW_MES(insert_loc == sec.m_entries.end() || insert_loc->first != sec_name, "duplicate key: " << sec_name);
sec.m_entries.emplace_hint(insert_loc, std::move(sec_name), load_storage_entry());
} }
} }
inline inline
@@ -343,12 +289,5 @@ namespace epee
RECURSION_LIMITATION(); RECURSION_LIMITATION();
CHECK_AND_ASSERT_THROW_MES(false, "Reading array entry is not supported"); CHECK_AND_ASSERT_THROW_MES(false, "Reading array entry is not supported");
} }
inline
void throwable_buffer_reader::set_limits(size_t objects, size_t fields, size_t strings)
{
max_objects = objects;
max_fields = fields;
max_strings = strings;
}
} }
} }

View File

@@ -84,10 +84,10 @@ namespace epee
} }
//----------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------
template<class t_struct> template<class t_struct>
bool load_t_from_binary(t_struct& out, const epee::span<const uint8_t> binary_buff, const epee::serialization::portable_storage::limits_t *limits = NULL) bool load_t_from_binary(t_struct& out, const epee::span<const uint8_t> binary_buff)
{ {
portable_storage ps; portable_storage ps;
bool rs = ps.load_from_binary(binary_buff, limits); bool rs = ps.load_from_binary(binary_buff);
if(!rs) if(!rs)
return false; return false;

View File

@@ -211,7 +211,6 @@ namespace epee
for(const section_pair& se: sec.m_entries) for(const section_pair& se: sec.m_entries)
{ {
CHECK_AND_ASSERT_THROW_MES(se.first.size() < std::numeric_limits<uint8_t>::max(), "storage_entry_name is too long: " << se.first.size() << ", val: " << se.first); CHECK_AND_ASSERT_THROW_MES(se.first.size() < std::numeric_limits<uint8_t>::max(), "storage_entry_name is too long: " << se.first.size() << ", val: " << se.first);
CHECK_AND_ASSERT_THROW_MES(!se.first.empty(), "storage_entry_name is empty");
uint8_t len = static_cast<uint8_t>(se.first.size()); uint8_t len = static_cast<uint8_t>(se.first.size());
strm.write((const char*)&len, sizeof(len)); strm.write((const char*)&len, sizeof(len));
strm.write(se.first.data(), size_t(len)); strm.write(se.first.data(), size_t(len));

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2017-2020, The Monero Project // Copyright (c) 2017-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2020, The Monero Project # Copyright (c) 2014-2019, The Monero Project
# #
# All rights reserved. # All rights reserved.
# #
@@ -27,7 +27,7 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
add_library(epee byte_slice.cpp byte_stream.cpp hex.cpp abstract_http_client.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp add_library(epee STATIC byte_slice.cpp byte_stream.cpp hex.cpp abstract_http_client.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp
wipeable_string.cpp levin_base.cpp memwipe.c connection_basic.cpp network_throttle.cpp network_throttle-detail.cpp mlocker.cpp buffer.cpp net_ssl.cpp wipeable_string.cpp levin_base.cpp memwipe.c connection_basic.cpp network_throttle.cpp network_throttle-detail.cpp mlocker.cpp buffer.cpp net_ssl.cpp
int-util.cpp) int-util.cpp)
@@ -35,7 +35,9 @@ if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW)))
add_library(epee_readline STATIC readline_buffer.cpp) add_library(epee_readline STATIC readline_buffer.cpp)
endif() endif()
set_property(SOURCE memwipe.c PROPERTY C_STANDARD 11) if(HAVE_C11)
SET_PROPERTY(SOURCE memwipe.c PROPERTY COMPILE_FLAGS -std=c11)
endif()
# Build and install libepee if we're building for GUI # Build and install libepee if we're building for GUI
if (BUILD_GUI_DEPS) if (BUILD_GUI_DEPS)
@@ -58,23 +60,14 @@ target_link_libraries(epee
${Boost_CHRONO_LIBRARY} ${Boost_CHRONO_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY} ${Boost_THREAD_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${OPENSSL_LIBRARIES}
PRIVATE PRIVATE
${OPENSSL_LIBRARIES}
${EXTRA_LIBRARIES}) ${EXTRA_LIBRARIES})
if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW))) if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW)))
target_link_libraries(epee_readline target_link_libraries(epee_readline
PUBLIC PUBLIC
easylogging easylogging
${Boost_SYSTEM_LIBRARY}
PRIVATE PRIVATE
${GNU_READLINE_LIBRARY}) ${GNU_READLINE_LIBRARY})
endif() endif()
target_include_directories(epee
PUBLIC
"${EPEE_INCLUDE_DIR_BASE}"
"${OPENSSL_INCLUDE_DIR}")

View File

@@ -137,11 +137,6 @@ namespace http
set_server(std::move(parsed.host), std::to_string(parsed.port), std::move(user), std::move(ssl_options)); set_server(std::move(parsed.host), std::to_string(parsed.port), std::move(user), std::move(ssl_options));
return true; return true;
} }
bool epee::net_utils::http::abstract_http_client::set_proxy(const std::string& address)
{
return false;
}
} }
} }
} }

View File

@@ -26,7 +26,6 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <limits>
#include <string.h> #include <string.h>
#include "net/buffer.h" #include "net/buffer.h"

View File

@@ -2,7 +2,7 @@
/// @author rfree (current maintainer in monero.cc project) /// @author rfree (current maintainer in monero.cc project)
/// @brief base for connection, contains e.g. the ratelimit hooks /// @brief base for connection, contains e.g. the ratelimit hooks
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2020, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@@ -209,7 +209,12 @@ namespace
} }
template<typename T> template<typename T>
auto quoted_(const T& arg) // avoid ADL selecting C++14 std::quoted using quoted_result = boost::joined_range<
const boost::joined_range<const boost::string_ref, const T>, const boost::string_ref
>;
template<typename T>
quoted_result<T> quoted(const T& arg)
{ {
return boost::range::join(boost::range::join(ceref(u8"\""), arg), ceref(u8"\"")); return boost::range::join(boost::range::join(ceref(u8"\""), arg), ceref(u8"\""));
} }
@@ -237,13 +242,13 @@ namespace
{ {
str.append(u8"Digest "); str.append(u8"Digest ");
add_first_field(str, u8"algorithm", algorithm); add_first_field(str, u8"algorithm", algorithm);
add_field(str, u8"nonce", quoted_(user.server.nonce)); add_field(str, u8"nonce", quoted(user.server.nonce));
add_field(str, u8"realm", quoted_(user.server.realm)); add_field(str, u8"realm", quoted(user.server.realm));
add_field(str, u8"response", quoted_(response)); add_field(str, u8"response", quoted(response));
add_field(str, u8"uri", quoted_(uri)); add_field(str, u8"uri", quoted(uri));
add_field(str, u8"username", quoted_(user.credentials.username)); add_field(str, u8"username", quoted(user.credentials.username));
if (!user.server.opaque.empty()) if (!user.server.opaque.empty())
add_field(str, u8"opaque", quoted_(user.server.opaque)); add_field(str, u8"opaque", quoted(user.server.opaque));
} }
//! Implements superseded algorithm specified in RFC 2069 //! Implements superseded algorithm specified in RFC 2069
@@ -669,8 +674,8 @@ namespace
Digest::name, (i == 0 ? boost::string_ref{} : sess_algo) Digest::name, (i == 0 ? boost::string_ref{} : sess_algo)
); );
add_field(out, u8"algorithm", algorithm); add_field(out, u8"algorithm", algorithm);
add_field(out, u8"realm", quoted_(auth_realm)); add_field(out, u8"realm", quoted(auth_realm));
add_field(out, u8"nonce", quoted_(nonce)); add_field(out, u8"nonce", quoted(nonce));
add_field(out, u8"stale", is_stale ? ceref("true") : ceref("false")); add_field(out, u8"stale", is_stale ? ceref("true") : ceref("false"));
fields.push_back(std::make_pair(std::string(server_auth_field), std::move(out))); fields.push_back(std::make_pair(std::string(server_auth_field), std::move(out)));

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2020, The Monero Project // Copyright (c) 2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2020, The Monero Project // Copyright (c) 2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2017-2020, The Monero Project // Copyright (c) 2017-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //

Some files were not shown because too many files have changed in this diff Show More