aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2020-04-19 20:05:26 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2020-04-19 20:05:26 +0200
commit8f9a45e853d9759f04a5f4fe9aa0146ed3f3fb17 (patch)
treeb9ef6928b2fdb8647a8c7d3e0f6d316198b51d48 /src/include
parenteb6b547e243144f27749811c15b6cce90e03aaa7 (diff)
downloadgnunet-8f9a45e853d9759f04a5f4fe9aa0146ed3f3fb17.tar.gz
gnunet-8f9a45e853d9759f04a5f4fe9aa0146ed3f3fb17.zip
towards less variance
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_revocation_service.h89
1 files changed, 79 insertions, 10 deletions
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h
index 1e1abb787..775da01ac 100644
--- a/src/include/gnunet_revocation_service.h
+++ b/src/include/gnunet_revocation_service.h
@@ -51,6 +51,47 @@ extern "C"
51#define GNUNET_REVOCATION_VERSION 0x00000000 51#define GNUNET_REVOCATION_VERSION 0x00000000
52 52
53/** 53/**
54 * The proof-of-work narrowing factor.
55 * The number of PoWs that are calculates as part of revocation.
56 */
57#define POW_COUNT 32
58
59struct GNUNET_REVOCATION_Pow
60{
61 /**
62 * The timestamp of the revocation
63 */
64 struct GNUNET_TIME_AbsoluteNBO timestamp;
65
66 /**
67 * The TTL of this revocation (purely informational)
68 */
69 uint64_t ttl;
70
71 /**
72 * The PoWs
73 */
74 uint64_t pow[POW_COUNT];
75
76 /**
77 * The signature
78 */
79 struct GNUNET_CRYPTO_EcdsaSignature signature;
80
81 /**
82 * The signature purpose
83 */
84 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
85
86 /**
87 * The revoked public key
88 */
89 struct GNUNET_CRYPTO_EcdsaPublicKey key;
90};
91
92struct GNUNET_REVOCATION_PowCalculationHandle;
93
94/**
54 * Handle for the key revocation query. 95 * Handle for the key revocation query.
55 */ 96 */
56struct GNUNET_REVOCATION_Query; 97struct GNUNET_REVOCATION_Query;
@@ -116,10 +157,7 @@ struct GNUNET_REVOCATION_Handle;
116 */ 157 */
117struct GNUNET_REVOCATION_Handle * 158struct GNUNET_REVOCATION_Handle *
118GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, 159GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
119 const struct GNUNET_CRYPTO_EcdsaPublicKey *key, 160 const struct GNUNET_REVOCATION_Pow *pow,
120 const struct GNUNET_CRYPTO_EcdsaSignature *sig,
121 const struct GNUNET_TIME_Absolute *ts,
122 uint64_t pow,
123 GNUNET_REVOCATION_Callback func, void *func_cls); 161 GNUNET_REVOCATION_Callback func, void *func_cls);
124 162
125 163
@@ -143,12 +181,42 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h);
143 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not 181 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
144 */ 182 */
145int 183int
146GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key, 184GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
147 const struct GNUNET_TIME_Absolute *ts,
148 uint64_t pow,
149 unsigned int matching_bits); 185 unsigned int matching_bits);
150 186
151 187
188struct GNUNET_REVOCATION_PowCalculationHandle*
189GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
190 int epochs,
191 unsigned int difficulty);
192
193
194/**
195 * Calculate a key revocation valid for broadcasting for a number
196 * of epochs.
197 *
198 * @param pc handle to the PoW, initially called with NULL.
199 * @param epochs number of epochs for which the revocation must be valid.
200 * @param pow current pow value to try
201 * @param difficulty current base difficulty to achieve
202 * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
203 */
204int
205GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc);
206
207
208const struct GNUNET_REVOCATION_Pow*
209GNUNET_REVOCATION_pow_get (const struct
210 GNUNET_REVOCATION_PowCalculationHandle *pc);
211
212
213void
214GNUNET_REVOCATION_pow_cleanup (struct
215 GNUNET_REVOCATION_PowCalculationHandle *pc);
216
217
218
219
152/** 220/**
153 * Create a revocation signature. 221 * Create a revocation signature.
154 * 222 *
@@ -156,9 +224,10 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
156 * @param sig where to write the revocation signature 224 * @param sig where to write the revocation signature
157 */ 225 */
158void 226void
159GNUNET_REVOCATION_sign_revocation (const struct 227GNUNET_REVOCATION_sign_revocation (struct
160 GNUNET_CRYPTO_EcdsaPrivateKey *key, 228 GNUNET_REVOCATION_Pow *pow,
161 struct GNUNET_CRYPTO_EcdsaSignature *sig); 229 const struct
230 GNUNET_CRYPTO_EcdsaPrivateKey *key);
162 231
163 232
164#if 0 /* keep Emacsens' auto-indent happy */ 233#if 0 /* keep Emacsens' auto-indent happy */