aboutsummaryrefslogtreecommitdiff
path: root/src/revocation
diff options
context:
space:
mode:
Diffstat (limited to 'src/revocation')
-rw-r--r--src/revocation/gnunet-revocation-tvg.c4
-rw-r--r--src/revocation/gnunet-revocation.c2
-rw-r--r--src/revocation/gnunet-service-revocation.c4
-rw-r--r--src/revocation/plugin_block_revocation.c50
-rw-r--r--src/revocation/revocation_api.c27
5 files changed, 45 insertions, 42 deletions
diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c
index 682f41530..a126709ce 100644
--- a/src/revocation/gnunet-revocation-tvg.c
+++ b/src/revocation/gnunet-revocation-tvg.c
@@ -115,14 +115,14 @@ run (void *cls,
115 GNUNET_IDENTITY_key_get_public (&id_priv, 115 GNUNET_IDENTITY_key_get_public (&id_priv,
116 &id_pub); 116 &id_pub);
117 GNUNET_STRINGS_data_to_string (&id_pub, 117 GNUNET_STRINGS_data_to_string (&id_pub,
118 GNUNET_IDENTITY_key_get_length (&id_pub), 118 GNUNET_IDENTITY_public_key_get_length (&id_pub),
119 ztld, 119 ztld,
120 sizeof (ztld)); 120 sizeof (ztld));
121 fprintf (stdout, "Zone private key (d, big-endian scalar):\n"); 121 fprintf (stdout, "Zone private key (d, big-endian scalar):\n");
122 print_bytes_ (&id_priv.ecdsa_key, sizeof(id_priv.ecdsa_key), 8, 1); 122 print_bytes_ (&id_priv.ecdsa_key, sizeof(id_priv.ecdsa_key), 8, 1);
123 fprintf (stdout, "\n"); 123 fprintf (stdout, "\n");
124 fprintf (stdout, "Zone identifier (ztype|zkey):\n"); 124 fprintf (stdout, "Zone identifier (ztype|zkey):\n");
125 key_len = GNUNET_IDENTITY_key_get_length (&id_pub); 125 key_len = GNUNET_IDENTITY_public_key_get_length (&id_pub);
126 GNUNET_assert (0 < key_len); 126 GNUNET_assert (0 < key_len);
127 print_bytes (&id_pub, key_len, 8); 127 print_bytes (&id_pub, key_len, 8);
128 fprintf (stdout, "\n"); 128 fprintf (stdout, "\n");
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c
index a7f96385c..853ca0f71 100644
--- a/src/revocation/gnunet-revocation.c
+++ b/src/revocation/gnunet-revocation.c
@@ -343,7 +343,7 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego)
343 GNUNET_DISK_fn_read (filename, proof_of_work, 343 GNUNET_DISK_fn_read (filename, proof_of_work,
344 GNUNET_REVOCATION_MAX_PROOF_SIZE)))) 344 GNUNET_REVOCATION_MAX_PROOF_SIZE))))
345 { 345 {
346 ssize_t ksize = GNUNET_IDENTITY_key_get_length (&key); 346 ssize_t ksize = GNUNET_IDENTITY_public_key_get_length (&key);
347 if (0 > ksize) 347 if (0 > ksize)
348 { 348 {
349 fprintf (stderr, 349 fprintf (stderr,
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index 4494ade83..fe74201f3 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -316,7 +316,7 @@ publicize_rm (const struct RevokeMessage *rm)
316 const struct GNUNET_IDENTITY_PublicKey *pk 316 const struct GNUNET_IDENTITY_PublicKey *pk
317 = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; 317 = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
318 318
319 pklen = GNUNET_IDENTITY_key_get_length (pk); 319 pklen = GNUNET_IDENTITY_public_key_get_length (pk);
320 if (0 > pklen) 320 if (0 > pklen)
321 { 321 {
322 GNUNET_break_op (0); 322 GNUNET_break_op (0);
@@ -950,7 +950,7 @@ run (void *cls,
950 GNUNET_REVOCATION_PowP *) &rm[1]; 950 GNUNET_REVOCATION_PowP *) &rm[1];
951 ssize_t ksize; 951 ssize_t ksize;
952 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; 952 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
953 ksize = GNUNET_IDENTITY_key_get_length (pk); 953 ksize = GNUNET_IDENTITY_public_key_get_length (pk);
954 if (0 > ksize) 954 if (0 > ksize)
955 { 955 {
956 GNUNET_break_op (0); 956 GNUNET_break_op (0);
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c
index 12ec555e4..0c81440eb 100644
--- a/src/revocation/plugin_block_revocation.c
+++ b/src/revocation/plugin_block_revocation.c
@@ -56,10 +56,10 @@ struct InternalContext
56 */ 56 */
57static enum GNUNET_GenericReturnValue 57static enum GNUNET_GenericReturnValue
58block_plugin_revocation_check_query (void *cls, 58block_plugin_revocation_check_query (void *cls,
59 enum GNUNET_BLOCK_Type type, 59 enum GNUNET_BLOCK_Type type,
60 const struct GNUNET_HashCode *query, 60 const struct GNUNET_HashCode *query,
61 const void *xquery, 61 const void *xquery,
62 size_t xquery_size) 62 size_t xquery_size)
63{ 63{
64 (void) cls; 64 (void) cls;
65 (void) query; 65 (void) query;
@@ -86,16 +86,16 @@ block_plugin_revocation_check_query (void *cls,
86 */ 86 */
87static enum GNUNET_GenericReturnValue 87static enum GNUNET_GenericReturnValue
88block_plugin_revocation_check_block (void *cls, 88block_plugin_revocation_check_block (void *cls,
89 enum GNUNET_BLOCK_Type type, 89 enum GNUNET_BLOCK_Type type,
90 const void *block, 90 const void *block,
91 size_t block_size) 91 size_t block_size)
92{ 92{
93 struct InternalContext *ic = cls; 93 struct InternalContext *ic = cls;
94 const struct RevokeMessage *rm = block; 94 const struct RevokeMessage *rm = block;
95 const struct GNUNET_REVOCATION_PowP *pow 95 const struct GNUNET_REVOCATION_PowP *pow
96 = (const struct GNUNET_REVOCATION_PowP *) &rm[1]; 96 = (const struct GNUNET_REVOCATION_PowP *) &rm[1];
97 struct GNUNET_IDENTITY_PublicKey pk; 97 struct GNUNET_IDENTITY_PublicKey pk;
98 ssize_t pklen; 98 size_t pklen;
99 size_t left; 99 size_t left;
100 100
101 if (GNUNET_BLOCK_TYPE_REVOCATION != type) 101 if (GNUNET_BLOCK_TYPE_REVOCATION != type)
@@ -114,9 +114,10 @@ block_plugin_revocation_check_block (void *cls,
114 return GNUNET_NO; 114 return GNUNET_NO;
115 } 115 }
116 left = block_size - sizeof (*rm) - sizeof (*pow); 116 left = block_size - sizeof (*rm) - sizeof (*pow);
117 pklen = GNUNET_IDENTITY_read_key_from_buffer (&pk, 117 GNUNET_IDENTITY_read_public_key_from_buffer (&pow[1],
118 &pow[1], 118 left,
119 left); 119 &pk,
120 &pklen);
120 if (0 > pklen) 121 if (0 > pklen)
121 { 122 {
122 GNUNET_break_op (0); 123 GNUNET_break_op (0);
@@ -152,14 +153,14 @@ block_plugin_revocation_check_block (void *cls,
152 */ 153 */
153static enum GNUNET_BLOCK_ReplyEvaluationResult 154static enum GNUNET_BLOCK_ReplyEvaluationResult
154block_plugin_revocation_check_reply ( 155block_plugin_revocation_check_reply (
155 void *cls, 156 void *cls,
156 enum GNUNET_BLOCK_Type type, 157 enum GNUNET_BLOCK_Type type,
157 struct GNUNET_BLOCK_Group *group, 158 struct GNUNET_BLOCK_Group *group,
158 const struct GNUNET_HashCode *query, 159 const struct GNUNET_HashCode *query,
159 const void *xquery, 160 const void *xquery,
160 size_t xquery_size, 161 size_t xquery_size,
161 const void *reply_block, 162 const void *reply_block,
162 size_t reply_block_size) 163 size_t reply_block_size)
163{ 164{
164 (void) cls; 165 (void) cls;
165 (void) group; 166 (void) group;
@@ -199,7 +200,7 @@ block_plugin_revocation_get_key (void *cls,
199 const struct GNUNET_REVOCATION_PowP *pow 200 const struct GNUNET_REVOCATION_PowP *pow
200 = (const struct GNUNET_REVOCATION_PowP *) &rm[1]; 201 = (const struct GNUNET_REVOCATION_PowP *) &rm[1];
201 struct GNUNET_IDENTITY_PublicKey pk; 202 struct GNUNET_IDENTITY_PublicKey pk;
202 ssize_t pklen; 203 size_t pklen;
203 size_t left; 204 size_t left;
204 205
205 if (GNUNET_BLOCK_TYPE_REVOCATION != type) 206 if (GNUNET_BLOCK_TYPE_REVOCATION != type)
@@ -218,9 +219,10 @@ block_plugin_revocation_get_key (void *cls,
218 return GNUNET_NO; 219 return GNUNET_NO;
219 } 220 }
220 left = block_size - sizeof (*rm) - sizeof (*pow); 221 left = block_size - sizeof (*rm) - sizeof (*pow);
221 pklen = GNUNET_IDENTITY_read_key_from_buffer (&pk, 222 GNUNET_IDENTITY_read_public_key_from_buffer (&pow[1],
222 &pow[1], 223 left,
223 left); 224 &pk,
225 &pklen);
224 if (0 > pklen) 226 if (0 > pklen)
225 { 227 {
226 GNUNET_break_op (0); 228 GNUNET_break_op (0);
@@ -242,7 +244,7 @@ void *
242libgnunet_plugin_block_revocation_init (void *cls) 244libgnunet_plugin_block_revocation_init (void *cls)
243{ 245{
244 static const enum GNUNET_BLOCK_Type types[] = { 246 static const enum GNUNET_BLOCK_Type types[] = {
245 GNUNET_BLOCK_TYPE_REVOCATION, 247 GNUNET_BLOCK_TYPE_REVOCATION,
246 GNUNET_BLOCK_TYPE_ANY /* end of list */ 248 GNUNET_BLOCK_TYPE_ANY /* end of list */
247 }; 249 };
248 const struct GNUNET_CONFIGURATION_Handle *cfg = cls; 250 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 78b3c083a..34b4eddd7 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -407,14 +407,14 @@ REV_create_signature_message (const struct GNUNET_REVOCATION_PowP *pow)
407 size_t ksize; 407 size_t ksize;
408 408
409 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; 409 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
410 ksize = GNUNET_IDENTITY_key_get_length (pk); 410 ksize = GNUNET_IDENTITY_public_key_get_length (pk);
411 spurp = GNUNET_malloc (sizeof (*spurp) + ksize); 411 spurp = GNUNET_malloc (sizeof (*spurp) + ksize);
412 spurp->timestamp = pow->timestamp; 412 spurp->timestamp = pow->timestamp;
413 spurp->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); 413 spurp->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
414 spurp->purpose.size = htonl (sizeof(*spurp) + ksize); 414 spurp->purpose.size = htonl (sizeof(*spurp) + ksize);
415 GNUNET_IDENTITY_write_key_to_buffer (pk, 415 GNUNET_IDENTITY_write_public_key_to_buffer (pk,
416 (char*) &spurp[1], 416 (char*) &spurp[1],
417 ksize); 417 ksize);
418 return spurp; 418 return spurp;
419} 419}
420 420
@@ -426,14 +426,15 @@ check_signature_identity (const struct GNUNET_REVOCATION_PowP *pow,
426 unsigned char *sig; 426 unsigned char *sig;
427 size_t ksize; 427 size_t ksize;
428 428
429 ksize = GNUNET_IDENTITY_key_get_length (key); 429 ksize = GNUNET_IDENTITY_public_key_get_length (key);
430 spurp = REV_create_signature_message (pow); 430 spurp = REV_create_signature_message (pow);
431 sig = ((unsigned char*) &pow[1] + ksize); 431 sig = ((unsigned char*) &pow[1] + ksize);
432 if (GNUNET_OK != 432 if (GNUNET_OK !=
433 GNUNET_IDENTITY_signature_verify_raw_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, 433 GNUNET_IDENTITY_signature_verify_raw_ (
434 &spurp->purpose, 434 GNUNET_SIGNATURE_PURPOSE_REVOCATION,
435 sig, 435 &spurp->purpose,
436 key)) 436 sig,
437 key))
437 { 438 {
438 return GNUNET_SYSERR; 439 return GNUNET_SYSERR;
439 } 440 }
@@ -503,7 +504,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
503 GNUNET_memcpy (&buf[sizeof(uint64_t)], 504 GNUNET_memcpy (&buf[sizeof(uint64_t)],
504 &pow->timestamp, 505 &pow->timestamp,
505 sizeof (uint64_t)); 506 sizeof (uint64_t));
506 pklen = GNUNET_IDENTITY_key_get_length (pk); 507 pklen = GNUNET_IDENTITY_public_key_get_length (pk);
507 if (0 > pklen) 508 if (0 > pklen)
508 { 509 {
509 GNUNET_break (0); 510 GNUNET_break (0);
@@ -578,7 +579,7 @@ sign_pow_identity (const struct GNUNET_IDENTITY_PrivateKey *key,
578 ts = GNUNET_TIME_absolute_subtract (ts, 579 ts = GNUNET_TIME_absolute_subtract (ts,
579 GNUNET_TIME_UNIT_WEEKS); 580 GNUNET_TIME_UNIT_WEEKS);
580 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; 581 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
581 ksize = GNUNET_IDENTITY_key_get_length (pk); 582 ksize = GNUNET_IDENTITY_public_key_get_length (pk);
582 pow->timestamp = GNUNET_TIME_absolute_hton (ts); 583 pow->timestamp = GNUNET_TIME_absolute_hton (ts);
583 rp = REV_create_signature_message (pow); 584 rp = REV_create_signature_message (pow);
584 sig = ((char*) &pow[1]) + ksize; 585 sig = ((char*) &pow[1]) + ksize;
@@ -691,7 +692,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
691 GNUNET_memcpy (&buf[sizeof(uint64_t)], 692 GNUNET_memcpy (&buf[sizeof(uint64_t)],
692 &pc->pow->timestamp, 693 &pc->pow->timestamp,
693 sizeof (uint64_t)); 694 sizeof (uint64_t));
694 ksize = GNUNET_IDENTITY_key_get_length (pk); 695 ksize = GNUNET_IDENTITY_public_key_get_length (pk);
695 GNUNET_assert (0 < ksize); 696 GNUNET_assert (0 < ksize);
696 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], 697 GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
697 pk, 698 pk,
@@ -749,7 +750,7 @@ GNUNET_REVOCATION_proof_get_size (const struct GNUNET_REVOCATION_PowP *pow)
749 750
750 size = sizeof (struct GNUNET_REVOCATION_PowP); 751 size = sizeof (struct GNUNET_REVOCATION_PowP);
751 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; 752 pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
752 ksize = GNUNET_IDENTITY_key_get_length (pk); 753 ksize = GNUNET_IDENTITY_public_key_get_length (pk);
753 size += ksize; 754 size += ksize;
754 size += GNUNET_IDENTITY_signature_get_raw_length_by_type (pk->type); 755 size += GNUNET_IDENTITY_signature_get_raw_length_by_type (pk->type);
755 return size; 756 return size;