diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-07-18 00:44:39 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-07-18 00:44:39 +0200 |
commit | 7f4ddbcab8598e3d5e29c23ce883cdfa664408f1 (patch) | |
tree | 5f1b18463f641f24fad519e0aefb60b97d707b52 /src/revocation | |
parent | 28ab2c446fba4980a8295d59fdf203a028a35dd6 (diff) | |
download | gnunet-7f4ddbcab8598e3d5e29c23ce883cdfa664408f1.tar.gz gnunet-7f4ddbcab8598e3d5e29c23ce883cdfa664408f1.zip |
merge flags into enum for GNUNET_DISK_pipe() API, fixing #6188
Diffstat (limited to 'src/revocation')
-rw-r--r-- | src/revocation/gnunet-revocation-tvg.c | 19 | ||||
-rw-r--r-- | src/revocation/revocation_api.c | 8 |
2 files changed, 15 insertions, 12 deletions
diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c index b8f462b28..29df1bb4d 100644 --- a/src/revocation/gnunet-revocation-tvg.c +++ b/src/revocation/gnunet-revocation-tvg.c | |||
@@ -43,13 +43,14 @@ print_bytes (void *buf, | |||
43 | 43 | ||
44 | for (i = 0; i < buf_len; i++) | 44 | for (i = 0; i < buf_len; i++) |
45 | { | 45 | { |
46 | if ((0 != i) && (0 != fold) && (i%fold == 0)) | 46 | if ((0 != i) && (0 != fold) && (i % fold == 0)) |
47 | printf("\n"); | 47 | printf ("\n"); |
48 | printf("%02x", ((unsigned char*)buf)[i]); | 48 | printf ("%02x", ((unsigned char*) buf)[i]); |
49 | } | 49 | } |
50 | printf("\n"); | 50 | printf ("\n"); |
51 | } | 51 | } |
52 | 52 | ||
53 | |||
53 | /** | 54 | /** |
54 | * Main function that will be run. | 55 | * Main function that will be run. |
55 | * | 56 | * |
@@ -73,12 +74,12 @@ run (void *cls, | |||
73 | GNUNET_CRYPTO_ecdsa_key_create (&id_priv); | 74 | GNUNET_CRYPTO_ecdsa_key_create (&id_priv); |
74 | GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv, | 75 | GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv, |
75 | &id_pub); | 76 | &id_pub); |
76 | fprintf(stdout, "Zone private key (d, little-endian scalar):\n"); | 77 | fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); |
77 | print_bytes (&id_priv, sizeof(id_priv), 0); | 78 | print_bytes (&id_priv, sizeof(id_priv), 0); |
78 | fprintf(stdout, "\n"); | 79 | fprintf (stdout, "\n"); |
79 | fprintf(stdout, "Zone public key (zk):\n"); | 80 | fprintf (stdout, "Zone public key (zk):\n"); |
80 | print_bytes (&id_pub, sizeof(id_pub), 0); | 81 | print_bytes (&id_pub, sizeof(id_pub), 0); |
81 | fprintf(stdout, "\n"); | 82 | fprintf (stdout, "\n"); |
82 | memset (&pow, 0, sizeof (pow)); | 83 | memset (&pow, 0, sizeof (pow)); |
83 | GNUNET_REVOCATION_pow_init (&id_priv, | 84 | GNUNET_REVOCATION_pow_init (&id_priv, |
84 | &pow); | 85 | &pow); |
@@ -99,7 +100,7 @@ run (void *cls, | |||
99 | GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (&pow, | 100 | GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (&pow, |
100 | TEST_DIFFICULTY, | 101 | TEST_DIFFICULTY, |
101 | exp)); | 102 | exp)); |
102 | fprintf(stdout, "Proof:\n"); | 103 | fprintf (stdout, "Proof:\n"); |
103 | print_bytes (&pow, | 104 | print_bytes (&pow, |
104 | sizeof (pow), | 105 | sizeof (pow), |
105 | 8); | 106 | 8); |
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 3815e47b0..e0b195aa9 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -468,9 +468,9 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
468 | /** | 468 | /** |
469 | * First, check if PoW set is strictly monotically increasing | 469 | * First, check if PoW set is strictly monotically increasing |
470 | */ | 470 | */ |
471 | for (unsigned int i = 0; i < POW_COUNT-1; i++) | 471 | for (unsigned int i = 0; i < POW_COUNT - 1; i++) |
472 | { | 472 | { |
473 | if (GNUNET_ntohll (pow->pow[i]) >= GNUNET_ntohll (pow->pow[i+1])) | 473 | if (GNUNET_ntohll (pow->pow[i]) >= GNUNET_ntohll (pow->pow[i + 1])) |
474 | return GNUNET_NO; | 474 | return GNUNET_NO; |
475 | } | 475 | } |
476 | GNUNET_memcpy (&buf[sizeof(uint64_t)], | 476 | GNUNET_memcpy (&buf[sizeof(uint64_t)], |
@@ -592,6 +592,7 @@ GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow, | |||
592 | return pc; | 592 | return pc; |
593 | } | 593 | } |
594 | 594 | ||
595 | |||
595 | /** | 596 | /** |
596 | * Comparison function for quicksort | 597 | * Comparison function for quicksort |
597 | * | 598 | * |
@@ -602,9 +603,10 @@ GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow, | |||
602 | static int | 603 | static int |
603 | cmp_pow_value (const void *a, const void *b) | 604 | cmp_pow_value (const void *a, const void *b) |
604 | { | 605 | { |
605 | return ( GNUNET_ntohll(*(uint64_t*)a) - GNUNET_ntohll(*(uint64_t*)b)); | 606 | return (GNUNET_ntohll (*(uint64_t*) a) - GNUNET_ntohll (*(uint64_t*) b)); |
606 | } | 607 | } |
607 | 608 | ||
609 | |||
608 | /** | 610 | /** |
609 | * Calculate a key revocation valid for broadcasting for a number | 611 | * Calculate a key revocation valid for broadcasting for a number |
610 | * of epochs. | 612 | * of epochs. |