fix
[oweals/gnunet.git] / src / revocation / revocation.h
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
19 /**
20  * @author Christian Grothoff
21  * @file revocation/revocation.h
22  * @brief messages for key revocation
23  */
24 #ifndef REVOCATION_H
25 #define REVOCATION_H
26
27 #include "gnunet_util_lib.h"
28
29 GNUNET_NETWORK_STRUCT_BEGIN
30
31 /**
32  * Query key revocation status.
33  */
34 struct QueryMessage
35 {
36   /**
37    * Type: #GNUNET_MESSAGE_TYPE_REVOCATION_QUERY
38    */
39   struct GNUNET_MessageHeader header;
40
41   /**
42    * For alignment.
43    */
44   uint32_t reserved GNUNET_PACKED;
45
46   /**
47    * Key to check.
48    */
49   struct GNUNET_CRYPTO_EcdsaPublicKey key;
50
51 };
52
53
54 /**
55  * Key revocation response.
56  */
57 struct QueryResponseMessage
58 {
59   /**
60    * Type: #GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE
61    */
62   struct GNUNET_MessageHeader header;
63
64   /**
65    * #GNUNET_NO if revoked, #GNUNET_YES if valid.
66    */
67   uint32_t is_valid GNUNET_PACKED;
68
69 };
70
71
72 /**
73  * Revoke key.  These messages are exchanged between peers (during
74  * flooding) but also sent by the client to the service.  When the
75  * client sends it to the service, the message is answered by a
76  * #GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE (which is just
77  * in a `struct GNUNET_MessageHeader`.
78  */
79 struct RevokeMessage
80 {
81   /**
82    * Type: #GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE
83    */
84   struct GNUNET_MessageHeader header;
85
86   /**
87    * For alignment.
88    */
89   uint32_t reserved GNUNET_PACKED;
90
91   /**
92    * Number that causes a hash collision with the @e public_key.
93    */
94   uint64_t proof_of_work GNUNET_PACKED;
95
96   /**
97    * Signature confirming revocation.
98    */
99   struct GNUNET_CRYPTO_EcdsaSignature signature;
100
101   /**
102    * Must have purpose #GNUNET_SIGNATURE_PURPOSE_REVOCATION,
103    * size expands over the public key.
104    */
105   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
106
107   /**
108    * Key to revoke.
109    */
110   struct GNUNET_CRYPTO_EcdsaPublicKey public_key;
111
112 };
113
114
115 /**
116  * Key revocation response.
117  */
118 struct RevocationResponseMessage
119 {
120   /**
121    * Type: #GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE
122    */
123   struct GNUNET_MessageHeader header;
124
125   /**
126    * #GNUNET_NO if revoked, #GNUNET_YES if valid.
127    */
128   uint32_t is_valid GNUNET_PACKED;
129
130 };
131
132
133 GNUNET_NETWORK_STRUCT_END
134
135
136
137 #endif