From 04e0fe3ad717fea3c08aeab1a1ed967435885d2a Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 13 Jan 2019 14:00:50 +0000 Subject: [PATCH] Move crypto code to a subdirectory --- CMakeLists.txt | 8 ++++---- daemon/rcutil.cpp | 2 +- include/llarp.hpp | 2 +- libabyss/src/client.cpp | 2 +- llarp/address_info.hpp | 2 +- llarp/{ => crypto}/crypto.cpp | 2 +- llarp/{ => crypto}/crypto.hpp | 0 llarp/{ => crypto}/crypto_libsodium.cpp | 3 ++- llarp/dht.h | 2 +- llarp/dht/bucket.hpp | 2 +- llarp/encrypted_frame.cpp | 2 +- llarp/encrypted_frame.hpp | 2 +- llarp/exit/endpoint.hpp | 2 +- llarp/exit_info.hpp | 2 +- llarp/link/server.hpp | 2 +- llarp/link/session.hpp | 2 +- llarp/messages/exit.hpp | 3 ++- llarp/messages/path_transfer.hpp | 2 +- llarp/messages/relay.hpp | 2 +- llarp/messages/relay_commit.hpp | 2 +- llarp/messages/transfer_traffic.hpp | 2 +- llarp/nodedb.cpp | 2 +- llarp/nodedb.hpp | 2 +- llarp/path/path.hpp | 2 +- llarp/path/path_types.hpp | 2 +- llarp/pow.hpp | 2 +- llarp/router.cpp | 2 +- llarp/router.hpp | 2 +- llarp/router_contact.cpp | 2 +- llarp/router_contact.hpp | 3 ++- llarp/rpc.hpp | 2 +- llarp/service/Identity.hpp | 2 +- llarp/service/Info.hpp | 2 +- llarp/service/Intro.hpp | 2 +- llarp/service/IntroSet.hpp | 2 +- llarp/service/handler.hpp | 2 +- llarp/service/protocol.hpp | 2 +- test/{ => crypto}/test_llarp_crypto.cpp | 6 ++++-- test/service/test_llarp_service_identity.cpp | 2 +- test/test_llarp_encrypted_frame.cpp | 6 ++++-- test/test_llarp_router.cpp | 3 +-- test/test_llarp_router_contact.cpp | 2 +- 42 files changed, 53 insertions(+), 47 deletions(-) rename llarp/{ => crypto}/crypto.cpp (97%) rename llarp/{ => crypto}/crypto.hpp (100%) rename llarp/{ => crypto}/crypto_libsodium.cpp (99%) rename test/{ => crypto}/test_llarp_crypto.cpp (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc4f55f8a..fe7aae0fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -493,8 +493,8 @@ set(LIB_SRC llarp/codel.cpp llarp/config.cpp llarp/context.cpp - llarp/crypto.cpp - llarp/crypto_libsodium.cpp + llarp/crypto/crypto.cpp + llarp/crypto/crypto_libsodium.cpp llarp/dht.cpp llarp/dht/bucket.cpp llarp/dht/context.cpp @@ -614,6 +614,7 @@ set(DNS_SRC ) set(TEST_SRC + test/crypto/test_llarp_crypto.cpp test/dht/test_llarp_dht_key.cpp test/dht/test_llarp_dht.cpp test/dns/test_llarp_dns_dns.cpp @@ -626,12 +627,11 @@ set(TEST_SRC test/routing/test_llarp_routing_obtainexitmessage.cpp test/service/test_llarp_service_address.cpp test/service/test_llarp_service_identity.cpp - test/test_llarp_crypto.cpp test/test_llarp_dns.cpp test/test_llarp_dnsd.cpp test/test_llarp_encrypted_frame.cpp - test/test_llarp_router.cpp test/test_llarp_router_contact.cpp + test/test_llarp_router.cpp test/util/test_llarp_util_aligned.cpp test/util/test_llarp_util_bencode.cpp test/util/test_llarp_util_encode.cpp diff --git a/daemon/rcutil.cpp b/daemon/rcutil.cpp index dce7d5a7c..5a956d699 100644 --- a/daemon/rcutil.cpp +++ b/daemon/rcutil.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/include/llarp.hpp b/include/llarp.hpp index ba569ea10..7639336f7 100644 --- a/include/llarp.hpp +++ b/include/llarp.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_HPP #define LLARP_HPP -#include +#include #include #include diff --git a/libabyss/src/client.cpp b/libabyss/src/client.cpp index 6c1eed8e4..028a88b35 100644 --- a/libabyss/src/client.cpp +++ b/libabyss/src/client.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/llarp/address_info.hpp b/llarp/address_info.hpp index baee3daa0..9568f92f9 100644 --- a/llarp/address_info.hpp +++ b/llarp/address_info.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_AI_HPP #define LLARP_AI_HPP -#include +#include #include #include #include diff --git a/llarp/crypto.cpp b/llarp/crypto/crypto.cpp similarity index 97% rename from llarp/crypto.cpp rename to llarp/crypto/crypto.cpp index 4c49583a6..1c90f56d2 100644 --- a/llarp/crypto.cpp +++ b/llarp/crypto/crypto.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/llarp/crypto.hpp b/llarp/crypto/crypto.hpp similarity index 100% rename from llarp/crypto.hpp rename to llarp/crypto/crypto.hpp diff --git a/llarp/crypto_libsodium.cpp b/llarp/crypto/crypto_libsodium.cpp similarity index 99% rename from llarp/crypto_libsodium.cpp rename to llarp/crypto/crypto_libsodium.cpp index 826c510a4..57f92af41 100644 --- a/llarp/crypto_libsodium.cpp +++ b/llarp/crypto/crypto_libsodium.cpp @@ -1,4 +1,5 @@ -#include +#include + #include #include #include diff --git a/llarp/dht.h b/llarp/dht.h index 3bc6ad15f..1d3d0448d 100644 --- a/llarp/dht.h +++ b/llarp/dht.h @@ -1,7 +1,7 @@ #ifndef LLARP_DHT_H_ #define LLARP_DHT_H_ -#include +#include #include #include diff --git a/llarp/dht/bucket.hpp b/llarp/dht/bucket.hpp index be6a6c0cd..e1a83e6a7 100644 --- a/llarp/dht/bucket.hpp +++ b/llarp/dht/bucket.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_DHT_BUCKET_HPP #define LLARP_DHT_BUCKET_HPP -#include +#include #include #include #include diff --git a/llarp/encrypted_frame.cpp b/llarp/encrypted_frame.cpp index eef7ddcd3..803bd5db8 100644 --- a/llarp/encrypted_frame.cpp +++ b/llarp/encrypted_frame.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/llarp/encrypted_frame.hpp b/llarp/encrypted_frame.hpp index 3b516478e..da6c97d09 100644 --- a/llarp/encrypted_frame.hpp +++ b/llarp/encrypted_frame.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_ENCRYPTED_FRAME_HPP #define LLARP_ENCRYPTED_FRAME_HPP -#include +#include #include #include #include diff --git a/llarp/exit/endpoint.hpp b/llarp/exit/endpoint.hpp index f4fb3d723..23995f259 100644 --- a/llarp/exit/endpoint.hpp +++ b/llarp/exit/endpoint.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_EXIT_ENDPOINT_HPP #define LLARP_EXIT_ENDPOINT_HPP -#include +#include #include #include #include diff --git a/llarp/exit_info.hpp b/llarp/exit_info.hpp index 8182c3654..53018f525 100644 --- a/llarp/exit_info.hpp +++ b/llarp/exit_info.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_XI_HPP #define LLARP_XI_HPP -#include +#include #include #include #include diff --git a/llarp/link/server.hpp b/llarp/link/server.hpp index 29d52e877..a99054ba2 100644 --- a/llarp/link/server.hpp +++ b/llarp/link/server.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_LINK_SERVER_HPP #define LLARP_LINK_SERVER_HPP -#include +#include #include #include #include diff --git a/llarp/link/session.hpp b/llarp/link/session.hpp index d4a7ab3ce..579c521be 100644 --- a/llarp/link/session.hpp +++ b/llarp/link/session.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_LINK_SESSION_HPP #define LLARP_LINK_SESSION_HPP -#include +#include #include #include #include diff --git a/llarp/messages/exit.hpp b/llarp/messages/exit.hpp index 90064a678..a27dc31bc 100644 --- a/llarp/messages/exit.hpp +++ b/llarp/messages/exit.hpp @@ -1,6 +1,7 @@ #ifndef LLARP_MESSAGES_EXIT_HPP #define LLARP_MESSAGES_EXIT_HPP -#include + +#include #include #include diff --git a/llarp/messages/path_transfer.hpp b/llarp/messages/path_transfer.hpp index 109639065..0cb313f22 100644 --- a/llarp/messages/path_transfer.hpp +++ b/llarp/messages/path_transfer.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_MESSAGES_PATH_TRANSFER_HPP #define LLARP_MESSAGES_PATH_TRANSFER_HPP -#include +#include #include #include #include diff --git a/llarp/messages/relay.hpp b/llarp/messages/relay.hpp index c53f774e4..87383e2b2 100644 --- a/llarp/messages/relay.hpp +++ b/llarp/messages/relay.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_MESSAGES_RELAY_HPP #define LLARP_MESSAGES_RELAY_HPP -#include +#include #include #include #include diff --git a/llarp/messages/relay_commit.hpp b/llarp/messages/relay_commit.hpp index 5ab67c9db..d695fecdd 100644 --- a/llarp/messages/relay_commit.hpp +++ b/llarp/messages/relay_commit.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_RELAY_COMMIT_HPP #define LLARP_RELAY_COMMIT_HPP -#include +#include #include #include #include diff --git a/llarp/messages/transfer_traffic.hpp b/llarp/messages/transfer_traffic.hpp index d41793131..a02357dbc 100644 --- a/llarp/messages/transfer_traffic.hpp +++ b/llarp/messages/transfer_traffic.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_MESSAGES_TRANSFER_TRAFFIC_HPP #define LLARP_MESSAGES_TRANSFER_TRAFFIC_HPP -#include +#include #include #include diff --git a/llarp/nodedb.cpp b/llarp/nodedb.cpp index 4b04966a9..8dd0afc4e 100644 --- a/llarp/nodedb.cpp +++ b/llarp/nodedb.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include #include diff --git a/llarp/nodedb.hpp b/llarp/nodedb.hpp index a5f63271f..203fdf71a 100644 --- a/llarp/nodedb.hpp +++ b/llarp/nodedb.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_NODEDB_HPP #define LLARP_NODEDB_HPP -#include +#include #include #include #include diff --git a/llarp/path/path.hpp b/llarp/path/path.hpp index 994bc0394..e2de9b130 100644 --- a/llarp/path/path.hpp +++ b/llarp/path/path.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_PATH_HPP #define LLARP_PATH_HPP -#include +#include #include #include #include diff --git a/llarp/path/path_types.hpp b/llarp/path/path_types.hpp index 0bfa31570..545c729da 100644 --- a/llarp/path/path_types.hpp +++ b/llarp/path/path_types.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_PATH_TYPES_HPP #define LLARP_PATH_TYPES_HPP -#include +#include #include namespace llarp diff --git a/llarp/pow.hpp b/llarp/pow.hpp index 7ed2cc294..a135add0a 100644 --- a/llarp/pow.hpp +++ b/llarp/pow.hpp @@ -1,6 +1,6 @@ #ifndef LLARP_POW_HPP #define LLARP_POW_HPP -#include +#include #include #include diff --git a/llarp/router.cpp b/llarp/router.cpp index 07226e4d8..c14563f77 100644 --- a/llarp/router.cpp +++ b/llarp/router.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include #include diff --git a/llarp/router.hpp b/llarp/router.hpp index 7e7be04d3..d0068dd9b 100644 --- a/llarp/router.hpp +++ b/llarp/router.hpp @@ -2,7 +2,7 @@ #define LLARP_ROUTER_HPP #include -#include +#include #include #include #include diff --git a/llarp/router_contact.cpp b/llarp/router_contact.cpp index 9ea68b117..05031adc0 100644 --- a/llarp/router_contact.cpp +++ b/llarp/router_contact.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include #include diff --git a/llarp/router_contact.hpp b/llarp/router_contact.hpp index c14c49688..a822eab61 100644 --- a/llarp/router_contact.hpp +++ b/llarp/router_contact.hpp @@ -3,8 +3,9 @@ #include #include -#include +#include #include +#include #include #include diff --git a/llarp/rpc.hpp b/llarp/rpc.hpp index 3cfcdb901..9a3af0767 100644 --- a/llarp/rpc.hpp +++ b/llarp/rpc.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_RPC_HPP #define LLARP_RPC_HPP -#include +#include #include #include diff --git a/llarp/service/Identity.hpp b/llarp/service/Identity.hpp index 4b312e893..507c06027 100644 --- a/llarp/service/Identity.hpp +++ b/llarp/service/Identity.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_SERVICE_IDENTITY_HPP #define LLARP_SERVICE_IDENTITY_HPP -#include +#include #include #include #include diff --git a/llarp/service/Info.hpp b/llarp/service/Info.hpp index 53effe67d..8fac57172 100644 --- a/llarp/service/Info.hpp +++ b/llarp/service/Info.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_SERVICE_INFO_HPP #define LLARP_SERVICE_INFO_HPP -#include +#include #include #include diff --git a/llarp/service/Intro.hpp b/llarp/service/Intro.hpp index 562f2e4da..d0cabf4d6 100644 --- a/llarp/service/Intro.hpp +++ b/llarp/service/Intro.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_SERVICE_INTRO_HPP #define LLARP_SERVICE_INTRO_HPP -#include +#include #include #include diff --git a/llarp/service/IntroSet.hpp b/llarp/service/IntroSet.hpp index 9c235f9fe..4b7e591e4 100644 --- a/llarp/service/IntroSet.hpp +++ b/llarp/service/IntroSet.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_SERVICE_INTROSET_HPP #define LLARP_SERVICE_INTROSET_HPP -#include +#include #include #include #include diff --git a/llarp/service/handler.hpp b/llarp/service/handler.hpp index 2fcfa6b09..8e3401858 100644 --- a/llarp/service/handler.hpp +++ b/llarp/service/handler.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_SERVICE_HANDLER_HPP #define LLARP_SERVICE_HANDLER_HPP -#include +#include #include #include #include diff --git a/llarp/service/protocol.hpp b/llarp/service/protocol.hpp index 3020cb204..5a366b1d2 100644 --- a/llarp/service/protocol.hpp +++ b/llarp/service/protocol.hpp @@ -1,7 +1,7 @@ #ifndef LLARP_SERVICE_PROTOCOL_HPP #define LLARP_SERVICE_PROTOCOL_HPP -#include +#include #include #include #include diff --git a/test/test_llarp_crypto.cpp b/test/crypto/test_llarp_crypto.cpp similarity index 96% rename from test/test_llarp_crypto.cpp rename to test/crypto/test_llarp_crypto.cpp index 4f14ead91..2694720d0 100644 --- a/test/test_llarp_crypto.cpp +++ b/test/crypto/test_llarp_crypto.cpp @@ -1,7 +1,9 @@ -#include -#include +#include + #include +#include + namespace llarp { struct PQCryptoTest : public ::testing::Test diff --git a/test/service/test_llarp_service_identity.cpp b/test/service/test_llarp_service_identity.cpp index ef7316c3c..6872ceecf 100644 --- a/test/service/test_llarp_service_identity.cpp +++ b/test/service/test_llarp_service_identity.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include #include diff --git a/test/test_llarp_encrypted_frame.cpp b/test/test_llarp_encrypted_frame.cpp index f4885c09f..450a117bf 100644 --- a/test/test_llarp_encrypted_frame.cpp +++ b/test/test_llarp_encrypted_frame.cpp @@ -1,8 +1,10 @@ -#include -#include +#include + #include #include +#include + using EncryptedFrame = llarp::EncryptedFrame; using SecretKey = llarp::SecretKey; using PubKey = llarp::PubKey; diff --git a/test/test_llarp_router.cpp b/test/test_llarp_router.cpp index 0dde08de1..5ebdfad12 100644 --- a/test/test_llarp_router.cpp +++ b/test/test_llarp_router.cpp @@ -1,6 +1,5 @@ - #include -#include +#include #include #include diff --git a/test/test_llarp_router_contact.cpp b/test/test_llarp_router_contact.cpp index a0f09f8f4..937954218 100644 --- a/test/test_llarp_router_contact.cpp +++ b/test/test_llarp_router_contact.cpp @@ -1,7 +1,7 @@ #include +#include #include -#include static const byte_t DEF_VALUE[] = "unittest";