GNUnet  0.11.x
revocation_api.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2013, 2016 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
25 #include "platform.h"
27 #include "gnunet_signatures.h"
28 #include "gnunet_protocols.h"
29 #include "revocation.h"
30 #include <inttypes.h>
31 
36 {
41 
46 
50  void *func_cls;
51 };
52 
53 
58 struct BestPow
59 {
63  uint64_t pow;
64 
68  unsigned int bits;
69 };
70 
71 
77 {
81  struct BestPow best[POW_COUNT];
82 
87 
91  uint64_t current_pow;
92 
97  unsigned int epochs;
98 
102  unsigned int difficulty;
103 
104 };
105 
115 static void
117  enum GNUNET_MQ_Error error)
118 {
119  struct GNUNET_REVOCATION_Query *q = cls;
120 
122  "Revocation query MQ error\n");
123  q->func (q->func_cls,
124  GNUNET_SYSERR);
126 }
127 
128 
135 static void
137  const struct QueryResponseMessage *qrm)
138 {
139  struct GNUNET_REVOCATION_Query *q = cls;
140 
142  "Revocation query result: %d\n",
143  (uint32_t) ntohl (qrm->is_valid));
144  q->func (q->func_cls,
145  ntohl (qrm->is_valid));
147 }
148 
149 
161  const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
163  void *func_cls)
164 {
165  struct GNUNET_REVOCATION_Query *q
167  struct GNUNET_MQ_MessageHandler handlers[] = {
168  GNUNET_MQ_hd_fixed_size (revocation_query_response,
170  struct QueryResponseMessage,
171  q),
173  };
174  struct QueryMessage *qm;
175  struct GNUNET_MQ_Envelope *env;
176 
177  q->mq = GNUNET_CLIENT_connect (cfg,
178  "revocation",
179  handlers,
181  q);
182  if (NULL == q->mq)
183  {
184  GNUNET_free (q);
185  return NULL;
186  }
187  q->func = func;
188  q->func_cls = func_cls;
189  env = GNUNET_MQ_msg (qm,
191  qm->reserved = htonl (0);
192  qm->key = *key;
193  GNUNET_MQ_send (q->mq,
194  env);
195  return q;
196 }
197 
198 
204 void
206 {
207  if (NULL != q->mq)
208  {
209  GNUNET_MQ_destroy (q->mq);
210  q->mq = NULL;
211  }
212  GNUNET_free (q);
213 }
214 
215 
220 {
225 
230 
234  void *func_cls;
235 };
236 
237 
247 static void
249  enum GNUNET_MQ_Error error)
250 {
251  struct GNUNET_REVOCATION_Handle *h = cls;
252 
254  "Revocation MQ error\n");
255  h->func (h->func_cls,
256  GNUNET_SYSERR);
258 }
259 
260 
267 static void
269  const struct RevocationResponseMessage *rrm)
270 {
271  struct GNUNET_REVOCATION_Handle *h = cls;
272 
274  "Revocation transmission result: %d\n",
275  (uint32_t) ntohl (rrm->is_valid));
276  h->func (h->func_cls,
277  ntohl (rrm->is_valid));
279 }
280 
281 
300  const struct GNUNET_REVOCATION_PowP *pow,
302  void *func_cls)
303 {
306  struct GNUNET_MQ_MessageHandler handlers[] = {
307  GNUNET_MQ_hd_fixed_size (revocation_response,
310  h),
312  };
313  unsigned long long matching_bits;
314  struct GNUNET_TIME_Relative epoch_duration;
315  struct RevokeMessage *rm;
316  struct GNUNET_MQ_Envelope *env;
317 
318  if ((GNUNET_OK !=
320  "REVOCATION",
321  "WORKBITS",
322  &matching_bits)))
323  {
324  GNUNET_break (0);
325  GNUNET_free (h);
326  return NULL;
327  }
328  if ((GNUNET_OK !=
330  "REVOCATION",
331  "EPOCH_DURATION",
332  &epoch_duration)))
333  {
334  GNUNET_break (0);
335  GNUNET_free (h);
336  return NULL;
337  }
339  (unsigned int) matching_bits,
340  epoch_duration))
341  {
342  GNUNET_break (0);
343  GNUNET_free (h);
344  return NULL;
345  }
346 
347 
348  h->mq = GNUNET_CLIENT_connect (cfg,
349  "revocation",
350  handlers,
352  h);
353  if (NULL == h->mq)
354  {
355  GNUNET_free (h);
356  return NULL;
357  }
358  h->func = func;
359  h->func_cls = func_cls;
360  env = GNUNET_MQ_msg (rm,
362  rm->reserved = htonl (0);
363  rm->proof_of_work = *pow;
364  GNUNET_MQ_send (h->mq,
365  env);
366  return h;
367 }
368 
369 
375 void
377 {
378  if (NULL != h->mq)
379  {
380  GNUNET_MQ_destroy (h->mq);
381  h->mq = NULL;
382  }
383  GNUNET_free (h);
384 }
385 
386 
393 static unsigned int
395 {
396  unsigned int hash_count;
397  hash_count = 0;
398  while ((0 == GNUNET_CRYPTO_hash_get_bit_ltr (hash, hash_count)))
399  hash_count++;
400  return hash_count;
401 }
402 
403 
410 static unsigned int
412 {
413  double sum = 0.0;
414  for (unsigned int j = 0; j<POW_COUNT; j++)
415  sum += ph->best[j].bits;
416  double avg = sum / POW_COUNT;
417  return avg;
418 }
419 
420 
431  unsigned int difficulty,
433 {
434  char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
435  + sizeof (struct GNUNET_TIME_AbsoluteNBO)
436  + sizeof (uint64_t)] GNUNET_ALIGN;
438  struct GNUNET_HashCode result;
439  struct GNUNET_TIME_Absolute ts;
440  struct GNUNET_TIME_Absolute exp;
441  struct GNUNET_TIME_Relative ttl;
442  struct GNUNET_TIME_Relative buffer;
443  unsigned int score = 0;
444  unsigned int tmp_score = 0;
445  unsigned int epochs;
446  uint64_t pow_val;
447 
451  spurp.key = pow->key;
452  spurp.timestamp = pow->timestamp;
454  spurp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
455  + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
456  + sizeof (struct GNUNET_TIME_AbsoluteNBO));
457  if (GNUNET_OK !=
459  &spurp.purpose,
460  &pow->signature,
461  &pow->key))
462  {
464  "Proof of work signature invalid!\n");
465  return GNUNET_NO;
466  }
467 
471  for (unsigned int i = 0; i < POW_COUNT-1; i++)
472  {
473  if (GNUNET_ntohll (pow->pow[i]) >= GNUNET_ntohll (pow->pow[i+1]))
474  return GNUNET_NO;
475  }
476  GNUNET_memcpy (&buf[sizeof(uint64_t)],
477  &pow->timestamp,
478  sizeof (uint64_t));
479  GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
480  &pow->key,
481  sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey));
482  for (unsigned int i = 0; i < POW_COUNT; i++)
483  {
484  pow_val = GNUNET_ntohll (pow->pow[i]);
485  GNUNET_memcpy (buf, &pow->pow[i], sizeof(uint64_t));
486  GNUNET_CRYPTO_pow_hash ("GnsRevocationPow",
487  buf,
488  sizeof(buf),
489  &result);
490  tmp_score = count_leading_zeroes (&result);
492  "Score %u with %" PRIu64 " (#%u)\n",
493  tmp_score, pow_val, i);
494 
495  score += tmp_score;
496 
497  }
498  score = score / POW_COUNT;
499  if (score < difficulty)
500  return GNUNET_NO;
501  epochs = score - difficulty;
502 
507  ttl = GNUNET_TIME_relative_multiply (epoch_duration,
508  epochs);
512  buffer = GNUNET_TIME_relative_divide (epoch_duration,
513  10);
514  exp = GNUNET_TIME_absolute_add (ts, ttl);
515  exp = GNUNET_TIME_absolute_add (exp,
516  buffer);
517 
519  return GNUNET_NO; /* Not yet valid. */
520  /* Revert to actual start time */
521  ts = GNUNET_TIME_absolute_add (ts,
522  buffer);
523 
524  if (0 == GNUNET_TIME_absolute_get_remaining (exp).rel_value_us)
525  return GNUNET_NO; /* expired */
526  return GNUNET_YES;
527 }
528 
529 
536 void
538  struct GNUNET_REVOCATION_PowP *pow)
539 {
542 
549 
551  rp.timestamp = pow->timestamp;
553  rp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
554  + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
555  + sizeof (struct GNUNET_TIME_AbsoluteNBO));
557  rp.key = pow->key;
560  &rp.purpose,
561  &pow->signature));
562 }
563 
564 
576  int epochs,
577  unsigned int difficulty)
578 {
580  struct GNUNET_TIME_Relative ttl;
581 
582 
584  pc->pow = pow;
586  epochs);
587  pc->pow->ttl = GNUNET_TIME_relative_hton (ttl);
589  UINT64_MAX);
590  pc->difficulty = difficulty;
591  pc->epochs = epochs;
592  return pc;
593 }
594 
602 static int
603 cmp_pow_value (const void *a, const void *b)
604 {
605  return ( GNUNET_ntohll(*(uint64_t*)a) - GNUNET_ntohll(*(uint64_t*)b));
606 }
607 
620 {
621  char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
622  + sizeof (uint64_t)
623  + sizeof (uint64_t)] GNUNET_ALIGN;
624  struct GNUNET_HashCode result;
625  unsigned int zeros;
626  int ret;
627  uint64_t pow_nbo;
628 
629  pc->current_pow++;
630 
634  for (unsigned int i = 0; i < POW_COUNT; i++)
635  if (pc->current_pow == pc->best[i].pow)
636  return GNUNET_NO;
637  pow_nbo = GNUNET_htonll (pc->current_pow);
638  GNUNET_memcpy (buf, &pow_nbo, sizeof(uint64_t));
639  GNUNET_memcpy (&buf[sizeof(uint64_t)],
640  &pc->pow->timestamp,
641  sizeof (uint64_t));
642  GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
643  &pc->pow->key,
644  sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey));
645  GNUNET_CRYPTO_pow_hash ("GnsRevocationPow",
646  buf,
647  sizeof(buf),
648  &result);
649  zeros = count_leading_zeroes (&result);
650  for (unsigned int i = 0; i < POW_COUNT; i++)
651  {
652  if (pc->best[i].bits < zeros)
653  {
654  pc->best[i].bits = zeros;
655  pc->best[i].pow = pc->current_pow;
656  pc->pow->pow[i] = pow_nbo;
658  "New best score %u with %" PRIu64 " (#%u)\n",
659  zeros, pc->current_pow, i);
660 
661  break;
662  }
663  }
664  ret = calculate_score (pc) >= pc->difficulty + pc->epochs ? GNUNET_YES :
665  GNUNET_NO;
666  if (GNUNET_YES == ret)
667  {
668  /* Sort POWs) */
669  qsort (pc->pow->pow, POW_COUNT, sizeof (uint64_t), &cmp_pow_value);
670  }
671  return ret;
672 }
673 
674 
682 void
684 {
685  GNUNET_free (pc);
686 }
687 
688 
689 /* end of revocation_api.c */
#define GNUNET_MESSAGE_TYPE_REVOCATION_QUERY
Client to service: was this key revoked?
struct GNUNET_REVOCATION_PowP proof_of_work
Number that causes a hash collision with the public_key.
Definition: revocation.h:95
void GNUNET_REVOCATION_pow_init(const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, struct GNUNET_REVOCATION_PowP *pow)
Initializes a fresh PoW computation.
static unsigned int epochs
-e option.
void GNUNET_REVOCATION_query_cancel(struct GNUNET_REVOCATION_Query *q)
Cancel key revocation check.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_subtract(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration)
Subtract a given relative duration from the given start time.
Definition: time.c:422
static unsigned int calculate_score(const struct GNUNET_REVOCATION_PowCalculationHandle *ph)
Calculate the average zeros in the pows.
int GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
Definition: time.c:673
int GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
uint64_t rel_value_us
The actual value.
struct GNUNET_MQ_Handle * mq
Message queue to the service.
struct GNUNET_TIME_AbsoluteNBO timestamp
The timestamp of the revocation.
struct GNUNET_CRYPTO_EcdsaPublicKey key
The revoked public key.
enum GNUNET_GenericReturnValue GNUNET_REVOCATION_pow_round(struct GNUNET_REVOCATION_PowCalculationHandle *pc)
Calculate a key revocation valid for broadcasting for a number of epochs.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:1063
uint32_t purpose
What does this signature vouch for? This must contain a GNUNET_SIGNATURE_PURPOSE_XXX constant (from g...
static void revocation_mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
uint64_t current_pow
The current nonce to try.
GNUNET_MQ_Error
Error codes for the queue.
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Random on unsigned 64-bit values.
struct GNUNET_MQ_Handle * mq
Message queue to the service.
#define POW_COUNT
The proof-of-work narrowing factor.
Struct for a proof of work as part of the revocation.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_ATS_PerformanceHandle * ph
ATS performance handle used.
Definition: gnunet-ats.c:116
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
GNUNET_GenericReturnValue
Named constants for return values.
Definition: gnunet_common.h:83
struct BestPow best[POW_COUNT]
Current set of found PoWs.
The signature object we use for the PoW.
uint64_t pow
PoW nonce.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration)
Add a given relative duration to the given start time.
Definition: time.c:395
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Private ECC key encoded for transmission.
Query key revocation status.
Definition: revocation.h:37
Time for absolute time used by GNUnet, in microseconds and in network byte order. ...
void GNUNET_REVOCATION_pow_stop(struct GNUNET_REVOCATION_PowCalculationHandle *pc)
Stop a PoW calculation.
#define GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE
Client to service OR peer-to-peer: revoke this key!
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static unsigned int count_leading_zeroes(const struct GNUNET_HashCode *hash)
Count the leading zeroes in hash.
static struct GNUNET_TIME_Relative epoch_duration
Epoch length.
header of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed ...
void * func_cls
Closure for func.
#define GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE
Service to client: answer if key was revoked!
static int cmp_pow_value(const void *a, const void *b)
Comparison function for quicksort.
Revoke key.
Definition: revocation.h:80
Key revocation response.
Definition: revocation.h:59
static void handle_revocation_response(void *cls, const struct RevocationResponseMessage *rrm)
Handle response to our revocation query.
#define GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE
Service to client: revocation confirmed.
messages for key revocation
unsigned int difficulty
The difficulty (leading zeros) to achieve.
static char buf[2048]
struct GNUNET_REVOCATION_PowP * pow
The final PoW result data structure.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:442
void * func_cls
Closure for func.
uint32_t size
How many bytes does this signature sign? (including this purpose header); in network byte order (!)...
A 512-bit hashcode.
void GNUNET_CRYPTO_pow_hash(const char *salt, const void *buf, size_t buf_len, struct GNUNET_HashCode *result)
Calculate the &#39;proof-of-work&#39; hash (an expensive hash).
Definition: crypto_pow.c:41
static void handle_revocation_query_response(void *cls, const struct QueryResponseMessage *qrm)
Handle response to our revocation query.
Message handler for a specific message type.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
uint64_t pow[32]
The PoWs.
struct GNUNET_CRYPTO_EcdsaSignature signature
The signature.
static struct GNUNET_REVOCATION_Query * q
Handle for revocation query.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:36
uint32_t is_valid
GNUNET_NO if revoked, GNUNET_YES if valid.
Definition: revocation.h:69
#define GNUNET_SIGNATURE_PURPOSE_REVOCATION
Signature for confirming a key revocation.
struct GNUNET_HashCode key
The key used in the DHT.
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:176
struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a)
Convert relative time to network byte order.
Definition: time.c:625
uint32_t reserved
For alignment.
Definition: revocation.h:47
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
unsigned int bits
Corresponding zero bits in hash.
struct GNUNET_REVOCATION_PowCalculationHandle * GNUNET_REVOCATION_pow_start(struct GNUNET_REVOCATION_PowP *pow, int epochs, unsigned int difficulty)
Starts a proof-of-work calculation given the pow object as well as target epochs and difficulty...
Handle for the key revocation query.
struct GNUNET_TIME_AbsoluteNBO timestamp
The timestamp of the revocation.
int GNUNET_CRYPTO_ecdsa_sign_(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig)
ECDSA Sign a given block.
Definition: crypto_ecc.c:645
Key revocation response.
Definition: revocation.h:102
struct GNUNET_REVOCATION_Handle * GNUNET_REVOCATION_revoke(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_REVOCATION_PowP *pow, GNUNET_REVOCATION_Callback func, void *func_cls)
Perform key revocation.
void(* GNUNET_REVOCATION_Callback)(void *cls, enum GNUNET_GenericReturnValue is_valid)
Callback to call with the result of a key revocation query.
Handle to a message queue.
Definition: mq.c:85
int GNUNET_CRYPTO_ecdsa_verify_(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_EcdsaSignature *sig, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Verify ECDSA signature.
Definition: crypto_ecc.c:745
static struct GNUNET_FS_PublishContext * pc
Handle to FS-publishing operation.
struct GNUNET_CRYPTO_EcdsaPublicKey key
Key to check.
Definition: revocation.h:52
configuration data
Definition: configuration.c:84
#define GNUNET_TIME_UNIT_WEEKS
One week.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
static void query_mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
#define GNUNET_TIME_UNIT_YEARS
One year (365 days).
#define GNUNET_log(kind,...)
struct GNUNET_REVOCATION_Query * GNUNET_REVOCATION_query(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_CRYPTO_EcdsaPublicKey *key, GNUNET_REVOCATION_Callback func, void *func_cls)
Check if a key was revoked.
Handle for the key revocation operation.
int GNUNET_CRYPTO_hash_get_bit_ltr(const struct GNUNET_HashCode *code, unsigned int bit)
Obtain a bit from a hashcode.
Definition: crypto_hash.c:252
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition: time.c:331
GNUNET_REVOCATION_Callback func
Function to call with the result.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_divide(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Divide relative time by a given factor.
Definition: time.c:527
Time for absolute times used by GNUnet, in microseconds.
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:833
GNUNET_REVOCATION_Callback func
Function to call once we are done.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
The handle to a PoW calculation.
uint32_t is_valid
GNUNET_NO if revocation failed for internal reasons (e.g.
Definition: revocation.h:113
void GNUNET_REVOCATION_revoke_cancel(struct GNUNET_REVOCATION_Handle *h)
Cancel key revocation.
static unsigned long long matching_bits
Number of matching bits required for revocation.
unsigned int epochs
Epochs how long the PoW should be valid.
struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a)
Convert absolute time to network byte order.
Definition: time.c:657
struct GNUNET_CRYPTO_EcdsaPublicKey key
The revoked public key.
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
The signature purpose.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
Helper struct that holds a found pow nonce and the corresponding number of leading zeroes...
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:53
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
enum GNUNET_GenericReturnValue GNUNET_REVOCATION_check_pow(const struct GNUNET_REVOCATION_PowP *pow, unsigned int difficulty, struct GNUNET_TIME_Relative epoch_duration)
Check if the given proof-of-work is valid.
uint32_t reserved
For alignment.
Definition: revocation.h:90