diff options
Diffstat (limited to 'src/revocation/plugin_block_revocation.c')
-rw-r--r-- | src/revocation/plugin_block_revocation.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c index 291c56f70..3c9344a49 100644 --- a/src/revocation/plugin_block_revocation.c +++ b/src/revocation/plugin_block_revocation.c | |||
@@ -143,16 +143,18 @@ block_plugin_revocation_evaluate (void *cls, | |||
143 | GNUNET_break_op (0); | 143 | GNUNET_break_op (0); |
144 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 144 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
145 | } | 145 | } |
146 | if (0 >= | 146 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; |
147 | GNUNET_REVOCATION_check_pow (&rm->proof_of_work, | 147 | const struct GNUNET_IDENTITY_PublicKey *pk; |
148 | ic->matching_bits, | 148 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; |
149 | ic->epoch_duration)) | 149 | if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow, |
150 | ic->matching_bits, | ||
151 | ic->epoch_duration)) | ||
150 | { | 152 | { |
151 | GNUNET_break_op (0); | 153 | GNUNET_break_op (0); |
152 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 154 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
153 | } | 155 | } |
154 | GNUNET_CRYPTO_hash (&rm->proof_of_work.key, | 156 | GNUNET_CRYPTO_hash (pk, |
155 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 157 | GNUNET_IDENTITY_key_get_length (pk), |
156 | &chash); | 158 | &chash); |
157 | if (GNUNET_YES == | 159 | if (GNUNET_YES == |
158 | GNUNET_BLOCK_GROUP_bf_test_and_set (group, | 160 | GNUNET_BLOCK_GROUP_bf_test_and_set (group, |
@@ -182,13 +184,16 @@ block_plugin_revocation_get_key (void *cls, | |||
182 | { | 184 | { |
183 | const struct RevokeMessage *rm = block; | 185 | const struct RevokeMessage *rm = block; |
184 | 186 | ||
185 | if (block_size != sizeof(*rm)) | 187 | if (block_size <= sizeof(*rm)) |
186 | { | 188 | { |
187 | GNUNET_break_op (0); | 189 | GNUNET_break_op (0); |
188 | return GNUNET_SYSERR; | 190 | return GNUNET_SYSERR; |
189 | } | 191 | } |
190 | GNUNET_CRYPTO_hash (&rm->proof_of_work.key, | 192 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; |
191 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 193 | const struct GNUNET_IDENTITY_PublicKey *pk; |
194 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | ||
195 | GNUNET_CRYPTO_hash (pk, | ||
196 | GNUNET_IDENTITY_key_get_length (pk), | ||
192 | key); | 197 | key); |
193 | return GNUNET_OK; | 198 | return GNUNET_OK; |
194 | } | 199 | } |