uncrustify as demanded.
[oweals/gnunet.git] / src / secretsharing / secretsharing_protocol.h
1 /*
2       This file is part of GNUnet
3       Copyright (C) 2012 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 /**
23  * @file secretsharing/secretsharing_protocol.h
24  * @brief p2p message definitions for secretsharing
25  * @author Florian Dold
26  */
27
28 #ifndef GNUNET_SECRETSHARING_PROTOCOL_H
29 #define GNUNET_SECRETSHARING_PROTOCOL_H
30
31 #include "platform.h"
32 #include "gnunet_common.h"
33 #include "gnunet_protocols.h"
34 #include "secretsharing.h"
35
36
37 GNUNET_NETWORK_STRUCT_BEGIN
38
39
40 /**
41  * Consensus element data used in the first round of key generation.
42  */
43 struct GNUNET_SECRETSHARING_KeygenCommitData {
44   /**
45    * Signature over the rest of the message.
46    */
47   struct GNUNET_CRYPTO_EddsaSignature signature;
48   /**
49    * Signature purpose for signing the keygen commit data.
50    */
51   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
52   /**
53    * Peer that inserts this element.
54    */
55   struct GNUNET_PeerIdentity peer;
56   /**
57    * Ephemeral paillier public key used by 'peer' for
58    * this session.
59    */
60   struct GNUNET_CRYPTO_PaillierPublicKey pubkey;
61   /**
62    * Commitment of 'peer' to its presecret.
63    */
64   struct GNUNET_HashCode commitment GNUNET_PACKED;
65 };
66
67
68 struct GNUNET_SECRETSHARING_KeygenRevealData {
69   /**
70    * Signature over rest of the message.
71    */
72   struct GNUNET_CRYPTO_EddsaSignature signature;
73   /*
74    * Signature purpose for signing the keygen commit data.
75    */
76   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
77   /**
78    * Peer that inserts this element.
79    */
80   struct GNUNET_PeerIdentity peer;
81
82   /* values follow */
83 };
84
85
86 /**
87  * Data of then element put in consensus
88  * for decrypting a value.
89  */
90 struct GNUNET_SECRETSHARING_DecryptData {
91   /*
92    * Signature over rest of the message.
93    */
94   struct GNUNET_CRYPTO_EddsaSignature signature;
95   /*
96    * Signature purpose for signing the keygen commit data.
97    */
98   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
99   /**
100    * Ciphertext we want to decrypt.
101    */
102   struct GNUNET_SECRETSHARING_Ciphertext ciphertext;
103   /**
104    * Peer that inserts this element.
105    */
106   struct GNUNET_PeerIdentity peer;
107   /**
108    * Partial decryption, computed as c_1^{s_i}
109    */
110   struct GNUNET_SECRETSHARING_FieldElement partial_decryption;
111   /**
112    * Commitment for the non-interactive zero knowledge proof.
113    * g^\beta, with \beta < q
114    */
115   struct GNUNET_SECRETSHARING_FieldElement nizk_commit1;
116   /**
117    * Commitment for the non-interactive zero knowledge proof.
118    * c_1^\beta, with \beta < q
119    */
120   struct GNUNET_SECRETSHARING_FieldElement nizk_commit2;
121   /**
122    * Reponse to the challenge computed from the protocol transcript.
123    * r = \beta + challenge \cdot share_i
124    */
125   struct GNUNET_SECRETSHARING_FieldElement nizk_response;
126 };
127
128
129 struct GNUNET_SECRETSHARING_FairEncryption {
130   struct GNUNET_CRYPTO_PaillierCiphertext c;
131   /**
132    * h = g^x, where x is the fairly encrypte secret.
133    */
134   char h[GNUNET_SECRETSHARING_ELGAMAL_BITS / 8];
135   char t1[GNUNET_SECRETSHARING_ELGAMAL_BITS / 8];
136   char t2[GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8];
137   char z[GNUNET_SECRETSHARING_ELGAMAL_BITS / 8];
138   char w[GNUNET_CRYPTO_PAILLIER_BITS / 8];
139 };
140
141 GNUNET_NETWORK_STRUCT_END
142
143 #endif