diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2023-10-19 09:54:35 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-10-19 09:54:35 +0200 |
commit | 98c00bad3d29a80c514818615c224a29307400cc (patch) | |
tree | 75681e421f4aec753eb509c037ed6e353447cc73 /src/secretsharing/secretsharing.h | |
parent | b7a1d4379ebcff1c878d068cbd8df34fd16d81d4 (diff) | |
download | gnunet-98c00bad3d29a80c514818615c224a29307400cc.tar.gz gnunet-98c00bad3d29a80c514818615c224a29307400cc.zip |
BUILD: Move set/consensus/secretsharing to contrib/service
Diffstat (limited to 'src/secretsharing/secretsharing.h')
-rw-r--r-- | src/secretsharing/secretsharing.h | 227 |
1 files changed, 0 insertions, 227 deletions
diff --git a/src/secretsharing/secretsharing.h b/src/secretsharing/secretsharing.h deleted file mode 100644 index 6e104ebfa..000000000 --- a/src/secretsharing/secretsharing.h +++ /dev/null | |||
@@ -1,227 +0,0 @@ | |||
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 | |||
21 | /** | ||
22 | * @author Florian Dold | ||
23 | * @file secretsharing/secretsharing.h | ||
24 | * @brief messages used for the secretsharing api | ||
25 | */ | ||
26 | #ifndef SECRETSHARING_H | ||
27 | #define SECRETSHARING_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_util_lib.h" | ||
31 | #include "gnunet_time_lib.h" | ||
32 | #include "gnunet_common.h" | ||
33 | #include "gnunet_secretsharing_service.h" | ||
34 | |||
35 | |||
36 | GNUNET_NETWORK_STRUCT_BEGIN | ||
37 | |||
38 | struct GNUNET_SECRETSHARING_FieldElement | ||
39 | { | ||
40 | /** | ||
41 | * Value of an element in <elgamal_g>. | ||
42 | */ | ||
43 | unsigned char bits[GNUNET_SECRETSHARING_ELGAMAL_BITS / 8]; | ||
44 | }; | ||
45 | |||
46 | |||
47 | struct GNUNET_SECRETSHARING_CreateMessage | ||
48 | { | ||
49 | /** | ||
50 | * Type: GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_GENERATE | ||
51 | */ | ||
52 | struct GNUNET_MessageHeader header; | ||
53 | |||
54 | /** | ||
55 | * Session ID, will be used for consensus. | ||
56 | */ | ||
57 | struct GNUNET_HashCode session_id GNUNET_PACKED; | ||
58 | |||
59 | /** | ||
60 | * Start time for communication with the other peers. | ||
61 | */ | ||
62 | struct GNUNET_TIME_AbsoluteNBO start; | ||
63 | |||
64 | /** | ||
65 | * Deadline for the establishment of the crypto system. | ||
66 | */ | ||
67 | struct GNUNET_TIME_AbsoluteNBO deadline; | ||
68 | |||
69 | /** | ||
70 | * Minimum number of cooperating peers to decrypt a | ||
71 | * value. | ||
72 | */ | ||
73 | uint16_t threshold GNUNET_PACKED; | ||
74 | |||
75 | /** | ||
76 | * Number of peers at the end of this message. | ||
77 | */ | ||
78 | uint16_t num_peers GNUNET_PACKED; | ||
79 | |||
80 | /* struct GNUNET_PeerIdentity[num_peers]; */ | ||
81 | }; | ||
82 | |||
83 | |||
84 | struct GNUNET_SECRETSHARING_ShareHeaderNBO | ||
85 | { | ||
86 | /** | ||
87 | * Threshold for the key this share belongs to. | ||
88 | */ | ||
89 | uint16_t threshold; | ||
90 | |||
91 | /** | ||
92 | * Peers that have the share. | ||
93 | */ | ||
94 | uint16_t num_peers; | ||
95 | |||
96 | /** | ||
97 | * Index of our peer in the list. | ||
98 | */ | ||
99 | uint16_t my_peer; | ||
100 | |||
101 | /** | ||
102 | * Public key. Must correspond to the product of | ||
103 | * the homomorphic share commitments. | ||
104 | */ | ||
105 | struct GNUNET_SECRETSHARING_PublicKey public_key; | ||
106 | |||
107 | /** | ||
108 | * Share of 'my_peer' | ||
109 | */ | ||
110 | struct GNUNET_SECRETSHARING_FieldElement my_share; | ||
111 | }; | ||
112 | |||
113 | |||
114 | /** | ||
115 | * Notify the client that then threshold secret has been | ||
116 | * established. | ||
117 | */ | ||
118 | struct GNUNET_SECRETSHARING_SecretReadyMessage | ||
119 | { | ||
120 | /** | ||
121 | * Type: GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_SECRET_READY | ||
122 | */ | ||
123 | struct GNUNET_MessageHeader header; | ||
124 | |||
125 | /* rest: the serialized share */ | ||
126 | }; | ||
127 | |||
128 | |||
129 | struct GNUNET_SECRETSHARING_DecryptRequestMessage | ||
130 | { | ||
131 | /** | ||
132 | * Type: GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_DECRYPT_REQUEST | ||
133 | */ | ||
134 | struct GNUNET_MessageHeader header; | ||
135 | |||
136 | /** | ||
137 | * Until when should the decryption start? | ||
138 | */ | ||
139 | struct GNUNET_TIME_AbsoluteNBO start; | ||
140 | |||
141 | /** | ||
142 | * Until when should the decryption be finished? | ||
143 | */ | ||
144 | struct GNUNET_TIME_AbsoluteNBO deadline; | ||
145 | |||
146 | /** | ||
147 | * Ciphertext we want to decrypt. | ||
148 | */ | ||
149 | struct GNUNET_SECRETSHARING_Ciphertext ciphertext; | ||
150 | |||
151 | /* the share with payload */ | ||
152 | }; | ||
153 | |||
154 | |||
155 | struct GNUNET_SECRETSHARING_DecryptResponseMessage | ||
156 | { | ||
157 | /** | ||
158 | * Type: #GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_DECRYPT_DONE | ||
159 | */ | ||
160 | struct GNUNET_MessageHeader header; | ||
161 | |||
162 | /** | ||
163 | * Zero if decryption failed, non-zero if decryption succeeded. | ||
164 | * If the decryption failed, plaintext is also zero. | ||
165 | */ | ||
166 | uint32_t success GNUNET_PACKED; | ||
167 | |||
168 | /** | ||
169 | * Decrypted plaintext. | ||
170 | */ | ||
171 | struct GNUNET_SECRETSHARING_FieldElement plaintext; | ||
172 | }; | ||
173 | |||
174 | |||
175 | GNUNET_NETWORK_STRUCT_END | ||
176 | |||
177 | |||
178 | /** | ||
179 | * A share, with all values in in host byte order. | ||
180 | */ | ||
181 | struct GNUNET_SECRETSHARING_Share | ||
182 | { | ||
183 | /** | ||
184 | * Threshold for the key this share belongs to. | ||
185 | */ | ||
186 | uint16_t threshold; | ||
187 | |||
188 | /** | ||
189 | * Peers that have the share. | ||
190 | */ | ||
191 | uint16_t num_peers; | ||
192 | |||
193 | /** | ||
194 | * Index of our peer in the list. | ||
195 | */ | ||
196 | uint16_t my_peer; | ||
197 | |||
198 | /** | ||
199 | * Public key. Computed from the | ||
200 | * exponentiated coefficients. | ||
201 | */ | ||
202 | struct GNUNET_SECRETSHARING_PublicKey public_key; | ||
203 | |||
204 | /** | ||
205 | * Share of 'my_peer' | ||
206 | */ | ||
207 | struct GNUNET_SECRETSHARING_FieldElement my_share; | ||
208 | |||
209 | /** | ||
210 | * Peer identities (includes 'my_peer') | ||
211 | */ | ||
212 | struct GNUNET_PeerIdentity *peers; | ||
213 | |||
214 | /* | ||
215 | * For each peer, store elgamal_g to the peer's | ||
216 | * share. | ||
217 | */ | ||
218 | struct GNUNET_SECRETSHARING_FieldElement *sigmas; | ||
219 | |||
220 | /* | ||
221 | * Original indices of peers from the DKG round. | ||
222 | */ | ||
223 | uint16_t *original_indices; | ||
224 | }; | ||
225 | |||
226 | |||
227 | #endif | ||