Move secure into its own folder
This commit is contained in:
parent
f2e449c65a
commit
d6017c4733
25 changed files with 73 additions and 63 deletions
|
@ -233,44 +233,7 @@ add_library (blake2
|
|||
blake2/blake2.h
|
||||
${BLAKE2_IMPLEMENTATION})
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set (PLATFORM_SECURE_SOURCE rai/plat/osx/working.mm)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set (PLATFORM_SECURE_SOURCE rai/plat/windows/working.cpp)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set (PLATFORM_SECURE_SOURCE rai/plat/posix/working.cpp)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
set (PLATFORM_SECURE_SOURCE rai/plat/posix/working.cpp)
|
||||
else ()
|
||||
error ("Unknown platform: ${CMAKE_SYSTEM_NAME}")
|
||||
endif ()
|
||||
|
||||
# Embed bootstrap representative weights in executable
|
||||
file (READ rep_weights.bin filedata HEX)
|
||||
string (REGEX REPLACE "(..)" "0x\\1," filedata ${filedata})
|
||||
file (WRITE ${CMAKE_BINARY_DIR}/bootstrap_weights.cpp "#include <cstddef>\n"
|
||||
"namespace rai {\n"
|
||||
" unsigned char rai_bootstrap_weights[] = {${filedata} 0x00};\n"
|
||||
" size_t rai_bootstrap_weights_size = sizeof(rai_bootstrap_weights) - 1;\n"
|
||||
"}\n")
|
||||
|
||||
add_library (secure
|
||||
${PLATFORM_SECURE_SOURCE}
|
||||
${CMAKE_BINARY_DIR}/bootstrap_weights.cpp
|
||||
rai/config.hpp
|
||||
rai/common.cpp
|
||||
rai/common.hpp
|
||||
rai/blockstore.cpp
|
||||
rai/blockstore.hpp
|
||||
rai/ledger.cpp
|
||||
rai/ledger.hpp
|
||||
rai/node/utility.cpp
|
||||
rai/node/utility.hpp
|
||||
rai/versioning.hpp
|
||||
rai/versioning.cpp)
|
||||
|
||||
target_link_libraries(secure Boost::boost)
|
||||
|
||||
add_subdirectory(rai/secure)
|
||||
add_subdirectory(rai/lib)
|
||||
add_subdirectory(rai/node)
|
||||
|
||||
|
@ -414,9 +377,9 @@ add_subdirectory(rai/rai_node)
|
|||
set_target_properties (argon2 PROPERTIES COMPILE_FLAGS "${PLATFORM_C_FLAGS} ${PLATFORM_COMPILE_FLAGS}")
|
||||
set_target_properties (blake2 PROPERTIES COMPILE_FLAGS "${PLATFORM_C_FLAGS} ${PLATFORM_COMPILE_FLAGS} -D__SSE2__")
|
||||
set_target_properties (ed25519 PROPERTIES COMPILE_FLAGS "${PLATFORM_C_FLAGS} ${PLATFORM_COMPILE_FLAGS} -DED25519_CUSTOMHASH -DED25519_CUSTOMRNG")
|
||||
set_target_properties (secure node rai_lib rai_lib_static PROPERTIES COMPILE_FLAGS "${PLATFORM_CXX_FLAGS} ${PLATFORM_COMPILE_FLAGS} -DQT_NO_KEYWORDS -DACTIVE_NETWORK=${ACTIVE_NETWORK} -DRAIBLOCKS_VERSION_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR} -DRAIBLOCKS_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR} -DBOOST_ASIO_HAS_STD_ARRAY=1")
|
||||
set_target_properties (node rai_lib rai_lib_static PROPERTIES COMPILE_FLAGS "${PLATFORM_CXX_FLAGS} ${PLATFORM_COMPILE_FLAGS} -DQT_NO_KEYWORDS -DACTIVE_NETWORK=${ACTIVE_NETWORK} -DRAIBLOCKS_VERSION_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR} -DRAIBLOCKS_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR} -DBOOST_ASIO_HAS_STD_ARRAY=1")
|
||||
# TODO: Do globally
|
||||
set_target_properties (secure node PROPERTIES LINK_FLAGS "${PLATFORM_LINK_FLAGS}")
|
||||
set_target_properties (node PROPERTIES LINK_FLAGS "${PLATFORM_LINK_FLAGS}")
|
||||
|
||||
if (WIN32)
|
||||
set (PLATFORM_LIBS Ws2_32 mswsock iphlpapi ntdll)
|
||||
|
|
|
@ -31,6 +31,7 @@ add_library (rai_lib SHARED ${sources})
|
|||
add_library (rai_lib_static STATIC ${sources})
|
||||
|
||||
target_link_libraries (rai_lib
|
||||
secure
|
||||
ed25519
|
||||
xxhash
|
||||
blake2
|
||||
|
@ -38,6 +39,7 @@ target_link_libraries (rai_lib
|
|||
Boost::boost)
|
||||
|
||||
target_link_libraries (rai_lib_static
|
||||
secure
|
||||
ed25519
|
||||
xxhash
|
||||
blake2
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <rai/config.hpp>
|
||||
#include <rai/secure/config.hpp>
|
||||
#include <rai/lib/numbers.hpp>
|
||||
#include <rai/lib/utility.hpp>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <rai/blockstore.hpp>
|
||||
#include <rai/ledger.hpp>
|
||||
#include <rai/secure/blockstore.hpp>
|
||||
#include <rai/secure/ledger.hpp>
|
||||
#include <rai/node/common.hpp>
|
||||
|
||||
#include <atomic>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <rai/common.hpp>
|
||||
#include <rai/secure/common.hpp>
|
||||
#include <rai/lib/interface.h>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <rai/ledger.hpp>
|
||||
#include <rai/secure/ledger.hpp>
|
||||
#include <rai/lib/work.hpp>
|
||||
#include <rai/node/bootstrap.hpp>
|
||||
#include <rai/node/stats.hpp>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <boost/beast.hpp>
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <rai/node/utility.hpp>
|
||||
#include <rai/secure/utility.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace rai
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <rai/blockstore.hpp>
|
||||
#include <rai/common.hpp>
|
||||
#include <rai/secure/blockstore.hpp>
|
||||
#include <rai/secure/common.hpp>
|
||||
#include <rai/node/common.hpp>
|
||||
#include <rai/node/openclwork.hpp>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <rai/common.hpp>
|
||||
#include <rai/secure/common.hpp>
|
||||
|
||||
namespace rai
|
||||
{
|
||||
|
|
44
rai/secure/CMakeLists.txt
Normal file
44
rai/secure/CMakeLists.txt
Normal file
|
@ -0,0 +1,44 @@
|
|||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set (PLATFORM_SECURE_SOURCE plat/osx/working.mm)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set (PLATFORM_SECURE_SOURCE plat/windows/working.cpp)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set (PLATFORM_SECURE_SOURCE plat/posix/working.cpp)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
set (PLATFORM_SECURE_SOURCE plat/posix/working.cpp)
|
||||
else ()
|
||||
error ("Unknown platform: ${CMAKE_SYSTEM_NAME}")
|
||||
endif ()
|
||||
|
||||
# Embed bootstrap representative weights in executable
|
||||
file (READ ${CMAKE_SOURCE_DIR}/rep_weights.bin filedata HEX)
|
||||
string (REGEX REPLACE "(..)" "0x\\1," filedata ${filedata})
|
||||
file (WRITE ${CMAKE_BINARY_DIR}/bootstrap_weights.cpp "#include <cstddef>\n"
|
||||
"namespace rai {\n"
|
||||
" unsigned char rai_bootstrap_weights[] = {${filedata} 0x00};\n"
|
||||
" size_t rai_bootstrap_weights_size = sizeof(rai_bootstrap_weights) - 1;\n"
|
||||
"}\n")
|
||||
|
||||
add_library (secure
|
||||
${PLATFORM_SECURE_SOURCE}
|
||||
${CMAKE_BINARY_DIR}/bootstrap_weights.cpp
|
||||
config.hpp
|
||||
common.cpp
|
||||
common.hpp
|
||||
blockstore.cpp
|
||||
blockstore.hpp
|
||||
ledger.cpp
|
||||
ledger.hpp
|
||||
utility.cpp
|
||||
utility.hpp
|
||||
versioning.hpp
|
||||
versioning.cpp)
|
||||
|
||||
target_link_libraries(secure Boost::boost)
|
||||
|
||||
# TODO: Do globally
|
||||
set_target_properties (secure
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${PLATFORM_CXX_FLAGS} ${PLATFORM_COMPILE_FLAGS} -DQT_NO_KEYWORDS -DACTIVE_NETWORK=${ACTIVE_NETWORK} -DRAIBLOCKS_VERSION_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR} -DRAIBLOCKS_VERSION_MINOR=${CPACK_PACKAGE_VERSION_MINOR} -DBOOST_ASIO_HAS_STD_ARRAY=1")
|
||||
# TODO: Do globally
|
||||
set_target_properties (secure PROPERTIES LINK_FLAGS "${PLATFORM_LINK_FLAGS}")
|
|
@ -1,6 +1,6 @@
|
|||
#include <queue>
|
||||
#include <rai/blockstore.hpp>
|
||||
#include <rai/versioning.hpp>
|
||||
#include <rai/secure/blockstore.hpp>
|
||||
#include <rai/secure/versioning.hpp>
|
||||
|
||||
namespace
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <rai/common.hpp>
|
||||
#include <rai/secure/common.hpp>
|
||||
|
||||
namespace rai
|
||||
{
|
|
@ -1,9 +1,9 @@
|
|||
#include <rai/common.hpp>
|
||||
#include <rai/secure/common.hpp>
|
||||
|
||||
#include <rai/blockstore.hpp>
|
||||
#include <rai/secure/blockstore.hpp>
|
||||
#include <rai/lib/interface.h>
|
||||
#include <rai/node/common.hpp>
|
||||
#include <rai/versioning.hpp>
|
||||
#include <rai/secure/versioning.hpp>
|
||||
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <rai/lib/blocks.hpp>
|
||||
#include <rai/node/utility.hpp>
|
||||
#include <rai/secure/utility.hpp>
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include <rai/blockstore.hpp>
|
||||
#include <rai/ledger.hpp>
|
||||
#include <rai/secure/blockstore.hpp>
|
||||
#include <rai/secure/ledger.hpp>
|
||||
#include <rai/node/common.hpp>
|
||||
#include <rai/node/stats.hpp>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <rai/common.hpp>
|
||||
#include <rai/secure/common.hpp>
|
||||
|
||||
namespace rai
|
||||
{
|
|
@ -1,5 +1,6 @@
|
|||
#include <rai/secure/utility.hpp>
|
||||
|
||||
#include <rai/lib/interface.h>
|
||||
#include <rai/node/utility.hpp>
|
||||
#include <rai/node/working.hpp>
|
||||
|
||||
#include <lmdb/libraries/liblmdb/lmdb.h>
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include <lmdb/libraries/liblmdb/lmdb.h>
|
||||
|
||||
#include <rai/config.hpp>
|
||||
#include <rai/secure/config.hpp>
|
||||
#include <rai/lib/interface.h>
|
||||
#include <rai/lib/numbers.hpp>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <rai/versioning.hpp>
|
||||
#include <rai/secure/versioning.hpp>
|
||||
|
||||
rai::account_info_v1::account_info_v1 () :
|
||||
head (0),
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <rai/lib/blocks.hpp>
|
||||
#include <rai/node/utility.hpp>
|
||||
#include <rai/secure/utility.hpp>
|
||||
|
||||
namespace rai
|
||||
{
|
Loading…
Add table
Add a link
Reference in a new issue