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