mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Compare commits
314 Commits
0.28.2
...
0.30.0-hf1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa4f347e7c | ||
|
|
0a0adaac6d | ||
|
|
3d2aae9ea5 | ||
|
|
3d5ff2b4cd | ||
|
|
d20f0d5014 | ||
|
|
a8859b495b | ||
|
|
caccee1d98 | ||
|
|
379110a8a2 | ||
|
|
8d37cd9169 | ||
|
|
b40ade5165 | ||
|
|
c475b23c7d | ||
|
|
d6b9cfcc34 | ||
|
|
0c05bd3def | ||
|
|
8f7ab21423 | ||
|
|
07418cfb34 | ||
|
|
ac9816c01d | ||
|
|
bd3e4ac11c | ||
|
|
926d08db6f | ||
|
|
a23f6457dc | ||
|
|
4f9dba22c7 | ||
|
|
97e1a7db25 | ||
|
|
e03effd63b | ||
|
|
f9a65e4966 | ||
|
|
3c52fdfabe | ||
|
|
938b2fed7c | ||
|
|
d6875975ab | ||
|
|
92b2ca70b7 | ||
|
|
df6ac8f7f5 | ||
|
|
fa796a2eb5 | ||
|
|
c7b3153958 | ||
|
|
5bbb89753d | ||
|
|
654084d181 | ||
|
|
094f08211a | ||
|
|
74b0a7c633 | ||
|
|
8f09d3449d | ||
|
|
0c7a7903b6 | ||
|
|
6a8d24372e | ||
|
|
884dc11365 | ||
|
|
83830ef9c0 | ||
|
|
849e1ce5f4 | ||
|
|
4eb6020813 | ||
|
|
d655fdca56 | ||
|
|
b6df6748df | ||
|
|
269809dd1a | ||
|
|
65fdf1dc5e | ||
|
|
60002bf9bc | ||
|
|
dd94de2830 | ||
|
|
e1fc81f66f | ||
|
|
b2cf1e4c65 | ||
|
|
a65f692ab7 | ||
|
|
44e4a50050 | ||
|
|
ffbcb96eff | ||
|
|
eed1a891a7 | ||
|
|
9b787434c9 | ||
|
|
f4fe55caff | ||
|
|
8df88238cd | ||
|
|
ea0bd08660 | ||
|
|
c1f50ca7b3 | ||
|
|
a6f866b4d8 | ||
|
|
545b2fd6b1 | ||
|
|
b0a855a10e | ||
|
|
b5600e940a | ||
|
|
7f5d273e53 | ||
|
|
b0e6be93ff | ||
|
|
324c42ae09 | ||
|
|
acd03faee5 | ||
|
|
94af42da44 | ||
|
|
1e9624270d | ||
|
|
a50d67257c | ||
|
|
3759c553b0 | ||
|
|
332114c02a | ||
|
|
5d841c13b7 | ||
|
|
caecf78a6d | ||
|
|
408a62f7d0 | ||
|
|
b822d061ef | ||
|
|
020a112e77 | ||
|
|
8e33ae78f8 | ||
|
|
dbddc6b7f2 | ||
|
|
f32be2b28d | ||
|
|
0f05ebd834 | ||
|
|
14db51e3e4 | ||
|
|
8f3bb286f2 | ||
|
|
258c93f8d8 | ||
|
|
88f885f2e7 | ||
|
|
91eee1a42d | ||
|
|
6a55f99ede | ||
|
|
0b457497d0 | ||
|
|
b7c9e33343 | ||
|
|
502d5689bf | ||
|
|
d015debe2b | ||
|
|
d8aab5a749 | ||
|
|
7ed2094a6a | ||
|
|
464410d8be | ||
|
|
aa0e17dd93 | ||
|
|
b2cb4df29a | ||
|
|
3d777f3f5d | ||
|
|
1842878c40 | ||
|
|
23f47adb60 | ||
|
|
377e3d479c | ||
|
|
d5193a776e | ||
|
|
ef51128270 | ||
|
|
9b15c88b0e | ||
|
|
f1c29ae20b | ||
|
|
6d2e3da306 | ||
|
|
7695ea2822 | ||
|
|
c729ceab20 | ||
|
|
e8643dd8cc | ||
|
|
7b69592fe1 | ||
|
|
12e11721f9 | ||
|
|
96c13f0d98 | ||
|
|
df728cd2cd | ||
|
|
0d7cad8d64 | ||
|
|
d69285f6ad | ||
|
|
b8e192e058 | ||
|
|
aeebfeab10 | ||
|
|
8aafebbb75 | ||
|
|
c3da2e1f03 | ||
|
|
c8c8003677 | ||
|
|
caab155a00 | ||
|
|
1b85b6eaba | ||
|
|
863add6a19 | ||
|
|
64b80e0573 | ||
|
|
ed902d9dea | ||
|
|
f38b373cb6 | ||
|
|
b8f2fdb6ac | ||
|
|
182f570f24 | ||
|
|
5b90ccf65d | ||
|
|
22a8e25538 | ||
|
|
d63aab6312 | ||
|
|
774dcad392 | ||
|
|
7b7b27ee9e | ||
|
|
c5adbc859a | ||
|
|
2cc12b2f2f | ||
|
|
13b33b5d4d | ||
|
|
c7dea3ed17 | ||
|
|
a7e6ecb5b3 | ||
|
|
5964710f73 | ||
|
|
262a61564c | ||
|
|
4cc4421c82 | ||
|
|
2786950c16 | ||
|
|
e45c1b238f | ||
|
|
d166e6a45e | ||
|
|
e759137f15 | ||
|
|
0bb570a36d | ||
|
|
38c6083a2f | ||
|
|
cfdf0d2f0a | ||
|
|
f0dc2bc425 | ||
|
|
32ec3fe089 | ||
|
|
9e69bd5c56 | ||
|
|
ceeb36039e | ||
|
|
2bfae2f0ac | ||
|
|
b25f322c93 | ||
|
|
f77ecba896 | ||
|
|
5d2d88209f | ||
|
|
ecf1a3c69c | ||
|
|
3f0eacf5e7 | ||
|
|
d49f9ea109 | ||
|
|
2ec40cb6f1 | ||
|
|
3e342e4b71 | ||
|
|
147fee0272 | ||
|
|
fa900de548 | ||
|
|
8cd44c637d | ||
|
|
729caaacff | ||
|
|
2f5d721ec1 | ||
|
|
c15394c42a | ||
|
|
36a62f110c | ||
|
|
2d02b46253 | ||
|
|
6cf75f0fc2 | ||
|
|
1a3e2e3f36 | ||
|
|
645e32b19e | ||
|
|
fa0a61b5d7 | ||
|
|
2336fe2708 | ||
|
|
0cbd81146f | ||
|
|
a268c1a7ad | ||
|
|
3b7107b255 | ||
|
|
a2ea89c64e | ||
|
|
b44cb1a64c | ||
|
|
1dc3acb071 | ||
|
|
0cf58cc505 | ||
|
|
eb49e1bf47 | ||
|
|
0627d3487b | ||
|
|
84161b86c7 | ||
|
|
110bbf3956 | ||
|
|
fad9998f9d | ||
|
|
b38a96ae82 | ||
|
|
e82d774d32 | ||
|
|
8d1b169f5a | ||
|
|
70ccdabf7c | ||
|
|
af36942e1f | ||
|
|
b1b98fa3b0 | ||
|
|
bb251063fc | ||
|
|
663742e0d1 | ||
|
|
16c89aee04 | ||
|
|
abe735102a | ||
|
|
70a37811bd | ||
|
|
edab96e973 | ||
|
|
e7a50e2a5a | ||
|
|
e18ba24670 | ||
|
|
f41fc87a33 | ||
|
|
5ec3534fea | ||
|
|
6bd39a316e | ||
|
|
8434203e71 | ||
|
|
59431c513a | ||
|
|
edc1bc35fd | ||
|
|
18ccdf8bd4 | ||
|
|
a0dcc4da8c | ||
|
|
2b91e62d5d | ||
|
|
bc5a25168a | ||
|
|
f453c58389 | ||
|
|
ad74606ab3 | ||
|
|
bb15295935 | ||
|
|
f0c1fbb098 | ||
|
|
692f224e1c | ||
|
|
5bd9cd2ee8 | ||
|
|
70fc091e74 | ||
|
|
1d09c54fdc | ||
|
|
c7ebe7205c | ||
|
|
1b6c707abb | ||
|
|
a0010effbc | ||
|
|
c094772bc0 | ||
|
|
7ce871f3b2 | ||
|
|
77b3ad5de1 | ||
|
|
a75a0c0b84 | ||
|
|
072fc53019 | ||
|
|
5bad2db667 | ||
|
|
7c2478480d | ||
|
|
761f218c0a | ||
|
|
163e8eb8fc | ||
|
|
6fccd07479 | ||
|
|
c86a40a361 | ||
|
|
362726de4a | ||
|
|
5962a4817a | ||
|
|
2e05471d72 | ||
|
|
d998c6461e | ||
|
|
94f13fb606 | ||
|
|
7edf783102 | ||
|
|
efc2159441 | ||
|
|
3078c6da12 | ||
|
|
de6f678de7 | ||
|
|
d8d51e8103 | ||
|
|
361f1da5b8 | ||
|
|
30e068ae17 | ||
|
|
3b751cc6e6 | ||
|
|
6d60f19d73 | ||
|
|
94235d4b4f | ||
|
|
367c3a5bfc | ||
|
|
f3b172b0c9 | ||
|
|
023715474c | ||
|
|
f5873bcad0 | ||
|
|
9f27801b8d | ||
|
|
9eb0c2964c | ||
|
|
73d64bbafc | ||
|
|
ea67a2d051 | ||
|
|
1e7588d0ab | ||
|
|
b6b3548c0c | ||
|
|
097a8ce640 | ||
|
|
fed3f7b74b | ||
|
|
c079d9ae38 | ||
|
|
6a093b1b44 | ||
|
|
4dc573f195 | ||
|
|
b7f07aed00 | ||
|
|
cb791482a0 | ||
|
|
bd7eb94d69 | ||
|
|
223389a464 | ||
|
|
575f124fb8 | ||
|
|
483f768370 | ||
|
|
ab20ca95aa | ||
|
|
bf775036bc | ||
|
|
08bfd302fe | ||
|
|
3b6ea02920 | ||
|
|
26bfeb1319 | ||
|
|
72659d431e | ||
|
|
53dabe68ef | ||
|
|
ccd6b46995 | ||
|
|
91b3227a0f | ||
|
|
b354360bc0 | ||
|
|
8c24f7eb03 | ||
|
|
f473eade5a | ||
|
|
dc74a44b70 | ||
|
|
f96ac3db67 | ||
|
|
b11b9939f4 | ||
|
|
e595fd5e02 | ||
|
|
af52276cd9 | ||
|
|
2eec47415e | ||
|
|
4a2af70c2c | ||
|
|
6211065802 | ||
|
|
0f8206e269 | ||
|
|
4ccc3751d6 | ||
|
|
7ef6e58024 | ||
|
|
57689c4e66 | ||
|
|
2fc8d70655 | ||
|
|
7ee9f8513c | ||
|
|
1a843fb4f6 | ||
|
|
9111ad1a9d | ||
|
|
a5a9242f4e | ||
|
|
e4f585b7fe | ||
|
|
e3ac1001be | ||
|
|
67f2a5d9d6 | ||
|
|
89b9fa0b35 | ||
|
|
4c0de726c8 | ||
|
|
7d96075e14 | ||
|
|
924a8cdd4b | ||
|
|
b27d078c67 | ||
|
|
c64ec9cfb9 | ||
|
|
3d6e76046c | ||
|
|
48d6a4ab6a | ||
|
|
f535304e1b | ||
|
|
2f485672fa | ||
|
|
63d438c979 | ||
|
|
c955c03197 | ||
|
|
ceff6bc271 | ||
|
|
80a5f5878f | ||
|
|
1e6111c09c | ||
|
|
d468deee12 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -24,6 +24,11 @@ bin/rippled
|
||||
Debug/*.*
|
||||
Release/*.*
|
||||
|
||||
# Ignore coverage files.
|
||||
*.gcno
|
||||
*.gcda
|
||||
*.gcov
|
||||
|
||||
# Ignore locally installed node_modules
|
||||
/node_modules
|
||||
|
||||
|
||||
136
.travis.yml
136
.travis.yml
@@ -1,70 +1,84 @@
|
||||
sudo: false
|
||||
language: cpp
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
|
||||
env:
|
||||
- TARGET=debug
|
||||
- TARGET=debug.nounity
|
||||
# We can specify any combination of builds here, for example, to
|
||||
# include release builds, too, uncomment the following lines.
|
||||
#- TARGET=release
|
||||
#- TARGET=release.nounity
|
||||
global:
|
||||
# Maintenance note: to move to a new version
|
||||
# of boost, update both BOOST_ROOT and BOOST_URL.
|
||||
# Note that for simplicity, BOOST_ROOT's final
|
||||
# namepart must match the folder name internal
|
||||
# to boost's .tar.gz.
|
||||
- BOOST_ROOT=$HOME/boost_1_59_0
|
||||
- BOOST_URL='http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.59.0%2Fboost_1_59_0.tar.gz%2Fdownload&ts=1441761349&use_mirror=skylineservers'
|
||||
- RIPPLED_OLD_GCC_ABI=1
|
||||
|
||||
|
||||
packages: &gcc5_pkgs
|
||||
- gcc-5
|
||||
- g++-5
|
||||
- python-software-properties
|
||||
- protobuf-compiler
|
||||
- libprotobuf-dev
|
||||
- libssl-dev
|
||||
- libstdc++6
|
||||
- binutils-gold
|
||||
# Provides a backtrace if the unittests crash
|
||||
- gdb
|
||||
|
||||
packages: &gcc48_pkgs
|
||||
- gcc-4.8
|
||||
- g++-4.8
|
||||
- python-software-properties
|
||||
- protobuf-compiler
|
||||
- libprotobuf-dev
|
||||
- libssl-dev
|
||||
- libstdc++6
|
||||
- binutils-gold
|
||||
# Provides a backtrace if the unittests crash
|
||||
- gdb
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- compiler: gcc
|
||||
env: GCC_VER=5 TARGET=debug.nounity
|
||||
addons: &ao_gcc5
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: *gcc5_pkgs
|
||||
|
||||
- compiler: gcc
|
||||
env: GCC_VER=5 TARGET=coverage
|
||||
addons: *ao_gcc5
|
||||
|
||||
- compiler: clang
|
||||
env: GCC_VER=4.8 TARGET=debug
|
||||
addons: &ao_gcc48
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: *gcc48_pkgs
|
||||
|
||||
- compiler: clang
|
||||
env: GCC_VER=4.8 TARGET=debug.nounity
|
||||
addons: *ao_gcc48
|
||||
|
||||
- compiler: gcc
|
||||
env: GCC_VER=4.8 TARGET=debug
|
||||
addons: *ao_gcc48
|
||||
|
||||
- compiler: gcc
|
||||
env: GCC_VER=4.8 TARGET=debug.nounity
|
||||
addons: *ao_gcc48
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $BOOST_ROOT
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq python-software-properties
|
||||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
- sudo add-apt-repository -y ppa:afrank/boost
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq g++-4.8
|
||||
- sudo apt-get install -qq libboost1.57-all-dev
|
||||
- sudo apt-get install -qq mlocate
|
||||
- sudo updatedb
|
||||
- sudo locate libboost | grep /lib | grep -e ".a$"
|
||||
- sudo apt-get install -qq protobuf-compiler libprotobuf-dev libssl-dev exuberant-ctags
|
||||
# We need gcc >= 4.8 for some c++11 features
|
||||
- sudo apt-get install -qq gcc-4.8
|
||||
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
|
||||
- sudo update-alternatives --set gcc /usr/bin/gcc-4.8
|
||||
# Stuff is gold. Nuff said ;)
|
||||
- sudo apt-get -y install binutils-gold
|
||||
# We can get a backtrace if the guy crashes
|
||||
- sudo apt-get -y install gdb
|
||||
# What versions are we ACTUALLY running?
|
||||
- g++ -v
|
||||
- clang -v
|
||||
# Avoid `spurious errors` caused by ~/.npm permission issues
|
||||
# Does it already exist? Who owns? What permissions?
|
||||
- ls -lah ~/.npm || mkdir ~/.npm
|
||||
# Make sure we own it
|
||||
- sudo chown -R $USER ~/.npm
|
||||
- bin/ci/ubuntu/install-dependencies.sh
|
||||
|
||||
script:
|
||||
# Set so any failing command will abort the build
|
||||
- set -e
|
||||
# Make sure vcxproj is up to date
|
||||
- scons vcxproj
|
||||
- git diff --exit-code
|
||||
# $CC will be either `clang` or `gcc` (If only we could do -j12 ;)
|
||||
- scons $CC.$TARGET
|
||||
# We can be sure we're using the build/$CC.$TARGET variant (-f so never err)
|
||||
- rm -f build/rippled
|
||||
- export RIPPLED_PATH="$PWD/build/$CC.$TARGET/rippled"
|
||||
# See what we've actually built
|
||||
- ldd $RIPPLED_PATH
|
||||
# Run unittests (under gdb)
|
||||
- | # create gdb script
|
||||
echo "set env MALLOC_CHECK_=3" > script.gdb
|
||||
echo "run" >> script.gdb
|
||||
echo "backtrace full" >> script.gdb
|
||||
# gdb --help
|
||||
- cat script.gdb | gdb --ex 'set print thread-events off' --return-child-result --args $RIPPLED_PATH --unittest
|
||||
- npm install
|
||||
# Use build/(gcc|clang).$TARGET/rippled
|
||||
- |
|
||||
echo "exports.default_server_config = {\"rippled_path\" : \"$RIPPLED_PATH\"};" > test/config.js
|
||||
- bin/ci/ubuntu/build-and-test.sh
|
||||
|
||||
# Run integration tests
|
||||
- npm test
|
||||
notifications:
|
||||
email:
|
||||
false
|
||||
|
||||
@@ -17,18 +17,29 @@
|
||||
|
||||
"""
|
||||
Invocation:
|
||||
./Builds/Test.py - builds and tests all configurations
|
||||
|
||||
#
|
||||
# The build must succeed without shell aliases for this to work.
|
||||
#
|
||||
# Common problems:
|
||||
# 1) Boost not found. Solution: export BOOST_ROOT=[path to boost folder]
|
||||
# 2) OpenSSL not found. Solution: export OPENSSL_ROOT=[path to OpenSSL folder]
|
||||
# 3) scons is an alias. Solution: Create a script named "scons" somewhere in
|
||||
# your $PATH (eg. ~/bin/scons will often work).
|
||||
# #!/bin/sh
|
||||
# python /C/Python27/Scripts/scons.py "${@}"
|
||||
./Builds/Test.py - builds and tests all configurations
|
||||
|
||||
The build must succeed without shell aliases for this to work.
|
||||
|
||||
To pass flags to scons, put them at the very end of the command line, after
|
||||
the -- flag - like this:
|
||||
|
||||
./Builds/Test.py -- -j4 # Pass -j4 to scons.
|
||||
|
||||
|
||||
Common problems:
|
||||
|
||||
1) Boost not found. Solution: export BOOST_ROOT=[path to boost folder]
|
||||
|
||||
2) OpenSSL not found. Solution: export OPENSSL_ROOT=[path to OpenSSL folder]
|
||||
|
||||
3) scons is an alias. Solution: Create a script named "scons" somewhere in
|
||||
your $PATH (eg. ~/bin/scons will often work).
|
||||
|
||||
#!/bin/sh
|
||||
python /C/Python27/Scripts/scons.py "${@}"
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
|
||||
339
Builds/VisualStudio2015/README.md
Normal file
339
Builds/VisualStudio2015/README.md
Normal file
@@ -0,0 +1,339 @@
|
||||
# Visual Studio 2015 Build Instructions
|
||||
|
||||
## Important
|
||||
|
||||
We do not recommend Windows for rippled production use at this time. Currently, the Ubuntu
|
||||
platform has received the highest level of quality assurance, testing, and support.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To clone the source code repository, create branches for inspection or modification,
|
||||
build rippled under Visual Studio, and run the unit tests you will need these
|
||||
software components:
|
||||
|
||||
* [Visual Studio 2015](https://www.visualstudio.com/)
|
||||
* [Git for Windows](http://git-scm.com/)
|
||||
* [Google Protocol Buffers Compiler](https://code.google.com/p/protobuf/source/checkout)
|
||||
* [OpenSSL Library](README.md#install-openssl)
|
||||
* [ActivePerl](https://www.activestate.com/activeperl/downloads)
|
||||
(Recommended to build OpenSSL.)
|
||||
* [Boost 1.59 library](http://www.boost.org/users/download/)
|
||||
* [Node.js](http://nodejs.org/download/)
|
||||
|
||||
Any version of Visual Studio 2015 may be used, including the Visual Studio Community
|
||||
Edition which is available under a free license.
|
||||
|
||||
## Install Software
|
||||
|
||||
### Install Visual Studio 2015
|
||||
|
||||
If not already installed on your system, download your choice of installers from the
|
||||
[Visual Studio 2015 Download](https://www.visualstudio.com/downloads/download-visual-studio-vs)
|
||||
page, run the installer, and follow the directions.
|
||||
The **Visual Studio 2015 Community** edition is available for free, while paid editions
|
||||
may be used for an free initial trial period.
|
||||
|
||||
### Install Git for Windows
|
||||
|
||||
Git is a distributed revision control system. The Windows version also provides the
|
||||
bash shell and many Windows versions of Unix commands. While there are other
|
||||
varieties of Git (such as TortoiseGit, which has a native Windows interface and
|
||||
integrates with the Explorer shell), we recommend installing
|
||||
[Git for Windows](https://git-scm.com/) since
|
||||
it provides a Unix-like command line environment useful for running shell scripts.
|
||||
Use of the bash shell under Windows is mandatory for running the unit tests.
|
||||
|
||||
* NOTE: To gain full featured access to the
|
||||
[git-subtree](https://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/)
|
||||
functionality used in the rippled repository we suggest Git version 1.8.3.2 or later.
|
||||
|
||||
### Install Google Protocol Buffers Compiler
|
||||
|
||||
Building rippled requires **protoc.exe** version 2.5.1 or later. At your option you
|
||||
may build it yourself from the sources in the
|
||||
[Google Protocol Buffers](https://github.com/google/protobuf) repository,
|
||||
or you may download a
|
||||
[protoc.exe](https://ripple.github.io/Downloads/protoc/2.5.1/protoc.exe)
|
||||
([alternate link](https://github.com/ripple/Downloads/raw/gh-pages/protoc/2.5.1/protoc.exe))
|
||||
precompiled Windows executable from the
|
||||
[Ripple Organization](https://github.com/ripple).
|
||||
|
||||
Either way, once you have the required version of **protoc.exe**, copy it into
|
||||
a folder in your command line `%PATH%`.
|
||||
|
||||
* **NOTE:** If you use an older version of the compiler, the build will fail with
|
||||
errors related to a mismatch of the version of protocol buffer headers versus
|
||||
the compiler.
|
||||
|
||||
### Install ActivePerl
|
||||
|
||||
If not already installed on your system, download your choice of installers from the
|
||||
[Activeperl Download](https://www.activestate.com/activeperl/downloads)
|
||||
page, run the installer, and follow the directions.
|
||||
|
||||
## Configure Dependencies
|
||||
|
||||
### Install OpenSSL
|
||||
|
||||
1. Download OpenSSL *v1.0.2d or higher* source https://www.openssl.org/source/
|
||||
2. Unpack the source archive into a temporary folder.
|
||||
3. Open `cmd.exe`. Change the the folder where you unpacked OpenSSL.
|
||||
4. Build the 64-bit libraries: (
|
||||
[Reference 1](http://developer.covenanteyes.com/building-openssl-for-visual-studio/),
|
||||
[Reference 2](http://www.p-nand-q.com/programming/windows/building_openssl_with_visual_studio_2013.html))
|
||||
|
||||
```powershell
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
|
||||
|
||||
perl Configure VC-WIN64A --prefix=C:\lib\openssl-VC-64
|
||||
ms\do_win64a
|
||||
nmake -f ms\nt.mak
|
||||
nmake -f ms\nt.mak install
|
||||
|
||||
copy tmp32\lib.pdb C:\lib\openssl-VC-64\lib\
|
||||
```
|
||||
5. Optionally, delete the temporary folder.
|
||||
|
||||
* NOTE: Since rippled links statically to OpenSSL, it does not matter where the OpenSSL
|
||||
.DLL files are placed, or what version they are. rippled does not use or require any
|
||||
external .DLL files to run other than the standard operating system ones.
|
||||
|
||||
### Build Boost
|
||||
|
||||
After downloading boost and unpacking it, open a **Developer Command Prompt** for
|
||||
Visual Studio, change to the directory containing boost, then bootstrap the build tools:
|
||||
|
||||
```powershell
|
||||
cd C:\lib\boost_1_59_0
|
||||
bootstrap
|
||||
```
|
||||
|
||||
The rippled application is linked statically to the standard runtimes and external
|
||||
dependencies on Windows, to ensure that the behavior of the executable is not
|
||||
affected by changes in outside files. Therefore, it is necessary to build the
|
||||
required boost static libraries using this command:
|
||||
|
||||
```powershell
|
||||
bjam --toolset=msvc-14.0 --build-type=complete variant=debug,release link=static runtime-link=static address-model=64
|
||||
```
|
||||
|
||||
Building the boost libraries may take considerable time. When the build process
|
||||
is completed, take note of both the reported compiler include paths and linker
|
||||
library paths as they will be required later.
|
||||
|
||||
* NOTE: If older versions of Visual Studio are also installed, the build may fail.
|
||||
If this happens, make sure that only Visual Studio 2015 is installed. Due to
|
||||
defects in the uninstallation procedures of these Microsoft products, it may
|
||||
be necessary to start with a fresh install of the operating system with only
|
||||
the necessary development environment components installed to have a successful build.
|
||||
|
||||
### Clone the rippled repository
|
||||
|
||||
If you are familiar with cloning github repositories, just follow your normal process
|
||||
and clone `git@github.com:ripple/rippled.git`. Otherwise follow this section for instructions.
|
||||
|
||||
1. If you don't have a github account, sign up for one at
|
||||
[github.com](https://github.com/).
|
||||
2. Make sure you have Github ssh keys. For help see
|
||||
[generating-ssh-keys](https://help.github.com/articles/generating-ssh-keys).
|
||||
|
||||
Open the "Git Bash" shell that was installed with "Git for Windows" in the
|
||||
step above. Navigate to the directory where you want to clone rippled (git
|
||||
bash uses `/c` for windows's `C:` and forward slash where windows uses
|
||||
backslash, so `C:\Users\joe\projs` would be `/c/Users/joe/projs` in git bash).
|
||||
Now clone the repository and optionally switch to the *master* branch.
|
||||
Type the following at the bash prompt:
|
||||
|
||||
```powershell
|
||||
git clone git@github.com:ripple/rippled.git
|
||||
cd rippled
|
||||
git checkout master
|
||||
```
|
||||
|
||||
* If you receive an error about not having the "correct access rights"
|
||||
make sure you have Github ssh keys, as described above.
|
||||
|
||||
### Configure Library Paths
|
||||
|
||||
Open the solution file located at **Builds/Visual Studio 2015/ripple.sln**
|
||||
and select the "View->Other Windows->Property Manager" to bring up the Property Manager.
|
||||
Expand the *debug | x64* section (or similar section on 32-windows) and
|
||||
double click the *Microsoft.Cpp.x64.user* property sheet to bring up the
|
||||
*Property Pages* dialog (these sections will be called *Win32* instead of
|
||||
*x64* on 32-bit windows). These are global properties applied to all
|
||||
64-bit build targets:
|
||||
|
||||

|
||||
|
||||
Go to *C/C++, General, Additional Include Directories* and add the
|
||||
location of the boost installation:
|
||||
|
||||

|
||||
|
||||
Then, go to *Linker, General, Additional Library Directories* and add
|
||||
the location of the compiled boost libraries reported at the completion
|
||||
of building the boost libraries:
|
||||
|
||||

|
||||
|
||||
Follow the same procedure for adding the `Additional Include Directories`
|
||||
and `Additional Library Directories` required for OpenSSL. In our example
|
||||
these directories are **C:\lib\openssl-VC-64\include** and
|
||||
**C:\lib\openssl-VC-64\lib** respectively.
|
||||
|
||||
# Setup Environment
|
||||
|
||||
## Create a working directory for rippled.cfg
|
||||
|
||||
The rippled server uses the [Rippled.cfg](https://wiki.ripple.com/Rippled.cfg)
|
||||
file to read its configuration parameters. This section describes setting up
|
||||
a directory to hold the config file. The next sections describe how to tell
|
||||
the rippled server where that file is.
|
||||
|
||||
1. Create a directory to hold the configuration file. In this example, the
|
||||
ripple config directory was created in `C:\Users\joe\ripple\config`.
|
||||
2. Copy the example config file located in `doc\rippled-example.cfg` to the
|
||||
new directory and rename it "rippled.cfg".
|
||||
3. Read the rippled.cfg file and edit as appropriate.
|
||||
|
||||
## Change the Visual Studio Projects Debugging Properties
|
||||
|
||||
1. If not already open, open the solution file located at **Builds/Visual Studio 2015/Ripple.sln**
|
||||
2. Select the correct solution platform in the solution platform dropdown (either *x64*
|
||||
or *Win32* depending on machine type).
|
||||
3. Select the "Project->Properties" menu item to bring up RippleD's Properties Pages
|
||||
4. In "Configuration Properties" select "Debugging".
|
||||
5. In the upper-left Configurations drop down, select "All Configurations".
|
||||
6. In "Debugger to Launch" select "Local Windows Debugger".
|
||||
|
||||
### Tell rippled where to find the configuration file.
|
||||
|
||||
The `--conf` command-line switch to tell rippled where to find this file.
|
||||
In the "Command Arguments" field in the properties dialog (that you opened
|
||||
in the above section), add: `--conf="C:/Users/joe/ripple/config/rippled.cfg"`
|
||||
(of course replacing that path with the path you set up above).
|
||||
|
||||

|
||||
|
||||
### Set the _NO_DEBUG_HEAP Environment Variable
|
||||
|
||||
Rippled can run very slowly in the debugger when using the Windows Debug Heap.
|
||||
Set the `_NO_DEBUG_HEAP` environment variable to one to disable the debug heap.
|
||||
In the "Environment" field (that you opened in the above section), add:
|
||||
`_NO_DEBUG_HEAP=1`
|
||||
|
||||

|
||||
|
||||
# Build
|
||||
|
||||
After these steps are complete, rippled should be ready to build. Simply
|
||||
set rippled as the startup project by right clicking on it in the
|
||||
Visual Studio Solution Explorer, choose **Set as Startup Project**,
|
||||
and then choose the **Build->Build Solution** menu item.
|
||||
|
||||
# Unit Tests (Recommended)
|
||||
|
||||
The external rippled unit tests are written in Javascript using Node.js,
|
||||
and utilize the mocha unit test framework. To run the unit tests, it
|
||||
will be necessary to perform the following steps:
|
||||
|
||||
## Install Node.js
|
||||
|
||||
[Install Node.js](http://nodejs.org/download/). We recommend the Windows
|
||||
installer (**.msi** file) as it takes care of updating the *PATH* environment
|
||||
variable so that scripts can find the command. On Windows systems,
|
||||
**Node.js** comes with **npm**. A separate installation of **npm**
|
||||
is not necessary.
|
||||
|
||||
## Create node_modules
|
||||
|
||||
Open a windows console. From the root of your local rippled repository
|
||||
directory, invoke **npm** to bring in the necessary components:
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
If you get an error that looks like
|
||||
|
||||
```
|
||||
Error: ENOENT, stat 'C:\Users\username\AppData\Roaming\npm'
|
||||
```
|
||||
|
||||
simply create the indicated folder and try again.
|
||||
|
||||
## Create a test config.js
|
||||
|
||||
From a *bash* shell (installed with Git for Windows), copy the
|
||||
example configuration file into the appropriate location:
|
||||
|
||||
```
|
||||
cp test/config-example.js test/config.js
|
||||
```
|
||||
|
||||
Edit your version of test/config.js to reflect the correct path to the rippled executable:
|
||||
|
||||
```
|
||||
exports.default_server_config = {
|
||||
// Where to find the binary.
|
||||
rippled_path: path.resolve(__dirname, "../build/msvc.debug/rippled.exe")
|
||||
};
|
||||
```
|
||||
|
||||
Also in **test/config.js**, change any occurrences of the
|
||||
IP address *0.0.0.0* to *127.0.0.1*.
|
||||
|
||||
## Run Tests
|
||||
|
||||
From a windows console, run the unit tests:
|
||||
|
||||
```
|
||||
npm test
|
||||
```
|
||||
|
||||
Alternatively, run an individual test using mocha:
|
||||
|
||||
```
|
||||
sh
|
||||
node_modules/mocha/bin/mocha test/account_tx-test.js
|
||||
```
|
||||
|
||||
* NOTE: The version of ripple-lib provided by the npm install
|
||||
facility is usually slightly behind the develop branch of the
|
||||
authoritative ripple-lib repository. Therefore, some tests might fail.
|
||||
|
||||
## Development ripple-lib
|
||||
|
||||
To use the latest branch of **ripple-lib** during the unit tests,
|
||||
first clone the repository in a new location outside of your rippled
|
||||
repository. Then update the submodules. After, run **npm install**
|
||||
to set up the **node_modules** directory. Finally, install the
|
||||
**grunt** command line tools required to run **grunt** and
|
||||
build **ripple-lib**.
|
||||
|
||||
```
|
||||
git clone git@github.com:ripple/ripple-lib.git
|
||||
cd ripple-lib
|
||||
git submodule update --init
|
||||
npm install
|
||||
npm install -g grunt-cli
|
||||
grunt
|
||||
```
|
||||
|
||||
Now link this version of **ripple-lib** into the global packages:
|
||||
|
||||
```
|
||||
sudo npm link
|
||||
```
|
||||
|
||||
To make rippled use the newly linked global **ripple-lib** package
|
||||
instead of the one installed under **node_modules**, change
|
||||
directories to the local rippled repository and delete the old
|
||||
**ripple-lib** then link to the new one:
|
||||
|
||||
```
|
||||
sh
|
||||
rm -rf node_modules/ripple-lib
|
||||
npm link ripple-lib
|
||||
```
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
BIN
Builds/VisualStudio2015/images/NoDebugHeapPropPage.png
Normal file
BIN
Builds/VisualStudio2015/images/NoDebugHeapPropPage.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
Builds/VisualStudio2015/images/VS2015x64IncludeDirs.png
Normal file
BIN
Builds/VisualStudio2015/images/VS2015x64IncludeDirs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
BIN
Builds/VisualStudio2015/images/VS2015x64LibraryDirs.png
Normal file
BIN
Builds/VisualStudio2015/images/VS2015x64LibraryDirs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
BIN
Builds/VisualStudio2015/images/VS2015x64Properties.png
Normal file
BIN
Builds/VisualStudio2015/images/VS2015x64Properties.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
Builds/VisualStudio2015/images/VSCommandArgsPropPage.png
Normal file
BIN
Builds/VisualStudio2015/images/VSCommandArgsPropPage.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -1,9 +1,9 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 2013 for Windows Desktop
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}") = "RippleD", "RippleD.vcxproj", "{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -1,14 +1,18 @@
|
||||
%define rippled_branch %(echo $RIPPLED_BRANCH)
|
||||
Name: rippled
|
||||
Version: 0.28.2
|
||||
Release: 1%{?dist}
|
||||
# Version must be limited to MAJOR.MINOR.PATCH
|
||||
Version: 0.30.0
|
||||
# Release should include either the build or hotfix number (ex: hf1%{?dist} or b2%{?dist})
|
||||
# If there is no b# or hf#, then use 1%{?dist}
|
||||
Release: %{?dist}
|
||||
Summary: Ripple peer-to-peer network daemon
|
||||
|
||||
Group: Applications/Internet
|
||||
License: ISC
|
||||
URL: https://github.com/ripple/rippled
|
||||
|
||||
# curl -L -o SOURCES/rippled-release.zip https://github.com/ripple/rippled/archive/release.zip
|
||||
Source0: rippled-release.zip
|
||||
# curl -L -o SOURCES/rippled-release.zip https://github.com/ripple/rippled/archive/${RIPPLED_BRANCH}.zip
|
||||
Source0: rippled-%{rippled_branch}.zip
|
||||
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||
|
||||
BuildRequires: gcc-c++ scons openssl-devel protobuf-devel
|
||||
@@ -20,13 +24,11 @@ Rippled is the server component of the Ripple network.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -n rippled-release
|
||||
%setup -n rippled-%{rippled_branch}
|
||||
|
||||
|
||||
%build
|
||||
# Assume boost is manually installed
|
||||
export RIPPLED_BOOST_HOME=/usr/local/boost_1_55_0
|
||||
scons -j `grep -c processor /proc/cpuinfo` build/rippled
|
||||
scons -j `grep -c processor /proc/cpuinfo`
|
||||
|
||||
|
||||
%install
|
||||
@@ -49,4 +51,4 @@ rm -rf %{buildroot}
|
||||
%defattr(-,root,root,-)
|
||||
/usr/bin/rippled
|
||||
/usr/share/rippled/LICENSE
|
||||
/etc/rippled/rippled-example.cfg
|
||||
%config(noreplace) /etc/rippled/rippled.cfg
|
||||
|
||||
@@ -117,6 +117,13 @@ LICENSE file for more details.
|
||||
* Ripple Wiki - https://ripple.com/wiki/
|
||||
* Ripple Primer - https://ripple.com/ripple_primer.pdf
|
||||
* Ripple Primer (Market Making) - https://ripple.com/ripple-mm.pdf
|
||||
* Ripple Gateway Primer - https://ripple.com/ripple-gateways.pdf
|
||||
* Ripple Gateway Primer - https://ripple.com/ripple-gateways.pdf
|
||||
* Consensus - https://wiki.ripple.com/Consensus
|
||||
|
||||
- - -
|
||||
|
||||
Copyright © 2015, Ripple Labs. All rights reserved.
|
||||
|
||||
Portions of this document, including but not limited to the Ripple logo, images
|
||||
and image templates are the property of Ripple Labs and cannot be copied or
|
||||
used without permission.
|
||||
|
||||
142
SConstruct
142
SConstruct
@@ -15,11 +15,13 @@
|
||||
|
||||
clang All clang variants
|
||||
clang.debug clang debug variant
|
||||
clang.coverage clang coverage variant
|
||||
clang.release clang release variant
|
||||
clang.profile clang profile variant
|
||||
|
||||
gcc All gcc variants
|
||||
gcc.debug gcc debug variant
|
||||
gcc.coverage gcc coverage variant
|
||||
gcc.release gcc release variant
|
||||
gcc.profile gcc profile variant
|
||||
|
||||
@@ -56,7 +58,7 @@ The following environment variables modify the build environment:
|
||||
If set, used to detect a toolchain.
|
||||
|
||||
BOOST_ROOT
|
||||
Path to the boost directory.
|
||||
Path to the boost directory.
|
||||
OPENSSL_ROOT
|
||||
Path to the openssl directory.
|
||||
|
||||
@@ -65,6 +67,19 @@ The following extra options may be used:
|
||||
(see: https://martine.github.io/ninja/). Only gcc and clang targets
|
||||
are supported.
|
||||
|
||||
GCC 5 support: There is transitional support for user-installed gcc 5. Setting
|
||||
the environment variable: `RIPPLED_OLD_GCC_ABI` to one enables the transitional
|
||||
support. Due to an ABI change between gcc 4 and gcc 5, it is assumed all
|
||||
libraries are built with the old, gcc 4 ABI. Since no linux distro has upgraded
|
||||
to gcc 5, this allows us to use the package manager to install rippled
|
||||
dependencies and to easily switch between gcc 4 and gcc 5. It also means if the
|
||||
user builds C++ dependencies themselves - such as boost - they must either be
|
||||
built with gcc 4 or with the preprocessor flag `_GLIBCXX_USE_CXX11_ABI` set to
|
||||
zero. When linux distros upgrade to gcc 5, the transitional support will be
|
||||
removed. To enable C++-14 support, define the environment variable `RIPPLED_USE_CPP_14`
|
||||
to one. This is also transitional and will be removed when we permanently enable C++ 14
|
||||
support.
|
||||
|
||||
'''
|
||||
#
|
||||
'''
|
||||
@@ -108,6 +123,7 @@ BUILD_TIME = 'Mon Apr 7 20:33:19 UTC 2014'
|
||||
OPENSSL_ERROR = ('Your openSSL was built on %s; '
|
||||
'rippled needs a version built on or after %s.')
|
||||
UNITY_BUILD_DIRECTORY = 'src/ripple/unity/'
|
||||
USE_CPP_14 = os.getenv('RIPPLED_USE_CPP_14')
|
||||
|
||||
def check_openssl():
|
||||
if Beast.system.platform in CHECK_PLATFORMS:
|
||||
@@ -250,6 +266,9 @@ def print_coms(target, source, env):
|
||||
# TODO Add 'PROTOCCOM' to this list and make it work
|
||||
Beast.print_coms(['CXXCOM', 'CCCOM', 'LINKCOM'], env)
|
||||
|
||||
def is_debug_variant(variant):
|
||||
return variant in ('debug', 'coverage')
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Set construction variables for the base environment
|
||||
@@ -266,13 +285,22 @@ def config_base(env):
|
||||
'OPENSSL_NO_SSL2'
|
||||
,'DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER'
|
||||
,{'HAVE_USLEEP' : '1'}
|
||||
,{'SOCI_CXX_C11' : '1'}
|
||||
,'_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS'
|
||||
])
|
||||
|
||||
if USE_CPP_14:
|
||||
env.Append(CPPDEFINES=[
|
||||
'-DBEAST_NO_CXX14_COMPATIBILITY',
|
||||
'-DBEAST_NO_CXX14_INTEGER_SEQUENCE',
|
||||
'-DBEAST_NO_CXX14_MAKE_UNIQUE',
|
||||
'-DBEAST_NO_CXX14_EQUAL',
|
||||
'-DBOOST_NO_AUTO_PTR',
|
||||
'-DBEAST_NO_CXX14_MAKE_REVERSE_ITERATOR',
|
||||
])
|
||||
|
||||
try:
|
||||
BOOST_ROOT = os.path.normpath(os.environ['BOOST_ROOT'])
|
||||
env.Append(CPPPATH=[
|
||||
BOOST_ROOT,
|
||||
])
|
||||
env.Append(LIBPATH=[
|
||||
os.path.join(BOOST_ROOT, 'stage', 'lib'),
|
||||
])
|
||||
@@ -287,7 +315,7 @@ def config_base(env):
|
||||
os.path.join(OPENSSL_ROOT, 'include'),
|
||||
])
|
||||
env.Append(LIBPATH=[
|
||||
os.path.join(OPENSSL_ROOT, 'lib', 'VC', 'static'),
|
||||
os.path.join(OPENSSL_ROOT, 'lib'),
|
||||
])
|
||||
except KeyError:
|
||||
pass
|
||||
@@ -307,14 +335,31 @@ def config_base(env):
|
||||
env.Append(CPPPATH=[os.path.join(profile_jemalloc, 'include')])
|
||||
env.Append(LINKFLAGS=['-Wl,-rpath,' + os.path.join(profile_jemalloc, 'lib')])
|
||||
|
||||
def gccStdLibDir():
|
||||
try:
|
||||
for l in subprocess.check_output(['gcc', '-v'], stderr=subprocess.STDOUT).split():
|
||||
if l.startswith('--prefix'):
|
||||
return l.split('=')[1] + '/lib64'
|
||||
except:
|
||||
pass
|
||||
raise SCons.UserError('Could not find gccStdLibDir')
|
||||
|
||||
# Set toolchain and variant specific construction variables
|
||||
def config_env(toolchain, variant, env):
|
||||
if variant == 'debug':
|
||||
if is_debug_variant(variant):
|
||||
env.Append(CPPDEFINES=['DEBUG', '_DEBUG'])
|
||||
|
||||
elif variant == 'release' or variant == 'profile':
|
||||
env.Append(CPPDEFINES=['NDEBUG'])
|
||||
|
||||
if 'BOOST_ROOT' in env:
|
||||
if toolchain == 'gcc':
|
||||
env.Append(CCFLAGS=['-isystem' + env['BOOST_ROOT']])
|
||||
else:
|
||||
env.Append(CPPPATH=[
|
||||
env['BOOST_ROOT'],
|
||||
])
|
||||
|
||||
if toolchain in Split('clang gcc'):
|
||||
if Beast.system.linux:
|
||||
env.ParseConfig('pkg-config --static --cflags --libs openssl')
|
||||
@@ -351,7 +396,7 @@ def config_env(toolchain, variant, env):
|
||||
|
||||
env.Append(CXXFLAGS=[
|
||||
'-frtti',
|
||||
'-std=c++11',
|
||||
'-std=c++14' if USE_CPP_14 else '-std=c++11',
|
||||
'-Wno-invalid-offsetof'])
|
||||
|
||||
env.Append(CPPDEFINES=['_FILE_OFFSET_BITS=64'])
|
||||
@@ -371,8 +416,24 @@ def config_env(toolchain, variant, env):
|
||||
])
|
||||
else:
|
||||
if toolchain == 'gcc':
|
||||
if os.getenv('RIPPLED_OLD_GCC_ABI'):
|
||||
gcc_ver = ''
|
||||
try:
|
||||
gcc_ver = subprocess.check_output(['gcc', '-dumpversion'],
|
||||
stderr=subprocess.STDOUT).strip()
|
||||
except:
|
||||
pass
|
||||
if gcc_ver.startswith('5'):
|
||||
# remove rpath and CXX11_ABI flag when distro uses
|
||||
# non-user installed gcc 5
|
||||
env.Append(CPPDEFINES={
|
||||
'-D_GLIBCXX_USE_CXX11_ABI' : 0
|
||||
})
|
||||
env.Append(LINKFLAGS=['-Wl,-rpath,' + gccStdLibDir()])
|
||||
|
||||
env.Append(CCFLAGS=[
|
||||
'-Wno-unused-but-set-variable'
|
||||
'-Wno-unused-but-set-variable',
|
||||
'-Wno-deprecated',
|
||||
])
|
||||
|
||||
boost_libs = [
|
||||
@@ -414,6 +475,12 @@ def config_env(toolchain, variant, env):
|
||||
'-fno-strict-aliasing'
|
||||
])
|
||||
|
||||
if variant == 'coverage':
|
||||
env.Append(CXXFLAGS=[
|
||||
'-fprofile-arcs', '-ftest-coverage'])
|
||||
env.Append(LINKFLAGS=[
|
||||
'-fprofile-arcs', '-ftest-coverage'])
|
||||
|
||||
if toolchain == 'clang':
|
||||
if Beast.system.osx:
|
||||
env.Replace(CC='clang', CXX='clang++', LINK='clang++')
|
||||
@@ -428,6 +495,8 @@ def config_env(toolchain, variant, env):
|
||||
env.Append(CXXFLAGS=[
|
||||
'-Wno-mismatched-tags',
|
||||
'-Wno-deprecated-register',
|
||||
'-Wno-unused-local-typedefs',
|
||||
'-Wno-unknown-warning-option',
|
||||
])
|
||||
|
||||
elif toolchain == 'gcc':
|
||||
@@ -441,7 +510,7 @@ def config_env(toolchain, variant, env):
|
||||
# If we are in debug mode, use GCC-specific functionality to add
|
||||
# extra error checking into the code (e.g. std::vector will throw
|
||||
# for out-of-bounds conditions)
|
||||
if variant == 'debug':
|
||||
if is_debug_variant(variant):
|
||||
env.Append(CPPDEFINES={
|
||||
'_FORTIFY_SOURCE': 2
|
||||
})
|
||||
@@ -486,8 +555,8 @@ def config_env(toolchain, variant, env):
|
||||
'WIN32_CONSOLE',
|
||||
])
|
||||
env.Append(LIBS=[
|
||||
'ssleay32MT.lib',
|
||||
'libeay32MT.lib',
|
||||
'ssleay32.lib',
|
||||
'libeay32.lib',
|
||||
'Shlwapi.lib',
|
||||
'kernel32.lib',
|
||||
'user32.lib',
|
||||
@@ -553,13 +622,14 @@ base.Append(CPPPATH=[
|
||||
os.path.join('src', 'beast'),
|
||||
os.path.join(build_dir, 'proto'),
|
||||
os.path.join('src','soci','src'),
|
||||
os.path.join('src','soci','include'),
|
||||
])
|
||||
|
||||
base.Decider('MD5-timestamp')
|
||||
set_implicit_cache()
|
||||
|
||||
# Configure the toolchains, variants, default toolchain, and default target
|
||||
variants = ['debug', 'release', 'profile']
|
||||
variants = ['debug', 'coverage', 'release', 'profile']
|
||||
all_toolchains = ['clang', 'gcc', 'msvc']
|
||||
if Beast.system.osx:
|
||||
toolchains = ['clang']
|
||||
@@ -634,6 +704,7 @@ def get_soci_sources(style):
|
||||
result = []
|
||||
cpp_path = [
|
||||
'src/soci/src/core',
|
||||
'src/soci/include/private',
|
||||
'src/sqlite', ]
|
||||
append_sources(result,
|
||||
'src/ripple/unity/soci.cpp',
|
||||
@@ -644,8 +715,20 @@ def get_soci_sources(style):
|
||||
CPPPATH=cpp_path)
|
||||
return result
|
||||
|
||||
def get_common_sources(toolchain):
|
||||
result = []
|
||||
if toolchain == 'msvc':
|
||||
warning_flags = {}
|
||||
else:
|
||||
warning_flags = {'CCFLAGS': ['-Wno-unused-function']}
|
||||
append_sources(
|
||||
result,
|
||||
'src/ripple/unity/secp256k1.cpp',
|
||||
CPPPATH=['src/secp256k1'],
|
||||
**warning_flags)
|
||||
return result
|
||||
|
||||
def get_classic_sources():
|
||||
def get_classic_sources(toolchain):
|
||||
result = []
|
||||
append_sources(
|
||||
result,
|
||||
@@ -658,13 +741,17 @@ def get_classic_sources():
|
||||
append_sources(result, *list_sources('src/ripple/basics', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/crypto', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/json', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/ledger', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/legacy', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/net', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/overlay', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/peerfinder', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/protocol', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/rpc', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/shamap', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/test', '.cpp'))
|
||||
append_sources(result, *list_sources('src/ripple/unl', '.cpp'))
|
||||
|
||||
append_sources(
|
||||
result,
|
||||
*list_sources('src/ripple/nodestore', '.cpp'),
|
||||
@@ -675,10 +762,11 @@ def get_classic_sources():
|
||||
])
|
||||
|
||||
result += get_soci_sources('classic')
|
||||
result += get_common_sources(toolchain)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def get_unity_sources():
|
||||
def get_unity_sources(toolchain):
|
||||
result = []
|
||||
append_sources(
|
||||
result,
|
||||
@@ -686,21 +774,23 @@ def get_unity_sources():
|
||||
'src/ripple/unity/app_main.cpp',
|
||||
'src/ripple/unity/app_misc.cpp',
|
||||
'src/ripple/unity/app_paths.cpp',
|
||||
'src/ripple/unity/app_tests.cpp',
|
||||
'src/ripple/unity/app_tx.cpp',
|
||||
'src/ripple/unity/core.cpp',
|
||||
'src/ripple/unity/basics.cpp',
|
||||
'src/ripple/unity/crypto.cpp',
|
||||
'src/ripple/unity/ledger.cpp',
|
||||
'src/ripple/unity/net.cpp',
|
||||
'src/ripple/unity/overlay.cpp',
|
||||
'src/ripple/unity/peerfinder.cpp',
|
||||
'src/ripple/unity/json.cpp',
|
||||
'src/ripple/unity/protocol.cpp',
|
||||
'src/ripple/unity/rpcx.cpp',
|
||||
'src/ripple/unity/shamap.cpp',
|
||||
'src/ripple/unity/test.cpp',
|
||||
'src/ripple/unity/unl.cpp',
|
||||
)
|
||||
|
||||
result += get_soci_sources('unity')
|
||||
|
||||
append_sources(
|
||||
result,
|
||||
'src/ripple/unity/nodestore.cpp',
|
||||
@@ -710,6 +800,9 @@ def get_unity_sources():
|
||||
'src/snappy/config',
|
||||
])
|
||||
|
||||
result += get_soci_sources('unity')
|
||||
result += get_common_sources(toolchain)
|
||||
|
||||
return result
|
||||
|
||||
# Declare the targets
|
||||
@@ -772,15 +865,11 @@ def should_build_ninja(style, toolchain, variant):
|
||||
return False
|
||||
|
||||
for tu_style in ['classic', 'unity']:
|
||||
if tu_style == 'classic':
|
||||
sources = get_classic_sources()
|
||||
else:
|
||||
sources = get_unity_sources()
|
||||
for toolchain in all_toolchains:
|
||||
for variant in variants:
|
||||
if not should_prepare_targets(tu_style, toolchain, variant):
|
||||
continue
|
||||
if variant == 'profile' and toolchain == 'msvc':
|
||||
if variant in ['profile', 'coverage'] and toolchain == 'msvc':
|
||||
continue
|
||||
# Configure this variant's construction environment
|
||||
env = base.Clone()
|
||||
@@ -800,6 +889,10 @@ for tu_style in ['classic', 'unity']:
|
||||
|
||||
object_builder = ObjectBuilder(env, variant_dirs)
|
||||
|
||||
if tu_style == 'classic':
|
||||
sources = get_classic_sources(toolchain)
|
||||
else:
|
||||
sources = get_unity_sources(toolchain)
|
||||
for s, k in sources:
|
||||
object_builder.add_source_files(*s, **k)
|
||||
|
||||
@@ -822,9 +915,7 @@ for tu_style in ['classic', 'unity']:
|
||||
'src/ripple/unity/protobuf.cpp',
|
||||
'src/ripple/unity/ripple.proto.cpp',
|
||||
'src/ripple/unity/resource.cpp',
|
||||
'src/ripple/unity/rpcx.cpp',
|
||||
'src/ripple/unity/server.cpp',
|
||||
'src/ripple/unity/validators.cpp',
|
||||
'src/ripple/unity/websocket02.cpp'
|
||||
)
|
||||
|
||||
@@ -910,7 +1001,7 @@ for key, value in aliases.iteritems():
|
||||
env.Alias(key, value)
|
||||
|
||||
vcxproj = base.VSProject(
|
||||
os.path.join('Builds', 'VisualStudio2013', 'RippleD'),
|
||||
os.path.join('Builds', 'VisualStudio2015', 'RippleD'),
|
||||
source = [],
|
||||
VSPROJECT_ROOT_DIRS = ['src/beast', 'src', '.'],
|
||||
VSPROJECT_CONFIGS = msvc_configs)
|
||||
@@ -944,4 +1035,3 @@ def do_count(target, source, env):
|
||||
print "Total unit test lines: %d" % lines
|
||||
|
||||
PhonyTargets(env, count = do_count)
|
||||
|
||||
|
||||
26
appveyor.yml
26
appveyor.yml
@@ -6,20 +6,22 @@ environment:
|
||||
# that it's a small download. We also use appveyor's free cache, avoiding fees
|
||||
# downloading from S3 each time.
|
||||
# TODO: script to create this package.
|
||||
RIPPLED_DEPS_URL: https://s3-ap-northeast-1.amazonaws.com/history-replay/rippled_deps.zip
|
||||
RIPPLED_DEPS_URL: https://github.com/ripple/Downloads/blob/gh-pages/appveyor/rippled_deps15.zip?raw=true
|
||||
|
||||
# Other dependencies we just download each time.
|
||||
PIP_URL: https://bootstrap.pypa.io/get-pip.py
|
||||
PYWIN32_URL: https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20219/pywin32-219.win-amd64-py2.7.exe
|
||||
|
||||
# Scons honours these environment variables, setting the include/lib paths.
|
||||
BOOST_ROOT: C:/rippled_deps/boost
|
||||
OPENSSL_ROOT: C:/rippled_deps/openssl
|
||||
BOOST_ROOT: C:/rippled_deps15/boost
|
||||
OPENSSL_ROOT: C:/rippled_deps15/openssl
|
||||
|
||||
os: Visual Studio 2015
|
||||
|
||||
# At the end of each successful build we cache this directory. It must be less
|
||||
# than 100MB total compressed.
|
||||
cache:
|
||||
- "C:\\rippled_deps"
|
||||
- "C:\\rippled_deps15"
|
||||
|
||||
# This means we'll download a zip of the branch we want, rather than the full
|
||||
# history.
|
||||
@@ -27,7 +29,7 @@ shallow_clone: true
|
||||
|
||||
install:
|
||||
# We want easy_install, python and protoc.exe on PATH.
|
||||
- SET PATH=%PYTHON%;%PYTHON%/Scripts;C:/rippled_deps;%PATH%
|
||||
- SET PATH=%PYTHON%;%PYTHON%/Scripts;C:/rippled_deps15;%PATH%
|
||||
|
||||
# `ps` prefix means the command is executed by powershell.
|
||||
- ps: Start-FileDownload $env:PIP_URL
|
||||
@@ -46,9 +48,17 @@ install:
|
||||
# Download dependencies if appveyor didn't restore them from the cache.
|
||||
# Use 7zip to unzip.
|
||||
- ps: |
|
||||
if (-not(Test-Path 'C:/rippled_deps')) {
|
||||
if (-not(Test-Path 'C:/rippled_deps15')) {
|
||||
echo "Download from $env:RIPPLED_DEPS_URL"
|
||||
Start-FileDownload "$env:RIPPLED_DEPS_URL"
|
||||
7z x rippled_deps.zip -oC:\ -y > $null
|
||||
7z x rippled_deps15.zip -oC:\ -y > $null
|
||||
}
|
||||
|
||||
# Newer DEPS include a versions file.
|
||||
# Dump it so we can verify correct behavior.
|
||||
- ps: |
|
||||
if (Test-Path 'C:/rippled_deps15/versions.txt') {
|
||||
cat 'C:/rippled_deps15/versions.txt'
|
||||
}
|
||||
|
||||
# TODO: This is giving me grief
|
||||
@@ -58,7 +68,7 @@ install:
|
||||
|
||||
build_script:
|
||||
# We set the environment variables needed to put compilers on the PATH.
|
||||
- '"%VS120COMNTOOLS%../../VC/vcvarsall.bat" x86_amd64'
|
||||
- '"%VS140COMNTOOLS%../../VC/vcvarsall.bat" x86_amd64'
|
||||
# Show which version of the compiler we are using.
|
||||
- cl
|
||||
- scons msvc.debug -j%NUMBER_OF_PROCESSORS%
|
||||
|
||||
36
bin/ci/ubuntu/build-and-test.sh
Executable file
36
bin/ci/ubuntu/build-and-test.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash -u
|
||||
# We use set -e and bash with -u to bail on first non zero exit code of any
|
||||
# processes launched or upon any unbound variable
|
||||
set -e
|
||||
__dirname=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
echo "using CC: $CC"
|
||||
echo "using TARGET: $TARGET"
|
||||
export RIPPLED_PATH="$PWD/build/$CC.$TARGET/rippled"
|
||||
echo "using RIPPLED_PATH: $RIPPLED_PATH"
|
||||
# Make sure vcxproj is up to date
|
||||
scons vcxproj
|
||||
git diff --exit-code
|
||||
# $CC will be either `clang` or `gcc`
|
||||
# http://docs.travis-ci.com/user/migrating-from-legacy/?utm_source=legacy-notice&utm_medium=banner&utm_campaign=legacy-upgrade
|
||||
# indicates that 2 cores are available to containers.
|
||||
scons -j${NUM_PROCESSORS:-2} $CC.$TARGET
|
||||
# We can be sure we're using the build/$CC.$TARGET variant
|
||||
# (-f so never err)
|
||||
rm -f build/rippled
|
||||
|
||||
# See what we've actually built
|
||||
ldd $RIPPLED_PATH
|
||||
if [[ $TARGET == "coverage" ]]; then
|
||||
$RIPPLED_PATH --unittest
|
||||
# We pass along -p to keep path segments so as to avoid collisions
|
||||
codecov --gcov-args=-p --gcov-source-match='^src/(ripple|beast)'
|
||||
else
|
||||
# Run unittests (under gdb)
|
||||
cat $__dirname/unittests.gdb | gdb \
|
||||
--return-child-result \
|
||||
--args $RIPPLED_PATH --unittest
|
||||
fi
|
||||
|
||||
# Run NPM tests
|
||||
npm install
|
||||
npm test --rippled=$RIPPLED_PATH
|
||||
25
bin/ci/ubuntu/install-dependencies.sh
Executable file
25
bin/ci/ubuntu/install-dependencies.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash -u
|
||||
# Exit if anything fails.
|
||||
set -e
|
||||
# Override gcc version to $GCC_VER.
|
||||
# Put an appropriate symlink at the front of the path.
|
||||
mkdir -v $HOME/bin
|
||||
for g in gcc g++ gcov gcc-ar gcc-nm gcc-ranlib
|
||||
do
|
||||
test -x $( type -p ${g}-$GCC_VER )
|
||||
ln -sv $(type -p ${g}-$GCC_VER) $HOME/bin/${g}
|
||||
done
|
||||
export PATH=$PWD/bin:$PATH
|
||||
|
||||
# What versions are we ACTUALLY running?
|
||||
g++ -v
|
||||
clang -v
|
||||
# Avoid `spurious errors` caused by ~/.npm permission issues
|
||||
# Does it already exist? Who owns? What permissions?
|
||||
ls -lah ~/.npm || mkdir ~/.npm
|
||||
# Make sure we own it
|
||||
chown -Rc $USER ~/.npm
|
||||
# We use this so we can filter the subtrees from our coverage report
|
||||
pip install --user https://github.com/sublimator/codecov-python/zipball/source-match
|
||||
|
||||
bash bin/sh/install-boost.sh
|
||||
4
bin/ci/ubuntu/unittests.gdb
Normal file
4
bin/ci/ubuntu/unittests.gdb
Normal file
@@ -0,0 +1,4 @@
|
||||
set env MALLOC_CHECK_=3
|
||||
set print thread-events off
|
||||
run
|
||||
backtrace full
|
||||
22
bin/sh/install-boost.sh
Normal file
22
bin/sh/install-boost.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# Assumptions:
|
||||
# 1) BOOST_ROOT and BOOST_URL are already defined,
|
||||
# and contain valid values.
|
||||
# 2) The last namepart of BOOST_ROOT matches the
|
||||
# folder name internal to boost's .tar.gz
|
||||
# When testing you can force a boost build by clearing travis caches:
|
||||
# https://travis-ci.org/ripple/rippled/caches
|
||||
set -e
|
||||
if [ ! -d "$BOOST_ROOT/lib" ]
|
||||
then
|
||||
wget $BOOST_URL -O /tmp/boost.tar.gz
|
||||
cd `dirname $BOOST_ROOT`
|
||||
rm -fr ${BOOST_ROOT}
|
||||
tar xzf /tmp/boost.tar.gz
|
||||
cd $BOOST_ROOT && \
|
||||
./bootstrap.sh --prefix=$BOOST_ROOT && \
|
||||
./b2 -d1 define=_GLIBCXX_USE_CXX11_ABI=0 && ./b2 -d0 define=_GLIBCXX_USE_CXX11_ABI=0 install
|
||||
else
|
||||
echo "Using cached boost at $BOOST_ROOT"
|
||||
fi
|
||||
|
||||
@@ -26,3 +26,4 @@ A list of rippled version numbers, and the Github pull requests they contain.
|
||||
0.28.2-b7: Includes pulls 1077, 1080, 1086, 1095, 1098, 1106 and 1112.
|
||||
0.28.2-b8: Includes pulls 1078, 1100, 1108, 1114, 1118, 1119 and 1121.
|
||||
0.28.2-b9: Includes pulls 1053, 1109, 1111, 1117, 1122 and 1123.
|
||||
0.29.1-b11: Includes pulls 1279, 1271, 1289, 1291, 1290, 1267, 1294, 1276, 1231, and 1286.
|
||||
|
||||
@@ -359,38 +359,18 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
# [overlay] EXPERIMENTAL
|
||||
# [overlay]
|
||||
#
|
||||
# This section is EXPERIMENTAL, and should not be
|
||||
# present for production configuration settings.
|
||||
# Controls settings related to the peer to peer overlay.
|
||||
#
|
||||
# A set of key/value pair parameters to configure the overlay.
|
||||
#
|
||||
# auto_connect = 0 | 1
|
||||
#
|
||||
# When set, activates the autoconnect feature. This maintains outgoing
|
||||
# connections using PeerFinder's "Outgoing Connection Strategy."
|
||||
#
|
||||
# become_superpeer = 'never' | 'always' | 'auto'
|
||||
#
|
||||
# Controls the selection of peer roles:
|
||||
#
|
||||
# 'never' Always handshake in the leaf role.
|
||||
# 'always' Always handshake in the superpeer role.
|
||||
# 'auto' Start as a leaf, promote to superpeer after
|
||||
# passing capability check (default).
|
||||
#
|
||||
# In the leaf role, a peer does not advertise its IP and port for
|
||||
# the purpose of receiving incoming connections. The peer also does
|
||||
# not forward transactions and validations received from other peers.
|
||||
#
|
||||
# In the superpeer role, a peer advertises its IP and port for
|
||||
# receiving incoming connections after passing an incoming connection
|
||||
# test. Superpeers forward transactions and protocol messages to all
|
||||
# other peers. Superpeers do not forward validations to other superpeers.
|
||||
# Instead, a validation received by a superpeer from a leaf is forwarded
|
||||
# only to other leaf connections.
|
||||
# public_ip = <IP-address>
|
||||
#
|
||||
# If the server has a known, fixed public IPv4 address,
|
||||
# specify that IP address here in dotted decimal notation.
|
||||
# Peers will use this information to reject attempt to proxy
|
||||
# connections to or from this server.
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
11
package.json
11
package.json
@@ -7,19 +7,18 @@
|
||||
"test": "test"
|
||||
},
|
||||
"dependencies": {
|
||||
"assert-diff": "^1.0.1",
|
||||
"async": "~0.2.9",
|
||||
"babel": "^5.8.21",
|
||||
"coffee-script": "^1.8.0",
|
||||
"deep-equal": "0.0.0",
|
||||
"extend": "~1.2.0",
|
||||
"lodash": "^3.5.0",
|
||||
"mocha": "^2.1.0",
|
||||
"request": "^2.47.0",
|
||||
"ripple-lib": "0.10.0",
|
||||
"ripple-lib": "0.13.0-rc6.0",
|
||||
"simple-jsonrpc": "~0.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"assert-diff": "^1.0.1",
|
||||
"coffee-script": "^1.8.0",
|
||||
"mocha": "^2.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha test/websocket-test.js test/server-test.js test/*-test.{js,coffee}"
|
||||
},
|
||||
|
||||
@@ -164,13 +164,6 @@
|
||||
#define RIPPLE_SINGLE_IO_SERVICE_THREAD 0
|
||||
#endif
|
||||
|
||||
/** Config: RIPPLE_HOOK_VALIDATORS
|
||||
Activates code for handling validations and validators (work in progress).
|
||||
*/
|
||||
#ifndef RIPPLE_HOOK_VALIDATORS
|
||||
#define RIPPLE_HOOK_VALIDATORS 0
|
||||
#endif
|
||||
|
||||
/** Config: RIPPLE_ENABLE_TICKETS
|
||||
Enables processing of ticket transactions
|
||||
*/
|
||||
@@ -178,13 +171,9 @@
|
||||
#define RIPPLE_ENABLE_TICKETS 0
|
||||
#endif
|
||||
|
||||
/** Config: RIPPLE_ENABLE_MULTI_SIGN
|
||||
When set, activates the current state of the multi-sign feature which is
|
||||
under development. When the feature is complete and released this
|
||||
#define should be removed.
|
||||
*/
|
||||
#ifndef RIPPLE_ENABLE_MULTI_SIGN
|
||||
#define RIPPLE_ENABLE_MULTI_SIGN 0
|
||||
// Uses OpenSSL instead of alternatives
|
||||
#ifndef RIPPLE_USE_OPENSSL
|
||||
#define RIPPLE_USE_OPENSSL 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace detail
|
||||
{
|
||||
|
||||
/** Specialized helper class template for swapping bytes.
|
||||
|
||||
|
||||
Normally you won't use this directly, use the helper function
|
||||
byteSwap instead. You can specialize this class for your
|
||||
own user defined types, as was done for uint24.
|
||||
@@ -204,7 +204,7 @@ namespace detail
|
||||
template <typename IntegralType>
|
||||
struct SwapBytes
|
||||
{
|
||||
inline IntegralType operator() (IntegralType value) const noexcept
|
||||
inline IntegralType operator() (IntegralType value) const noexcept
|
||||
{
|
||||
return ByteOrder::swap (value);
|
||||
}
|
||||
@@ -215,7 +215,7 @@ struct SwapBytes
|
||||
template <>
|
||||
struct SwapBytes <std::int16_t>
|
||||
{
|
||||
inline std::int16_t operator() (std::int16_t value) const noexcept
|
||||
inline std::int16_t operator() (std::int16_t value) const noexcept
|
||||
{
|
||||
return static_cast <std::int16_t> (ByteOrder::swap (static_cast <std::uint16_t> (value)));
|
||||
}
|
||||
@@ -224,7 +224,7 @@ struct SwapBytes <std::int16_t>
|
||||
template <>
|
||||
struct SwapBytes <std::int32_t>
|
||||
{
|
||||
inline std::int32_t operator() (std::int32_t value) const noexcept
|
||||
inline std::int32_t operator() (std::int32_t value) const noexcept
|
||||
{
|
||||
return static_cast <std::int32_t> (ByteOrder::swap (static_cast <std::uint32_t> (value)));
|
||||
}
|
||||
@@ -233,7 +233,7 @@ struct SwapBytes <std::int32_t>
|
||||
template <>
|
||||
struct SwapBytes <std::int64_t>
|
||||
{
|
||||
inline std::int64_t operator() (std::int64_t value) const noexcept
|
||||
inline std::int64_t operator() (std::int64_t value) const noexcept
|
||||
{
|
||||
return static_cast <std::int64_t> (ByteOrder::swap (static_cast <std::uint64_t> (value)));
|
||||
}
|
||||
|
||||
@@ -56,5 +56,5 @@
|
||||
|
||||
// Suffix
|
||||
#include <beast/config/Suffix.h>
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#define BEAST_MEMORY_H_INCLUDED
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
||||
#include <beast/Config.h>
|
||||
|
||||
namespace beast {
|
||||
@@ -86,7 +86,7 @@ Type* createCopyIfNotNull (const Type* pointer)
|
||||
|
||||
ScopedAutoReleasePool(ScopedAutoReleasePool const&) = delete;
|
||||
ScopedAutoReleasePool& operator= (ScopedAutoReleasePool const&) = delete;
|
||||
|
||||
|
||||
private:
|
||||
void* pool;
|
||||
};
|
||||
|
||||
@@ -6,9 +6,9 @@ Wrappers and utilities to make working with boost::asio easier.
|
||||
|
||||
If an object calls asynchronous initiating functions it must either:
|
||||
|
||||
1. Manage its lifetime by being reference counted
|
||||
1. Manage its lifetime by being reference counted
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
2. Wait for all pending completion handlers to be called before
|
||||
allowing itself to be destroyed.
|
||||
2. Wait for all pending completion handlers to be called before
|
||||
allowing itself to be destroyed.
|
||||
|
||||
@@ -34,7 +34,7 @@ is_short_read (boost::system::error_code const& ec)
|
||||
return (ec.category() == boost::asio::error::get_ssl_category())
|
||||
&& (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ);
|
||||
}
|
||||
|
||||
|
||||
/** Returns a human readable message if the error code is SSL related. */
|
||||
std::string
|
||||
asio_message(boost::system::error_code const& ec);
|
||||
|
||||
@@ -41,8 +41,8 @@ asio_message (boost::system::error_code const& ec)
|
||||
+ ","
|
||||
+ boost::lexical_cast<std::string> (ERR_GET_REASON (ec.value ()))
|
||||
+ ") ";
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
char buf[errorBufferSize];
|
||||
::ERR_error_string_n (ec.value (), buf, errorBufferSize);
|
||||
error += buf;
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
the output sequence is empty, out_ will point to the end of
|
||||
the list of buffers, and out_pos_ and out_end_ will be 0:
|
||||
|
||||
|
||||
|
||||
|<------+------------------>| out_ == list_.end()
|
||||
in_pos_ out_pos_ == 0
|
||||
out_end_ == 0
|
||||
|
||||
@@ -28,7 +28,7 @@ class error_test : public unit_test::suite
|
||||
{
|
||||
public:
|
||||
void run ()
|
||||
{
|
||||
{
|
||||
{
|
||||
boost::system::error_code ec = boost::system::error_code (335544539,
|
||||
boost::asio::error::get_ssl_category ());
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
b.commit(10);
|
||||
expect(to_str(b.data()) == "567890ABCD");
|
||||
}
|
||||
|
||||
|
||||
test_prepare();
|
||||
test_commit();
|
||||
test_consume();
|
||||
|
||||
@@ -61,6 +61,7 @@ public:
|
||||
using period = typename Clock::period;
|
||||
using duration = typename Clock::duration;
|
||||
using time_point = typename Clock::time_point;
|
||||
using clock_type = Clock;
|
||||
|
||||
static bool const is_steady = Clock::is_steady;
|
||||
|
||||
@@ -68,12 +69,6 @@ public:
|
||||
|
||||
/** Returns the current time. */
|
||||
virtual time_point now() const = 0;
|
||||
|
||||
/** Returning elapsed ticks since the epoch. */
|
||||
rep elapsed()
|
||||
{
|
||||
return now().time_since_epoch().count();
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <ctime>
|
||||
#include <locale>
|
||||
|
||||
|
||||
/*
|
||||
|
||||
chrono_io synopsis
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
|
||||
explicit durationpunct(size_t refs = 0);
|
||||
explicit durationpunct(duration_style fmt, size_t refs = 0);
|
||||
|
||||
|
||||
bool is_symbol_name() const noexcept;
|
||||
bool is_prefix_name() const noexcept;
|
||||
};
|
||||
|
||||
@@ -268,7 +268,7 @@ static double monotonicCurrentTimeInSeconds()
|
||||
{
|
||||
return GetTickCount64() / 1000.0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ static double monotonicCurrentTimeInSeconds()
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
|
||||
static double monotonicCurrentTimeInSeconds()
|
||||
{
|
||||
struct StaticInitializer
|
||||
@@ -291,7 +291,7 @@ static double monotonicCurrentTimeInSeconds()
|
||||
|
||||
mach_timebase_info_data_t timebase;
|
||||
(void) mach_timebase_info (&timebase);
|
||||
|
||||
|
||||
if (timebase.numer % 1000000 == 0)
|
||||
{
|
||||
numerator = timebase.numer / 1000000.0;
|
||||
@@ -304,13 +304,13 @@ static double monotonicCurrentTimeInSeconds()
|
||||
//denominator = timebase.denom * (std::uint64_t) 1000000 * 1000.0;
|
||||
denominator = timebase.denom * 1000000000.0;
|
||||
}
|
||||
|
||||
|
||||
ratio = numerator / denominator;
|
||||
}
|
||||
|
||||
double ratio;
|
||||
};
|
||||
|
||||
|
||||
static StaticInitializer const data;
|
||||
|
||||
return mach_absolute_time() * data.ratio;
|
||||
@@ -319,7 +319,7 @@ static double monotonicCurrentTimeInSeconds()
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#include <time.h>
|
||||
|
||||
namespace beast {
|
||||
@@ -334,7 +334,7 @@ static double monotonicCurrentTimeInSeconds()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
namespace beast {
|
||||
@@ -349,7 +349,7 @@ static double getStartupTime()
|
||||
{
|
||||
when = detail::monotonicCurrentTimeInSeconds();
|
||||
}
|
||||
|
||||
|
||||
double when;
|
||||
};
|
||||
|
||||
@@ -368,7 +368,7 @@ struct StartupTimeStaticInitializer
|
||||
};
|
||||
|
||||
static StartupTimeStaticInitializer startupTimeStaticInitializer;
|
||||
|
||||
|
||||
}
|
||||
|
||||
RelativeTime RelativeTime::fromStartup ()
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define BEAST_CHRONO_MANUAL_CLOCK_H_INCLUDED
|
||||
|
||||
#include <beast/chrono/abstract_clock.h>
|
||||
#include <cassert>
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ struct cyclic_iterator_base
|
||||
}
|
||||
|
||||
//
|
||||
// cyclic_iterator_decl.hpp
|
||||
// cyclic_iterator_decl.hpp
|
||||
//
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
namespace beast {
|
||||
|
||||
/*
|
||||
/*
|
||||
Portions from http://www.adp-gmbh.ch/cpp/common/base64.html
|
||||
Copyright notice:
|
||||
|
||||
|
||||
@@ -17,67 +17,42 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CRYPTO_SHA512_H_INCLUDED
|
||||
#define BEAST_CRYPTO_SHA512_H_INCLUDED
|
||||
#ifndef BEAST_CRYPTO_MAC_FACADE_H_INCLUDED
|
||||
#define BEAST_CRYPTO_MAC_FACADE_H_INCLUDED
|
||||
|
||||
#include <beast/crypto/secure_erase.h>
|
||||
#include <beast/hash/endian.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <beast/crypto/impl/sha512_context.h>
|
||||
#include <type_traits>
|
||||
#include <array>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
class sha512_hasher
|
||||
// Message Authentication Code (MAC) facade
|
||||
template <class Context, bool Secure>
|
||||
class mac_facade
|
||||
{
|
||||
public:
|
||||
static beast::endian const endian =
|
||||
beast::endian::native;
|
||||
|
||||
using result_type =
|
||||
std::array<std::uint8_t, 64>;
|
||||
|
||||
sha512_hasher()
|
||||
{
|
||||
detail::init(ctx_);
|
||||
}
|
||||
|
||||
void
|
||||
operator()(void const* data,
|
||||
std::size_t size) noexcept
|
||||
{
|
||||
detail::update(ctx_, data, size);
|
||||
}
|
||||
|
||||
explicit
|
||||
operator result_type() noexcept
|
||||
{
|
||||
result_type digest;
|
||||
finish(ctx_, &digest[0]);
|
||||
return digest;
|
||||
}
|
||||
|
||||
private:
|
||||
detail::sha512_context ctx_;
|
||||
};
|
||||
Context ctx_;
|
||||
|
||||
// secure version
|
||||
class sha512_hasher_s
|
||||
{
|
||||
public:
|
||||
static beast::endian const endian =
|
||||
beast::endian::native;
|
||||
|
||||
using result_type =
|
||||
std::array<std::uint8_t, 64>;
|
||||
std::array<std::uint8_t,
|
||||
Context::digest_size>;
|
||||
|
||||
sha512_hasher_s()
|
||||
mac_facade() noexcept
|
||||
{
|
||||
init(ctx_);
|
||||
}
|
||||
|
||||
~sha512_hasher_s()
|
||||
~mac_facade()
|
||||
{
|
||||
secure_erase(ctx_);
|
||||
erase(std::integral_constant<
|
||||
bool, Secure>{});
|
||||
}
|
||||
|
||||
void
|
||||
@@ -96,9 +71,21 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
detail::sha512_context ctx_;
|
||||
inline
|
||||
void
|
||||
erase (std::false_type) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
erase (std::true_type) noexcept
|
||||
{
|
||||
secure_erase(&ctx_, sizeof(ctx_));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
430
src/beast/beast/crypto/detail/ripemd_context.h
Normal file
430
src/beast/beast/crypto/detail/ripemd_context.h
Normal file
@@ -0,0 +1,430 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CRYPTO_RIPEMD_CONTEXT_H_INCLUDED
|
||||
#define BEAST_CRYPTO_RIPEMD_CONTEXT_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
// Based on
|
||||
// https://code.google.com/p/blockchain/source/browse/trunk/RIPEMD160.cpp
|
||||
/*
|
||||
Copyright (c) Katholieke Universiteit Leuven
|
||||
1996 All Rights Reserved
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
// This implementation has been modified from the
|
||||
// original. It has been updated for C++11.
|
||||
|
||||
struct ripemd160_context
|
||||
{
|
||||
static unsigned int const block_size = 64;
|
||||
static unsigned int const digest_size = 20;
|
||||
|
||||
unsigned int tot_len;
|
||||
unsigned int len;
|
||||
unsigned char block[256];
|
||||
std::uint32_t h[5];
|
||||
};
|
||||
|
||||
// ROL(x, n) cyclically rotates x over n bits to the left
|
||||
// x must be of an unsigned 32 bits type and 0 <= n < 32.
|
||||
#define BEAST_RIPEMD_ROL(x, n) (((x) << (n)) | ((x) >> (32-(n))))
|
||||
|
||||
// the five basic functions F(), G() and H()
|
||||
#define BEAST_RIPEMD_F(x, y, z) ((x) ^ (y) ^ (z))
|
||||
#define BEAST_RIPEMD_G(x, y, z) (((x) & (y)) | (~(x) & (z)))
|
||||
#define BEAST_RIPEMD_H(x, y, z) (((x) | ~(y)) ^ (z))
|
||||
#define BEAST_RIPEMD_I(x, y, z) (((x) & (z)) | ((y) & ~(z)))
|
||||
#define BEAST_RIPEMD_J(x, y, z) ((x) ^ ((y) | ~(z)))
|
||||
|
||||
// the ten basic operations FF() through III()
|
||||
#define BEAST_RIPEMD_FF(a, b, c, d, e, x, s) { \
|
||||
(a) += BEAST_RIPEMD_F((b), (c), (d)) + (x); \
|
||||
(a) = BEAST_RIPEMD_ROL((a), (s)) + (e); \
|
||||
(c) = BEAST_RIPEMD_ROL((c), 10); }
|
||||
#define BEAST_RIPEMD_GG(a, b, c, d, e, x, s) { \
|
||||
(a) += BEAST_RIPEMD_G((b), (c), (d)) + (x) + 0x5a827999UL; \
|
||||
(a) = BEAST_RIPEMD_ROL((a), (s)) + (e); \
|
||||
(c) = BEAST_RIPEMD_ROL((c), 10); }
|
||||
#define BEAST_RIPEMD_HH(a, b, c, d, e, x, s) { \
|
||||
(a) += BEAST_RIPEMD_H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\
|
||||
(a) = BEAST_RIPEMD_ROL((a), (s)) + (e); \
|
||||
(c) = BEAST_RIPEMD_ROL((c), 10); }
|
||||
#define BEAST_RIPEMD_II(a, b, c, d, e, x, s) { \
|
||||
(a) += BEAST_RIPEMD_I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\
|
||||
(a) = BEAST_RIPEMD_ROL((a), (s)) + (e); \
|
||||
(c) = BEAST_RIPEMD_ROL((c), 10); }
|
||||
#define BEAST_RIPEMD_JJ(a, b, c, d, e, x, s) { \
|
||||
(a) += BEAST_RIPEMD_J((b), (c), (d)) + (x) + 0xa953fd4eUL;\
|
||||
(a) = BEAST_RIPEMD_ROL((a), (s)) + (e); \
|
||||
(c) = BEAST_RIPEMD_ROL((c), 10); }
|
||||
#define BEAST_RIPEMD_FFF(a, b, c, d, e, x, s) { \
|
||||
(a) += BEAST_RIPEMD_F((b), (c), (d)) + (x); \
|
||||
(a) = BEAST_RIPEMD_ROL((a), (s)) + (e); \
|
||||
(c) = BEAST_RIPEMD_ROL((c), 10); }
|
||||
#define BEAST_RIPEMD_GGG(a, b, c, d, e, x, s) { \
|
||||
(a) += BEAST_RIPEMD_G((b), (c), (d)) + (x) + 0x7a6d76e9UL;\
|
||||
(a) = BEAST_RIPEMD_ROL((a), (s)) + (e); \
|
||||
(c) = BEAST_RIPEMD_ROL((c), 10); }
|
||||
#define BEAST_RIPEMD_HHH(a, b, c, d, e, x, s) { \
|
||||
(a) += BEAST_RIPEMD_H((b), (c), (d)) + (x) + 0x6d703ef3UL;\
|
||||
(a) = BEAST_RIPEMD_ROL((a), (s)) + (e); \
|
||||
(c) = BEAST_RIPEMD_ROL((c), 10); }
|
||||
#define BEAST_RIPEMD_III(a, b, c, d, e, x, s) { \
|
||||
(a) += BEAST_RIPEMD_I((b), (c), (d)) + (x) + 0x5c4dd124UL;\
|
||||
(a) = BEAST_RIPEMD_ROL((a), (s)) + (e); \
|
||||
(c) = BEAST_RIPEMD_ROL((c), 10); }
|
||||
#define BEAST_RIPEMD_JJJ(a, b, c, d, e, x, s) { \
|
||||
(a) += BEAST_RIPEMD_J((b), (c), (d)) + (x) + 0x50a28be6UL;\
|
||||
(a) = BEAST_RIPEMD_ROL((a), (s)) + (e); \
|
||||
(c) = BEAST_RIPEMD_ROL((c), 10); }
|
||||
|
||||
template <class = void>
|
||||
void ripemd_load (std::array<std::uint32_t, 16>& X,
|
||||
unsigned char const* p)
|
||||
{
|
||||
for(int i = 0; i < 16; ++i)
|
||||
{
|
||||
X[i] =
|
||||
((std::uint32_t) *((p)+3) << 24) |
|
||||
((std::uint32_t) *((p)+2) << 16) |
|
||||
((std::uint32_t) *((p)+1) << 8) |
|
||||
((std::uint32_t) * (p));
|
||||
p += 4;
|
||||
}
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
void ripemd_compress (ripemd160_context& ctx,
|
||||
std::array<std::uint32_t, 16>& X) noexcept
|
||||
{
|
||||
std::uint32_t aa = ctx.h[0];
|
||||
std::uint32_t bb = ctx.h[1];
|
||||
std::uint32_t cc = ctx.h[2];
|
||||
std::uint32_t dd = ctx.h[3];
|
||||
std::uint32_t ee = ctx.h[4];
|
||||
std::uint32_t aaa = ctx.h[0];
|
||||
std::uint32_t bbb = ctx.h[1];
|
||||
std::uint32_t ccc = ctx.h[2];
|
||||
std::uint32_t ddd = ctx.h[3];
|
||||
std::uint32_t eee = ctx.h[4];
|
||||
|
||||
// round 1
|
||||
BEAST_RIPEMD_FF(aa, bb, cc, dd, ee, X[ 0], 11);
|
||||
BEAST_RIPEMD_FF(ee, aa, bb, cc, dd, X[ 1], 14);
|
||||
BEAST_RIPEMD_FF(dd, ee, aa, bb, cc, X[ 2], 15);
|
||||
BEAST_RIPEMD_FF(cc, dd, ee, aa, bb, X[ 3], 12);
|
||||
BEAST_RIPEMD_FF(bb, cc, dd, ee, aa, X[ 4], 5);
|
||||
BEAST_RIPEMD_FF(aa, bb, cc, dd, ee, X[ 5], 8);
|
||||
BEAST_RIPEMD_FF(ee, aa, bb, cc, dd, X[ 6], 7);
|
||||
BEAST_RIPEMD_FF(dd, ee, aa, bb, cc, X[ 7], 9);
|
||||
BEAST_RIPEMD_FF(cc, dd, ee, aa, bb, X[ 8], 11);
|
||||
BEAST_RIPEMD_FF(bb, cc, dd, ee, aa, X[ 9], 13);
|
||||
BEAST_RIPEMD_FF(aa, bb, cc, dd, ee, X[10], 14);
|
||||
BEAST_RIPEMD_FF(ee, aa, bb, cc, dd, X[11], 15);
|
||||
BEAST_RIPEMD_FF(dd, ee, aa, bb, cc, X[12], 6);
|
||||
BEAST_RIPEMD_FF(cc, dd, ee, aa, bb, X[13], 7);
|
||||
BEAST_RIPEMD_FF(bb, cc, dd, ee, aa, X[14], 9);
|
||||
BEAST_RIPEMD_FF(aa, bb, cc, dd, ee, X[15], 8);
|
||||
|
||||
// round 2
|
||||
BEAST_RIPEMD_GG(ee, aa, bb, cc, dd, X[ 7], 7);
|
||||
BEAST_RIPEMD_GG(dd, ee, aa, bb, cc, X[ 4], 6);
|
||||
BEAST_RIPEMD_GG(cc, dd, ee, aa, bb, X[13], 8);
|
||||
BEAST_RIPEMD_GG(bb, cc, dd, ee, aa, X[ 1], 13);
|
||||
BEAST_RIPEMD_GG(aa, bb, cc, dd, ee, X[10], 11);
|
||||
BEAST_RIPEMD_GG(ee, aa, bb, cc, dd, X[ 6], 9);
|
||||
BEAST_RIPEMD_GG(dd, ee, aa, bb, cc, X[15], 7);
|
||||
BEAST_RIPEMD_GG(cc, dd, ee, aa, bb, X[ 3], 15);
|
||||
BEAST_RIPEMD_GG(bb, cc, dd, ee, aa, X[12], 7);
|
||||
BEAST_RIPEMD_GG(aa, bb, cc, dd, ee, X[ 0], 12);
|
||||
BEAST_RIPEMD_GG(ee, aa, bb, cc, dd, X[ 9], 15);
|
||||
BEAST_RIPEMD_GG(dd, ee, aa, bb, cc, X[ 5], 9);
|
||||
BEAST_RIPEMD_GG(cc, dd, ee, aa, bb, X[ 2], 11);
|
||||
BEAST_RIPEMD_GG(bb, cc, dd, ee, aa, X[14], 7);
|
||||
BEAST_RIPEMD_GG(aa, bb, cc, dd, ee, X[11], 13);
|
||||
BEAST_RIPEMD_GG(ee, aa, bb, cc, dd, X[ 8], 12);
|
||||
|
||||
// round 3
|
||||
BEAST_RIPEMD_HH(dd, ee, aa, bb, cc, X[ 3], 11);
|
||||
BEAST_RIPEMD_HH(cc, dd, ee, aa, bb, X[10], 13);
|
||||
BEAST_RIPEMD_HH(bb, cc, dd, ee, aa, X[14], 6);
|
||||
BEAST_RIPEMD_HH(aa, bb, cc, dd, ee, X[ 4], 7);
|
||||
BEAST_RIPEMD_HH(ee, aa, bb, cc, dd, X[ 9], 14);
|
||||
BEAST_RIPEMD_HH(dd, ee, aa, bb, cc, X[15], 9);
|
||||
BEAST_RIPEMD_HH(cc, dd, ee, aa, bb, X[ 8], 13);
|
||||
BEAST_RIPEMD_HH(bb, cc, dd, ee, aa, X[ 1], 15);
|
||||
BEAST_RIPEMD_HH(aa, bb, cc, dd, ee, X[ 2], 14);
|
||||
BEAST_RIPEMD_HH(ee, aa, bb, cc, dd, X[ 7], 8);
|
||||
BEAST_RIPEMD_HH(dd, ee, aa, bb, cc, X[ 0], 13);
|
||||
BEAST_RIPEMD_HH(cc, dd, ee, aa, bb, X[ 6], 6);
|
||||
BEAST_RIPEMD_HH(bb, cc, dd, ee, aa, X[13], 5);
|
||||
BEAST_RIPEMD_HH(aa, bb, cc, dd, ee, X[11], 12);
|
||||
BEAST_RIPEMD_HH(ee, aa, bb, cc, dd, X[ 5], 7);
|
||||
BEAST_RIPEMD_HH(dd, ee, aa, bb, cc, X[12], 5);
|
||||
|
||||
// round 4
|
||||
BEAST_RIPEMD_II(cc, dd, ee, aa, bb, X[ 1], 11);
|
||||
BEAST_RIPEMD_II(bb, cc, dd, ee, aa, X[ 9], 12);
|
||||
BEAST_RIPEMD_II(aa, bb, cc, dd, ee, X[11], 14);
|
||||
BEAST_RIPEMD_II(ee, aa, bb, cc, dd, X[10], 15);
|
||||
BEAST_RIPEMD_II(dd, ee, aa, bb, cc, X[ 0], 14);
|
||||
BEAST_RIPEMD_II(cc, dd, ee, aa, bb, X[ 8], 15);
|
||||
BEAST_RIPEMD_II(bb, cc, dd, ee, aa, X[12], 9);
|
||||
BEAST_RIPEMD_II(aa, bb, cc, dd, ee, X[ 4], 8);
|
||||
BEAST_RIPEMD_II(ee, aa, bb, cc, dd, X[13], 9);
|
||||
BEAST_RIPEMD_II(dd, ee, aa, bb, cc, X[ 3], 14);
|
||||
BEAST_RIPEMD_II(cc, dd, ee, aa, bb, X[ 7], 5);
|
||||
BEAST_RIPEMD_II(bb, cc, dd, ee, aa, X[15], 6);
|
||||
BEAST_RIPEMD_II(aa, bb, cc, dd, ee, X[14], 8);
|
||||
BEAST_RIPEMD_II(ee, aa, bb, cc, dd, X[ 5], 6);
|
||||
BEAST_RIPEMD_II(dd, ee, aa, bb, cc, X[ 6], 5);
|
||||
BEAST_RIPEMD_II(cc, dd, ee, aa, bb, X[ 2], 12);
|
||||
|
||||
// round 5
|
||||
BEAST_RIPEMD_JJ(bb, cc, dd, ee, aa, X[ 4], 9);
|
||||
BEAST_RIPEMD_JJ(aa, bb, cc, dd, ee, X[ 0], 15);
|
||||
BEAST_RIPEMD_JJ(ee, aa, bb, cc, dd, X[ 5], 5);
|
||||
BEAST_RIPEMD_JJ(dd, ee, aa, bb, cc, X[ 9], 11);
|
||||
BEAST_RIPEMD_JJ(cc, dd, ee, aa, bb, X[ 7], 6);
|
||||
BEAST_RIPEMD_JJ(bb, cc, dd, ee, aa, X[12], 8);
|
||||
BEAST_RIPEMD_JJ(aa, bb, cc, dd, ee, X[ 2], 13);
|
||||
BEAST_RIPEMD_JJ(ee, aa, bb, cc, dd, X[10], 12);
|
||||
BEAST_RIPEMD_JJ(dd, ee, aa, bb, cc, X[14], 5);
|
||||
BEAST_RIPEMD_JJ(cc, dd, ee, aa, bb, X[ 1], 12);
|
||||
BEAST_RIPEMD_JJ(bb, cc, dd, ee, aa, X[ 3], 13);
|
||||
BEAST_RIPEMD_JJ(aa, bb, cc, dd, ee, X[ 8], 14);
|
||||
BEAST_RIPEMD_JJ(ee, aa, bb, cc, dd, X[11], 11);
|
||||
BEAST_RIPEMD_JJ(dd, ee, aa, bb, cc, X[ 6], 8);
|
||||
BEAST_RIPEMD_JJ(cc, dd, ee, aa, bb, X[15], 5);
|
||||
BEAST_RIPEMD_JJ(bb, cc, dd, ee, aa, X[13], 6);
|
||||
|
||||
// parallel round 1
|
||||
BEAST_RIPEMD_JJJ(aaa, bbb, ccc, ddd, eee, X[ 5], 8);
|
||||
BEAST_RIPEMD_JJJ(eee, aaa, bbb, ccc, ddd, X[14], 9);
|
||||
BEAST_RIPEMD_JJJ(ddd, eee, aaa, bbb, ccc, X[ 7], 9);
|
||||
BEAST_RIPEMD_JJJ(ccc, ddd, eee, aaa, bbb, X[ 0], 11);
|
||||
BEAST_RIPEMD_JJJ(bbb, ccc, ddd, eee, aaa, X[ 9], 13);
|
||||
BEAST_RIPEMD_JJJ(aaa, bbb, ccc, ddd, eee, X[ 2], 15);
|
||||
BEAST_RIPEMD_JJJ(eee, aaa, bbb, ccc, ddd, X[11], 15);
|
||||
BEAST_RIPEMD_JJJ(ddd, eee, aaa, bbb, ccc, X[ 4], 5);
|
||||
BEAST_RIPEMD_JJJ(ccc, ddd, eee, aaa, bbb, X[13], 7);
|
||||
BEAST_RIPEMD_JJJ(bbb, ccc, ddd, eee, aaa, X[ 6], 7);
|
||||
BEAST_RIPEMD_JJJ(aaa, bbb, ccc, ddd, eee, X[15], 8);
|
||||
BEAST_RIPEMD_JJJ(eee, aaa, bbb, ccc, ddd, X[ 8], 11);
|
||||
BEAST_RIPEMD_JJJ(ddd, eee, aaa, bbb, ccc, X[ 1], 14);
|
||||
BEAST_RIPEMD_JJJ(ccc, ddd, eee, aaa, bbb, X[10], 14);
|
||||
BEAST_RIPEMD_JJJ(bbb, ccc, ddd, eee, aaa, X[ 3], 12);
|
||||
BEAST_RIPEMD_JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6);
|
||||
|
||||
// parallel round 2
|
||||
BEAST_RIPEMD_III(eee, aaa, bbb, ccc, ddd, X[ 6], 9);
|
||||
BEAST_RIPEMD_III(ddd, eee, aaa, bbb, ccc, X[11], 13);
|
||||
BEAST_RIPEMD_III(ccc, ddd, eee, aaa, bbb, X[ 3], 15);
|
||||
BEAST_RIPEMD_III(bbb, ccc, ddd, eee, aaa, X[ 7], 7);
|
||||
BEAST_RIPEMD_III(aaa, bbb, ccc, ddd, eee, X[ 0], 12);
|
||||
BEAST_RIPEMD_III(eee, aaa, bbb, ccc, ddd, X[13], 8);
|
||||
BEAST_RIPEMD_III(ddd, eee, aaa, bbb, ccc, X[ 5], 9);
|
||||
BEAST_RIPEMD_III(ccc, ddd, eee, aaa, bbb, X[10], 11);
|
||||
BEAST_RIPEMD_III(bbb, ccc, ddd, eee, aaa, X[14], 7);
|
||||
BEAST_RIPEMD_III(aaa, bbb, ccc, ddd, eee, X[15], 7);
|
||||
BEAST_RIPEMD_III(eee, aaa, bbb, ccc, ddd, X[ 8], 12);
|
||||
BEAST_RIPEMD_III(ddd, eee, aaa, bbb, ccc, X[12], 7);
|
||||
BEAST_RIPEMD_III(ccc, ddd, eee, aaa, bbb, X[ 4], 6);
|
||||
BEAST_RIPEMD_III(bbb, ccc, ddd, eee, aaa, X[ 9], 15);
|
||||
BEAST_RIPEMD_III(aaa, bbb, ccc, ddd, eee, X[ 1], 13);
|
||||
BEAST_RIPEMD_III(eee, aaa, bbb, ccc, ddd, X[ 2], 11);
|
||||
|
||||
// parallel round 3
|
||||
BEAST_RIPEMD_HHH(ddd, eee, aaa, bbb, ccc, X[15], 9);
|
||||
BEAST_RIPEMD_HHH(ccc, ddd, eee, aaa, bbb, X[ 5], 7);
|
||||
BEAST_RIPEMD_HHH(bbb, ccc, ddd, eee, aaa, X[ 1], 15);
|
||||
BEAST_RIPEMD_HHH(aaa, bbb, ccc, ddd, eee, X[ 3], 11);
|
||||
BEAST_RIPEMD_HHH(eee, aaa, bbb, ccc, ddd, X[ 7], 8);
|
||||
BEAST_RIPEMD_HHH(ddd, eee, aaa, bbb, ccc, X[14], 6);
|
||||
BEAST_RIPEMD_HHH(ccc, ddd, eee, aaa, bbb, X[ 6], 6);
|
||||
BEAST_RIPEMD_HHH(bbb, ccc, ddd, eee, aaa, X[ 9], 14);
|
||||
BEAST_RIPEMD_HHH(aaa, bbb, ccc, ddd, eee, X[11], 12);
|
||||
BEAST_RIPEMD_HHH(eee, aaa, bbb, ccc, ddd, X[ 8], 13);
|
||||
BEAST_RIPEMD_HHH(ddd, eee, aaa, bbb, ccc, X[12], 5);
|
||||
BEAST_RIPEMD_HHH(ccc, ddd, eee, aaa, bbb, X[ 2], 14);
|
||||
BEAST_RIPEMD_HHH(bbb, ccc, ddd, eee, aaa, X[10], 13);
|
||||
BEAST_RIPEMD_HHH(aaa, bbb, ccc, ddd, eee, X[ 0], 13);
|
||||
BEAST_RIPEMD_HHH(eee, aaa, bbb, ccc, ddd, X[ 4], 7);
|
||||
BEAST_RIPEMD_HHH(ddd, eee, aaa, bbb, ccc, X[13], 5);
|
||||
|
||||
// parallel round 4
|
||||
BEAST_RIPEMD_GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15);
|
||||
BEAST_RIPEMD_GGG(bbb, ccc, ddd, eee, aaa, X[ 6], 5);
|
||||
BEAST_RIPEMD_GGG(aaa, bbb, ccc, ddd, eee, X[ 4], 8);
|
||||
BEAST_RIPEMD_GGG(eee, aaa, bbb, ccc, ddd, X[ 1], 11);
|
||||
BEAST_RIPEMD_GGG(ddd, eee, aaa, bbb, ccc, X[ 3], 14);
|
||||
BEAST_RIPEMD_GGG(ccc, ddd, eee, aaa, bbb, X[11], 14);
|
||||
BEAST_RIPEMD_GGG(bbb, ccc, ddd, eee, aaa, X[15], 6);
|
||||
BEAST_RIPEMD_GGG(aaa, bbb, ccc, ddd, eee, X[ 0], 14);
|
||||
BEAST_RIPEMD_GGG(eee, aaa, bbb, ccc, ddd, X[ 5], 6);
|
||||
BEAST_RIPEMD_GGG(ddd, eee, aaa, bbb, ccc, X[12], 9);
|
||||
BEAST_RIPEMD_GGG(ccc, ddd, eee, aaa, bbb, X[ 2], 12);
|
||||
BEAST_RIPEMD_GGG(bbb, ccc, ddd, eee, aaa, X[13], 9);
|
||||
BEAST_RIPEMD_GGG(aaa, bbb, ccc, ddd, eee, X[ 9], 12);
|
||||
BEAST_RIPEMD_GGG(eee, aaa, bbb, ccc, ddd, X[ 7], 5);
|
||||
BEAST_RIPEMD_GGG(ddd, eee, aaa, bbb, ccc, X[10], 15);
|
||||
BEAST_RIPEMD_GGG(ccc, ddd, eee, aaa, bbb, X[14], 8);
|
||||
|
||||
// parallel round 5
|
||||
BEAST_RIPEMD_FFF(bbb, ccc, ddd, eee, aaa, X[12] , 8);
|
||||
BEAST_RIPEMD_FFF(aaa, bbb, ccc, ddd, eee, X[15] , 5);
|
||||
BEAST_RIPEMD_FFF(eee, aaa, bbb, ccc, ddd, X[10] , 12);
|
||||
BEAST_RIPEMD_FFF(ddd, eee, aaa, bbb, ccc, X[ 4] , 9);
|
||||
BEAST_RIPEMD_FFF(ccc, ddd, eee, aaa, bbb, X[ 1] , 12);
|
||||
BEAST_RIPEMD_FFF(bbb, ccc, ddd, eee, aaa, X[ 5] , 5);
|
||||
BEAST_RIPEMD_FFF(aaa, bbb, ccc, ddd, eee, X[ 8] , 14);
|
||||
BEAST_RIPEMD_FFF(eee, aaa, bbb, ccc, ddd, X[ 7] , 6);
|
||||
BEAST_RIPEMD_FFF(ddd, eee, aaa, bbb, ccc, X[ 6] , 8);
|
||||
BEAST_RIPEMD_FFF(ccc, ddd, eee, aaa, bbb, X[ 2] , 13);
|
||||
BEAST_RIPEMD_FFF(bbb, ccc, ddd, eee, aaa, X[13] , 6);
|
||||
BEAST_RIPEMD_FFF(aaa, bbb, ccc, ddd, eee, X[14] , 5);
|
||||
BEAST_RIPEMD_FFF(eee, aaa, bbb, ccc, ddd, X[ 0] , 15);
|
||||
BEAST_RIPEMD_FFF(ddd, eee, aaa, bbb, ccc, X[ 3] , 13);
|
||||
BEAST_RIPEMD_FFF(ccc, ddd, eee, aaa, bbb, X[ 9] , 11);
|
||||
BEAST_RIPEMD_FFF(bbb, ccc, ddd, eee, aaa, X[11] , 11);
|
||||
|
||||
// combine results
|
||||
ddd += cc + ctx.h[1]; // final result for h[0]
|
||||
ctx.h[1] = ctx.h[2] + dd + eee;
|
||||
ctx.h[2] = ctx.h[3] + ee + aaa;
|
||||
ctx.h[3] = ctx.h[4] + aa + bbb;
|
||||
ctx.h[4] = ctx.h[0] + bb + ccc;
|
||||
ctx.h[0] = ddd;
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
void init (ripemd160_context& ctx) noexcept
|
||||
{
|
||||
ctx.len = 0;
|
||||
ctx.tot_len = 0;
|
||||
ctx.h[0] = 0x67452301UL;
|
||||
ctx.h[1] = 0xefcdab89UL;
|
||||
ctx.h[2] = 0x98badcfeUL;
|
||||
ctx.h[3] = 0x10325476UL;
|
||||
ctx.h[4] = 0xc3d2e1f0UL;
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
void update (ripemd160_context& ctx,
|
||||
void const* message, std::size_t size) noexcept
|
||||
{
|
||||
auto const pm = reinterpret_cast<
|
||||
unsigned char const*>(message);
|
||||
unsigned int block_nb;
|
||||
unsigned int new_len, rem_len, tmp_len;
|
||||
const unsigned char *shifted_message;
|
||||
tmp_len = ripemd160_context::block_size - ctx.len;
|
||||
rem_len = size < tmp_len ? size : tmp_len;
|
||||
std::memcpy(&ctx.block[ctx.len], pm, rem_len);
|
||||
if (ctx.len + size < ripemd160_context::block_size) {
|
||||
ctx.len += size;
|
||||
return;
|
||||
}
|
||||
new_len = size - rem_len;
|
||||
block_nb = new_len / ripemd160_context::block_size;
|
||||
shifted_message = pm + rem_len;
|
||||
std::array<std::uint32_t, 16> X;
|
||||
ripemd_load(X, ctx.block);
|
||||
ripemd_compress(ctx, X);
|
||||
for (int i = 0; i < block_nb; ++i)
|
||||
{
|
||||
ripemd_load(X, shifted_message +
|
||||
i * ripemd160_context::block_size);
|
||||
ripemd_compress(ctx, X);
|
||||
}
|
||||
rem_len = new_len % ripemd160_context::block_size;
|
||||
std::memcpy(ctx.block, &shifted_message[
|
||||
block_nb * ripemd160_context::block_size],
|
||||
rem_len);
|
||||
ctx.len = rem_len;
|
||||
ctx.tot_len += (block_nb + 1) *
|
||||
ripemd160_context::block_size;
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
void finish (ripemd160_context& ctx,
|
||||
void* digest) noexcept
|
||||
{
|
||||
std::array<std::uint32_t, 16> X;
|
||||
X.fill(0);
|
||||
// put leftovers into X
|
||||
auto p = &ctx.block[0];
|
||||
// uint8_t i goes into word X[i div 4] at pos. 8*(i mod 4)
|
||||
for (int i = 0; i < ctx.len; ++i)
|
||||
X[i >> 2] ^= (std::uint32_t) *p++ << (8 * (i & 3));
|
||||
ctx.tot_len += ctx.len;
|
||||
// append the bit m_n == 1
|
||||
X[(ctx.tot_len>>2)&15] ^=
|
||||
(uint32_t)1 << (8*(ctx.tot_len&3) + 7);
|
||||
// length goes to next block?
|
||||
if ((ctx.tot_len & 63) > 55)
|
||||
{
|
||||
ripemd_compress(ctx, X);
|
||||
X.fill(0);
|
||||
}
|
||||
// append length in bits*/
|
||||
X[14] = ctx.tot_len << 3;
|
||||
X[15] = (ctx.tot_len >> 29) | (0 << 3);
|
||||
ripemd_compress(ctx, X);
|
||||
|
||||
std::uint8_t* pd = reinterpret_cast<
|
||||
std::uint8_t*>(digest);
|
||||
for (std::uint32_t i = 0; i < 20; i += 4)
|
||||
{
|
||||
pd[i] = (std::uint8_t)(ctx.h[i>>2]); // implicit cast to uint8_t
|
||||
pd[i+1] = (std::uint8_t)(ctx.h[i>>2] >> 8); // extracts the 8 least
|
||||
pd[i+2] = (std::uint8_t)(ctx.h[i>>2] >> 16); // significant bits.
|
||||
pd[i+3] = (std::uint8_t)(ctx.h[i>>2] >> 24);
|
||||
}
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
@@ -27,10 +27,14 @@
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
// Based on https://github.com/ogay/sha2
|
||||
// This implementation has been modified from the
|
||||
// original. It has been updated for C++11.
|
||||
|
||||
/*
|
||||
* Updated to C++, zedwood.com 2012
|
||||
* Based on Olivier Gay's version
|
||||
* See Modified BSD License below:
|
||||
* See Modified BSD License below:
|
||||
*
|
||||
* FIPS 180-2 SHA-224/256/384/512 implementation
|
||||
* Issue date: 04/30/2005
|
||||
@@ -64,11 +68,22 @@ namespace detail {
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
struct sha256_context
|
||||
{
|
||||
static unsigned int const block_size = 64;
|
||||
static unsigned int const digest_size = 32;
|
||||
|
||||
unsigned int tot_len;
|
||||
unsigned int len;
|
||||
unsigned char block[2 * block_size];
|
||||
std::uint32_t h[8];
|
||||
};
|
||||
|
||||
struct sha512_context
|
||||
{
|
||||
static unsigned int const block_size = 128;
|
||||
static unsigned int const digest_size = 64;
|
||||
|
||||
|
||||
unsigned int tot_len;
|
||||
unsigned int len;
|
||||
unsigned char block[2 * block_size];
|
||||
@@ -80,39 +95,184 @@ struct sha512_context
|
||||
#define BEAST_SHA2_ROTL(x, n) ((x << n) | (x >> ((sizeof(x) << 3) - n)))
|
||||
#define BEAST_SHA2_CH(x, y, z) ((x & y) ^ (~x & z))
|
||||
#define BEAST_SHA2_MAJ(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
|
||||
#define BEAST_SHA256_F1(x) (BEAST_SHA2_ROTR(x, 2) ^ BEAST_SHA2_ROTR(x, 13) ^ BEAST_SHA2_ROTR(x, 22))
|
||||
#define BEAST_SHA256_F2(x) (BEAST_SHA2_ROTR(x, 6) ^ BEAST_SHA2_ROTR(x, 11) ^ BEAST_SHA2_ROTR(x, 25))
|
||||
#define BEAST_SHA256_F3(x) (BEAST_SHA2_ROTR(x, 7) ^ BEAST_SHA2_ROTR(x, 18) ^ BEAST_SHA2_SHFR(x, 3))
|
||||
#define BEAST_SHA256_F4(x) (BEAST_SHA2_ROTR(x, 17) ^ BEAST_SHA2_ROTR(x, 19) ^ BEAST_SHA2_SHFR(x, 10))
|
||||
#define BEAST_SHA512_F1(x) (BEAST_SHA2_ROTR(x, 28) ^ BEAST_SHA2_ROTR(x, 34) ^ BEAST_SHA2_ROTR(x, 39))
|
||||
#define BEAST_SHA512_F2(x) (BEAST_SHA2_ROTR(x, 14) ^ BEAST_SHA2_ROTR(x, 18) ^ BEAST_SHA2_ROTR(x, 41))
|
||||
#define BEAST_SHA512_F3(x) (BEAST_SHA2_ROTR(x, 1) ^ BEAST_SHA2_ROTR(x, 8) ^ BEAST_SHA2_SHFR(x, 7))
|
||||
#define BEAST_SHA512_F4(x) (BEAST_SHA2_ROTR(x, 19) ^ BEAST_SHA2_ROTR(x, 61) ^ BEAST_SHA2_SHFR(x, 6))
|
||||
#define BEAST_SHA2_PACK32(str, x) \
|
||||
{ \
|
||||
*(x) = \
|
||||
((std::uint32_t) *((str) + 3) ) \
|
||||
| ((std::uint32_t) *((str) + 2) << 8) \
|
||||
| ((std::uint32_t) *((str) + 1) << 16) \
|
||||
| ((std::uint32_t) *((str) + 0) << 24); \
|
||||
}
|
||||
#define BEAST_SHA2_UNPACK32(x, str) \
|
||||
{ \
|
||||
*((str) + 3) = (std::uint8_t) ((x) ); \
|
||||
*((str) + 2) = (std::uint8_t) ((x) >> 8); \
|
||||
*((str) + 1) = (std::uint8_t) ((x) >> 16); \
|
||||
*((str) + 0) = (std::uint8_t) ((x) >> 24); \
|
||||
}
|
||||
#define BEAST_SHA2_UNPACK64(x, str) \
|
||||
{ \
|
||||
*((str) + 7) = (std::uint8_t) ((x) ); \
|
||||
*((str) + 6) = (std::uint8_t) ((x) >> 8); \
|
||||
*((str) + 5) = (std::uint8_t) ((x) >> 16); \
|
||||
*((str) + 4) = (std::uint8_t) ((x) >> 24); \
|
||||
*((str) + 3) = (std::uint8_t) ((x) >> 32); \
|
||||
*((str) + 2) = (std::uint8_t) ((x) >> 40); \
|
||||
*((str) + 1) = (std::uint8_t) ((x) >> 48); \
|
||||
*((str) + 0) = (std::uint8_t) ((x) >> 56); \
|
||||
*((str) + 3) = (std::uint8_t) ((x) ); \
|
||||
*((str) + 2) = (std::uint8_t) ((x) >> 8); \
|
||||
*((str) + 1) = (std::uint8_t) ((x) >> 16); \
|
||||
*((str) + 0) = (std::uint8_t) ((x) >> 24); \
|
||||
}
|
||||
#define BEAST_SHA2_PACK64(str, x) \
|
||||
{ \
|
||||
*(x) = ((std::uint64_t) *((str) + 7) ) \
|
||||
| ((std::uint64_t) *((str) + 6) << 8) \
|
||||
| ((std::uint64_t) *((str) + 5) << 16) \
|
||||
| ((std::uint64_t) *((str) + 4) << 24) \
|
||||
| ((std::uint64_t) *((str) + 3) << 32) \
|
||||
| ((std::uint64_t) *((str) + 2) << 40) \
|
||||
| ((std::uint64_t) *((str) + 1) << 48) \
|
||||
| ((std::uint64_t) *((str) + 0) << 56); \
|
||||
*(x) = \
|
||||
((std::uint64_t) *((str) + 7) ) \
|
||||
| ((std::uint64_t) *((str) + 6) << 8) \
|
||||
| ((std::uint64_t) *((str) + 5) << 16) \
|
||||
| ((std::uint64_t) *((str) + 4) << 24) \
|
||||
| ((std::uint64_t) *((str) + 3) << 32) \
|
||||
| ((std::uint64_t) *((str) + 2) << 40) \
|
||||
| ((std::uint64_t) *((str) + 1) << 48) \
|
||||
| ((std::uint64_t) *((str) + 0) << 56); \
|
||||
}
|
||||
#define BEAST_SHA2_UNPACK64(x, str) \
|
||||
{ \
|
||||
*((str) + 7) = (std::uint8_t) ((x) ); \
|
||||
*((str) + 6) = (std::uint8_t) ((x) >> 8); \
|
||||
*((str) + 5) = (std::uint8_t) ((x) >> 16); \
|
||||
*((str) + 4) = (std::uint8_t) ((x) >> 24); \
|
||||
*((str) + 3) = (std::uint8_t) ((x) >> 32); \
|
||||
*((str) + 2) = (std::uint8_t) ((x) >> 40); \
|
||||
*((str) + 1) = (std::uint8_t) ((x) >> 48); \
|
||||
*((str) + 0) = (std::uint8_t) ((x) >> 56); \
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// SHA256
|
||||
|
||||
template <class = void>
|
||||
void sha256_transform (sha256_context& ctx,
|
||||
unsigned char const* message,
|
||||
unsigned int block_nb) noexcept
|
||||
{
|
||||
static unsigned long long const K[64] = {
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
||||
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
||||
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
||||
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
|
||||
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
|
||||
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
||||
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
||||
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
|
||||
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
|
||||
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
||||
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
||||
};
|
||||
std::uint32_t w[64];
|
||||
std::uint32_t wv[8];
|
||||
std::uint32_t t1, t2;
|
||||
unsigned char const* sub_block;
|
||||
int i, j;
|
||||
for (i = 0; i < (int) block_nb; i++) {
|
||||
sub_block = message + (i << 6);
|
||||
for (j = 0; j < 16; j++)
|
||||
BEAST_SHA2_PACK32(&sub_block[j << 2], &w[j]);
|
||||
for (j = 16; j < 64; j++)
|
||||
w[j] = BEAST_SHA256_F4(
|
||||
w[j - 2]) + w[j - 7] +
|
||||
BEAST_SHA256_F3(w[j - 15]) +
|
||||
w[j - 16];
|
||||
for (j = 0; j < 8; j++)
|
||||
wv[j] = ctx.h[j];
|
||||
for (j = 0; j < 64; j++) {
|
||||
t1 = wv[7] + BEAST_SHA256_F2(wv[4]) +
|
||||
BEAST_SHA2_CH(wv[4], wv[5], wv[6]) +
|
||||
K[j] + w[j];
|
||||
t2 = BEAST_SHA256_F1(wv[0]) +
|
||||
BEAST_SHA2_MAJ(wv[0], wv[1], wv[2]);
|
||||
wv[7] = wv[6];
|
||||
wv[6] = wv[5];
|
||||
wv[5] = wv[4];
|
||||
wv[4] = wv[3] + t1;
|
||||
wv[3] = wv[2];
|
||||
wv[2] = wv[1];
|
||||
wv[1] = wv[0];
|
||||
wv[0] = t1 + t2;
|
||||
}
|
||||
for (j = 0; j < 8; j++)
|
||||
ctx.h[j] += wv[j];
|
||||
}
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
void init (sha256_context& ctx) noexcept
|
||||
{
|
||||
ctx.len = 0;
|
||||
ctx.tot_len = 0;
|
||||
ctx.h[0] = 0x6a09e667;
|
||||
ctx.h[1] = 0xbb67ae85;
|
||||
ctx.h[2] = 0x3c6ef372;
|
||||
ctx.h[3] = 0xa54ff53a;
|
||||
ctx.h[4] = 0x510e527f;
|
||||
ctx.h[5] = 0x9b05688c;
|
||||
ctx.h[6] = 0x1f83d9ab;
|
||||
ctx.h[7] = 0x5be0cd19;
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
void update (sha256_context& ctx,
|
||||
void const* message, std::size_t size) noexcept
|
||||
{
|
||||
auto const pm = reinterpret_cast<
|
||||
unsigned char const*>(message);
|
||||
unsigned int block_nb;
|
||||
unsigned int new_len, rem_len, tmp_len;
|
||||
const unsigned char *shifted_message;
|
||||
tmp_len = sha256_context::block_size - ctx.len;
|
||||
rem_len = size < tmp_len ? size : tmp_len;
|
||||
std::memcpy(&ctx.block[ctx.len], pm, rem_len);
|
||||
if (ctx.len + size < sha256_context::block_size) {
|
||||
ctx.len += size;
|
||||
return;
|
||||
}
|
||||
new_len = size - rem_len;
|
||||
block_nb = new_len / sha256_context::block_size;
|
||||
shifted_message = pm + rem_len;
|
||||
sha256_transform(ctx, ctx.block, 1);
|
||||
sha256_transform(ctx, shifted_message, block_nb);
|
||||
rem_len = new_len % sha256_context::block_size;
|
||||
std::memcpy(ctx.block, &shifted_message[
|
||||
block_nb << 6], rem_len);
|
||||
ctx.len = rem_len;
|
||||
ctx.tot_len += (block_nb + 1) << 6;
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
void finish (sha256_context& ctx,
|
||||
void* digest) noexcept
|
||||
{
|
||||
auto const pd = reinterpret_cast<
|
||||
unsigned char*>(digest);
|
||||
unsigned int block_nb;
|
||||
unsigned int pm_len;
|
||||
unsigned int len_b;
|
||||
int i;
|
||||
block_nb = (1 + ((sha256_context::block_size - 9) <
|
||||
(ctx.len % sha256_context::block_size)));
|
||||
len_b = (ctx.tot_len + ctx.len) << 3;
|
||||
pm_len = block_nb << 6;
|
||||
std::memset(ctx.block + ctx.len, 0, pm_len - ctx.len);
|
||||
ctx.block[ctx.len] = 0x80;
|
||||
BEAST_SHA2_UNPACK32(len_b, ctx.block + pm_len - 4);
|
||||
sha256_transform(ctx, ctx.block, block_nb);
|
||||
for (i = 0 ; i < 8; i++)
|
||||
BEAST_SHA2_UNPACK32(ctx.h[i], &pd[i << 2]);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// SHA512
|
||||
|
||||
template <class = void>
|
||||
void sha512_transform (sha512_context& ctx,
|
||||
@@ -183,8 +343,7 @@ void sha512_transform (sha512_context& ctx,
|
||||
BEAST_SHA2_CH(wv[4], wv[5], wv[6]) +
|
||||
K[j] + w[j];
|
||||
t2 = BEAST_SHA512_F1(wv[0]) +
|
||||
BEAST_SHA2_MAJ(wv[0],
|
||||
wv[1], wv[2]);
|
||||
BEAST_SHA2_MAJ(wv[0], wv[1], wv[2]);
|
||||
wv[7] = wv[6];
|
||||
wv[6] = wv[5];
|
||||
wv[5] = wv[4];
|
||||
@@ -202,16 +361,16 @@ void sha512_transform (sha512_context& ctx,
|
||||
template <class = void>
|
||||
void init (sha512_context& ctx) noexcept
|
||||
{
|
||||
ctx.len = 0;
|
||||
ctx.tot_len = 0;
|
||||
ctx.h[0] = 0x6a09e667f3bcc908ULL;
|
||||
ctx.h[1] = 0xbb67ae8584caa73bULL;
|
||||
ctx.h[2] = 0x3c6ef372fe94f82bULL;
|
||||
ctx.h[3] = 0xa54ff53a5f1d36f1ULL;
|
||||
ctx.h[4] = 0x510e527fade682d1ULL;
|
||||
ctx.h[5] = 0x9b05688c2b3e6c1fULL;
|
||||
ctx.h[6] = 0x1f83d9abfb41bd6bULL;
|
||||
ctx.h[6] = 0x1f83d9abfb41bd6bULL;
|
||||
ctx.h[7] = 0x5be0cd19137e2179ULL;
|
||||
ctx.len = 0;
|
||||
ctx.tot_len = 0;
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
@@ -256,7 +415,7 @@ void finish (sha512_context& ctx,
|
||||
(ctx.len % sha512_context::block_size));
|
||||
len_b = (ctx.tot_len + ctx.len) << 3;
|
||||
pm_len = block_nb << 7;
|
||||
memset(ctx.block + ctx.len, 0, pm_len - ctx.len);
|
||||
std::memset(ctx.block + ctx.len, 0, pm_len - ctx.len);
|
||||
ctx.block[ctx.len] = 0x80;
|
||||
BEAST_SHA2_UNPACK32(len_b, ctx.block + pm_len - 4);
|
||||
sha512_transform(ctx, ctx.block, block_nb);
|
||||
@@ -264,12 +423,6 @@ void finish (sha512_context& ctx,
|
||||
BEAST_SHA2_UNPACK64(ctx.h[i], &pd[i << 3]);
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
void secure_erase (sha512_context& ctx)
|
||||
{
|
||||
std::memset(ctx.block, 0, sizeof(ctx.block));
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
37
src/beast/beast/crypto/ripemd.h
Normal file
37
src/beast/beast/crypto/ripemd.h
Normal file
@@ -0,0 +1,37 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CRYPTO_RIPEMD_H_INCLUDED
|
||||
#define BEAST_CRYPTO_RIPEMD_H_INCLUDED
|
||||
|
||||
#include <beast/crypto/detail/mac_facade.h>
|
||||
#include <beast/crypto/detail/ripemd_context.h>
|
||||
|
||||
namespace beast {
|
||||
|
||||
using ripemd160_hasher = detail::mac_facade<
|
||||
detail::ripemd160_context, false>;
|
||||
|
||||
// secure version
|
||||
using ripemd160_hasher_s = detail::mac_facade<
|
||||
detail::ripemd160_context, true>;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
87
src/beast/beast/crypto/secure_erase.h
Normal file
87
src/beast/beast/crypto/secure_erase.h
Normal file
@@ -0,0 +1,87 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CRYPTO_SECURE_ERASE_H_INCLUDED
|
||||
#define BEAST_CRYPTO_SECURE_ERASE_H_INCLUDED
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <new>
|
||||
|
||||
namespace beast {
|
||||
|
||||
namespace detail {
|
||||
|
||||
class secure_erase_impl
|
||||
{
|
||||
private:
|
||||
struct base
|
||||
{
|
||||
virtual void operator()(
|
||||
void* dest, std::size_t bytes) const = 0;
|
||||
};
|
||||
|
||||
struct impl : base
|
||||
{
|
||||
void operator()(
|
||||
void* dest, std::size_t bytes) const override
|
||||
{
|
||||
char volatile* volatile p =
|
||||
const_cast<volatile char*>(
|
||||
reinterpret_cast<char*>(dest));
|
||||
if (bytes == 0)
|
||||
return;
|
||||
do
|
||||
{
|
||||
*p = 0;
|
||||
}
|
||||
while(*p++ == 0 && --bytes);
|
||||
}
|
||||
};
|
||||
|
||||
char buf_[sizeof(impl)];
|
||||
base& erase_;
|
||||
|
||||
public:
|
||||
secure_erase_impl()
|
||||
: erase_(*new(buf_) impl)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(
|
||||
void* dest, std::size_t bytes) const
|
||||
{
|
||||
return erase_(dest, bytes);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/** Guaranteed to fill memory with zeroes */
|
||||
template <class = void>
|
||||
void
|
||||
secure_erase (void* dest, std::size_t bytes)
|
||||
{
|
||||
static detail::secure_erase_impl const erase;
|
||||
erase(dest, bytes);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
44
src/beast/beast/crypto/sha2.h
Normal file
44
src/beast/beast/crypto/sha2.h
Normal file
@@ -0,0 +1,44 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CRYPTO_SHA2_H_INCLUDED
|
||||
#define BEAST_CRYPTO_SHA2_H_INCLUDED
|
||||
|
||||
#include <beast/crypto/detail/mac_facade.h>
|
||||
#include <beast/crypto/detail/sha2_context.h>
|
||||
|
||||
namespace beast {
|
||||
|
||||
using sha256_hasher = detail::mac_facade<
|
||||
detail::sha256_context, false>;
|
||||
|
||||
// secure version
|
||||
using sha256_hasher_s = detail::mac_facade<
|
||||
detail::sha256_context, true>;
|
||||
|
||||
using sha512_hasher = detail::mac_facade<
|
||||
detail::sha512_context, false>;
|
||||
|
||||
// secure version
|
||||
using sha512_hasher_s = detail::mac_facade<
|
||||
detail::sha512_context, true>;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -50,7 +50,9 @@
|
||||
|
||||
// Disables beast's std::equal safe iterator overloads
|
||||
#ifndef BEAST_NO_CXX14_EQUAL
|
||||
# ifdef _MSC_VER
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# define BEAST_NO_CXX14_EQUAL 1
|
||||
# elif defined(_MSC_VER)
|
||||
# define BEAST_NO_CXX14_EQUAL 0
|
||||
# elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402
|
||||
# define BEAST_NO_CXX14_EQUAL 1
|
||||
@@ -61,7 +63,9 @@
|
||||
|
||||
// Disables beast's std::integer_sequence
|
||||
#ifndef BEAST_NO_CXX14_INTEGER_SEQUENCE
|
||||
# ifdef _MSC_VER
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# define BEAST_NO_CXX14_INTEGER_SEQUENCE 1
|
||||
# elif defined(_MSC_VER)
|
||||
# define BEAST_NO_CXX14_INTEGER_SEQUENCE 0
|
||||
# elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402
|
||||
# define BEAST_NO_CXX14_INTEGER_SEQUENCE 1
|
||||
@@ -72,7 +76,9 @@
|
||||
|
||||
// Disables beast's std::make_reverse_iterator
|
||||
#ifndef BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR
|
||||
# ifdef _MSC_VER
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# define BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR 1
|
||||
# elif defined(_MSC_VER)
|
||||
# define BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR 0
|
||||
# elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402
|
||||
# define BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR 1
|
||||
|
||||
@@ -55,20 +55,20 @@ public:
|
||||
using size2 = std::index_sequence_for<int, size_t>; // generates size_t: 0,1
|
||||
using intmix = std::integer_sequence<int, 9, 8, 7, 2>; // generates int: 9,8,7,2
|
||||
using sizemix = std::index_sequence<1, 1, 2, 3, 5>; // generates size_t: 1,1,2,3,5
|
||||
|
||||
|
||||
// Make sure they're what we expect
|
||||
static_assert ( std::is_same <int3::value_type, int>::value, "int3 type wrong" );
|
||||
static_assert ( int3::static_size == 3, "int3 size wrong" );
|
||||
|
||||
|
||||
static_assert ( std::is_same <size7::value_type, size_t>::value, "size7 type wrong" );
|
||||
static_assert ( size7::static_size == 7, "size7 size wrong" );
|
||||
|
||||
|
||||
static_assert ( std::is_same <size4::value_type, size_t>::value, "size4 type wrong" );
|
||||
static_assert ( size4::static_size == 4, "size4 size wrong" );
|
||||
|
||||
|
||||
static_assert ( std::is_same <size2::value_type, size_t>::value, "size2 type wrong" );
|
||||
static_assert ( size2::static_size == 2, "size2 size wrong" );
|
||||
|
||||
|
||||
static_assert ( std::is_same <intmix::value_type, int>::value, "intmix type wrong" );
|
||||
static_assert ( intmix::static_size == 4, "intmix size wrong" );
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
static_assert ( sizemix::static_size == 5, "sizemix size wrong" );
|
||||
|
||||
auto tup = std::make_tuple ( 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 );
|
||||
|
||||
|
||||
// Use them
|
||||
auto t3 = extract ( tup, int3() );
|
||||
static_assert ( std::tuple_size<decltype(t3)>::value == int3::static_size, "t3 size wrong");
|
||||
|
||||
@@ -90,7 +90,7 @@ template <class T>
|
||||
using add_volatile_t = typename add_volatile<T>::type; // C++14
|
||||
template <class T>
|
||||
using add_cv_t = typename add_cv<T>::type; // C++14
|
||||
|
||||
|
||||
// reference modifications:
|
||||
template <class T>
|
||||
using remove_reference_t = typename remove_reference<T>::type; // C++14
|
||||
@@ -98,13 +98,13 @@ template <class T>
|
||||
using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++14
|
||||
template <class T>
|
||||
using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; // C++14
|
||||
|
||||
|
||||
// sign modifications:
|
||||
template <class T>
|
||||
using make_signed_t = typename make_signed<T>::type; // C++14
|
||||
template <class T>
|
||||
using make_unsigned_t = typename make_unsigned<T>::type; // C++14
|
||||
|
||||
|
||||
// array modifications:
|
||||
template <class T>
|
||||
using remove_extent_t = typename remove_extent<T>::type; // C++14
|
||||
|
||||
@@ -90,9 +90,9 @@ maybe_reverse_bytes(T& t, Hasher&)
|
||||
// is_uniquely_represented<T>
|
||||
|
||||
// A type T is contiguously hashable if for all combinations of two values of
|
||||
// a type, say x and y, if x == y, then it must also be true that
|
||||
// memcmp(addressof(x), addressof(y), sizeof(T)) == 0. I.e. if x == y,
|
||||
// then x and y have the same bit pattern representation.
|
||||
// a type, say x and y, if x == y, then it must also be true that
|
||||
// memcmp(addressof(x), addressof(y), sizeof(T)) == 0. I.e. if x == y,
|
||||
// then x and y have the same bit pattern representation.
|
||||
|
||||
template <class T>
|
||||
struct is_uniquely_represented
|
||||
@@ -120,7 +120,7 @@ struct is_uniquely_represented<T const volatile>
|
||||
|
||||
template <class T, class U>
|
||||
struct is_uniquely_represented<std::pair<T, U>>
|
||||
: public std::integral_constant<bool, is_uniquely_represented<T>::value &&
|
||||
: public std::integral_constant<bool, is_uniquely_represented<T>::value &&
|
||||
is_uniquely_represented<U>::value &&
|
||||
sizeof(T) + sizeof(U) == sizeof(std::pair<T, U>)>
|
||||
{
|
||||
@@ -131,7 +131,7 @@ struct is_uniquely_represented<std::pair<T, U>>
|
||||
template <class ...T>
|
||||
struct is_uniquely_represented<std::tuple<T...>>
|
||||
: public std::integral_constant<bool,
|
||||
static_and<is_uniquely_represented<T>::value...>::value &&
|
||||
static_and<is_uniquely_represented<T>::value...>::value &&
|
||||
static_sum<sizeof(T)...>::value == sizeof(std::tuple<T...>)>
|
||||
{
|
||||
};
|
||||
@@ -148,7 +148,7 @@ struct is_uniquely_represented<T[N]>
|
||||
|
||||
template <class T, std::size_t N>
|
||||
struct is_uniquely_represented<std::array<T, N>>
|
||||
: public std::integral_constant<bool, is_uniquely_represented<T>::value &&
|
||||
: public std::integral_constant<bool, is_uniquely_represented<T>::value &&
|
||||
sizeof(T)*N == sizeof(std::array<T, N>)>
|
||||
{
|
||||
};
|
||||
@@ -159,7 +159,7 @@ struct is_uniquely_represented<std::array<T, N>>
|
||||
combination of possible values of `T` held in `x` and `y`,
|
||||
if `x == y`, then it must be true that `memcmp(&x, &y, sizeof(T))`
|
||||
return 0; i.e. that `x` and `y` are represented by the same bit pattern.
|
||||
|
||||
|
||||
For example: A two's complement `int` should be contiguously hashable.
|
||||
Every bit pattern produces a unique value that does not compare equal to
|
||||
any other bit pattern's value. A IEEE floating point should not be
|
||||
@@ -206,7 +206,7 @@ struct is_contiguously_hashable<T[N], HashAlgorithm>
|
||||
Never
|
||||
Effect:
|
||||
Returns the reslting hash of all the input data.
|
||||
*/
|
||||
*/
|
||||
/** @{ */
|
||||
|
||||
// scalars
|
||||
@@ -271,21 +271,21 @@ hash_append(Hasher& h, T (&a)[N]) noexcept;
|
||||
template <class Hasher, class CharT, class Traits, class Alloc>
|
||||
std::enable_if_t
|
||||
<
|
||||
!is_contiguously_hashable<CharT, Hasher>::value
|
||||
!is_contiguously_hashable<CharT, Hasher>::value
|
||||
>
|
||||
hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcept;
|
||||
|
||||
template <class Hasher, class CharT, class Traits, class Alloc>
|
||||
std::enable_if_t
|
||||
<
|
||||
is_contiguously_hashable<CharT, Hasher>::value
|
||||
is_contiguously_hashable<CharT, Hasher>::value
|
||||
>
|
||||
hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcept;
|
||||
|
||||
template <class Hasher, class T, class U>
|
||||
std::enable_if_t
|
||||
<
|
||||
!is_contiguously_hashable<std::pair<T, U>, Hasher>::value
|
||||
!is_contiguously_hashable<std::pair<T, U>, Hasher>::value
|
||||
>
|
||||
hash_append (Hasher& h, std::pair<T, U> const& p) noexcept;
|
||||
|
||||
@@ -348,7 +348,7 @@ template <class Hasher, class CharT, class Traits, class Alloc>
|
||||
inline
|
||||
std::enable_if_t
|
||||
<
|
||||
!is_contiguously_hashable<CharT, Hasher>::value
|
||||
!is_contiguously_hashable<CharT, Hasher>::value
|
||||
>
|
||||
hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcept
|
||||
{
|
||||
@@ -361,7 +361,7 @@ template <class Hasher, class CharT, class Traits, class Alloc>
|
||||
inline
|
||||
std::enable_if_t
|
||||
<
|
||||
is_contiguously_hashable<CharT, Hasher>::value
|
||||
is_contiguously_hashable<CharT, Hasher>::value
|
||||
>
|
||||
hash_append(Hasher& h, std::basic_string<CharT, Traits, Alloc> const& s) noexcept
|
||||
{
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
//------------------------------- siphash.h ------------------------------------
|
||||
//
|
||||
//
|
||||
// This software is in the public domain. The only restriction on its use is
|
||||
// that no one can remove it from the public domain by claiming ownership of it,
|
||||
// including the original authors.
|
||||
//
|
||||
//
|
||||
// There is no warranty of correctness on the software contained herein. Use
|
||||
// at your own risk.
|
||||
//
|
||||
// Derived from:
|
||||
//
|
||||
//
|
||||
// SipHash reference C implementation
|
||||
//
|
||||
//
|
||||
// Written in 2012 by Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>
|
||||
// Daniel J. Bernstein <djb@cr.yp.to>
|
||||
//
|
||||
//
|
||||
// To the extent possible under law, the author(s) have dedicated all copyright
|
||||
// and related and neighboring rights to this software to the public domain
|
||||
// worldwide. This software is distributed without any warranty.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the CC0 Public Domain Dedication along
|
||||
// with this software. If not, see
|
||||
// <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
//
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <beast/hash/siphash.h>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define ALLOW_UNALIGNED_READS 1
|
||||
|
||||
//
|
||||
// short hash ... it could be used on any message,
|
||||
// short hash ... it could be used on any message,
|
||||
// but it's used by Spooky just for short messages.
|
||||
//
|
||||
void SpookyHash::Short(
|
||||
@@ -31,16 +31,16 @@ void SpookyHash::Short(
|
||||
uint64 *hash2)
|
||||
{
|
||||
uint64 buf[2*sc_numVars];
|
||||
union
|
||||
{
|
||||
const uint8 *p8;
|
||||
union
|
||||
{
|
||||
const uint8 *p8;
|
||||
uint32 *p32;
|
||||
uint64 *p64;
|
||||
size_t i;
|
||||
uint64 *p64;
|
||||
size_t i;
|
||||
} u;
|
||||
|
||||
u.p8 = (const uint8 *)message;
|
||||
|
||||
|
||||
if (!ALLOW_UNALIGNED_READS && (u.i & 0x7))
|
||||
{
|
||||
memcpy(buf, message, length);
|
||||
@@ -56,7 +56,7 @@ void SpookyHash::Short(
|
||||
if (length > 15)
|
||||
{
|
||||
const uint64 *end = u.p64 + (length/32)*4;
|
||||
|
||||
|
||||
// handle all complete sets of 32 bytes
|
||||
for (; u.p64 < end; u.p64 += 4)
|
||||
{
|
||||
@@ -66,7 +66,7 @@ void SpookyHash::Short(
|
||||
a += u.p64[2];
|
||||
b += u.p64[3];
|
||||
}
|
||||
|
||||
|
||||
//Handle the case of 16+ remaining bytes.
|
||||
if (remainder >= 16)
|
||||
{
|
||||
@@ -77,7 +77,7 @@ void SpookyHash::Short(
|
||||
remainder -= 16;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Handle the last 0..15 bytes, and its length
|
||||
d += ((uint64)length) << 56;
|
||||
switch (remainder)
|
||||
@@ -131,9 +131,9 @@ void SpookyHash::Short(
|
||||
|
||||
// do the whole hash in one call
|
||||
void SpookyHash::Hash128(
|
||||
const void *message,
|
||||
size_t length,
|
||||
uint64 *hash1,
|
||||
const void *message,
|
||||
size_t length,
|
||||
uint64 *hash1,
|
||||
uint64 *hash2)
|
||||
{
|
||||
if (length < sc_bufSize)
|
||||
@@ -145,18 +145,18 @@ void SpookyHash::Hash128(
|
||||
uint64 h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11;
|
||||
uint64 buf[sc_numVars];
|
||||
uint64 *end;
|
||||
union
|
||||
{
|
||||
const uint8 *p8;
|
||||
uint64 *p64;
|
||||
size_t i;
|
||||
union
|
||||
{
|
||||
const uint8 *p8;
|
||||
uint64 *p64;
|
||||
size_t i;
|
||||
} u;
|
||||
size_t remainder;
|
||||
|
||||
|
||||
h0=h3=h6=h9 = *hash1;
|
||||
h1=h4=h7=h10 = *hash2;
|
||||
h2=h5=h8=h11 = sc_const;
|
||||
|
||||
|
||||
u.p8 = (const uint8 *)message;
|
||||
end = u.p64 + (length/sc_blockSize)*sc_numVars;
|
||||
|
||||
@@ -164,7 +164,7 @@ void SpookyHash::Hash128(
|
||||
if (ALLOW_UNALIGNED_READS || ((u.i & 0x7) == 0))
|
||||
{
|
||||
while (u.p64 < end)
|
||||
{
|
||||
{
|
||||
Mix(u.p64, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
|
||||
u.p64 += sc_numVars;
|
||||
}
|
||||
@@ -185,8 +185,8 @@ void SpookyHash::Hash128(
|
||||
memset(((uint8 *)buf)+remainder, 0, sc_blockSize-remainder);
|
||||
((uint8 *)buf)[sc_blockSize-1] =
|
||||
static_cast<uint8>(remainder);
|
||||
|
||||
// do some final mixing
|
||||
|
||||
// do some final mixing
|
||||
End(buf, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
|
||||
*hash1 = h0;
|
||||
*hash2 = h1;
|
||||
@@ -210,14 +210,14 @@ void SpookyHash::Update(const void *message, size_t length)
|
||||
uint64 h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11;
|
||||
size_t newLength = length + m_remainder;
|
||||
uint8 remainder;
|
||||
union
|
||||
{
|
||||
const uint8 *p8;
|
||||
uint64 *p64;
|
||||
size_t i;
|
||||
union
|
||||
{
|
||||
const uint8 *p8;
|
||||
uint64 *p64;
|
||||
size_t i;
|
||||
} u;
|
||||
const uint64 *end;
|
||||
|
||||
|
||||
// Is this message fragment too short? If it is, stuff it away.
|
||||
if (newLength < sc_bufSize)
|
||||
{
|
||||
@@ -226,7 +226,7 @@ void SpookyHash::Update(const void *message, size_t length)
|
||||
m_remainder = (uint8)newLength;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// init the variables
|
||||
if (m_length < sc_bufSize)
|
||||
{
|
||||
@@ -250,7 +250,7 @@ void SpookyHash::Update(const void *message, size_t length)
|
||||
h11 = m_state[11];
|
||||
}
|
||||
m_length = length + m_length;
|
||||
|
||||
|
||||
// if we've got anything stuffed away, use it now
|
||||
if (m_remainder)
|
||||
{
|
||||
@@ -266,14 +266,14 @@ void SpookyHash::Update(const void *message, size_t length)
|
||||
{
|
||||
u.p8 = (const uint8 *)message;
|
||||
}
|
||||
|
||||
|
||||
// handle all whole blocks of sc_blockSize bytes
|
||||
end = u.p64 + (length/sc_blockSize)*sc_numVars;
|
||||
remainder = (uint8)(length-((const uint8 *)end-u.p8));
|
||||
if (ALLOW_UNALIGNED_READS || (u.i & 0x7) == 0)
|
||||
{
|
||||
while (u.p64 < end)
|
||||
{
|
||||
{
|
||||
Mix(u.p64, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
|
||||
u.p64 += sc_numVars;
|
||||
}
|
||||
@@ -281,7 +281,7 @@ void SpookyHash::Update(const void *message, size_t length)
|
||||
else
|
||||
{
|
||||
while (u.p64 < end)
|
||||
{
|
||||
{
|
||||
memcpy(m_data, u.p8, sc_blockSize);
|
||||
Mix(m_data, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
|
||||
u.p64 += sc_numVars;
|
||||
@@ -291,7 +291,7 @@ void SpookyHash::Update(const void *message, size_t length)
|
||||
// stuff away the last few bytes
|
||||
m_remainder = remainder;
|
||||
memcpy(m_data, end, remainder);
|
||||
|
||||
|
||||
// stuff away the variables
|
||||
m_state[0] = h0;
|
||||
m_state[1] = h1;
|
||||
@@ -319,10 +319,10 @@ void SpookyHash::Final(uint64 *hash1, uint64 *hash2)
|
||||
Short( m_data, m_length, hash1, hash2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const uint64 *data = (const uint64 *)m_data;
|
||||
uint8 remainder = m_remainder;
|
||||
|
||||
|
||||
uint64 h0 = m_state[0];
|
||||
uint64 h1 = m_state[1];
|
||||
uint64 h2 = m_state[2];
|
||||
@@ -348,7 +348,7 @@ void SpookyHash::Final(uint64 *hash1, uint64 *hash2)
|
||||
memset(&((uint8 *)data)[remainder], 0, (sc_blockSize-remainder));
|
||||
|
||||
((uint8 *)data)[sc_blockSize-1] = remainder;
|
||||
|
||||
|
||||
// do some final mixing
|
||||
End(data, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// Feb 5 2012: adjusted definitions of uint* to be more portable
|
||||
// Mar 30 2012: 3 bytes/cycle, not 4. Alpha was 4 but wasn't thorough enough.
|
||||
// August 5 2012: SpookyV2 (different results)
|
||||
//
|
||||
//
|
||||
// Up to 3 bytes/cycle for long messages. Reasonably fast for short messages.
|
||||
// All 1 or 2 bit deltas achieve avalanche within 1% bias per output bit.
|
||||
//
|
||||
@@ -20,9 +20,9 @@
|
||||
//
|
||||
// Google's CityHash has similar specs to SpookyHash, and CityHash is faster
|
||||
// on new Intel boxes. MD4 and MD5 also have similar specs, but they are orders
|
||||
// of magnitude slower. CRCs are two or more times slower, but unlike
|
||||
// SpookyHash, they have nice math for combining the CRCs of pieces to form
|
||||
// the CRCs of wholes. There are also cryptographic hashes, but those are even
|
||||
// of magnitude slower. CRCs are two or more times slower, but unlike
|
||||
// SpookyHash, they have nice math for combining the CRCs of pieces to form
|
||||
// the CRCs of wholes. There are also cryptographic hashes, but those are even
|
||||
// slower than MD5.
|
||||
//
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
void Init(
|
||||
uint64 seed1, // any 64-bit value will do, including 0
|
||||
uint64 seed2); // different seeds produce independent hashes
|
||||
|
||||
|
||||
//
|
||||
// Update: add a piece of a message to a SpookyHash state
|
||||
//
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
// I tried 3 pairs of each; they all differed by at least 212 bits.
|
||||
//
|
||||
static INLINE void Mix(
|
||||
const uint64 *data,
|
||||
const uint64 *data,
|
||||
uint64 &s0, uint64 &s1, uint64 &s2, uint64 &s3,
|
||||
uint64 &s4, uint64 &s5, uint64 &s6, uint64 &s7,
|
||||
uint64 &s8, uint64 &s9, uint64 &s10,uint64 &s11)
|
||||
@@ -171,7 +171,7 @@ public:
|
||||
//
|
||||
static INLINE void EndPartial(
|
||||
uint64 &h0, uint64 &h1, uint64 &h2, uint64 &h3,
|
||||
uint64 &h4, uint64 &h5, uint64 &h6, uint64 &h7,
|
||||
uint64 &h4, uint64 &h5, uint64 &h6, uint64 &h7,
|
||||
uint64 &h8, uint64 &h9, uint64 &h10,uint64 &h11)
|
||||
{
|
||||
h11+= h1; h2 ^= h11; h1 = Rot64(h1,44);
|
||||
@@ -189,9 +189,9 @@ public:
|
||||
}
|
||||
|
||||
static INLINE void End(
|
||||
const uint64 *data,
|
||||
const uint64 *data,
|
||||
uint64 &h0, uint64 &h1, uint64 &h2, uint64 &h3,
|
||||
uint64 &h4, uint64 &h5, uint64 &h6, uint64 &h7,
|
||||
uint64 &h4, uint64 &h5, uint64 &h6, uint64 &h7,
|
||||
uint64 &h8, uint64 &h9, uint64 &h10,uint64 &h11)
|
||||
{
|
||||
h0 += data[0]; h1 += data[1]; h2 += data[2]; h3 += data[3];
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
}
|
||||
|
||||
//
|
||||
// The goal is for each bit of the input to expand into 128 bits of
|
||||
// The goal is for each bit of the input to expand into 128 bits of
|
||||
// apparent entropy before it is fully overwritten.
|
||||
// n trials both set and cleared at least m bits of h0 h1 h2 h3
|
||||
// n: 2 m: 29
|
||||
@@ -259,7 +259,7 @@ public:
|
||||
h0 ^= h3; h3 = Rot64(h3,25); h0 += h3;
|
||||
h1 ^= h0; h0 = Rot64(h0,63); h1 += h0;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//
|
||||
@@ -267,7 +267,7 @@ private:
|
||||
// Short has a low startup cost, the normal mode is good for long
|
||||
// keys, the cost crossover is at about 192 bytes. The two modes were
|
||||
// held to the same quality bar.
|
||||
//
|
||||
//
|
||||
static void Short(
|
||||
const void *message, // message (array of bytes, not necessarily aligned)
|
||||
size_t length, // length of message (in bytes)
|
||||
|
||||
@@ -206,7 +206,7 @@ class spooky
|
||||
private:
|
||||
SpookyHash state_;
|
||||
|
||||
public:
|
||||
public:
|
||||
static beast::endian const endian = beast::endian::native;
|
||||
|
||||
spooky(std::size_t seed1 = 1, std::size_t seed2 = 2) noexcept
|
||||
@@ -429,9 +429,9 @@ public:
|
||||
{
|
||||
auto const start (
|
||||
std::chrono::high_resolution_clock::now());
|
||||
|
||||
|
||||
auto const hashes (make_hashes <Hasher> (keys));
|
||||
|
||||
|
||||
results.elapsed = std::chrono::duration_cast <std::chrono::milliseconds> (
|
||||
std::chrono::high_resolution_clock::now() - start);
|
||||
|
||||
|
||||
@@ -396,4 +396,4 @@ build_map (headers const& h)
|
||||
} // http
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -187,7 +187,7 @@ to_string (URL const& url)
|
||||
|
||||
s.append (url.scheme ());
|
||||
s.append ("://");
|
||||
|
||||
|
||||
if (!url.userinfo ().empty ())
|
||||
{
|
||||
s.append (url.userinfo ());
|
||||
|
||||
@@ -94,7 +94,7 @@ basic_parser::basic_parser (bool request) noexcept
|
||||
h->on_headers_complete = &basic_parser::cb_headers_complete;
|
||||
h->on_body = &basic_parser::cb_body;
|
||||
h->on_message_complete = &basic_parser::cb_message_complete;
|
||||
|
||||
|
||||
joyent::http_parser_init (s, request
|
||||
? joyent::http_parser_type::HTTP_REQUEST
|
||||
: joyent::http_parser_type::HTTP_RESPONSE);
|
||||
|
||||
@@ -31,7 +31,7 @@ basic_url_base::parse_impl (string_ref s, boost::system::error_code& ec)
|
||||
joyent::http_parser_url p;
|
||||
|
||||
value_type const* const data (s.data());
|
||||
|
||||
|
||||
int const error (joyent::http_parser_parse_url (
|
||||
data, s.size(), false, &p));
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ convert_http_errno (joyent::http_errno err)
|
||||
{
|
||||
return default_error_condition (code) == condition;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
equivalent (error_code const& code, int condition
|
||||
) const noexcept override
|
||||
@@ -151,7 +151,7 @@ convert_http_errno (joyent::http_errno err)
|
||||
};
|
||||
|
||||
static http_error_category_t http_error_category;
|
||||
|
||||
|
||||
return boost::system::error_code (
|
||||
err, http_error_category);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
// TODO Use <system_error>
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
// Wraps the C-language joyent http parser header in a namespace
|
||||
// Wraps the C-language joyent http parser header in a namespace
|
||||
|
||||
namespace beast {
|
||||
namespace joyent {
|
||||
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
// request
|
||||
beast::http::method_t method_;
|
||||
std::string url_;
|
||||
|
||||
|
||||
// response
|
||||
int status_;
|
||||
std::string reason_;
|
||||
@@ -248,7 +248,7 @@ message::operator= (message&& other)
|
||||
keep_alive_ = other.keep_alive_;
|
||||
upgrade_ = other.upgrade_;
|
||||
headers = std::move(other.headers);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
message& m, bool request)
|
||||
: beast::http::basic_parser (request)
|
||||
, message_(m)
|
||||
, write_body_(std::move(write_body))
|
||||
, write_body_(std::move(write_body))
|
||||
{
|
||||
message_.get().request(request);
|
||||
}
|
||||
@@ -208,4 +208,4 @@ parser::do_complete()
|
||||
} // http
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
|
||||
void test_url_parsing ()
|
||||
{
|
||||
char const* const urls[] =
|
||||
char const* const urls[] =
|
||||
{
|
||||
"http://en.wikipedia.org/wiki/URI#Examples_of_URI_references",
|
||||
"ftp://ftp.funet.fi/pub/standards/RFC/rfc959.txt"
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
log << encode (std::string(
|
||||
boost::asio::buffer_cast<char const*>(buf),
|
||||
boost::asio::buffer_size(buf)));
|
||||
}
|
||||
}
|
||||
|
||||
// Convert a ConstBufferSequence to a string
|
||||
template <class ConstBufferSequence>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/http/tests/urls_large_data.h>
|
||||
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
virtual ~Collector() = 0;
|
||||
|
||||
/** Create a hook.
|
||||
|
||||
|
||||
A hook is called at each collection interval, on an implementation
|
||||
defined thread. This is a convenience facility for gathering metrics
|
||||
in the polling style. The typical usage is to update all the metrics
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
*/
|
||||
/** @{ */
|
||||
virtual Counter make_counter (std::string const& name) = 0;
|
||||
|
||||
|
||||
Counter make_counter (std::string const& prefix, std::string const& name)
|
||||
{
|
||||
if (prefix.empty ())
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
}
|
||||
/** @} */
|
||||
|
||||
/** Create a gauge with the specified name.
|
||||
/** Create a gauge with the specified name.
|
||||
@see Gauge
|
||||
*/
|
||||
/** @{ */
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace beast {
|
||||
namespace insight {
|
||||
|
||||
/** A metric for measuring an integral value.
|
||||
|
||||
|
||||
A counter is a gauge calculated at the server. The owner of the counter
|
||||
may increment and decrement the value by an amount.
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class CounterImpl
|
||||
{
|
||||
public:
|
||||
using value_type = std::int64_t;
|
||||
|
||||
|
||||
virtual ~CounterImpl () = 0;
|
||||
virtual void increment (value_type amount) = 0;
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace beast {
|
||||
namespace insight {
|
||||
|
||||
/** A metric for reporting event timing.
|
||||
|
||||
|
||||
An event is an operation that has an associated millisecond time, or
|
||||
other integral value. Because events happen at a specific moment, the
|
||||
metric only supports a push-style interface.
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace beast {
|
||||
namespace insight {
|
||||
|
||||
/** A metric for measuring an integral value.
|
||||
|
||||
|
||||
A gauge is an instantaneous measurement of a value, like the gas gauge
|
||||
in a car. The caller directly sets the value, or adjusts it by a
|
||||
specified amount. The value is kept in the client rather than the collector.
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
|
||||
|
||||
/** A reference to a handler for performing polled collection. */
|
||||
class Hook : public Base
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace beast {
|
||||
namespace insight {
|
||||
|
||||
/** A metric for measuring an integral value.
|
||||
|
||||
|
||||
A meter may be thought of as an increment-only counter.
|
||||
|
||||
This is a lightweight reference wrapper which is cheap to copy and assign.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
|
||||
|
||||
/** A Collector which does not collect metrics. */
|
||||
class NullCollector : public Collector
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
{
|
||||
return Gauge (std::make_shared <detail::NullGaugeImpl> ());
|
||||
}
|
||||
|
||||
|
||||
Meter make_meter (std::string const&)
|
||||
{
|
||||
return Meter (std::make_shared <detail::NullMeterImpl> ());
|
||||
|
||||
@@ -616,7 +616,7 @@ void StatsDGaugeImpl::flush ()
|
||||
void StatsDGaugeImpl::do_set (GaugeImpl::value_type value)
|
||||
{
|
||||
m_value = value;
|
||||
|
||||
|
||||
if (m_value != m_last_value)
|
||||
{
|
||||
m_last_value = m_value;
|
||||
@@ -641,7 +641,7 @@ void StatsDGaugeImpl::do_increment (GaugeImpl::difference_type amount)
|
||||
{
|
||||
GaugeImpl::value_type const d (
|
||||
static_cast <GaugeImpl::value_type> (-amount));
|
||||
value = (d >= value) ? 0 : value - d;
|
||||
value = (d >= value) ? 0 : value - d;
|
||||
}
|
||||
|
||||
do_set (value);
|
||||
|
||||
@@ -160,91 +160,91 @@ private:
|
||||
}
|
||||
|
||||
/** Intrusive doubly linked list.
|
||||
|
||||
|
||||
This intrusive List is a container similar in operation to std::list in the
|
||||
Standard Template Library (STL). Like all @ref intrusive containers, List
|
||||
requires you to first derive your class from List<>::Node:
|
||||
|
||||
|
||||
@code
|
||||
|
||||
|
||||
struct Object : List <Object>::Node
|
||||
{
|
||||
explicit Object (int value) : m_value (value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int m_value;
|
||||
};
|
||||
|
||||
|
||||
@endcode
|
||||
|
||||
|
||||
Now we define the list, and add a couple of items.
|
||||
|
||||
|
||||
@code
|
||||
|
||||
|
||||
List <Object> list;
|
||||
|
||||
|
||||
list.push_back (* (new Object (1)));
|
||||
list.push_back (* (new Object (2)));
|
||||
|
||||
|
||||
@endcode
|
||||
|
||||
|
||||
For compatibility with the standard containers, push_back() expects a
|
||||
reference to the object. Unlike the standard container, however, push_back()
|
||||
places the actual object in the list and not a copy-constructed duplicate.
|
||||
|
||||
|
||||
Iterating over the list follows the same idiom as the STL:
|
||||
|
||||
|
||||
@code
|
||||
|
||||
|
||||
for (List <Object>::iterator iter = list.begin(); iter != list.end; ++iter)
|
||||
std::cout << iter->m_value;
|
||||
|
||||
|
||||
@endcode
|
||||
|
||||
|
||||
You can even use BOOST_FOREACH, or range based for loops:
|
||||
|
||||
|
||||
@code
|
||||
|
||||
|
||||
BOOST_FOREACH (Object& object, list) // boost only
|
||||
std::cout << object.m_value;
|
||||
|
||||
|
||||
for (Object& object : list) // C++11 only
|
||||
std::cout << object.m_value;
|
||||
|
||||
|
||||
@endcode
|
||||
|
||||
|
||||
Because List is mostly STL compliant, it can be passed into STL algorithms:
|
||||
e.g. `std::for_each()` or `std::find_first_of()`.
|
||||
|
||||
|
||||
In general, objects placed into a List should be dynamically allocated
|
||||
although this cannot be enforced at compile time. Since the caller provides
|
||||
the storage for the object, the caller is also responsible for deleting the
|
||||
object. An object still exists after being removed from a List, until the
|
||||
caller deletes it. This means an element can be moved from one List to
|
||||
another with practically no overhead.
|
||||
|
||||
|
||||
Unlike the standard containers, an object may only exist in one list at a
|
||||
time, unless special preparations are made. The Tag template parameter is
|
||||
used to distinguish between different list types for the same object,
|
||||
allowing the object to exist in more than one list simultaneously.
|
||||
|
||||
|
||||
For example, consider an actor system where a global list of actors is
|
||||
maintained, so that they can each be periodically receive processing
|
||||
time. We wish to also maintain a list of the subset of actors that require
|
||||
a domain-dependent update. To achieve this, we declare two tags, the
|
||||
associated list types, and the list element thusly:
|
||||
|
||||
|
||||
@code
|
||||
|
||||
|
||||
struct Actor; // Forward declaration required
|
||||
|
||||
|
||||
struct ProcessTag { };
|
||||
struct UpdateTag { };
|
||||
|
||||
|
||||
using ProcessList = List <Actor, ProcessTag>;
|
||||
using UpdateList = List <Actor, UpdateTag>;
|
||||
|
||||
|
||||
// Derive from both node types so we can be in each list at once.
|
||||
//
|
||||
struct Actor : ProcessList::Node, UpdateList::Node
|
||||
@@ -252,15 +252,15 @@ private:
|
||||
bool process (); // returns true if we need an update
|
||||
void update ();
|
||||
};
|
||||
|
||||
|
||||
@endcode
|
||||
|
||||
|
||||
@tparam T The base type of element which the list will store
|
||||
pointers to.
|
||||
|
||||
|
||||
@tparam Tag An optional unique type name used to distinguish lists and nodes,
|
||||
when the object can exist in multiple lists simultaneously.
|
||||
|
||||
|
||||
@ingroup beast_core intrusive
|
||||
*/
|
||||
template <typename T, typename Tag = void>
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
class Node
|
||||
{
|
||||
public:
|
||||
Node ()
|
||||
Node ()
|
||||
: m_next (nullptr)
|
||||
{ }
|
||||
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
|
||||
private:
|
||||
friend class LockFreeStack;
|
||||
|
||||
|
||||
template <class Container, bool IsConst>
|
||||
friend class LockFreeStackIterator;
|
||||
|
||||
@@ -262,7 +262,7 @@ public:
|
||||
{
|
||||
return iterator (&m_end);
|
||||
}
|
||||
|
||||
|
||||
const_iterator begin () const
|
||||
{
|
||||
return const_iterator (m_head.load ());
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
{
|
||||
return const_iterator (&m_end);
|
||||
}
|
||||
|
||||
|
||||
const_iterator cbegin () const
|
||||
{
|
||||
return const_iterator (m_head.load ());
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
/** Outputs all the HTTPMessage data excluding the body into a string. */
|
||||
String toString () const;
|
||||
|
||||
|
||||
private:
|
||||
HTTPVersion m_version;
|
||||
HTTPHeaders m_headers;
|
||||
|
||||
@@ -727,7 +727,7 @@ public:
|
||||
|
||||
if (isPositiveAndBelow (indexToRemove, numUsed))
|
||||
{
|
||||
bassert (data.elements != nullptr);
|
||||
bassert (data.elements != nullptr);
|
||||
ElementType removed (data.elements[indexToRemove]);
|
||||
removeInternal (indexToRemove);
|
||||
return removed;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/module/core/native/BasicNativeHeaders.h>
|
||||
#include <beast/module/core/core.h>
|
||||
|
||||
@@ -46,7 +47,10 @@
|
||||
#include <ws2tcpip.h>
|
||||
|
||||
#if ! BEAST_MINGW
|
||||
#pragma warning ( push )
|
||||
#pragma warning ( disable: 4091 )
|
||||
#include <Dbghelp.h>
|
||||
#pragma warning ( pop )
|
||||
|
||||
#if ! BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES
|
||||
#pragma comment (lib, "DbgHelp.lib")
|
||||
|
||||
@@ -70,7 +70,7 @@ bool chopUInt (int& value, int limit, std::string& input)
|
||||
auto left_iter = std::find_if_not (input.begin (), input.end (),
|
||||
[](std::string::value_type c)
|
||||
{
|
||||
return std::isdigit (c, std::locale::classic());
|
||||
return std::isdigit (c, std::locale::classic());
|
||||
});
|
||||
|
||||
std::string item (input.begin (), left_iter);
|
||||
@@ -163,7 +163,7 @@ bool SemanticVersion::parse (std::string const& input, bool debug)
|
||||
auto left_iter = std::find_if_not (input.begin (), input.end (),
|
||||
[](std::string::value_type c)
|
||||
{
|
||||
return std::isspace (c, std::locale::classic());
|
||||
return std::isspace (c, std::locale::classic());
|
||||
});
|
||||
|
||||
auto right_iter = std::find_if_not (input.rbegin (), input.rend (),
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
std::string print () const;
|
||||
|
||||
inline bool isRelease () const noexcept
|
||||
{
|
||||
{
|
||||
return preReleaseIdentifiers.empty();
|
||||
}
|
||||
inline bool isPreRelease () const noexcept
|
||||
@@ -75,8 +75,8 @@ public:
|
||||
int compare (SemanticVersion const& lhs, SemanticVersion const& rhs);
|
||||
|
||||
inline bool
|
||||
operator== (SemanticVersion const& lhs, SemanticVersion const& rhs)
|
||||
{
|
||||
operator== (SemanticVersion const& lhs, SemanticVersion const& rhs)
|
||||
{
|
||||
return compare (lhs, rhs) == 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,4 +109,4 @@ private:
|
||||
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace beast {
|
||||
|
||||
//==============================================================================
|
||||
|
||||
@@ -106,7 +106,10 @@
|
||||
#include <mapi.h>
|
||||
#include <float.h>
|
||||
#include <process.h>
|
||||
#pragma warning ( push )
|
||||
#pragma warning ( disable: 4091 )
|
||||
#include <shlobj.h>
|
||||
#pragma warning ( pop )
|
||||
#include <shlwapi.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
|
||||
@@ -63,8 +63,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
|
||||
case userHomeDirectory:
|
||||
{
|
||||
const char* homeDir = getenv ("HOME");
|
||||
|
||||
if (const char* homeDir = getenv ("HOME"))
|
||||
if (homeDir)
|
||||
return File (CharPointer_UTF8 (homeDir));
|
||||
|
||||
if (struct passwd* const pw = getpwuid (getuid()))
|
||||
@@ -166,8 +165,8 @@ private:
|
||||
DIR* dir;
|
||||
};
|
||||
|
||||
DirectoryIterator::NativeIterator::NativeIterator (const File& directory, const String& wildCard)
|
||||
: pimpl (new DirectoryIterator::NativeIterator::Pimpl (directory, wildCard))
|
||||
DirectoryIterator::NativeIterator::NativeIterator (const File& directory, const String& wildCard_)
|
||||
: pimpl (new DirectoryIterator::NativeIterator::Pimpl (directory, wildCard_))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
/** Reads a boolean from the stream.
|
||||
|
||||
The bool is encoded as a single byte - non-zero for true, 0 for false.
|
||||
The bool is encoded as a single byte - non-zero for true, 0 for false.
|
||||
|
||||
If the stream is exhausted, this will return false.
|
||||
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
|
||||
/** Reads two bytes from the stream as a little-endian 16-bit value.
|
||||
|
||||
If the next two bytes read are byte1 and byte2, this returns (byte1 | (byte2 << 8)).
|
||||
If the next two bytes read are byte1 and byte2, this returns (byte1 | (byte2 << 8)).
|
||||
|
||||
If the stream is exhausted partway through reading the bytes, this will return zero.
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace beast
|
||||
*/
|
||||
class MemoryOutputStream
|
||||
: public OutputStream
|
||||
{
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates an empty memory stream, ready to be written into.
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
capacity off the block, so that its length matches the amount of actual data that
|
||||
has been written so far.
|
||||
*/
|
||||
void flush();
|
||||
void flush() override;
|
||||
|
||||
bool write (const void*, size_t) override;
|
||||
std::int64_t getPosition() override { return position; }
|
||||
|
||||
@@ -73,7 +73,7 @@ parse_negative_integral (Int& num, FwdIt first, FwdIt last)
|
||||
if (limit_digit < 0)
|
||||
limit_digit = -limit_digit;
|
||||
|
||||
return parse_integral<Int> (num, first, last,
|
||||
return parse_integral<Int> (num, first, last,
|
||||
[limit_value, limit_digit](Int& value, Int digit)
|
||||
{
|
||||
assert ((digit >= 0) && (digit <= 9));
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
DeadlineTimer (DeadlineTimer const&) = delete;
|
||||
DeadlineTimer& operator= (DeadlineTimer const&) = delete;
|
||||
|
||||
|
||||
~DeadlineTimer ();
|
||||
|
||||
/** Cancel all notifications.
|
||||
|
||||
@@ -129,7 +129,7 @@ void Workers::deleteWorkers (LockFreeStack <Worker>& stack)
|
||||
|
||||
if (worker != nullptr)
|
||||
{
|
||||
// This call blocks until the thread orderly exits
|
||||
// This call blocks until the thread orderly exits
|
||||
delete worker;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
{
|
||||
if (m_lock_count > 0)
|
||||
unlock ();
|
||||
}
|
||||
}
|
||||
|
||||
inline void lock (char const* fileName, int lineNumber) noexcept
|
||||
{
|
||||
@@ -233,7 +233,7 @@ public:
|
||||
m_mutex.unlock ();
|
||||
--m_lock_count;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Mutex const& m_mutex;
|
||||
int m_lock_count;
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
*/
|
||||
inline explicit GenericScopedUnlock (LockType& lock) noexcept
|
||||
: lock_ (lock)
|
||||
{
|
||||
{
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
/** Create the dynamic buffer with the specified block size. */
|
||||
explicit DynamicBuffer (size_type blocksize = defaultBlocksize);
|
||||
|
||||
|
||||
DynamicBuffer (DynamicBuffer const& other);
|
||||
|
||||
~DynamicBuffer ();
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
return is_v4 () ? m_v4 == IP::AddressV4::any ()
|
||||
: false; // m_v6 == IP::AddressV6::any();
|
||||
}
|
||||
|
||||
|
||||
template <class Hasher>
|
||||
friend
|
||||
void
|
||||
@@ -198,21 +198,21 @@ public:
|
||||
{
|
||||
return ! (lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
friend
|
||||
bool
|
||||
operator> (Address const& lhs, Address const& rhs)
|
||||
{
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
|
||||
friend
|
||||
bool
|
||||
operator<= (Address const& lhs, Address const& rhs)
|
||||
{
|
||||
return ! (lhs > rhs);
|
||||
}
|
||||
|
||||
|
||||
friend
|
||||
bool
|
||||
operator>= (Address const& lhs, Address const& rhs)
|
||||
|
||||
@@ -38,7 +38,7 @@ struct AddressV4
|
||||
AddressV4 ();
|
||||
|
||||
/** Construct from a 32-bit unsigned.
|
||||
@note Octets are formed in order from the MSB to the LSB.
|
||||
@note Octets are formed in order from the MSB to the LSB.
|
||||
*/
|
||||
explicit AddressV4 (std::uint32_t value_);
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ void DynamicBuffer::shrink_to_fit ()
|
||||
{
|
||||
free (m_buffers.back ());
|
||||
m_buffers.erase (m_buffers.end () - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string DynamicBuffer::to_string () const
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
namespace beast {
|
||||
namespace IP {
|
||||
|
||||
@@ -147,8 +147,7 @@ bool is_public (AddressV4 const& addr)
|
||||
{
|
||||
return
|
||||
! is_private (addr) &&
|
||||
! is_multicast (addr) &&
|
||||
(addr != AddressV4::broadcast (addr));
|
||||
! is_multicast (addr);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -66,7 +66,7 @@ struct api
|
||||
dat_path, key_path, log_path,
|
||||
appnum, salt, key_size, block_size,
|
||||
load_factor, args...);
|
||||
}
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
static
|
||||
@@ -91,7 +91,7 @@ struct api
|
||||
return nudb::verify<Hasher>(
|
||||
dat_path, key_path, BufferSize);
|
||||
}
|
||||
|
||||
|
||||
template <class Function>
|
||||
static
|
||||
bool
|
||||
|
||||
@@ -40,7 +40,7 @@ struct varint;
|
||||
// possible size of T represented as varint.
|
||||
// T must be unsigned
|
||||
template <class T,
|
||||
bool = std::is_unsigned<T>::value>
|
||||
bool = std::is_unsigned<T>::value>
|
||||
struct varint_traits;
|
||||
|
||||
template <class T>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user