diff --git a/include/pearson.h b/include/pearson.h index 908f24f..9ceae47 100644 --- a/include/pearson.h +++ b/include/pearson.h @@ -17,10 +17,8 @@ */ -#include -#include - -#include "portable_endian.h" +#include // for size_t +#include // for uint8_t, uint16_t, uint32_t, uint64_t void pearson_hash_256 (uint8_t *out, const uint8_t *in, size_t len); diff --git a/src/edge.c b/src/edge.c index c626004..a7c2846 100644 --- a/src/edge.c +++ b/src/edge.c @@ -18,6 +18,7 @@ #include "auth.h" // for generate_private_key, generate_p... #include "n2n.h" +#include "pearson.h" // for pearson_hash_64 /* *************************************************** */ diff --git a/src/edge_utils.c b/src/edge_utils.c index a5acc73..6091969 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -18,7 +18,8 @@ #include "auth.h" // for generate_private_key #include "header_encryption.h" // for packet_header_encrypt, packet_he... -#include "n2n.h" +#include "n2n.h" // for n2n_edge_t, peer_info, n2n_edge_... +#include "pearson.h" // for pearson_hash_128, pearson_hash_64 #include "network_traffic_filter.h" #include "edge_utils_win32.h" diff --git a/src/header_encryption.c b/src/header_encryption.c index 3567bbe..981d7ea 100644 --- a/src/header_encryption.c +++ b/src/header_encryption.c @@ -18,7 +18,8 @@ #include "header_encryption.h" // for packet_header_change_dynamic_key, pac... -#include "n2n.h" +#include "n2n.h" // for he_context_t, N2N_COMMUNITY_SIZE, TRA... +#include "pearson.h" // for pearson_hash_128, pearson_hash_64 #define HASH_FIND_COMMUNITY(head, name, out) HASH_FIND_STR(head, name, out) diff --git a/src/management.c b/src/management.c index 5a27dcf..a207e00 100644 --- a/src/management.c +++ b/src/management.c @@ -9,6 +9,9 @@ #include #endif +#include // for pearson_hash_64 +#include "n2n.h" // for TRACE_DEBUG, traceEvent + // TODO: move logging defs in their own header and include that void setTraceLevel (int level); int getTraceLevel (); @@ -16,8 +19,6 @@ int getTraceLevel (); #include #include "management.h" -#include "n2n.h" // for traceEvent and friends - ssize_t send_reply (mgmt_req_t *req, strbuf_t *buf, size_t msg_len) { // TODO: better error handling (counters?) return sendto(req->mgmt_sock, buf->str, msg_len, 0, diff --git a/src/pearson.c b/src/pearson.c index 4852b43..bf0273a 100644 --- a/src/pearson.c +++ b/src/pearson.c @@ -22,6 +22,7 @@ #include "pearson.h" +#include "portable_endian.h" // for le64toh, htobe64 // Christopher Wellons' triple32 from https://github.com/skeeto/hash-prospector diff --git a/src/sn_utils.c b/src/sn_utils.c index 13e2ffb..26ffe06 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -16,9 +16,12 @@ * */ + #include "auth.h" // for ascii_to_bin, calculate_dynamic_key #include "header_encryption.h" // for packet_header_encrypt, packet_header_... -#include "n2n.h" +#include "n2n.h" // for sn_community, n2n_sn_t, peer_info +#include "pearson.h" // for pearson_hash_128, pearson_hash_32 + #define HASH_FIND_COMMUNITY(head, name, out) HASH_FIND_STR(head, name, out) diff --git a/src/supernode.c b/src/supernode.c index 4454fbd..8d7b7f9 100644 --- a/src/supernode.c +++ b/src/supernode.c @@ -18,7 +18,10 @@ /* Supernode for n2n-2.x */ -#include "n2n.h" + +#include "n2n.h" // for n2n_sn_t, sn_community, traceEvent +#include "pearson.h" // for pearson_hash_64 + #define HASH_FIND_COMMUNITY(head, name, out) HASH_FIND_STR(head, name, out) diff --git a/src/transform_aes.c b/src/transform_aes.c index 3a285c7..d60a78a 100644 --- a/src/transform_aes.c +++ b/src/transform_aes.c @@ -17,7 +17,8 @@ */ -#include "n2n.h" +#include "n2n.h" // for n2n_trans_op_t, traceEvent, TRACE_ERROR +#include "pearson.h" // for pearson_hash_256 // size of random value prepended to plaintext defaults to AES BLOCK_SIZE; diff --git a/src/transform_cc20.c b/src/transform_cc20.c index 05061a6..fdf3c6d 100644 --- a/src/transform_cc20.c +++ b/src/transform_cc20.c @@ -18,7 +18,8 @@ #include "cc20.h" // for CC20_IV_SIZE, cc20_crypt, cc20_deinit -#include "n2n.h" +#include "n2n.h" // for n2n_trans_op_t, traceEvent, TRACE_ERROR +#include "pearson.h" // for pearson_hash_256 // ChaCha20 plaintext preamble diff --git a/src/transform_speck.c b/src/transform_speck.c index a633844..872c356 100644 --- a/src/transform_speck.c +++ b/src/transform_speck.c @@ -17,8 +17,8 @@ */ -#include "n2n.h" - +#include "n2n.h" // for n2n_trans_op_t, traceEvent, TRACE_DEBUG +#include "pearson.h" // for pearson_hash_256 // Speck plaintext preamble #define TRANSOP_SPECK_PREAMBLE_SIZE (N2N_SPECK_IVEC_SIZE) diff --git a/src/transform_tf.c b/src/transform_tf.c index 2900639..be0adc7 100644 --- a/src/transform_tf.c +++ b/src/transform_tf.c @@ -17,7 +17,8 @@ */ -#include "n2n.h" +#include "n2n.h" // for n2n_trans_op_t, traceEvent, TRACE_ERROR +#include "pearson.h" // for pearson_hash_256 // size of random value prepended to plaintext defaults to TF_BLOCK_SIZE; diff --git a/tools/n2n-benchmark.c b/tools/n2n-benchmark.c index b4a3c95..510ddf5 100644 --- a/tools/n2n-benchmark.c +++ b/tools/n2n-benchmark.c @@ -22,7 +22,8 @@ #include #endif -#include "n2n.h" +#include "n2n.h" // for n2n_trans_op_t, n2n_common_t, n2n_edge_conf_t +#include "pearson.h" // for pearson_hash_64, pearson_hash_init #define DURATION 2.5 // test duration per algorithm #define PACKETS_BEFORE_GETTIME 2047 // do not check time after every packet but after (2 ^ n - 1) diff --git a/tools/tests-hashing.c b/tools/tests-hashing.c index dbbbbb8..6e40fe7 100644 --- a/tools/tests-hashing.c +++ b/tools/tests-hashing.c @@ -19,7 +19,8 @@ #include #include "n2n.h" -#include "hexdump.h" +#include "hexdump.h" // for fhexdump +#include "pearson.h" // for pearson_hash_128, pearson_hash_16, pearson_has... uint8_t PKT_CONTENT[]={