aboutsummaryrefslogtreecommitdiff
path: root/src/revocation/gnunet-service-revocation.c
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2021-12-29 18:22:37 +0100
committerChristian Grothoff <grothoff@gnunet.org>2021-12-29 18:22:37 +0100
commitc0b6f577cb6866a8bfce22acbcec6983d5f610f6 (patch)
treea7cb3c59313b8cc44b3ec51baa9bdd97e25efd09 /src/revocation/gnunet-service-revocation.c
parentfd620976c140d5df43cf174a54a9f88c4808cad3 (diff)
downloadgnunet-c0b6f577cb6866a8bfce22acbcec6983d5f610f6.tar.gz
gnunet-c0b6f577cb6866a8bfce22acbcec6983d5f610f6.zip
-updating block plugins to new API
Diffstat (limited to 'src/revocation/gnunet-service-revocation.c')
-rw-r--r--src/revocation/gnunet-service-revocation.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index 5fe0ade98..4494ade83 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -169,14 +169,16 @@ new_peer_entry (const struct GNUNET_PeerIdentity *peer)
169 * @return #GNUNET_YES if the message is verified 169 * @return #GNUNET_YES if the message is verified
170 * #GNUNET_NO if the key/signature don't verify 170 * #GNUNET_NO if the key/signature don't verify
171 */ 171 */
172static int 172static enum GNUNET_GenericReturnValue
173verify_revoke_message (const struct RevokeMessage *rm) 173verify_revoke_message (const struct RevokeMessage *rm)
174{ 174{
175 struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; 175 const struct GNUNET_REVOCATION_PowP *pow
176 if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow, 176 = (const struct GNUNET_REVOCATION_PowP *) &rm[1];
177 (unsigned 177
178 int) revocation_work_required, 178 if (GNUNET_YES !=
179 epoch_duration)) 179 GNUNET_REVOCATION_check_pow (pow,
180 (unsigned int) revocation_work_required,
181 epoch_duration))
180 { 182 {
181 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 183 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
182 "Proof of work invalid!\n"); 184 "Proof of work invalid!\n");
@@ -263,7 +265,7 @@ handle_query_message (void *cls,
263 * @param value our `struct PeerEntry` for the neighbour 265 * @param value our `struct PeerEntry` for the neighbour
264 * @return #GNUNET_OK (continue to iterate) 266 * @return #GNUNET_OK (continue to iterate)
265 */ 267 */
266static int 268static enum GNUNET_GenericReturnValue
267do_flood (void *cls, 269do_flood (void *cls,
268 const struct GNUNET_PeerIdentity *target, 270 const struct GNUNET_PeerIdentity *target,
269 void *value) 271 void *value)
@@ -278,10 +280,12 @@ do_flood (void *cls,
278 but we have no direct CORE 280 but we have no direct CORE
279 connection for flooding */ 281 connection for flooding */
280 e = GNUNET_MQ_msg_extra (cp, 282 e = GNUNET_MQ_msg_extra (cp,
281 htonl (rm->pow_size), 283 htonl (rm->pow_size),
282 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); 284 GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE);
283 *cp = *rm; 285 *cp = *rm;
284 memcpy (&cp[1], &rm[1], htonl (rm->pow_size)); 286 memcpy (&cp[1],
287 &rm[1],
288 htonl (rm->pow_size));
285 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 289 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
286 "Flooding revocation to `%s'\n", 290 "Flooding revocation to `%s'\n",
287 GNUNET_i2s (target)); 291 GNUNET_i2s (target));
@@ -300,17 +304,18 @@ do_flood (void *cls,
300 * @return #GNUNET_OK on success, #GNUNET_NO if we encountered an error, 304 * @return #GNUNET_OK on success, #GNUNET_NO if we encountered an error,
301 * #GNUNET_SYSERR if the message was malformed 305 * #GNUNET_SYSERR if the message was malformed
302 */ 306 */
303static int 307static enum GNUNET_GenericReturnValue
304publicize_rm (const struct RevokeMessage *rm) 308publicize_rm (const struct RevokeMessage *rm)
305{ 309{
306 struct RevokeMessage *cp; 310 struct RevokeMessage *cp;
307 struct GNUNET_HashCode hc; 311 struct GNUNET_HashCode hc;
308 struct GNUNET_SETU_Element e; 312 struct GNUNET_SETU_Element e;
309 ssize_t pklen; 313 ssize_t pklen;
310 const struct GNUNET_IDENTITY_PublicKey *pk; 314 const struct GNUNET_REVOCATION_PowP *pow
315 = (const struct GNUNET_REVOCATION_PowP *) &rm[1];
316 const struct GNUNET_IDENTITY_PublicKey *pk
317 = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
311 318
312 struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1];
313 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
314 pklen = GNUNET_IDENTITY_key_get_length (pk); 319 pklen = GNUNET_IDENTITY_key_get_length (pk);
315 if (0 > pklen) 320 if (0 > pklen)
316 { 321 {