blob: cc485fd8a378f35e660cb260a6411b474bbaa3cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
/*
This file is part of GNUnet.
Copyright (C) 2013 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @author Florian Dold
* @file secretsharing/secretsharing.h
* @brief messages used for the secretsharing api
*/
#ifndef SECRETSHARING_H
#define SECRETSHARING_H
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_time_lib.h"
#include "gnunet_common.h"
#include "gnunet_secretsharing_service.h"
GNUNET_NETWORK_STRUCT_BEGIN
struct GNUNET_SECRETSHARING_FieldElement
{
/**
* Value of an element in <elgamal_g>.
*/
unsigned char bits[GNUNET_SECRETSHARING_ELGAMAL_BITS / 8];
};
struct GNUNET_SECRETSHARING_CreateMessage
{
/**
* Type: GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_GENERATE
*/
struct GNUNET_MessageHeader header;
/**
* Session ID, will be used for consensus.
*/
struct GNUNET_HashCode session_id GNUNET_PACKED;
/**
* Start time for communication with the other peers.
*/
struct GNUNET_TIME_AbsoluteNBO start;
/**
* Deadline for the establishment of the crypto system.
*/
struct GNUNET_TIME_AbsoluteNBO deadline;
/**
* Mininum number of cooperating peers to decrypt a
* value.
*/
uint16_t threshold GNUNET_PACKED;
/**
* Number of peers at the end of this message.
*/
uint16_t num_peers GNUNET_PACKED;
/* struct GNUNET_PeerIdentity[num_peers]; */
};
struct GNUNET_SECRETSHARING_ShareHeaderNBO
{
/**
* Threshold for the key this share belongs to.
*/
uint16_t threshold;
/**
* Peers that have the share.
*/
uint16_t num_peers;
/**
* Index of our peer in the list.
*/
uint16_t my_peer;
/**
* Public key. Must correspond to the product of
* the homomorphic share commitments.
*/
struct GNUNET_SECRETSHARING_PublicKey public_key;
/**
* Share of 'my_peer'
*/
struct GNUNET_SECRETSHARING_FieldElement my_share;
};
/**
* Notify the client that then threshold secret has been
* established.
*/
struct GNUNET_SECRETSHARING_SecretReadyMessage
{
/**
* Type: GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_SECRET_READY
*/
struct GNUNET_MessageHeader header;
/* rest: the serialized share */
};
struct GNUNET_SECRETSHARING_DecryptRequestMessage
{
/**
* Type: GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_DECRYPT_REQUEST
*/
struct GNUNET_MessageHeader header;
/**
* Until when should the decryption start?
*/
struct GNUNET_TIME_AbsoluteNBO start;
/**
* Until when should the decryption be finished?
*/
struct GNUNET_TIME_AbsoluteNBO deadline;
/**
* Ciphertext we want to decrypt.
*/
struct GNUNET_SECRETSHARING_Ciphertext ciphertext;
/* the share with payload */
};
struct GNUNET_SECRETSHARING_DecryptResponseMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_DECRYPT_DONE
*/
struct GNUNET_MessageHeader header;
/**
* Zero if decryption failed, non-zero if decryption succeeded.
* If the decryption failed, plaintext is also zero.
*/
uint32_t success GNUNET_PACKED;
/**
* Decrypted plaintext.
*/
struct GNUNET_SECRETSHARING_FieldElement plaintext;
};
GNUNET_NETWORK_STRUCT_END
/**
* A share, with all values in in host byte order.
*/
struct GNUNET_SECRETSHARING_Share
{
/**
* Threshold for the key this share belongs to.
*/
uint16_t threshold;
/**
* Peers that have the share.
*/
uint16_t num_peers;
/**
* Index of our peer in the list.
*/
uint16_t my_peer;
/**
* Public key. Computed from the
* exponentiated coefficients.
*/
struct GNUNET_SECRETSHARING_PublicKey public_key;
/**
* Share of 'my_peer'
*/
struct GNUNET_SECRETSHARING_FieldElement my_share;
/**
* Peer identities (includes 'my_peer')
*/
struct GNUNET_PeerIdentity *peers;
/*
* For each peer, store elgamal_g to the peer's
* share.
*/
struct GNUNET_SECRETSHARING_FieldElement *sigmas;
/*
* Original indices of peers from the DKG round.
*/
uint16_t *original_indices;
};
#endif
|