Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
46fc72a
eosio 84109ebdc36927f8b1f3afa92672359c28f1bd71
johndebord Jun 10, 2020
6f94f76
Adding secp256k1 config
johndebord Jun 10, 2020
ffd81a8
Fix narrowing conversion error
johndebord May 14, 2020
bb1b5b1
Change to equality check against `nullptr`
johndebord May 14, 2020
f5261b0
move binary_stream to become fc::datastream
huangminghuang May 8, 2020
3b910c8
add skip to datastream
huangminghuang May 10, 2020
4d881e6
Add unity build support for some targets
huangminghuang May 21, 2020
5821b89
strip trailing spaces
huangminghuang Jun 1, 2020
8bd78e4
Add support for block log splitting
huangminghuang May 29, 2020
3a88ab5
Support unity build for unittests
huangminghuang Jun 12, 2020
5b0a329
consolidate unity build setting in one place
huangminghuang Jun 16, 2020
d11c258
const correctness fix
huangminghuang Jun 25, 2020
015ab6b
FC Consolidated Security Fixes for develop
jeffreyssmith2nd Aug 5, 2020
0a6c072
add std::list<> support to fc pack/unpack
spoonincode Aug 10, 2020
13feb7c
Remove fc::uint128_t typedef to avoid confusion with eosio::chain::co…
heifner Aug 11, 2020
7b5843e
Remove using namespace boost::multiprecision to avoid pulling in boos…
heifner Aug 11, 2020
71a8cfd
Stop using fc::optional. Start using std::optional
Jun 16, 2020
4d6e9dd
Remove fc/optional.hpp
Jun 16, 2020
fdb27a4
Made std::optional to fc::variant conversion explicit
Jun 17, 2020
7ce1e02
Remove many uses of has_value() on std::optional.
Jun 17, 2020
b810baf
Fixed infinite recursive all
Jun 18, 2020
edc557b
Prefer std::make_optional
Jun 18, 2020
3f14def
Rollback overzealous use of std::make_optional
Jun 23, 2020
d65ca1f
Formatting corrections
Jul 21, 2020
eb4a4a4
Migrate to std::variant
Jun 22, 2020
0b21af5
Added std namespace qualifier on a few methods.
Jun 22, 2020
4a06523
Remove static variant tests
Jun 22, 2020
03b409f
Remove static variant test
Jun 22, 2020
f37adfe
Remove static variant test
Jun 22, 2020
dc2bd21
Remove json_connection.hpp
Jun 24, 2020
e69f0b4
Fixup per code review comments. Fixed formatting. Created get_if meth…
Jun 25, 2020
dc39ad4
Corrected failing test
Jun 25, 2020
51535ae
Rename get_if to get.
Jun 25, 2020
1315f4f
Added comment to fc::get methods
Jun 25, 2020
5b1e9e1
Changed exception raised by get_index.
Jun 25, 2020
5682c99
Created fc::visit to maintain same exception semantics
Jun 29, 2020
acc78bf
Cleanup up documentation
Jun 29, 2020
e2b80db
Change fc::exception to derive from std::exception and handle std::ex…
Jul 15, 2020
1d83107
Throw std exceptions
Jul 15, 2020
3829435
Update variant tests
Jul 16, 2020
89547e3
Remove fc get/visit
Jul 16, 2020
5493ab9
Explicitly catch bad_alloc exceptions
Jul 21, 2020
a62c48b
Add missing return
heifner Aug 20, 2020
04ff667
Fix unnecessary object copying
huangminghuang Aug 24, 2020
06d67a1
remove unity build
huangminghuang Aug 25, 2020
26f699f
Merge branch 'eosio' into fixed_eosio
larryk85 Aug 26, 2020
4b68552
Fix support for stdout
heifner Oct 21, 2020
9564de1
Merge pull request #169 from EOSIO/fix-console-stdout
heifner Oct 21, 2020
27a2c60
add options for not using GMP and for static linking GMP
spoonincode Oct 23, 2020
88ecbef
Allow empty responses
heifner Oct 26, 2020
a256e93
Add zipkin_appender
heifner Oct 26, 2020
fd7cd2c
Use default logger for logging in zipkin_appender. Do not allow zipki…
heifner Oct 27, 2020
bddd252
Avoid random 0
heifner Oct 27, 2020
e089ce1
zipkin tags should be strings
heifner Oct 27, 2020
3b3eda9
Enforce id and traceId required
heifner Oct 27, 2020
8637f75
Merge pull request #170 from EOSIO/lost_gmp_opts
spoonincode Oct 28, 2020
e7ad1fb
Fix shutdown deadlock issue. Disallow 0 id. Moved shutdown to logger
heifner Oct 30, 2020
02aa7e5
Move over fwd changes
heifner Oct 30, 2020
588f7bd
Change zipkin support from being part of fc logging to its own indepe…
heifner Nov 6, 2020
40313ca
Fix default move constructor
heifner Nov 6, 2020
ef15c08
Remove dead code
heifner Nov 6, 2020
bfed880
Remove dead code
heifner Nov 6, 2020
fae2261
Merge pull request #171 from EOSIO/zipkin-appender
heifner Nov 9, 2020
99e1555
add reason to error msg in copy
allenhan2 Nov 10, 2020
1fe648d
use none recursive for boost version > 74
allenhan2 Nov 16, 2020
0643a87
avoid make_strand() as it's a boost 1.70 feature
spoonincode Nov 16, 2020
a7a105f
Merge pull request #175 from EOSIO/no_make_strand
spoonincode Nov 17, 2020
c820b5b
Merge branch 'eosio' into add_reason_to_copy
allenhan2 Nov 17, 2020
71d67eb
Merge pull request #174 from EOSIO/add_reason_to_copy
allenhan2 Nov 17, 2020
4697248
Add test cases for copy file and dir
allenhan2 Nov 17, 2020
97479bb
Add change for 1.74
yuehanb1 Nov 17, 2020
13ce5a7
update the boost version check
allenhan2 Nov 18, 2020
a4ad789
Merge branch 'eosio' into file_copy_norecursive
allenhan2 Nov 18, 2020
f5d7dfc
Merge pull request #176 from EOSIO/file_copy_norecursive
allenhan2 Nov 19, 2020
8737e6a
Ignore unused const variable.
Dec 22, 2020
fd621b6
Inhibit warning messages for 3rdParty libraries
Dec 23, 2020
70d240f
Merge pull request #179 from EOSIO/fix-compiler-warnings
Jan 5, 2021
251bcf9
replace old libsecp256k1 fork with upstream
spoonincode Dec 16, 2020
16f4131
Consistent declaration
heifner Jan 21, 2021
1a62af4
Merge pull request #172 from EOSIO/fwd
heifner Jan 21, 2021
40e443a
Merge pull request #180 from EOSIO/upstream_secp256k1_dec2020
brianjohnson5972 Jan 27, 2021
456ee35
add impl for blob to/from_variant
spoonincode Feb 1, 2021
4eb2950
Merge pull request #183 from EOSIO/blob_variant_impl
spoonincode Feb 1, 2021
c83f629
added defensive programming practices to cfile to ensure that a user …
Feb 2, 2021
0677c87
removed the const reference call
Feb 2, 2021
d3f86cd
for the open function, after it was closing it before an attempt to o…
Feb 2, 2021
5ced226
forgot that uptr cleans up the code. removed the extra eof checks
Feb 2, 2021
ce73728
addressed code formatting issues
Feb 3, 2021
cd8892d
removed the fclose from the unique_ptr cleanup
Feb 3, 2021
c8b78ab
removed the unique_ptr implementation for the FILE*
Feb 3, 2021
7cc6bee
updated the remaining functipn
Feb 4, 2021
3c83485
Fixed the ``remaining`` function so that it now just checks if the
Feb 4, 2021
fd7864e
fixed the remaining function so that it checks if there is a byte t…
Feb 4, 2021
a9c009c
updating the size if there was a write
Feb 4, 2021
f29c89e
removed the current_char as it is not needed anymore
Feb 4, 2021
2e66fcd
removed the size check. fixed remaining function in cfile to work wit…
Feb 5, 2021
fbad6f8
removed unused variable
Feb 5, 2021
dd48e11
fixed a few errors
Feb 5, 2021
8315662
error checking ungetc
Feb 5, 2021
8ea9cc1
Merge pull request #184 from EOSIO/feature/EPE-148_3
brianjohnson5972 Feb 9, 2021
b926614
remove BOOST_ASIO_HAS_LOCAL_SOCKETS ifdefs
spoonincode Feb 12, 2021
864ab47
Merge pull request #186 from EOSIO/no_local_socket_ifdef_spam
spoonincode Feb 18, 2021
03491cf
revert changes from PR 184
huangminghuang Feb 19, 2021
3ccf007
avoid datastream<cfile> to be used for unpack
huangminghuang Feb 19, 2021
50d57cb
Merge pull request #187 from EOSIO/huangminghuang/fix-datastream-cfile
brianjohnson5972 Feb 22, 2021
29ebe66
remvove uneeded Boost_LIBRARIES linkage from webauthn test
spoonincode Apr 27, 2021
4547a5d
Merge pull request #188 from EOSIO/remove_testwebauthn_boost_linkage
spoonincode Apr 27, 2021
7334ec8
Do not limit write to uint32_t size
heifner Apr 30, 2021
f3875ec
Merge pull request #192 from EOSIO/large-ship-dev
heifner Apr 30, 2021
7fb5c33
Switch to variadic template
heifner May 27, 2021
9ad5b38
Merge pull request #196 from EOSIO/fwd
heifner May 27, 2021
dc7df62
Add a log message when zipkin is connected
nickjjzhao Jun 14, 2021
b23635c
Retry connecting to zipkin every 30 seconds
nickjjzhao Jun 14, 2021
e3c3be7
Process SIGHUP to enable zipkin_appender
nickjjzhao Jun 15, 2021
66bb5f2
Move sleep(30) into the calling thread of post
nickjjzhao Jun 16, 2021
5b493ac
Make handling SIGHUP signal code thread safe
nickjjzhao Jun 17, 2021
2394a54
Update the method handling SIGHUP signal
nickjjzhao Jun 17, 2021
e4b4253
Use a timer instead of sleep to avoid main thread being blocked
nickjjzhao Jun 17, 2021
218e261
Update the handler of asynchronous wait on the timer
nickjjzhao Jun 18, 2021
c47902c
Make method handle_sighup() signal safe
nickjjzhao Jun 18, 2021
6e3ff70
Add scope operator to an atomic var
nickjjzhao Jun 18, 2021
3545c92
Make var timer_expired thread safe
nickjjzhao Jun 24, 2021
4e99264
Remove unneeded comment
nickjjzhao Jun 24, 2021
36ecb2b
Redefine a var as atomic_flag so it is signal safe, thread atomic and…
nickjjzhao Jun 24, 2021
d6912ce
Revert last commit that can cause a race condition
nickjjzhao Jun 28, 2021
1d15fda
Add a new option retry_interval_us
nickjjzhao Jun 28, 2021
d740af3
Fix new comments
nickjjzhao Jun 29, 2021
1b3e514
Merge pull request #200 from EOSIO/jjz-epe933-zipkin
heifner Jul 6, 2021
0b13fab
add includes needed for boost 1.77
spoonincode Jul 10, 2021
a9da388
Merge pull request #202 from EOSIO/boost177
spoonincode Jul 11, 2021
cb47900
add includes needed for boost 1.77
spoonincode Jul 10, 2021
7465dca
Merge pull request #205 from EOSIO/boost177_22x
spoonincode Jul 12, 2021
9a99032
Cancel timer and don't access my when shutdown to fix core-dump
heifner Jul 20, 2021
2cf87d1
Remove unneeded mutable
heifner Jul 20, 2021
0e0fe0c
Cancel timer and don't access my when shutdown to fix core-dump
heifner Jul 20, 2021
2889bbd
Remove unneeded mutable
heifner Jul 20, 2021
3148766
Merge pull request #209 from EOSIO/zipkin-timer-shutdown-eosio
heifner Jul 20, 2021
cd52f22
Merge pull request #207 from EOSIO/zipkin-timer-shutdown-2.2
heifner Jul 20, 2021
6387b46
implement zipkin nested span
huangminghuang May 9, 2021
138da8c
implement zipkin nested span
huangminghuang May 9, 2021
0b45f08
Merge pull request #211 from EOSIO/huangminghuang/zipkin-improvement
huangminghuang Aug 2, 2021
dd723b5
Merge pull request #212 from EOSIO/huangminghuang/zipkin-improvement-2.2
huangminghuang Aug 2, 2021
c076eba
remove websocketpp
praphael Sep 28, 2021
0cb5356
Merge pull request #214 from EOSIO/pdr/delete_websocketpp
praphael Sep 28, 2021
e0b8710
fix deepmind log not reset properly
Duncan-Ultra Oct 26, 2021
ac9dae2
Fix deepmind log
Duncan-Ultra Oct 26, 2021
bd83961
remove mutex lock
Duncan-Ultra Oct 27, 2021
4c41b3d
remove mutex lock
Duncan-Ultra Oct 27, 2021
795ef10
Merge pull request #217 from Duncan-Ultra/fix_deepmind_log_2.2.x
heifner Oct 28, 2021
701aaaa
Merge pull request #218 from Duncan-Ultra/fix_deepmind_log_eosio
heifner Oct 28, 2021
c94b2bd
fix gcc warnings
huangminghuang Oct 28, 2021
a0a2c44
avoid deprecated openssl apis
huangminghuang Oct 29, 2021
0de0857
Merge pull request #219 from EOSIO/huangminghuang/fix-gcc-warnings
huangminghuang Nov 19, 2021
e95d56e
Merge remote-tracking branch 'origin/eosio-2.2.x' into eosio
huangminghuang Nov 19, 2021
3754005
Merge pull request #221 from EOSIO/huangminghuang/fix-gcc-warnings-dev
huangminghuang Nov 24, 2021
02b2209
Fix segfault on shutdown and reduce log spam
heifner Dec 9, 2021
50fff3f
Merge pull request #225 from EOSIO/EPE-1692-zipkin-eosio
heifner Dec 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "secp256k1/upstream"]
path = secp256k1/upstream
url = https://github.com/cryptonomex/secp256k1-zkp.git
[submodule "include/fc/crypto/webauthn_json"]
path = include/fc/crypto/webauthn_json
url = https://github.com/Tencent/rapidjson/
[submodule "secp256k1/secp256k1"]
path = secp256k1/secp256k1
url = https://github.com/bitcoin-core/secp256k1
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ elseif(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

# Suppress warnings on 3rdParty Library
add_definitions( -w )
add_subdirectory( secp256k1 )
remove_definitions( -w )

IF( ECC_IMPL STREQUAL openssl )
SET( ECC_REST src/crypto/elliptic_impl_pub.cpp )
Expand Down Expand Up @@ -72,8 +75,7 @@ set( fc_sources
src/log/log_message.cpp
src/log/logger.cpp
src/log/appender.cpp
src/log/console_appender.cpp
src/log/gelf_appender.cpp
src/log/console_appender.cpp
src/log/dmlog_appender.cpp
src/log/logger_config.cpp
src/crypto/_digest_common.cpp
Expand Down Expand Up @@ -111,6 +113,8 @@ set( fc_sources
src/network/http/http_client.cpp
src/compress/smaz.cpp
src/compress/zlib.cpp
src/log/gelf_appender.cpp
src/log/zipkin.cpp
)

file( GLOB_RECURSE fc_headers ${CMAKE_CURRENT_SOURCE_DIR} *.hpp *.h )
Expand Down
8 changes: 7 additions & 1 deletion CMakeModules/FindGMP.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This module's inputs:
# GMP_STATIC - static link GMP
# This module defines:
# GMP_FOUND - system has GMP lib
# GMP_INCLUDE_DIR - the GMP include directory
Expand Down Expand Up @@ -32,7 +34,11 @@ else()
)

set(PREVIOUS_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}")
if(GMP_STATIC)
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()

find_library(GMP_LIBRARIES NAMES gmp
HINTS ENV GMP_LIB_DIR
Expand Down
2 changes: 1 addition & 1 deletion include/fc/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace fc {
memcpy(&bi, ve.data(), fc::min<size_t>(ve.size(),sizeof(bi)) );
}
else
memset( &bi, char(0), sizeof(bi) );
memset( bi.data, char(0), sizeof(bi.data) );
}


Expand Down
24 changes: 12 additions & 12 deletions include/fc/crypto/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ namespace fc { namespace crypto {
* @return
*/
template<const char * const * Prefixes, typename ...Ts>
struct base58_str_parser<fc::static_variant<Ts...>, Prefixes> {
static fc::static_variant<Ts...> apply(const std::string& base58str) {
struct base58_str_parser<std::variant<Ts...>, Prefixes> {
static std::variant<Ts...> apply(const std::string& base58str) {
const auto pivot = base58str.find('_');
FC_ASSERT(pivot != std::string::npos, "No delimiter in data, cannot determine suite type: ${str}", ("str", base58str));

const auto prefix_str = base58str.substr(0, pivot);
auto data_str = base58str.substr(pivot + 1);
FC_ASSERT(!data_str.empty(), "Data only has suite type prefix: ${str}", ("str", base58str));

return base58_str_parser_impl<fc::static_variant<Ts...>, Prefixes, 0, Ts...>::apply(prefix_str, data_str);
return base58_str_parser_impl<std::variant<Ts...>, Prefixes, 0, Ts...>::apply(prefix_str, data_str);
}
};

Expand All @@ -92,7 +92,7 @@ namespace fc { namespace crypto {
template< typename KeyType >
std::string operator()( const KeyType& key ) const {
using data_type = typename KeyType::data_type;
constexpr int position = Storage::template position<KeyType>();
constexpr int position = fc::get_index<Storage, KeyType>();
constexpr bool is_default = position == DefaultPosition;

checksummed_data<data_type> wrapper;
Expand Down Expand Up @@ -122,23 +122,23 @@ namespace fc { namespace crypto {
};

template<typename ... Ts>
struct eq_comparator<fc::static_variant<Ts...>> {
using variant_type = fc::static_variant<Ts...>;
struct eq_comparator<std::variant<Ts...>> {
using variant_type = std::variant<Ts...>;
struct visitor : public fc::visitor<bool> {
visitor(const variant_type &b)
: _b(b) {}

template<typename KeyType>
bool operator()(const KeyType &a) const {
const auto &b = _b.template get<KeyType>();
const auto &b = std::template get<KeyType>(_b);
return eq_comparator<KeyType>::apply(a,b);
}

const variant_type &_b;
};

static bool apply(const variant_type& a, const variant_type& b) {
return a.which() == b.which() && a.visit(visitor(b));
return a.index() == b.index() && std::visit(visitor(b), a);
}
};

Expand All @@ -150,23 +150,23 @@ namespace fc { namespace crypto {
};

template<typename ... Ts>
struct less_comparator<fc::static_variant<Ts...>> {
using variant_type = fc::static_variant<Ts...>;
struct less_comparator<std::variant<Ts...>> {
using variant_type = std::variant<Ts...>;
struct visitor : public fc::visitor<bool> {
visitor(const variant_type &b)
: _b(b) {}

template<typename KeyType>
bool operator()(const KeyType &a) const {
const auto &b = _b.template get<KeyType>();
const auto &b = std::template get<KeyType>(_b);
return less_comparator<KeyType>::apply(a,b);
}

const variant_type &_b;
};

static bool apply(const variant_type& a, const variant_type& b) {
return a.which() < b.which() || (a.which() == b.which() && a.visit(visitor(b)));
return a.index() < b.index() || (a.index() == b.index() && std::visit(visitor(b), a));
}
};

Expand Down
40 changes: 0 additions & 40 deletions include/fc/crypto/elliptic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ namespace fc {
typedef fc::array<char,65> public_key_point_data; ///< the full non-compressed version of the ECC point
typedef fc::array<char,72> signature;
typedef fc::array<unsigned char,65> compact_signature;
typedef std::vector<char> range_proof_type;
typedef fc::array<char,78> extended_key_data;
typedef fc::sha256 blinded_hash;
typedef fc::sha256 blind_signature;
Expand Down Expand Up @@ -53,11 +52,6 @@ namespace fc {
public_key child( const fc::sha256& offset )const;

bool valid()const;
/** Computes new pubkey = generator * offset + old pubkey ?! */
// public_key mult( const fc::sha256& offset )const;
/** Computes new pubkey = regenerate(offset).pubkey + old pubkey
* = offset * G + 1 * old pubkey ?! */
public_key add( const fc::sha256& offset )const;

public_key( public_key&& pk );
public_key& operator=( public_key&& pk );
Expand Down Expand Up @@ -150,39 +144,6 @@ namespace fc {
fc::fwd<detail::private_key_impl,32> my;
};

struct range_proof_info
{
int exp;
int mantissa;
uint64_t min_value;
uint64_t max_value;
};

commitment_type blind( const blind_factor_type& blind, uint64_t value );
blind_factor_type blind_sum( const std::vector<blind_factor_type>& blinds, uint32_t non_neg );
/** verifies taht commnits + neg_commits + excess == 0 */
bool verify_sum( const std::vector<commitment_type>& commits, const std::vector<commitment_type>& neg_commits, int64_t excess );
bool verify_range( uint64_t& min_val, uint64_t& max_val, const commitment_type& commit, const range_proof_type& proof );

range_proof_type range_proof_sign( uint64_t min_value,
const commitment_type& commit,
const blind_factor_type& commit_blind,
const blind_factor_type& nonce,
int8_t base10_exp,
uint8_t min_bits,
uint64_t actual_value
);

bool verify_range_proof_rewind( blind_factor_type& blind_out,
uint64_t& value_out,
string& message_out,
const blind_factor_type& nonce,
uint64_t& min_val,
uint64_t& max_val,
commitment_type commit,
const range_proof_type& proof );
range_proof_info range_get_info( const range_proof_type& proof );

/**
* Shims
*/
Expand Down Expand Up @@ -273,7 +234,6 @@ namespace fc {

FC_REFLECT_TYPENAME( fc::ecc::private_key )
FC_REFLECT_TYPENAME( fc::ecc::public_key )
FC_REFLECT( fc::ecc::range_proof_info, (exp)(mantissa)(min_value)(max_value) )
FC_REFLECT_DERIVED( fc::ecc::public_key_shim, (fc::crypto::shim<fc::ecc::public_key_data>), BOOST_PP_SEQ_NIL )
FC_REFLECT_DERIVED( fc::ecc::signature_shim, (fc::crypto::shim<fc::ecc::compact_signature>), BOOST_PP_SEQ_NIL )
FC_REFLECT_DERIVED( fc::ecc::private_key_shim, (fc::crypto::shim<fc::ecc::private_key_secret>), BOOST_PP_SEQ_NIL )
1 change: 0 additions & 1 deletion include/fc/crypto/elliptic_r1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ namespace fc {
~public_key();
bool verify( const fc::sha256& digest, const signature& sig );
public_key_data serialize()const;
public_key_point_data serialize_ecc_point()const;

operator public_key_data()const { return serialize(); }

Expand Down
2 changes: 1 addition & 1 deletion include/fc/crypto/private_key.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace fc { namespace crypto {
class private_key
{
public:
using storage_type = static_variant<ecc::private_key_shim, r1::private_key_shim>;
using storage_type = std::variant<ecc::private_key_shim, r1::private_key_shim>;

private_key() = default;
private_key( private_key&& ) = default;
Expand Down
2 changes: 1 addition & 1 deletion include/fc/crypto/public_key.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace fc { namespace crypto {
class public_key
{
public:
using storage_type = static_variant<ecc::public_key_shim, r1::public_key_shim, webauthn::public_key>;
using storage_type = std::variant<ecc::public_key_shim, r1::public_key_shim, webauthn::public_key>;

public_key() = default;
public_key( public_key&& ) = default;
Expand Down
3 changes: 2 additions & 1 deletion include/fc/crypto/sha1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class sha1
string str()const;
operator string()const;

char* data()const;
char* data();
const char* data()const;
size_t data_size()const { return 20; }

static sha1 hash( const char* d, uint32_t dlen );
Expand Down
3 changes: 2 additions & 1 deletion include/fc/crypto/sha224.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class sha224
string str()const;
operator string()const;

char* data()const;
char* data();
const char* data()const;
size_t data_size()const { return 224 / 8; }

static sha224 hash( const char* d, uint32_t dlen );
Expand Down
7 changes: 5 additions & 2 deletions include/fc/crypto/sha256.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <fc/platform_independence.hpp>
#include <fc/io/raw_fwd.hpp>

#include <boost/container_hash/hash.hpp>

namespace fc
{

Expand All @@ -17,8 +19,9 @@ class sha256
string str()const;
operator string()const;

char* data()const;
size_t data_size()const { return 256 / 8; }
const char* data()const;
char* data();
size_t data_size() const { return 256 / 8; }

static sha256 hash( const char* d, uint32_t dlen );
static sha256 hash( const string& );
Expand Down
3 changes: 2 additions & 1 deletion include/fc/crypto/sha512.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class sha512
string str()const;
operator string()const;

char* data()const;
char* data();
const char* data()const;
size_t data_size()const { return 512 / 8; }

static sha512 hash( const char* d, uint32_t dlen );
Expand Down
2 changes: 1 addition & 1 deletion include/fc/crypto/signature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace fc { namespace crypto {
class signature
{
public:
using storage_type = static_variant<ecc::signature_shim, r1::signature_shim, webauthn::signature>;
using storage_type = std::variant<ecc::signature_shim, r1::signature_shim, webauthn::signature>;

signature() = default;
signature( signature&& ) = default;
Expand Down
21 changes: 13 additions & 8 deletions include/fc/exception/exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* @brief Defines exception's used by fc
*/
#include <fc/log/logger.hpp>
#include <fc/optional.hpp>
#include <exception>
#include <functional>
#include <unordered_map>
Expand Down Expand Up @@ -55,7 +54,7 @@ namespace fc
* @see FC_RETHROW_EXCEPTION
* @see FC_RETHROW_EXCEPTIONS
*/
class exception
class exception : public std::exception
{
public:
static constexpr fc::microseconds format_time_limit = fc::milliseconds( 10 ); // limit time spent formatting exceptions
Expand Down Expand Up @@ -84,7 +83,7 @@ namespace fc

const char* name()const throw();
int64_t code()const throw();
virtual const char* what()const throw();
const char* what()const noexcept override;

/**
* @return a reference to log messages that have
Expand Down Expand Up @@ -139,7 +138,7 @@ namespace fc
void from_variant( const variant& e, exception& ll );
typedef std::shared_ptr<exception> exception_ptr;

typedef optional<exception> oexception;
typedef std::optional<exception> oexception;


/**
Expand Down Expand Up @@ -187,6 +186,8 @@ namespace fc

std::exception_ptr get_inner_exception()const;

static std_exception_wrapper from_current_exception(const std::exception& e);

virtual NO_RETURN void dynamic_rethrow_exception()const;
virtual std::shared_ptr<exception> dynamic_copy_exception()const;
private:
Expand Down Expand Up @@ -476,10 +477,8 @@ namespace fc
wdump( __VA_ARGS__ ); \
}

#define FC_LOG_AND_DROP( ... ) \
catch( const boost::interprocess::bad_alloc& ) {\
throw;\
} catch( fc::exception& er ) { \
#define FC_LOG_AND_DROP_ALL( ... ) \
catch( fc::exception& er ) { \
wlog( "${details}", ("details",er.to_detail_string()) ); \
} catch( const std::exception& e ) { \
fc::std_exception_wrapper sew( \
Expand All @@ -496,6 +495,12 @@ namespace fc
}


#define FC_LOG_AND_DROP( ... ) \
catch( const boost::interprocess::bad_alloc& ) {\
throw;\
} FC_LOG_AND_DROP_ALL(__VA_ARGS__)


/**
* @def FC_RETHROW_EXCEPTIONS(LOG_LEVEL,FORMAT,...)
* @brief Catchs all exception's, std::exceptions, and ... and rethrows them after
Expand Down
Loading