aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-tng.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-service-tng.c')
-rw-r--r--src/transport/gnunet-service-tng.c72
1 files changed, 10 insertions, 62 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index b55cd2485..cb6fcebdc 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -34,6 +34,7 @@
34 * 34 *
35 * Implement: 35 * Implement:
36 * - manage defragmentation, retransmission, track RTT, loss, etc. 36 * - manage defragmentation, retransmission, track RTT, loss, etc.
37 * - DV data structures, learning, forgetting, using them!
37 * 38 *
38 * Easy: 39 * Easy:
39 * - use ATS bandwidth allocation callback and schedule transmissions! 40 * - use ATS bandwidth allocation callback and schedule transmissions!
@@ -153,6 +154,9 @@ struct TransportBackchannelEncapsulationMessage
153 */ 154 */
154 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key; 155 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
155 156
157 // FIXME: probably should add random IV here as well,
158 // especially if we re-use ephemeral keys!
159
156 /** 160 /**
157 * HMAC over the ciphertext of the encrypted, variable-size 161 * HMAC over the ciphertext of the encrypted, variable-size
158 * body that follows. Verified via DH of @e target and 162 * body that follows. Verified via DH of @e target and
@@ -177,8 +181,7 @@ struct EphemeralConfirmation
177 struct GNUNET_CRYPTO_EccSignaturePurpose purpose; 181 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
178 182
179 /** 183 /**
180 * How long is this signature over the ephemeral key 184 * How long is this signature over the ephemeral key valid?
181 * valid?
182 */ 185 */
183 struct GNUNET_TIME_AbsoluteNBO ephemeral_validity; 186 struct GNUNET_TIME_AbsoluteNBO ephemeral_validity;
184 187
@@ -192,37 +195,6 @@ struct EphemeralConfirmation
192 195
193 196
194/** 197/**
195 * Message by which a peqer confirms that it is using an ephemeral
196 * key.
197 */
198struct EphemeralConfirmationMessage
199{
200
201 /**
202 * Message header, type is #GNUNET_MESSAGE_TYPE_TRANSPORT_EPHEMERAL_CONFIRMATION
203 */
204 struct GNUNET_MessageHeader header;
205
206 /**
207 * Must be zero.
208 */
209 uint32_t reserved;
210
211 /**
212 * How long is this signature over the ephemeral key
213 * valid?
214 */
215 struct GNUNET_TIME_AbsoluteNBO ephemeral_validity;
216
217 /**
218 * Ephemeral key setup by the sender for @e target, used
219 * to encrypt the payload.
220 */
221 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
222};
223
224
225/**
226 * Plaintext of the variable-size payload that is encrypted 198 * Plaintext of the variable-size payload that is encrypted
227 * within a `struct TransportBackchannelEncapsulationMessage` 199 * within a `struct TransportBackchannelEncapsulationMessage`
228 */ 200 */
@@ -546,6 +518,10 @@ enum ClientType
546 518
547/** 519/**
548 * Entry in our cache of ephemeral keys we currently use. 520 * Entry in our cache of ephemeral keys we currently use.
521 * This way, we only sign an ephemeral once per @e target,
522 * and then can re-use it over multiple
523 * #GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION
524 * messages (as signing is expensive).
549 */ 525 */
550struct EphemeralCacheEntry 526struct EphemeralCacheEntry
551{ 527{
@@ -2525,31 +2501,7 @@ handle_backchannel_encapsulation (void *cls,
2525 // FIXME: check HMAC 2501 // FIXME: check HMAC
2526 // FIXME: decrypt payload 2502 // FIXME: decrypt payload
2527 // FIXME: forward to specified communicator! 2503 // FIXME: forward to specified communicator!
2528 2504 // (using GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING)
2529 finish_cmc_handling (cmc);
2530}
2531
2532
2533/**
2534 * Communicator gave us an ephemeral confirmation. Process the request.
2535 *
2536 * @param cls a `struct CommunicatorMessageContext` (must call #finish_cmc_handling() when done)
2537 * @param ec the message that was received
2538 */
2539static void
2540handle_ephemeral_confirmation (void *cls,
2541 const struct EphemeralConfirmationMessage *ec)
2542{
2543 struct CommunicatorMessageContext *cmc = cls;
2544
2545 // FIXME: notify communicator (?) about ephemeral confirmation!?
2546 // FIXME: or does this have something to do with the ephemeral_map?
2547 // where did I plan to use this message again!?
2548 // FIXME: communicator API has a very general notification API,
2549 // nothing specific for ephemeral keys;
2550 // why do we have a ephemeral key-specific message here?
2551 // => first revise where we get such messages from communicator
2552 // before processing further here!
2553 finish_cmc_handling (cmc); 2505 finish_cmc_handling (cmc);
2554} 2506}
2555 2507
@@ -2726,10 +2678,6 @@ handle_incoming_msg (void *cls,
2726 GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION, 2678 GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION,
2727 struct TransportBackchannelEncapsulationMessage, 2679 struct TransportBackchannelEncapsulationMessage,
2728 &cmc), 2680 &cmc),
2729 GNUNET_MQ_hd_fixed_size (ephemeral_confirmation,
2730 GNUNET_MESSAGE_TYPE_TRANSPORT_EPHEMERAL_CONFIRMATION,
2731 struct EphemeralConfirmationMessage,
2732 &cmc),
2733 GNUNET_MQ_hd_var_size (dv_learn, 2681 GNUNET_MQ_hd_var_size (dv_learn,
2734 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN, 2682 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN,
2735 struct TransportDVLearn, 2683 struct TransportDVLearn,