diff options
Diffstat (limited to 'src/revocation/gnunet-service-revocation.c')
-rw-r--r-- | src/revocation/gnunet-service-revocation.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 3e811cd9a..3c08e8452 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -129,6 +129,11 @@ static struct GNUNET_SET_ListenHandle *revocation_union_listen_handle; | |||
129 | static unsigned long long revocation_work_required; | 129 | static unsigned long long revocation_work_required; |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * Length of an expiration expoch | ||
133 | */ | ||
134 | static struct GNUNET_TIME_Relative epoch_duration; | ||
135 | |||
136 | /** | ||
132 | * Our application ID for set union operations. Must be the | 137 | * Our application ID for set union operations. Must be the |
133 | * same for all (compatible) peers. | 138 | * same for all (compatible) peers. |
134 | */ | 139 | */ |
@@ -167,25 +172,15 @@ new_peer_entry (const struct GNUNET_PeerIdentity *peer) | |||
167 | static int | 172 | static int |
168 | verify_revoke_message (const struct RevokeMessage *rm) | 173 | verify_revoke_message (const struct RevokeMessage *rm) |
169 | { | 174 | { |
170 | if (GNUNET_YES != | 175 | if (GNUNET_YES != GNUNET_REVOCATION_check_pow (&rm->proof_of_work, |
171 | GNUNET_REVOCATION_check_pow (&rm->public_key, | 176 | (unsigned int) revocation_work_required, |
172 | rm->proof_of_work, | 177 | epoch_duration)) |
173 | (unsigned int) revocation_work_required)) | ||
174 | { | 178 | { |
175 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 179 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
176 | "Proof of work invalid!\n"); | 180 | "Proof of work invalid!\n"); |
177 | GNUNET_break_op (0); | 181 | GNUNET_break_op (0); |
178 | return GNUNET_NO; | 182 | return GNUNET_NO; |
179 | } | 183 | } |
180 | if (GNUNET_OK != | ||
181 | GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, | ||
182 | &rm->purpose, | ||
183 | &rm->signature, | ||
184 | &rm->public_key)) | ||
185 | { | ||
186 | GNUNET_break_op (0); | ||
187 | return GNUNET_NO; | ||
188 | } | ||
189 | return GNUNET_YES; | 184 | return GNUNET_YES; |
190 | } | 185 | } |
191 | 186 | ||
@@ -308,7 +303,7 @@ publicize_rm (const struct RevokeMessage *rm) | |||
308 | struct GNUNET_HashCode hc; | 303 | struct GNUNET_HashCode hc; |
309 | struct GNUNET_SET_Element e; | 304 | struct GNUNET_SET_Element e; |
310 | 305 | ||
311 | GNUNET_CRYPTO_hash (&rm->public_key, | 306 | GNUNET_CRYPTO_hash (&rm->proof_of_work.key, |
312 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 307 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), |
313 | &hc); | 308 | &hc); |
314 | if (GNUNET_YES == | 309 | if (GNUNET_YES == |
@@ -848,6 +843,20 @@ run (void *cls, | |||
848 | GNUNET_free (fn); | 843 | GNUNET_free (fn); |
849 | return; | 844 | return; |
850 | } | 845 | } |
846 | if (GNUNET_OK != | ||
847 | GNUNET_CONFIGURATION_get_value_time (cfg, | ||
848 | "REVOCATION", | ||
849 | "EPOCH_DURATION", | ||
850 | &epoch_duration)) | ||
851 | { | ||
852 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | ||
853 | "REVOCATION", | ||
854 | "EPOCH_DURATION"); | ||
855 | GNUNET_SCHEDULER_shutdown (); | ||
856 | GNUNET_free (fn); | ||
857 | return; | ||
858 | } | ||
859 | |||
851 | revocation_set = GNUNET_SET_create (cfg, | 860 | revocation_set = GNUNET_SET_create (cfg, |
852 | GNUNET_SET_OPERATION_UNION); | 861 | GNUNET_SET_OPERATION_UNION); |
853 | revocation_union_listen_handle | 862 | revocation_union_listen_handle |
@@ -893,7 +902,7 @@ run (void *cls, | |||
893 | return; | 902 | return; |
894 | } | 903 | } |
895 | GNUNET_break (0 == ntohl (rm->reserved)); | 904 | GNUNET_break (0 == ntohl (rm->reserved)); |
896 | GNUNET_CRYPTO_hash (&rm->public_key, | 905 | GNUNET_CRYPTO_hash (&rm->proof_of_work.key, |
897 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 906 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), |
898 | &hc); | 907 | &hc); |
899 | GNUNET_break (GNUNET_OK == | 908 | GNUNET_break (GNUNET_OK == |