GNUnet 0.22.1
gnunet_secretsharing_service.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
32#ifndef GNUNET_SECRETSHARING_SERVICE_H
33#define GNUNET_SECRETSHARING_SERVICE_H
34
35#ifdef __cplusplus
36extern "C"
37{
38#if 0 /* keep Emacsens' auto-indent happy */
39}
40#endif
41#endif
42
43
44#include "gnunet_common.h"
45#include "gnunet_time_lib.h"
47#include <gcrypt.h>
48
49
57#define GNUNET_SECRETSHARING_ELGAMAL_BITS 1024
58
59
63#define GNUNET_SECRETSHARING_ELGAMAL_P_HEX \
64 "0x08a347d3d69e8b2dd7d1b12a08dfbccbebf4ca" \
65 "6f4269a0814e158a34312964d946b3ef22882317" \
66 "2bcf30fc08f772774cb404f9bc002a6f66b09a79" \
67 "d810d67c4f8cb3bedc6060e3c8ef874b1b64df71" \
68 "6c7d2b002da880e269438d5a776e6b5f253c8df5" \
69 "6a16b1c7ce58def07c03db48238aadfc52a354a2" \
70 "7ed285b0c1675cad3f3"
71
76#define GNUNET_SECRETSHARING_ELGAMAL_Q_HEX \
77 "0x0451a3e9eb4f4596ebe8d895046fde65f5fa65" \
78 "37a134d040a70ac51a1894b26ca359f79144118b" \
79 "95e7987e047bb93ba65a027cde001537b3584d3c" \
80 "ec086b3e27c659df6e303071e477c3a58db26fb8" \
81 "b63e958016d4407134a1c6ad3bb735af929e46fa" \
82 "b50b58e3e72c6f783e01eda411c556fe2951aa51" \
83 "3f6942d860b3ae569f9"
84
89#define GNUNET_SECRETSHARING_ELGAMAL_G_HEX \
90 "0x05c00c36d2e822950087ef09d8252994adc4e4" \
91 "8fe3ec70269f035b46063aff0c99b633fd64df43" \
92 "02442e1914c829a41505a275438871f365e91c12" \
93 "3d5303ef9e90f4b8cb89bf86cc9b513e74a72634" \
94 "9cfd9f953674fab5d511e1c078fc72d72b34086f" \
95 "c82b4b951989eb85325cb203ff98df76bc366bba" \
96 "1d7024c3650f60d0da"
97
98
104
111
112
117
118
123{
124 uint32_t bits[GNUNET_SECRETSHARING_ELGAMAL_BITS / 8 / sizeof(uint32_t)];
125};
126
127
132{
133 uint32_t c1_bits[GNUNET_SECRETSHARING_ELGAMAL_BITS / 8 / sizeof(uint32_t)];
134 uint32_t c2_bits[GNUNET_SECRETSHARING_ELGAMAL_BITS / 8 / sizeof(uint32_t)];
135};
136
137
145{
149 uint32_t bits[GNUNET_SECRETSHARING_ELGAMAL_BITS / 8 / sizeof(uint32_t)];
150};
151
152
171typedef void
174 my_share,
175 struct
178 unsigned int num_ready_peers,
179 const struct
180 GNUNET_PeerIdentity *ready_peers);
181
182
190typedef void
192 const struct
194 plaintext);
195
196
216 unsigned int num_peers,
217 const struct GNUNET_PeerIdentity *peers,
218 const struct GNUNET_HashCode *session_id,
220 struct GNUNET_TIME_Absolute deadline,
221 unsigned int threshold,
223 void *cls);
224
225
232void
234
235
249int
252 const struct
255 result_ciphertext);
256
257
276 struct GNUNET_SECRETSHARING_Share *share,
277 const struct
280 struct GNUNET_TIME_Absolute deadline,
282 void *decrypt_cb_cls);
283
284
293void
296
297
308GNUNET_SECRETSHARING_share_read (const void *data, size_t len, size_t *readlen);
309
310
322int
325 void *buf, size_t buflen, size_t *writelen);
326
327
328void
330
331
332int
335 plaintext,
336 gcry_mpi_t exponent);
337
338int
341 plaintext,
342 int64_t exponent);
343
344
345#if 0 /* keep Emacsens' auto-indent happy */
346{
347#endif
348#ifdef __cplusplus
349}
350#endif
351
352#endif
353 /* end of group */
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:38
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
static char * data
The data to insert into the dht.
struct GNUNET_CONTAINER_MultiPeerMap * peers
Map from PIDs to struct CadetPeer entries.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
Configuration API.
static unsigned int num_peers
Number of peers.
Functions related to time.
int GNUNET_SECRETSHARING_plaintext_generate(struct GNUNET_SECRETSHARING_Plaintext *plaintext, gcry_mpi_t exponent)
int GNUNET_SECRETSHARING_encrypt(const struct GNUNET_SECRETSHARING_PublicKey *public_key, const struct GNUNET_SECRETSHARING_Plaintext *plaintext, struct GNUNET_SECRETSHARING_Ciphertext *result_ciphertext)
Encrypt a value.
void GNUNET_SECRETSHARING_decrypt_cancel(struct GNUNET_SECRETSHARING_DecryptionHandle *dh)
Cancel a decryption.
int GNUNET_SECRETSHARING_plaintext_generate_i(struct GNUNET_SECRETSHARING_Plaintext *plaintext, int64_t exponent)
#define GNUNET_SECRETSHARING_ELGAMAL_BITS
Number of bits for secretsharing elements.
struct GNUNET_SECRETSHARING_Session * GNUNET_SECRETSHARING_create_session(const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int num_peers, const struct GNUNET_PeerIdentity *peers, const struct GNUNET_HashCode *session_id, struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute deadline, unsigned int threshold, GNUNET_SECRETSHARING_SecretReadyCallback cb, void *cls)
Create a session that will eventually establish a shared secret with the other peers.
void GNUNET_SECRETSHARING_share_destroy(struct GNUNET_SECRETSHARING_Share *share)
void GNUNET_SECRETSHARING_session_destroy(struct GNUNET_SECRETSHARING_Session *s)
Destroy a secret sharing session.
struct GNUNET_SECRETSHARING_Share * GNUNET_SECRETSHARING_share_read(const void *data, size_t len, size_t *readlen)
Read a share from its binary representation.
struct GNUNET_SECRETSHARING_DecryptionHandle * GNUNET_SECRETSHARING_decrypt(const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SECRETSHARING_Share *share, const struct GNUNET_SECRETSHARING_Ciphertext *ciphertext, struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute deadline, GNUNET_SECRETSHARING_DecryptCallback decrypt_cb, void *decrypt_cb_cls)
Publish the given ciphertext for decryption.
void(* GNUNET_SECRETSHARING_DecryptCallback)(void *cls, const struct GNUNET_SECRETSHARING_Plaintext *plaintext)
Called when a decryption has succeeded.
void(* GNUNET_SECRETSHARING_SecretReadyCallback)(void *cls, struct GNUNET_SECRETSHARING_Share *my_share, struct GNUNET_SECRETSHARING_PublicKey *public_key, unsigned int num_ready_peers, const struct GNUNET_PeerIdentity *ready_peers)
Called once the secret has been established with all peers, or the deadline is due.
int GNUNET_SECRETSHARING_share_write(const struct GNUNET_SECRETSHARING_Share *share, void *buf, size_t buflen, size_t *writelen)
Convert a share to its binary representation.
A 512-bit hashcode.
The identity of the host (wraps the signing key of the peer).
uint32_t c2_bits[1024/8/sizeof(uint32_t)]
uint32_t c1_bits[1024/8/sizeof(uint32_t)]
Handle to cancel a cooperative decryption operation.
GNUNET_SECRETSHARING_DecryptCallback decrypt_cb
Called when the secret sharing is done.
Plain, unencrypted message that can be encrypted with a group public key.
uint32_t bits[1024/8/sizeof(uint32_t)]
Value of the message.
Public key of a group sharing a secret.
uint32_t bits[1024/8/sizeof(uint32_t)]
Session that will eventually establish a shared secred between the involved peers and allow encryptio...
A share, with all values in in host byte order.
struct GNUNET_SECRETSHARING_FieldElement my_share
Share of 'my_peer'.
struct GNUNET_SECRETSHARING_PublicKey public_key
Public key.
Time for absolute times used by GNUnet, in microseconds.