2 This file is part of GNUnet.
3 (C) 2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @author Florian Dold
23 * @file secretsharing/secretsharing.h
24 * @brief messages used for the secretsharing api
26 #ifndef SECRETSHARING_H
27 #define SECRETSHARING_H
30 #include "gnunet_util_lib.h"
31 #include "gnunet_time_lib.h"
32 #include "gnunet_common.h"
33 #include "gnunet_secretsharing_service.h"
36 GNUNET_NETWORK_STRUCT_BEGIN
38 struct GNUNET_SECRETSHARING_FieldElement
41 * Value of an element in <elgamal_g>.
43 unsigned char bits[GNUNET_SECRETSHARING_KEY_BITS / 8];
47 struct GNUNET_SECRETSHARING_CreateMessage
50 * Type: GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_GENERATE
52 struct GNUNET_MessageHeader header;
55 * Session ID, will be used for consensus.
57 struct GNUNET_HashCode session_id GNUNET_PACKED;
60 * Deadline for the establishment of the crypto system.
62 struct GNUNET_TIME_AbsoluteNBO deadline;
65 * Mininum number of cooperating peers to decrypt a
68 uint16_t threshold GNUNET_PACKED;
71 * Number of peers at the end of this message.
73 uint16_t num_peers GNUNET_PACKED;
75 /* struct GNUNET_PeerIdentity[num_peers]; */
80 struct GNUNET_SECRETSHARING_ShareHeaderNBO
83 * Threshold for the key this share belongs to.
88 * Peers that have the share.
93 * Index of our peer in the list.
98 * Public key. Must correspond to the product of
99 * the homomorphic share commitments.
101 struct GNUNET_SECRETSHARING_PublicKey public_key;
106 struct GNUNET_SECRETSHARING_FieldElement my_share;
110 struct GNUNET_SECRETSHARING_SecretReadyMessage
113 * Type: GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_SECRET_READY
115 struct GNUNET_MessageHeader header;
117 /* rest: the serialized share */
122 struct GNUNET_SECRETSHARING_DecryptRequestMessage
125 * Type: GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_DECRYPT_REQUEST
127 struct GNUNET_MessageHeader header;
130 * Until when should the decryption be finished?
132 struct GNUNET_TIME_AbsoluteNBO deadline;
135 * Ciphertext we want to decrypt.
137 struct GNUNET_SECRETSHARING_Ciphertext ciphertext;
139 /* the share with payload */
143 struct GNUNET_SECRETSHARING_DecryptResponseMessage
146 * Type: GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_DECRYPT_DONE
148 struct GNUNET_MessageHeader header;
151 * Zero if decryption failed, non-zero if decryption succeeded.
152 * If the decryption failed, plaintext is also zero.
157 * Decrypted plaintext.
159 struct GNUNET_SECRETSHARING_FieldElement plaintext;
163 GNUNET_NETWORK_STRUCT_END
167 * A share, with all values in in host byte order.
169 struct GNUNET_SECRETSHARING_Share
172 * Threshold for the key this share belongs to.
177 * Peers that have the share.
182 * Index of our peer in the list.
187 * Public key. Must correspond to the product of
188 * the homomorphic share commitments.
190 struct GNUNET_SECRETSHARING_PublicKey public_key;
195 struct GNUNET_SECRETSHARING_FieldElement my_share;
198 * Peer identities (includes 'my_peer')
200 struct GNUNET_PeerIdentity *peers;
203 * Homomorphic commitments to each peer's share (includes 'my_peer')
205 struct GNUNET_SECRETSHARING_FieldElement *hom_share_commitments;
208 * Original indices of peers from the DKG round.
210 uint16_t *original_indices;