src: for every AGPL3.0 file, add SPDX identifier.
[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 /**
57  * Key revocation response.
58  */
59 struct QueryResponseMessage
60 {
61   /**
62    * Type: #GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE
63    */
64   struct GNUNET_MessageHeader header;
65
66   /**
67    * #GNUNET_NO if revoked, #GNUNET_YES if valid.
68    */
69   uint32_t is_valid GNUNET_PACKED;
70
71 };
72
73
74 /**
75  * Revoke key.  These messages are exchanged between peers (during
76  * flooding) but also sent by the client to the service.  When the
77  * client sends it to the service, the message is answered by a
78  * #GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE (which is just
79  * in a `struct GNUNET_MessageHeader`.
80  */
81 struct RevokeMessage
82 {
83   /**
84    * Type: #GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE
85    */
86   struct GNUNET_MessageHeader header;
87
88   /**
89    * For alignment.
90    */
91   uint32_t reserved GNUNET_PACKED;
92
93   /**
94    * Number that causes a hash collision with the @e public_key.
95    */
96   uint64_t proof_of_work GNUNET_PACKED;
97
98   /**
99    * Signature confirming revocation.
100    */
101   struct GNUNET_CRYPTO_EcdsaSignature signature;
102
103   /**
104    * Must have purpose #GNUNET_SIGNATURE_PURPOSE_REVOCATION,
105    * size expands over the public key.
106    */
107   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
108
109   /**
110    * Key to revoke.
111    */
112   struct GNUNET_CRYPTO_EcdsaPublicKey public_key;
113
114 };
115
116
117 /**
118  * Key revocation response.
119  */
120 struct RevocationResponseMessage
121 {
122   /**
123    * Type: #GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE
124    */
125   struct GNUNET_MessageHeader header;
126
127   /**
128    * #GNUNET_NO if revoked, #GNUNET_YES if valid.
129    */
130   uint32_t is_valid GNUNET_PACKED;
131
132 };
133
134
135 GNUNET_NETWORK_STRUCT_END
136
137
138
139 #endif