aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-10 14:57:20 +0100
committerChristian Grothoff <christian@grothoff.org>2022-01-10 14:57:20 +0100
commitbfd4daf8ae1a3c6229ee3a8ca944adb2ef7e8677 (patch)
tree25aba3b09bbd0f1fdbc8f9295f49e2caffdb950c
parent98edb2e5e83bafe96bb312262fcd9e992589b1d3 (diff)
downloadgnunet-bfd4daf8ae1a3c6229ee3a8ca944adb2ef7e8677.tar.gz
gnunet-bfd4daf8ae1a3c6229ee3a8ca944adb2ef7e8677.zip
-remove signing from DHTU API: no longer needed
-rw-r--r--src/dhtu/plugin_dhtu_gnunet.c182
-rw-r--r--src/dhtu/plugin_dhtu_ip.c78
-rw-r--r--src/include/gnunet_dhtu_plugin.h75
3 files changed, 51 insertions, 284 deletions
diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c
index ee78858c8..2163af941 100644
--- a/src/dhtu/plugin_dhtu_gnunet.c
+++ b/src/dhtu/plugin_dhtu_gnunet.c
@@ -35,42 +35,6 @@
35 35
36 36
37/** 37/**
38 * Handle for a private key used by this underlay.
39 */
40struct GNUNET_DHTU_PrivateKey
41{
42 /**
43 * GNUnet uses eddsa for peers.
44 */
45 struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
46
47};
48
49GNUNET_NETWORK_STRUCT_BEGIN
50
51/**
52 * Handle for a public key used by this underlay.
53 */
54struct PublicKey
55{
56
57 /**
58 * Header.
59 */
60 struct GNUNET_DHTU_PublicKey header;
61
62 /**
63 * GNUnet uses eddsa for peers.
64 */
65 struct GNUNET_PeerIdentity peer_pub;
66
67};
68
69
70GNUNET_NETWORK_STRUCT_END
71
72
73/**
74 * Handle for a HELLO we're offering the transport. 38 * Handle for a HELLO we're offering the transport.
75 */ 39 */
76struct HelloHandle 40struct HelloHandle
@@ -106,19 +70,14 @@ struct GNUNET_DHTU_Source
106{ 70{
107 71
108 /** 72 /**
109 * Application context for this source. 73 * Hash of @e pid, position of this peer in the DHT overlay.
110 */
111 void *app_ctx;
112
113 /**
114 * Hash position of this peer in the DHT.
115 */ 74 */
116 struct GNUNET_DHTU_Hash my_id; 75 struct GNUNET_DHTU_HashKey id;
117 76
118 /** 77 /**
119 * Private key of this peer. 78 * Application context for this source.
120 */ 79 */
121 struct GNUNET_DHTU_PrivateKey pk; 80 void *app_ctx;
122 81
123}; 82};
124 83
@@ -146,17 +105,6 @@ struct GNUNET_DHTU_Target
146 struct GNUNET_MQ_Handle *mq; 105 struct GNUNET_MQ_Handle *mq;
147 106
148 /** 107 /**
149 * Public key of the peer.
150 */
151 struct PublicKey pk;
152
153 /**
154 * Hash of the @a pk to identify position of the peer
155 * in the DHT.
156 */
157 struct GNUNET_DHTU_Hash peer_id;
158
159 /**
160 * Head of preferences expressed for this target. 108 * Head of preferences expressed for this target.
161 */ 109 */
162 struct GNUNET_DHTU_PreferenceHandle *ph_head; 110 struct GNUNET_DHTU_PreferenceHandle *ph_head;
@@ -172,6 +120,16 @@ struct GNUNET_DHTU_Target
172 struct GNUNET_ATS_ConnectivitySuggestHandle *csh; 120 struct GNUNET_ATS_ConnectivitySuggestHandle *csh;
173 121
174 /** 122 /**
123 * Identity of this peer.
124 */
125 struct GNUNET_PeerIdentity pid;
126
127 /**
128 * Hash of @e pid, position of this peer in the DHT overlay.
129 */
130 struct GNUNET_DHTU_HashKey id;
131
132 /**
175 * Preference counter, length of the @a ph_head DLL. 133 * Preference counter, length of the @a ph_head DLL.
176 */ 134 */
177 unsigned int ph_count; 135 unsigned int ph_count;
@@ -215,11 +173,6 @@ struct Plugin
215 struct GNUNET_DHTU_Source src; 173 struct GNUNET_DHTU_Source src;
216 174
217 /** 175 /**
218 * My identity.
219 */
220 struct GNUNET_PeerIdentity my_identity;
221
222 /**
223 * Callbacks into the DHT. 176 * Callbacks into the DHT.
224 */ 177 */
225 struct GNUNET_DHTU_PluginEnvironment *env; 178 struct GNUNET_DHTU_PluginEnvironment *env;
@@ -253,76 +206,13 @@ struct Plugin
253 * Hellos we are offering to transport. 206 * Hellos we are offering to transport.
254 */ 207 */
255 struct HelloHandle *hh_tail; 208 struct HelloHandle *hh_tail;
256};
257
258 209
259/** 210 /**
260 * Use our private key to sign a message. 211 * Identity of this peer.
261 * 212 */
262 * @param cls closure 213 struct GNUNET_PeerIdentity my_identity;
263 * @param pk our private key to sign with
264 * @param purpose what to sign
265 * @param[out] signature, allocated on heap and returned
266 * @return -1 on error, otherwise number of bytes in @a sig
267 */
268static ssize_t
269ip_sign (void *cls,
270 const struct GNUNET_DHTU_PrivateKey *pk,
271 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
272 void **sig)
273{
274 struct GNUNET_CRYPTO_EddsaSignature *es;
275
276 es = GNUNET_new (struct GNUNET_CRYPTO_EddsaSignature);
277 GNUNET_CRYPTO_eddsa_sign_ (&pk->eddsa_priv,
278 purpose,
279 es);
280 *sig = es;
281 return sizeof (*es);
282}
283
284
285/**
286 * Verify signature in @a sig over @a purpose.
287 *
288 * @param cls closure
289 * @param pk public key to verify signature of
290 * @param purpose what was being signed
291 * @param sig signature data
292 * @param sig_size number of bytes in @a sig
293 * @return #GNUNET_OK if signature is valid
294 * #GNUNET_NO if signatures are not supported
295 * #GNUNET_SYSERR if signature is invalid
296 */
297static enum GNUNET_GenericReturnValue
298ip_verify (void *cls,
299 const struct GNUNET_DHTU_PublicKey *pk,
300 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
301 const void *sig,
302 size_t sig_size)
303{
304 const struct GNUNET_CRYPTO_EddsaSignature *es = sig;
305 const struct PublicKey *pub;
306 214
307 GNUNET_assert (sizeof (struct PublicKey) == 215};
308 ntohs (pk->size));
309 pub = (const struct PublicKey *) pk;
310 if (sizeof (*es) != sig_size)
311 {
312 GNUNET_break_op (0);
313 return GNUNET_SYSERR;
314 }
315 if (GNUNET_OK !=
316 GNUNET_CRYPTO_eddsa_verify_ (ntohl (purpose->purpose),
317 purpose,
318 es,
319 &pub->peer_pub.public_key))
320 {
321 GNUNET_break_op (0);
322 return GNUNET_SYSERR;
323 }
324 return GNUNET_OK;
325}
326 216
327 217
328/** 218/**
@@ -409,7 +299,7 @@ ip_hold (void *cls,
409 GNUNET_ATS_connectivity_suggest_cancel (target->csh); 299 GNUNET_ATS_connectivity_suggest_cancel (target->csh);
410 target->csh 300 target->csh
411 = GNUNET_ATS_connectivity_suggest (plugin->ats, 301 = GNUNET_ATS_connectivity_suggest (plugin->ats,
412 &target->pk.peer_pub, 302 &target->pid,
413 target->ph_count); 303 target->ph_count);
414 return ph; 304 return ph;
415} 305}
@@ -439,7 +329,7 @@ ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph)
439 else 329 else
440 target->csh 330 target->csh
441 = GNUNET_ATS_connectivity_suggest (plugin->ats, 331 = GNUNET_ATS_connectivity_suggest (plugin->ats,
442 &target->pk.peer_pub, 332 &target->pid,
443 target->ph_count); 333 target->ph_count);
444} 334}
445 335
@@ -503,15 +393,13 @@ core_connect_cb (void *cls,
503 target = GNUNET_new (struct GNUNET_DHTU_Target); 393 target = GNUNET_new (struct GNUNET_DHTU_Target);
504 target->plugin = plugin; 394 target->plugin = plugin;
505 target->mq = mq; 395 target->mq = mq;
506 target->pk.header.size = htons (sizeof (struct PublicKey)); 396 target->pid = *peer;
507 target->pk.peer_pub = *peer;
508 GNUNET_CRYPTO_hash (peer, 397 GNUNET_CRYPTO_hash (peer,
509 sizeof (struct GNUNET_PeerIdentity), 398 sizeof (*peer),
510 &target->peer_id.hc); 399 &target->id.sha512);
511 plugin->env->connect_cb (plugin->env->cls, 400 plugin->env->connect_cb (plugin->env->cls,
512 &target->pk.header,
513 &target->peer_id,
514 target, 401 target,
402 &target->id,
515 &target->app_ctx); 403 &target->app_ctx);
516 return target; 404 return target;
517} 405}
@@ -573,12 +461,11 @@ peerinfo_cb (void *cls,
573 &GPI_plugins_find); 461 &GPI_plugins_find);
574 if (NULL == addr) 462 if (NULL == addr)
575 return; 463 return;
576 GNUNET_CRYPTO_hash (&plugin->my_identity, 464 GNUNET_CRYPTO_hash (peer,
577 sizeof (struct GNUNET_PeerIdentity), 465 sizeof (*peer),
578 &plugin->src.my_id.hc); 466 &plugin->src.id.sha512);
579 plugin->env->address_add_cb (plugin->env->cls, 467 plugin->env->address_add_cb (plugin->env->cls,
580 &plugin->src.my_id, 468 &plugin->src.id,
581 &plugin->src.pk,
582 addr, 469 addr,
583 &plugin->src, 470 &plugin->src,
584 &plugin->src.app_ctx); 471 &plugin->src.app_ctx);
@@ -729,22 +616,11 @@ libgnunet_plugin_dhtu_ip_init (void *cls)
729 NULL), 616 NULL),
730 GNUNET_MQ_handler_end () 617 GNUNET_MQ_handler_end ()
731 }; 618 };
732 struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
733 619
734 pk = GNUNET_CRYPTO_eddsa_key_create_from_configuration (env->cfg);
735 if (NULL == pk)
736 {
737 GNUNET_break (0);
738 return NULL;
739 }
740 plugin = GNUNET_new (struct Plugin); 620 plugin = GNUNET_new (struct Plugin);
741 plugin->env = env; 621 plugin->env = env;
742 plugin->src.pk.eddsa_priv = *pk;
743 GNUNET_free (pk);
744 api = GNUNET_new (struct GNUNET_DHTU_PluginFunctions); 622 api = GNUNET_new (struct GNUNET_DHTU_PluginFunctions);
745 api->cls = plugin; 623 api->cls = plugin;
746 api->sign = &ip_sign;
747 api->verify = &ip_verify;
748 api->try_connect = &ip_try_connect; 624 api->try_connect = &ip_try_connect;
749 api->hold = &ip_hold; 625 api->hold = &ip_hold;
750 api->drop = &ip_drop; 626 api->drop = &ip_drop;
diff --git a/src/dhtu/plugin_dhtu_ip.c b/src/dhtu/plugin_dhtu_ip.c
index ae35adb37..8eec6294b 100644
--- a/src/dhtu/plugin_dhtu_ip.c
+++ b/src/dhtu/plugin_dhtu_ip.c
@@ -56,6 +56,11 @@ struct GNUNET_DHTU_Source
56 struct GNUNET_DHTU_Source *prev; 56 struct GNUNET_DHTU_Source *prev;
57 57
58 /** 58 /**
59 * Position of this peer in the DHT.
60 */
61 struct GNUNET_DHTU_HashKey id;
62
63 /**
59 * Application context for this source. 64 * Application context for this source.
60 */ 65 */
61 void *app_ctx; 66 void *app_ctx;
@@ -66,11 +71,6 @@ struct GNUNET_DHTU_Source
66 char *address; 71 char *address;
67 72
68 /** 73 /**
69 * Hash of the IP address.
70 */
71 struct GNUNET_DHTU_Hash id;
72
73 /**
74 * My actual address. 74 * My actual address.
75 */ 75 */
76 struct sockaddr_storage addr; 76 struct sockaddr_storage addr;
@@ -111,11 +111,6 @@ struct GNUNET_DHTU_Target
111 void *app_ctx; 111 void *app_ctx;
112 112
113 /** 113 /**
114 * Hash of the IP address.
115 */
116 struct GNUNET_DHTU_Hash id;
117
118 /**
119 * Head of preferences expressed for this target. 114 * Head of preferences expressed for this target.
120 */ 115 */
121 struct GNUNET_DHTU_PreferenceHandle *ph_head; 116 struct GNUNET_DHTU_PreferenceHandle *ph_head;
@@ -126,6 +121,11 @@ struct GNUNET_DHTU_Target
126 struct GNUNET_DHTU_PreferenceHandle *ph_tail; 121 struct GNUNET_DHTU_PreferenceHandle *ph_tail;
127 122
128 /** 123 /**
124 * Position of this peer in the DHT.
125 */
126 struct GNUNET_DHTU_HashKey id;
127
128 /**
129 * Target IP address. 129 * Target IP address.
130 */ 130 */
131 struct sockaddr_storage addr; 131 struct sockaddr_storage addr;
@@ -229,48 +229,6 @@ struct Plugin
229 229
230 230
231/** 231/**
232 * Use our private key to sign a message.
233 *
234 * @param cls closure
235 * @param pk our private key to sign with
236 * @param purpose what to sign
237 * @param[out] signature, allocated on heap and returned
238 * @return -1 on error, otherwise number of bytes in @a sig
239 */
240static ssize_t
241ip_sign (void *cls,
242 const struct GNUNET_DHTU_PrivateKey *pk,
243 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
244 void **sig)
245{
246 return 0;
247}
248
249
250/**
251 * Verify signature in @a sig over @a purpose.
252 *
253 * @param cls closure
254 * @param pk public key to verify signature of
255 * @param purpose what was being signed
256 * @param sig signature data
257 * @param sig_size number of bytes in @a sig
258 * @return #GNUNET_OK if signature is valid
259 * #GNUNET_NO if signatures are not supported
260 * #GNUNET_SYSERR if signature is invalid
261 */
262static enum GNUNET_GenericReturnValue
263ip_verify (void *cls,
264 const struct GNUNET_DHTU_PublicKey *pk,
265 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
266 const void *sig,
267 size_t sig_size)
268{
269 return GNUNET_NO;
270}
271
272
273/**
274 * Create a target to which we may send traffic. 232 * Create a target to which we may send traffic.
275 * 233 *
276 * @param plugin our plugin 234 * @param plugin our plugin
@@ -283,7 +241,6 @@ create_target (struct Plugin *plugin,
283 const struct sockaddr *addr, 241 const struct sockaddr *addr,
284 socklen_t addrlen) 242 socklen_t addrlen)
285{ 243{
286 static struct GNUNET_DHTU_PublicKey pk;
287 struct GNUNET_DHTU_Target *dst; 244 struct GNUNET_DHTU_Target *dst;
288 245
289 if (MAX_DESTS > 246 if (MAX_DESTS >
@@ -316,7 +273,6 @@ create_target (struct Plugin *plugin,
316 GNUNET_assert (NULL == dst->ph_head); 273 GNUNET_assert (NULL == dst->ph_head);
317 GNUNET_free (dst); 274 GNUNET_free (dst);
318 } 275 }
319 pk.size = htons (sizeof (pk));
320 dst = GNUNET_new (struct GNUNET_DHTU_Target); 276 dst = GNUNET_new (struct GNUNET_DHTU_Target);
321 dst->addrlen = addrlen; 277 dst->addrlen = addrlen;
322 memcpy (&dst->addr, 278 memcpy (&dst->addr,
@@ -331,7 +287,7 @@ create_target (struct Plugin *plugin,
331 GNUNET_assert (sizeof (struct sockaddr_in) == addrlen); 287 GNUNET_assert (sizeof (struct sockaddr_in) == addrlen);
332 GNUNET_CRYPTO_hash (&s4->sin_addr, 288 GNUNET_CRYPTO_hash (&s4->sin_addr,
333 sizeof (struct in_addr), 289 sizeof (struct in_addr),
334 &dst->id.hc); 290 &dst->id.sha512);
335 } 291 }
336 break; 292 break;
337 case AF_INET6: 293 case AF_INET6:
@@ -341,7 +297,7 @@ create_target (struct Plugin *plugin,
341 GNUNET_assert (sizeof (struct sockaddr_in6) == addrlen); 297 GNUNET_assert (sizeof (struct sockaddr_in6) == addrlen);
342 GNUNET_CRYPTO_hash (&s6->sin6_addr, 298 GNUNET_CRYPTO_hash (&s6->sin6_addr,
343 sizeof (struct in6_addr), 299 sizeof (struct in6_addr),
344 &dst->id.hc); 300 &dst->id.sha512);
345 } 301 }
346 break; 302 break;
347 default: 303 default:
@@ -353,9 +309,8 @@ create_target (struct Plugin *plugin,
353 plugin->dst_tail, 309 plugin->dst_tail,
354 dst); 310 dst);
355 plugin->env->connect_cb (plugin->env->cls, 311 plugin->env->connect_cb (plugin->env->cls,
356 &pk,
357 &dst->id,
358 dst, 312 dst,
313 &dst->id,
359 &dst->app_ctx); 314 &dst->app_ctx);
360 return dst; 315 return dst;
361} 316}
@@ -585,7 +540,7 @@ create_source (struct Plugin *plugin,
585 GNUNET_assert (sizeof (struct sockaddr_in) == addrlen); 540 GNUNET_assert (sizeof (struct sockaddr_in) == addrlen);
586 GNUNET_CRYPTO_hash (&s4->sin_addr, 541 GNUNET_CRYPTO_hash (&s4->sin_addr,
587 sizeof (struct in_addr), 542 sizeof (struct in_addr),
588 &src->id.hc); 543 &src->id.sha512);
589 GNUNET_asprintf (&src->address, 544 GNUNET_asprintf (&src->address,
590 "ip+udp://%s:%u", 545 "ip+udp://%s:%u",
591 inet_ntop (AF_INET, 546 inet_ntop (AF_INET,
@@ -603,7 +558,7 @@ create_source (struct Plugin *plugin,
603 GNUNET_assert (sizeof (struct sockaddr_in6) == addrlen); 558 GNUNET_assert (sizeof (struct sockaddr_in6) == addrlen);
604 GNUNET_CRYPTO_hash (&s6->sin6_addr, 559 GNUNET_CRYPTO_hash (&s6->sin6_addr,
605 sizeof (struct in6_addr), 560 sizeof (struct in6_addr),
606 &src->id.hc); 561 &src->id.sha512);
607 GNUNET_asprintf (&src->address, 562 GNUNET_asprintf (&src->address,
608 "ip+udp://[%s]:%u", 563 "ip+udp://[%s]:%u",
609 inet_ntop (AF_INET6, 564 inet_ntop (AF_INET6,
@@ -623,7 +578,6 @@ create_source (struct Plugin *plugin,
623 src); 578 src);
624 plugin->env->address_add_cb (plugin->env->cls, 579 plugin->env->address_add_cb (plugin->env->cls,
625 &src->id, 580 &src->id,
626 NULL, /* no key */
627 src->address, 581 src->address,
628 src, 582 src,
629 &src->app_ctx); 583 &src->app_ctx);
@@ -1023,8 +977,6 @@ libgnunet_plugin_dhtu_ip_init (void *cls)
1023 plugin); 977 plugin);
1024 api = GNUNET_new (struct GNUNET_DHTU_PluginFunctions); 978 api = GNUNET_new (struct GNUNET_DHTU_PluginFunctions);
1025 api->cls = plugin; 979 api->cls = plugin;
1026 api->sign = &ip_sign;
1027 api->verify = &ip_verify;
1028 api->try_connect = &ip_try_connect; 980 api->try_connect = &ip_try_connect;
1029 api->hold = &ip_hold; 981 api->hold = &ip_hold;
1030 api->drop = &ip_drop; 982 api->drop = &ip_drop;
diff --git a/src/include/gnunet_dhtu_plugin.h b/src/include/gnunet_dhtu_plugin.h
index e65318fb5..2c97d5848 100644
--- a/src/include/gnunet_dhtu_plugin.h
+++ b/src/include/gnunet_dhtu_plugin.h
@@ -57,36 +57,13 @@ struct GNUNET_DHTU_Target;
57 */ 57 */
58struct GNUNET_DHTU_PreferenceHandle; 58struct GNUNET_DHTU_PreferenceHandle;
59 59
60/**
61 * Opaque handle for a private key used by this underlay.
62 */
63struct GNUNET_DHTU_PrivateKey;
64 60
65/** 61/**
66 * Handle for a public key used by another peer. Note that 62 * Key used to identify peer's position in the DHT.
67 * the underlay used must be communicated separately.
68 */ 63 */
69struct GNUNET_DHTU_PublicKey 64struct GNUNET_DHTU_HashKey
70{ 65{
71 /** 66 struct GNUNET_HashCode sha512;
72 * How long is the public key, in network byte order.
73 */
74 uint16_t size;
75
76 /* followed by size-2 bytes of the actual public key */
77};
78
79
80/**
81 * Hash used by the DHT for keys and peers.
82 */
83struct GNUNET_DHTU_Hash
84{
85
86 /**
87 * For now, use a 512 bit hash. (To be discussed).
88 */
89 struct GNUNET_HashCode hc;
90}; 67};
91 68
92 69
@@ -111,9 +88,7 @@ struct GNUNET_DHTU_PluginEnvironment
111 * Function to call with new addresses of this peer. 88 * Function to call with new addresses of this peer.
112 * 89 *
113 * @param cls the closure 90 * @param cls the closure
114 * @param my_id hash position of this address in the DHT 91 * @param key hash position of this address in the DHT
115 * @param pk private key of this peer used at @a address,
116 * pointer will remain valid until @e address_del_cb is called
117 * @param address address under which we are likely reachable, 92 * @param address address under which we are likely reachable,
118 * pointer will remain valid until @e address_del_cb is called; to be used for HELLOs. Example: "ip+udp://1.1.1.1:2086/" 93 * pointer will remain valid until @e address_del_cb is called; to be used for HELLOs. Example: "ip+udp://1.1.1.1:2086/"
119 * @param source handle for sending from this address, NULL if we can only receive 94 * @param source handle for sending from this address, NULL if we can only receive
@@ -121,8 +96,7 @@ struct GNUNET_DHTU_PluginEnvironment
121 */ 96 */
122 void 97 void
123 (*address_add_cb)(void *cls, 98 (*address_add_cb)(void *cls,
124 const struct GNUNET_DHTU_Hash *my_id, 99 struct GNUNET_DHTU_HashKey *key,
125 const struct GNUNET_DHTU_PrivateKey *pk,
126 const char *address, 100 const char *address,
127 struct GNUNET_DHTU_Source *source, 101 struct GNUNET_DHTU_Source *source,
128 void **ctx); 102 void **ctx);
@@ -164,9 +138,8 @@ struct GNUNET_DHTU_PluginEnvironment
164 */ 138 */
165 void 139 void
166 (*connect_cb)(void *cls, 140 (*connect_cb)(void *cls,
167 const struct GNUNET_DHTU_PublicKey *pk,
168 const struct GNUNET_DHTU_Hash *peer_id,
169 struct GNUNET_DHTU_Target *target, 141 struct GNUNET_DHTU_Target *target,
142 struct GNUNET_DHTU_HashKey *key,
170 void **ctx); 143 void **ctx);
171 144
172 /** 145 /**
@@ -209,41 +182,6 @@ struct GNUNET_DHTU_PluginFunctions
209 void *cls; 182 void *cls;
210 183
211 /** 184 /**
212 * Use our private key to sign a message.
213 *
214 * @param cls closure
215 * @param pk our private key to sign with
216 * @param purpose what to sign
217 * @param[out] signature, allocated on heap and returned
218 * @return -1 on error, otherwise number of bytes in @a sig
219 */
220 ssize_t
221 (*sign)(void *cls,
222 const struct GNUNET_DHTU_PrivateKey *pk,
223 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
224 void **sig);
225
226 /**
227 * Verify signature in @a sig over @a purpose.
228 *
229 * @param cls closure
230 * @param pk public key to verify signature of
231 * @param purpose what was being signed
232 * @param sig signature data
233 * @param sig_size number of bytes in @a sig
234 * @return #GNUNET_OK if signature is valid
235 * #GNUNET_NO if signatures are not supported
236 * #GNUNET_SYSERR if signature is invalid
237 */
238 enum GNUNET_GenericReturnValue
239 (*verify)(void *cls,
240 const struct GNUNET_DHTU_PublicKey *pk,
241 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
242 const void *sig,
243 size_t sig_size);
244
245
246 /**
247 * Request creation of a session with a peer at the given @a address. 185 * Request creation of a session with a peer at the given @a address.
248 * 186 *
249 * @param cls closure (internal context for the plugin) 187 * @param cls closure (internal context for the plugin)
@@ -253,6 +191,7 @@ struct GNUNET_DHTU_PluginFunctions
253 (*try_connect) (void *cls, 191 (*try_connect) (void *cls,
254 const char *address); 192 const char *address);
255 193
194
256 /** 195 /**
257 * Request underlay to keep the connection to @a target alive if possible. 196 * Request underlay to keep the connection to @a target alive if possible.
258 * Hold may be called multiple times to express a strong preference to 197 * Hold may be called multiple times to express a strong preference to