diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-11-05 14:54:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-11-05 14:54:31 +0000 |
commit | 411064c8503b4cd8cc3184d233d59d97ae6449e1 (patch) | |
tree | c2a94ed3d39042a45766705544ffa6b431637246 /src/include/gnunet_secretsharing_service.h | |
parent | 3d050c1cc8f4b63c113e1b10f4cade67dd8d0a27 (diff) | |
download | gnunet-411064c8503b4cd8cc3184d233d59d97ae6449e1.tar.gz gnunet-411064c8503b4cd8cc3184d233d59d97ae6449e1.zip |
-improving API design
Diffstat (limited to 'src/include/gnunet_secretsharing_service.h')
-rw-r--r-- | src/include/gnunet_secretsharing_service.h | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/include/gnunet_secretsharing_service.h b/src/include/gnunet_secretsharing_service.h index 9f0df55af..f30761486 100644 --- a/src/include/gnunet_secretsharing_service.h +++ b/src/include/gnunet_secretsharing_service.h | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file include/gnunet_secretsharing_service.h | 22 | * @file include/gnunet_secretsharing_service.h |
23 | * @brief verified additive secret sharing and cooperative decryption | 23 | * @brief verifiable additive secret sharing and cooperative decryption |
24 | * @author Florian Dold | 24 | * @author Florian Dold |
25 | */ | 25 | */ |
26 | 26 | ||
@@ -75,7 +75,7 @@ struct GNUNET_SECRETSHARING_PublicKey | |||
75 | /** | 75 | /** |
76 | * Encrypted field element. | 76 | * Encrypted field element. |
77 | */ | 77 | */ |
78 | struct GNUNET_SECRETSHARING_Ciphertext | 78 | struct GNUNET_SECRETSHARING_Ciphertext |
79 | { | 79 | { |
80 | /** | 80 | /** |
81 | * First component. | 81 | * First component. |
@@ -111,7 +111,7 @@ struct GNUNET_SECRETSHARING_Message | |||
111 | * @param cls closure | 111 | * @param cls closure |
112 | * @param my_share the share of this peer | 112 | * @param my_share the share of this peer |
113 | * @param public_key public key of the session | 113 | * @param public_key public key of the session |
114 | * @param num_ready_peers number of peers in ready_peers | 114 | * @param num_ready_peers number of peers in @a ready_peers |
115 | * @param ready_peers peers that successfuly participated in establishing | 115 | * @param ready_peers peers that successfuly participated in establishing |
116 | * the shared secret | 116 | * the shared secret |
117 | */ | 117 | */ |
@@ -126,10 +126,12 @@ typedef void (*GNUNET_SECRETSHARING_SecretReadyCallback) (void *cls, | |||
126 | * Called when a decryption has succeeded. | 126 | * Called when a decryption has succeeded. |
127 | * | 127 | * |
128 | * @param cls closure | 128 | * @param cls closure |
129 | * @param result decrypted value, must be free'd by the callback eventually | 129 | * @param data decrypted value |
130 | * @param data_size number of bytes in @a data | ||
130 | */ | 131 | */ |
131 | typedef void (*GNUNET_SECRETSHARING_DecryptCallback) (void *cls, | 132 | typedef void (*GNUNET_SECRETSHARING_DecryptCallback) (void *cls, |
132 | struct GNUNET_SECRETSHARING_Message *result); | 133 | const void *data, |
134 | size_t data_size); | ||
133 | 135 | ||
134 | 136 | ||
135 | /** | 137 | /** |
@@ -164,7 +166,7 @@ GNUNET_SECRETSHARING_create_session (const struct GNUNET_CONFIGURATION_Handle *c | |||
164 | * @param share share to load the session from | 166 | * @param share share to load the session from |
165 | */ | 167 | */ |
166 | struct GNUNET_SECRETSHARING_Session * | 168 | struct GNUNET_SECRETSHARING_Session * |
167 | GNUNET_SECRETSHARING_load_session (const struct GNUNET_CONFIGURATION_Handle *cfg, | 169 | GNUNET_SECRETSHARING_load_session_DEPRECATED (const struct GNUNET_CONFIGURATION_Handle *cfg, |
168 | const struct GNUNET_SECRETSHARING_Share *share); | 170 | const struct GNUNET_SECRETSHARING_Share *share); |
169 | 171 | ||
170 | /** | 172 | /** |
@@ -174,7 +176,7 @@ GNUNET_SECRETSHARING_load_session (const struct GNUNET_CONFIGURATION_Handle *cfg | |||
174 | * @return the serialized secret share, to be freed by the caller | 176 | * @return the serialized secret share, to be freed by the caller |
175 | */ | 177 | */ |
176 | char * | 178 | char * |
177 | GNUNET_SECRETSHARING_share_to_string (const struct GNUNET_SECRETSHARING_Share *share); | 179 | GNUNET_SECRETSHARING_share_to_BIN (const struct GNUNET_SECRETSHARING_Share *share); |
178 | 180 | ||
179 | 181 | ||
180 | /** | 182 | /** |
@@ -184,7 +186,7 @@ GNUNET_SECRETSHARING_share_to_string (const struct GNUNET_SECRETSHARING_Share *s | |||
184 | * @return the serialized secret share, to be freed by the caller | 186 | * @return the serialized secret share, to be freed by the caller |
185 | */ | 187 | */ |
186 | const struct GNUNET_SECRETSHARING_Share * | 188 | const struct GNUNET_SECRETSHARING_Share * |
187 | GNUNET_SECRETSHARING_share_from_string (const char *str); | 189 | GNUNET_SECRETSHARING_share_from_BIN (const char *str); |
188 | 190 | ||
189 | 191 | ||
190 | /** | 192 | /** |
@@ -215,12 +217,14 @@ GNUNET_SECRETSHARING_destroy_session (struct GNUNET_SECRETSHARING_Session *sessi | |||
215 | * @param session session to take the key for encryption from, | 217 | * @param session session to take the key for encryption from, |
216 | * the session's ready callback must have been already called | 218 | * the session's ready callback must have been already called |
217 | * @param message message to encrypt | 219 | * @param message message to encrypt |
220 | * @param message_size number of bytes in @a message | ||
218 | * @param result_ciphertext pointer to store the resulting ciphertext | 221 | * @param result_ciphertext pointer to store the resulting ciphertext |
219 | * @return GNUNET_YES on succes, GNUNET_SYSERR if the message is invalid (invalid range) | 222 | * @return #GNUNET_YES on succes, #GNUNET_SYSERR if the message is invalid (invalid range) |
220 | */ | 223 | */ |
221 | int | 224 | int |
222 | GNUNET_SECRETSHARING_encrypt (const struct GNUNET_SECRETSHARING_Session *session, | 225 | GNUNET_SECRETSHARING_encrypt (const struct GNUNET_SECRETSHARING_PublicKey *session, |
223 | const struct GNUNET_SECRETSHARING_Message *message, | 226 | const void *message, |
227 | size_t message_size, | ||
224 | struct GNUNET_SECRETSHARING_Ciphertext *result_ciphertext); | 228 | struct GNUNET_SECRETSHARING_Ciphertext *result_ciphertext); |
225 | 229 | ||
226 | 230 | ||
@@ -234,14 +238,14 @@ GNUNET_SECRETSHARING_encrypt (const struct GNUNET_SECRETSHARING_Session *session | |||
234 | * @param session session to use for the decryption | 238 | * @param session session to use for the decryption |
235 | * @param ciphertext ciphertext to publish in order to decrypt it (if enough peers agree) | 239 | * @param ciphertext ciphertext to publish in order to decrypt it (if enough peers agree) |
236 | * @param decrypt_cb callback called once the decryption succeeded | 240 | * @param decrypt_cb callback called once the decryption succeeded |
237 | * @param cls closure for decrypt_cb | 241 | * @param decrypt_cb_cls closure for @a decrypt_cb |
238 | * @return handle to cancel the operation | 242 | * @return handle to cancel the operation |
239 | */ | 243 | */ |
240 | struct GNUNET_SECRETSHARING_DecryptionHandle * | 244 | struct GNUNET_SECRETSHARING_DecryptionHandle * |
241 | GNUNET_SECRETSHARING_publish_decrypt (struct GNUNET_SECRETSHARING_Session *session, | 245 | GNUNET_SECRETSHARING_decrypt (struct GNUNET_SECRETSHARING_Session *session, |
242 | struct GNUNET_SECRETSHARING_Ciphertext *ciphertext, | 246 | struct GNUNET_SECRETSHARING_Ciphertext *ciphertext, |
243 | GNUNET_SECRETSHARING_DecryptCallback decrypt_cb, | 247 | GNUNET_SECRETSHARING_DecryptCallback decrypt_cb, |
244 | void *cls); | 248 | void *decrypt_cb_cls); |
245 | 249 | ||
246 | 250 | ||
247 | /** | 251 | /** |
@@ -253,7 +257,7 @@ GNUNET_SECRETSHARING_publish_decrypt (struct GNUNET_SECRETSHARING_Session *sessi | |||
253 | * @param decryption_handle decryption to cancel | 257 | * @param decryption_handle decryption to cancel |
254 | */ | 258 | */ |
255 | void | 259 | void |
256 | GNUNET_SECRETSHARING_cancel_decrypt (struct GNUNET_SECRETSHARING_DecryptionHandle *decryption_handle); | 260 | GNUNET_SECRETSHARING_decrypt_cancel (struct GNUNET_SECRETSHARING_DecryptionHandle *decryption_handle); |
257 | 261 | ||
258 | 262 | ||
259 | 263 | ||