From 8fe9edb11728c34de80242b438cbb0d75e26a04d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 26 Feb 2022 01:57:13 +0100 Subject: -hack up GET/PUT signatures, still broken by design --- src/include/gnunet_dht_service.h | 51 +++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 8 deletions(-) (limited to 'src/include') diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h index e0f9f6fc3..4e14d981d 100644 --- a/src/include/gnunet_dht_service.h +++ b/src/include/gnunet_dht_service.h @@ -118,10 +118,10 @@ GNUNET_NETWORK_STRUCT_BEGIN /** * Message signed by a peer when doing path tracking. */ -struct GNUNET_DHT_HopSignature +struct GNUNET_DHT_PutHopSignature { /** - * Must be #GNUNET_SIGNATURE_PURPOSE_DHT_HOP. + * Must be #GNUNET_SIGNATURE_PURPOSE_DHT_PUT_HOP. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; @@ -131,9 +131,43 @@ struct GNUNET_DHT_HopSignature struct GNUNET_TIME_AbsoluteNBO expiration_time; /** - * Key of the block. + * Hash over the payload of the block. + */ + struct GNUNET_HashCode h_data; + + /** + * Previous hop the message was received from. All zeros + * if this peer was the initiator. */ - struct GNUNET_HashCode key; + struct GNUNET_PeerIdentity pred; + + /** + * Next hop the message was forwarded to. + */ + struct GNUNET_PeerIdentity succ; +}; + + +/** + * Message signed by a peer when doing path tracking + * for RESULT (GET) hops. + */ +struct GNUNET_DHT_ResultHopSignature +{ + /** + * Must be #GNUNET_SIGNATURE_PURPOSE_DHT_RESULT_HOP. + */ + struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + + /** + * Expiration time of the block. + */ + struct GNUNET_TIME_AbsoluteNBO expiration_time; + + /** + * Query hash of the GET that is being answered. + */ + struct GNUNET_HashCode query_hash; /** * Hash over the payload of the block. @@ -181,6 +215,7 @@ struct GNUNET_DHT_PathElement }; + GNUNET_NETWORK_STRUCT_END /** @@ -266,7 +301,7 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph); * * @param cls closure * @param exp when will this value expire - * @param key key of the result + * @param query_hash key of the query * @param get_path peers on reply path (or NULL if not recorded) * [0] = datastore's first neighbor, [length - 1] = local peer * @param get_path_length number of entries in @a get_path @@ -282,7 +317,7 @@ GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph); typedef void (*GNUNET_DHT_GetIterator) (void *cls, struct GNUNET_TIME_Absolute exp, - const struct GNUNET_HashCode *key, + const struct GNUNET_HashCode *query_hash, const struct GNUNET_DHT_PathElement *get_path, unsigned int get_path_length, const struct GNUNET_DHT_PathElement *put_path, @@ -487,7 +522,7 @@ GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path, * the last signature on the path is never verified as that is the slot where * our peer (@a me) would need to sign. * - * @param key key of the data (not necessarily the query hash) + * @param query_hash the query hash, not necessarily the key of the block * @param data payload (the block) * @param data_size number of bytes in @a data * @param exp_time expiration time of @a data @@ -501,7 +536,7 @@ GNUNET_DHT_pp2s (const struct GNUNET_DHT_PathElement *path, * @a get_path_len + @a put_path_len - 1 if no signature was valid */ unsigned int -GNUNET_DHT_verify_path (const struct GNUNET_HashCode *key, +GNUNET_DHT_verify_path (const struct GNUNET_HashCode *query_hash, const void *data, size_t data_size, struct GNUNET_TIME_Absolute exp_time, -- cgit v1.2.3