tighten formatting rules
[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      SPDX-License-Identifier: AGPL3.0-or-later
19  */
20
21 /**
22  * @author Christian Grothoff
23  * @file revocation/revocation.h
24  * @brief messages for key revocation
25  */
26 #ifndef REVOCATION_H
27 #define REVOCATION_H
28
29 #include "gnunet_util_lib.h"
30
31 GNUNET_NETWORK_STRUCT_BEGIN
32
33 /**
34  * Query key revocation status.
35  */
36 struct QueryMessage
37 {
38   /**
39    * Type: #GNUNET_MESSAGE_TYPE_REVOCATION_QUERY
40    */
41   struct GNUNET_MessageHeader header;
42
43   /**
44    * For alignment.
45    */
46   uint32_t reserved GNUNET_PACKED;
47
48   /**
49    * Key to check.
50    */
51   struct GNUNET_CRYPTO_EcdsaPublicKey key;
52 };
53
54
55 /**
56  * Key revocation response.
57  */
58 struct QueryResponseMessage
59 {
60   /**
61    * Type: #GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE
62    */
63   struct GNUNET_MessageHeader header;
64
65   /**
66    * #GNUNET_NO if revoked, #GNUNET_YES if valid.
67    */
68   uint32_t is_valid GNUNET_PACKED;
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. (@deprecated)
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  * Key revocation response.
116  */
117 struct RevocationResponseMessage
118 {
119   /**
120    * Type: #GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE
121    */
122   struct GNUNET_MessageHeader header;
123
124   /**
125    * #GNUNET_NO if revocation failed for internal reasons (e.g. disk full)
126    * #GNUNET_YES on success
127    */
128   uint32_t is_valid GNUNET_PACKED;
129 };
130
131
132 GNUNET_NETWORK_STRUCT_END
133
134
135 #endif