aboutsummaryrefslogtreecommitdiff
path: root/src/revocation/plugin_block_revocation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/revocation/plugin_block_revocation.c')
-rw-r--r--src/revocation/plugin_block_revocation.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c
index 8d16b8781..291c56f70 100644
--- a/src/revocation/plugin_block_revocation.c
+++ b/src/revocation/plugin_block_revocation.c
@@ -52,6 +52,7 @@
52struct InternalContext 52struct InternalContext
53{ 53{
54 unsigned int matching_bits; 54 unsigned int matching_bits;
55 struct GNUNET_TIME_Relative epoch_duration;
55}; 56};
56 57
57 58
@@ -142,24 +143,15 @@ block_plugin_revocation_evaluate (void *cls,
142 GNUNET_break_op (0); 143 GNUNET_break_op (0);
143 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 144 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
144 } 145 }
145 if (GNUNET_YES != 146 if (0 >=
146 GNUNET_REVOCATION_check_pow (&rm->public_key, 147 GNUNET_REVOCATION_check_pow (&rm->proof_of_work,
147 rm->proof_of_work, 148 ic->matching_bits,
148 ic->matching_bits)) 149 ic->epoch_duration))
149 { 150 {
150 GNUNET_break_op (0); 151 GNUNET_break_op (0);
151 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 152 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
152 } 153 }
153 if (GNUNET_OK != 154 GNUNET_CRYPTO_hash (&rm->proof_of_work.key,
154 GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION,
155 &rm->purpose,
156 &rm->signature,
157 &rm->public_key))
158 {
159 GNUNET_break_op (0);
160 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
161 }
162 GNUNET_CRYPTO_hash (&rm->public_key,
163 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 155 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
164 &chash); 156 &chash);
165 if (GNUNET_YES == 157 if (GNUNET_YES ==
@@ -195,7 +187,7 @@ block_plugin_revocation_get_key (void *cls,
195 GNUNET_break_op (0); 187 GNUNET_break_op (0);
196 return GNUNET_SYSERR; 188 return GNUNET_SYSERR;
197 } 189 }
198 GNUNET_CRYPTO_hash (&rm->public_key, 190 GNUNET_CRYPTO_hash (&rm->proof_of_work.key,
199 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), 191 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey),
200 key); 192 key);
201 return GNUNET_OK; 193 return GNUNET_OK;
@@ -218,6 +210,7 @@ libgnunet_plugin_block_revocation_init (void *cls)
218 struct GNUNET_BLOCK_PluginFunctions *api; 210 struct GNUNET_BLOCK_PluginFunctions *api;
219 struct InternalContext *ic; 211 struct InternalContext *ic;
220 unsigned long long matching_bits; 212 unsigned long long matching_bits;
213 struct GNUNET_TIME_Relative epoch_duration;
221 214
222 if (GNUNET_OK != 215 if (GNUNET_OK !=
223 GNUNET_CONFIGURATION_get_value_number (cfg, 216 GNUNET_CONFIGURATION_get_value_number (cfg,
@@ -225,6 +218,12 @@ libgnunet_plugin_block_revocation_init (void *cls)
225 "WORKBITS", 218 "WORKBITS",
226 &matching_bits)) 219 &matching_bits))
227 return NULL; 220 return NULL;
221 if (GNUNET_OK !=
222 GNUNET_CONFIGURATION_get_value_time (cfg,
223 "REVOCATION",
224 "EPOCH_DURATION",
225 &epoch_duration))
226 return NULL;
228 227
229 api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions); 228 api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions);
230 api->evaluate = &block_plugin_revocation_evaluate; 229 api->evaluate = &block_plugin_revocation_evaluate;
@@ -233,6 +232,7 @@ libgnunet_plugin_block_revocation_init (void *cls)
233 api->types = types; 232 api->types = types;
234 ic = GNUNET_new (struct InternalContext); 233 ic = GNUNET_new (struct InternalContext);
235 ic->matching_bits = (unsigned int) matching_bits; 234 ic->matching_bits = (unsigned int) matching_bits;
235 ic->epoch_duration = epoch_duration;
236 api->cls = ic; 236 api->cls = ic;
237 return api; 237 return api;
238} 238}