diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_common.h | 11 | ||||
-rw-r--r-- | src/include/gnunet_consensus_service.h | 8 | ||||
-rw-r--r-- | src/include/gnunet_secretsharing_service.h | 56 | ||||
-rw-r--r-- | src/include/gnunet_signatures.h | 15 |
4 files changed, 57 insertions, 33 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index e593826b7..e4423f145 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -682,6 +682,17 @@ GNUNET_ntoh_double (double d); | |||
682 | 682 | ||
683 | /** | 683 | /** |
684 | * @ingroup memory | 684 | * @ingroup memory |
685 | * Allocate a size @a n array with structs or unions of the given @a type. | ||
686 | * Wrapper around #GNUNET_malloc that returns a pointer | ||
687 | * to the newly created objects of the correct type. | ||
688 | * | ||
689 | * @param n number of elements in the array | ||
690 | * @param type name of the struct or union, i.e. pass 'struct Foo'. | ||
691 | */ | ||
692 | #define GNUNET_new_array(n, type) (type *) GNUNET_malloc ((n) * sizeof (type)) | ||
693 | |||
694 | /** | ||
695 | * @ingroup memory | ||
685 | * Wrapper around malloc. Allocates size bytes of memory. | 696 | * Wrapper around malloc. Allocates size bytes of memory. |
686 | * The memory will be zero'ed out. | 697 | * The memory will be zero'ed out. |
687 | * | 698 | * |
diff --git a/src/include/gnunet_consensus_service.h b/src/include/gnunet_consensus_service.h index 6d8d23a17..3b08b2dee 100644 --- a/src/include/gnunet_consensus_service.h +++ b/src/include/gnunet_consensus_service.h | |||
@@ -73,7 +73,7 @@ struct GNUNET_CONSENSUS_Handle; | |||
73 | * @param session_id session identifier | 73 | * @param session_id session identifier |
74 | * Allows a group of peers to have more than consensus session. | 74 | * Allows a group of peers to have more than consensus session. |
75 | * @param new_element_cb callback, called when a new element is added to the set by | 75 | * @param new_element_cb callback, called when a new element is added to the set by |
76 | * another peer | 76 | * another peer. Also called when an error occurs. |
77 | * @param new_element_cls closure for new_element | 77 | * @param new_element_cls closure for new_element |
78 | * @return handle to use, NULL on error | 78 | * @return handle to use, NULL on error |
79 | */ | 79 | */ |
@@ -135,14 +135,14 @@ typedef void (*GNUNET_CONSENSUS_ConcludeCallback) (void *cls); | |||
135 | * try to conclude the consensus within a given time window. | 135 | * try to conclude the consensus within a given time window. |
136 | * | 136 | * |
137 | * @param consensus consensus session | 137 | * @param consensus consensus session |
138 | * @param timeout timeout after which the conculde callback | 138 | * @param deadline deadline after which the conculde callback |
139 | * must be called | 139 | * whill be called |
140 | * @param conclude called when the conclusion was successful | 140 | * @param conclude called when the conclusion was successful |
141 | * @param conclude_cls closure for the conclude callback | 141 | * @param conclude_cls closure for the conclude callback |
142 | */ | 142 | */ |
143 | void | 143 | void |
144 | GNUNET_CONSENSUS_conclude (struct GNUNET_CONSENSUS_Handle *consensus, | 144 | GNUNET_CONSENSUS_conclude (struct GNUNET_CONSENSUS_Handle *consensus, |
145 | struct GNUNET_TIME_Relative timeout, | 145 | struct GNUNET_TIME_Absolute deadline, |
146 | GNUNET_CONSENSUS_ConcludeCallback conclude, | 146 | GNUNET_CONSENSUS_ConcludeCallback conclude, |
147 | void *conclude_cls); | 147 | void *conclude_cls); |
148 | 148 | ||
diff --git a/src/include/gnunet_secretsharing_service.h b/src/include/gnunet_secretsharing_service.h index 7eb372ef5..8569e15ea 100644 --- a/src/include/gnunet_secretsharing_service.h +++ b/src/include/gnunet_secretsharing_service.h | |||
@@ -46,6 +46,8 @@ extern "C" | |||
46 | * Number of bits for secretsharing keys. | 46 | * Number of bits for secretsharing keys. |
47 | * Must be smaller than the Pallier key size used internally | 47 | * Must be smaller than the Pallier key size used internally |
48 | * by the secretsharing service. | 48 | * by the secretsharing service. |
49 | * When changing this value, other internal parameters must also | ||
50 | * be adjusted. | ||
49 | */ | 51 | */ |
50 | #define GNUNET_SECRETSHARING_KEY_BITS 1024 | 52 | #define GNUNET_SECRETSHARING_KEY_BITS 1024 |
51 | 53 | ||
@@ -58,8 +60,8 @@ struct GNUNET_SECRETSHARING_Session; | |||
58 | 60 | ||
59 | /** | 61 | /** |
60 | * Share of a secret shared with a group of peers. | 62 | * Share of a secret shared with a group of peers. |
61 | * Contains both the share and information about the peers that have | 63 | * Contains the secret share itself, the public key, the list of peers, and the |
62 | * the other parts of the share. | 64 | * exponential commitments to the secret shares of the other peers. |
63 | */ | 65 | */ |
64 | struct GNUNET_SECRETSHARING_Share; | 66 | struct GNUNET_SECRETSHARING_Share; |
65 | 67 | ||
@@ -84,7 +86,8 @@ struct GNUNET_SECRETSHARING_PublicKey | |||
84 | */ | 86 | */ |
85 | struct GNUNET_SECRETSHARING_Ciphertext | 87 | struct GNUNET_SECRETSHARING_Ciphertext |
86 | { | 88 | { |
87 | uint32_t bits[2 * GNUNET_SECRETSHARING_KEY_BITS / 8 / sizeof (uint32_t)]; | 89 | uint32_t c1_bits[GNUNET_SECRETSHARING_KEY_BITS / 8 / sizeof (uint32_t)]; |
90 | uint32_t c2_bits[GNUNET_SECRETSHARING_KEY_BITS / 8 / sizeof (uint32_t)]; | ||
88 | }; | 91 | }; |
89 | 92 | ||
90 | 93 | ||
@@ -97,7 +100,7 @@ struct GNUNET_SECRETSHARING_Message | |||
97 | /** | 100 | /** |
98 | * Value of the message. | 101 | * Value of the message. |
99 | */ | 102 | */ |
100 | gcry_mpi_t value; | 103 | uint32_t bits[GNUNET_SECRETSHARING_KEY_BITS / 8 / sizeof (uint32_t)]; |
101 | }; | 104 | }; |
102 | 105 | ||
103 | 106 | ||
@@ -206,15 +209,19 @@ GNUNET_SECRETSHARING_encrypt (struct GNUNET_SECRETSHARING_PublicKey *public_key, | |||
206 | * When the operation is canceled, the decrypt_cb is not called anymore, but the calling | 209 | * When the operation is canceled, the decrypt_cb is not called anymore, but the calling |
207 | * peer may already have irrevocably contributed his share for the decryption of the value. | 210 | * peer may already have irrevocably contributed his share for the decryption of the value. |
208 | * | 211 | * |
212 | * @param cfg configuration to use | ||
209 | * @param share our secret share to use for decryption | 213 | * @param share our secret share to use for decryption |
210 | * @param ciphertext ciphertext to publish in order to decrypt it (if enough peers agree) | 214 | * @param ciphertext ciphertext to publish in order to decrypt it (if enough peers agree) |
211 | * @param decrypt_cb callback called once the decryption succeeded | 215 | * @param decrypt_cb callback called once the decryption succeeded |
216 | * @param deadline By when should the decryption be finished? | ||
212 | * @param decrypt_cb_cls closure for @a decrypt_cb | 217 | * @param decrypt_cb_cls closure for @a decrypt_cb |
213 | * @return handle to cancel the operation | 218 | * @return handle to cancel the operation |
214 | */ | 219 | */ |
215 | struct GNUNET_SECRETSHARING_DecryptionHandle * | 220 | struct GNUNET_SECRETSHARING_DecryptionHandle * |
216 | GNUNET_SECRETSHARING_decrypt (struct GNUNET_SECRETSHARING_Share *share, | 221 | GNUNET_SECRETSHARING_decrypt (struct GNUNET_CONFIGURATION_Handle *cfg, |
222 | struct GNUNET_SECRETSHARING_Share *share, | ||
217 | struct GNUNET_SECRETSHARING_Ciphertext *ciphertext, | 223 | struct GNUNET_SECRETSHARING_Ciphertext *ciphertext, |
224 | struct GNUNET_TIME_Absolute deadline, | ||
218 | GNUNET_SECRETSHARING_DecryptCallback decrypt_cb, | 225 | GNUNET_SECRETSHARING_DecryptCallback decrypt_cb, |
219 | void *decrypt_cb_cls); | 226 | void *decrypt_cb_cls); |
220 | 227 | ||
@@ -234,41 +241,32 @@ GNUNET_SECRETSHARING_decrypt_cancel (struct GNUNET_SECRETSHARING_DecryptionHandl | |||
234 | /** | 241 | /** |
235 | * Read a share from its binary representation. | 242 | * Read a share from its binary representation. |
236 | * | 243 | * |
237 | * @param data binary representation of the share | 244 | * @param data Binary representation of the share. |
238 | * @param len length of @a data | 245 | * @param len Length of @a data. |
239 | * @return the share, or NULL on error | 246 | * @param[out] readlen Number of bytes read, |
247 | * ignored if NULL. | ||
248 | * @return The share, or NULL on error. | ||
240 | */ | 249 | */ |
241 | struct GNUNET_SECRETSHARING_Share * | 250 | struct GNUNET_SECRETSHARING_Share * |
242 | GNUNET_SECRETSHARING_share_read (void *data, size_t len); | 251 | GNUNET_SECRETSHARING_share_read (const void *data, size_t len, size_t *readlen); |
243 | 252 | ||
244 | 253 | ||
245 | /** | 254 | /** |
246 | * Convert a share to its binary representation. Use | 255 | * Convert a share to its binary representation. |
247 | * #GNUNET_SECRETSHARING_share_size to get the necessary size for the binary | 256 | * Can be called with a NULL @a buf to get the size of the share. |
248 | * representation. | ||
249 | * | 257 | * |
250 | * @param share share to write | 258 | * @param share Share to write. |
251 | * @param buf buffer to write to | 259 | * @param buf Buffer to write to. |
252 | * @param buflen number of writable bytes in @a buffer | 260 | * @param buflen Number of writable bytes in @a buf. |
253 | * @param[out] writelen pointer to store number of bytes written, | 261 | * @param[out] writelen Pointer to store number of bytes written, |
254 | * ignored if NULL | 262 | * ignored if NULL. |
255 | * @return GNUNET_YES on success, GNUNET_NO on failure | 263 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure. |
256 | */ | 264 | */ |
257 | int | 265 | int |
258 | GNUNET_SECRETSHARING_share_write (struct GNUNET_SECRETSHARING_Share *share, | 266 | GNUNET_SECRETSHARING_share_write (const struct GNUNET_SECRETSHARING_Share *share, |
259 | void *buf, size_t buflen, size_t *writelen); | 267 | void *buf, size_t buflen, size_t *writelen); |
260 | 268 | ||
261 | 269 | ||
262 | /** | ||
263 | * Get the number of bytes necessary to represent the given share. | ||
264 | * | ||
265 | * @param share share | ||
266 | * @return number of bytes necessary to represent @a share | ||
267 | */ | ||
268 | size_t | ||
269 | GNUNET_SECRETSHARING_share_size (struct GNUNET_SECRETSHARING_Share *share); | ||
270 | |||
271 | |||
272 | 270 | ||
273 | #if 0 /* keep Emacsens' auto-indent happy */ | 271 | #if 0 /* keep Emacsens' auto-indent happy */ |
274 | { | 272 | { |
diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h index f8839c1aa..05d758cdb 100644 --- a/src/include/gnunet_signatures.h +++ b/src/include/gnunet_signatures.h | |||
@@ -151,6 +151,21 @@ extern "C" | |||
151 | */ | 151 | */ |
152 | #define GNUNET_SIGNATURE_PURPOSE_MESH_KX 21 | 152 | #define GNUNET_SIGNATURE_PURPOSE_MESH_KX 21 |
153 | 153 | ||
154 | /** | ||
155 | * Signature for the first round of distributed key generation. | ||
156 | */ | ||
157 | #define GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG1 22 | ||
158 | |||
159 | /** | ||
160 | * Signature for the second round of distributed key generation. | ||
161 | */ | ||
162 | #define GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG2 23 | ||
163 | |||
164 | /** | ||
165 | * Signature for cooperatice decryption. | ||
166 | */ | ||
167 | #define GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DECRYPTION 23 | ||
168 | |||
154 | 169 | ||
155 | #if 0 /* keep Emacsens' auto-indent happy */ | 170 | #if 0 /* keep Emacsens' auto-indent happy */ |
156 | { | 171 | { |