aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-10-16 09:48:03 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-10-16 09:48:03 +0200
commit4bf09d00f1aeb0586f14587dfa455a0a5b902eda (patch)
tree7d40dd74b1303e66f52668d6cc659bd2657232fd
parentffd4382a73e2fa1d99812df14ed1025fadeb4017 (diff)
downloadgnunet-4bf09d00f1aeb0586f14587dfa455a0a5b902eda.tar.gz
gnunet-4bf09d00f1aeb0586f14587dfa455a0a5b902eda.zip
- fix tvgs; expose alternative identity type
-rw-r--r--src/gnsrecord/gnunet-gnsrecord-tvg.c4
-rw-r--r--src/identity/gnunet-identity.c27
-rw-r--r--src/include/gnunet_gnsrecord_lib.h5
-rw-r--r--src/include/gnunet_identity_service.h2
-rw-r--r--src/revocation/gnunet-revocation-tvg.c14
5 files changed, 38 insertions, 14 deletions
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c
index 7c28a18d0..6e6f6414c 100644
--- a/src/gnsrecord/gnunet-gnsrecord-tvg.c
+++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c
@@ -104,10 +104,10 @@ run (void *cls,
104 GNUNET_IDENTITY_key_get_public (&id_priv, 104 GNUNET_IDENTITY_key_get_public (&id_priv,
105 &id_pub); 105 &id_pub);
106 fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); 106 fprintf (stdout, "Zone private key (d, little-endian scalar):\n");
107 print_bytes (&id_priv, sizeof(id_priv), 0); 107 print_bytes (&id_priv, GNUNET_IDENTITY_key_get_length (&id_pub), 0); //FIXME length for privkey?
108 fprintf (stdout, "\n"); 108 fprintf (stdout, "\n");
109 fprintf (stdout, "Zone public key (zk):\n"); 109 fprintf (stdout, "Zone public key (zk):\n");
110 print_bytes (&id_pub, sizeof(id_pub), 0); 110 print_bytes (&id_pub, GNUNET_IDENTITY_key_get_length (&id_pub), 0);
111 fprintf (stdout, "\n"); 111 fprintf (stdout, "\n");
112 112
113 pkey_data_p.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); 113 pkey_data_p.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY);
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index e16ca83e3..a01cd1ed7 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -66,6 +66,11 @@ static unsigned int verbose;
66static int quiet; 66static int quiet;
67 67
68/** 68/**
69 * Was "eddsa" specified?
70 */
71static int type_eddsa;
72
73/**
69 * -C option 74 * -C option
70 */ 75 */
71static char *create_ego; 76static char *create_ego;
@@ -357,9 +362,16 @@ print_ego (void *cls,
357 else 362 else
358 { 363 {
359 if (private_keys) 364 if (private_keys)
360 fprintf (stdout, "%s - %s - %s\n", identifier, s, privs); 365 fprintf (stdout, "%s - %s - %s - %s\n",
366 identifier, s, privs,
367 (ntohl (pk.type) == GNUNET_IDENTITY_TYPE_ECDSA) ?
368 "ECDSA" : "EdDSA");
361 else 369 else
362 fprintf (stdout, "%s - %s\n", identifier, s); 370 fprintf (stdout, "%s - %s - %s\n",
371 identifier, s,
372 (ntohl (pk.type) == GNUNET_IDENTITY_TYPE_ECDSA) ?
373 "ECDSA" : "EdDSA");
374
363 } 375 }
364 } 376 }
365 GNUNET_free (privs); 377 GNUNET_free (privs);
@@ -412,7 +424,7 @@ run (void *cls,
412 GNUNET_IDENTITY_create (sh, 424 GNUNET_IDENTITY_create (sh,
413 create_ego, 425 create_ego,
414 &pk, 426 &pk,
415 0, //Ignored 427 0, // Ignored
416 &create_finished, 428 &create_finished,
417 &create_op); 429 &create_op);
418 } 430 }
@@ -421,7 +433,9 @@ run (void *cls,
421 GNUNET_IDENTITY_create (sh, 433 GNUNET_IDENTITY_create (sh,
422 create_ego, 434 create_ego,
423 NULL, 435 NULL,
424 GNUNET_IDENTITY_TYPE_ECDSA, //FIXME from parameter 436 (type_eddsa) ?
437 GNUNET_IDENTITY_TYPE_EDDSA :
438 GNUNET_IDENTITY_TYPE_ECDSA,
425 &create_finished, 439 &create_finished,
426 &create_op); 440 &create_op);
427 } 441 }
@@ -458,6 +472,11 @@ main (int argc, char *const *argv)
458 gettext_noop ( 472 gettext_noop (
459 "set the private key for the identity to PRIVATE_KEY (use together with -C)"), 473 "set the private key for the identity to PRIVATE_KEY (use together with -C)"),
460 &privkey_ego), 474 &privkey_ego),
475 GNUNET_GETOPT_option_flag ('X',
476 "eddsa",
477 gettext_noop (
478 "generate an EdDSA identity. (use together with -C) EXPERIMENTAL"),
479 &type_eddsa),
461 GNUNET_GETOPT_option_flag ('d', 480 GNUNET_GETOPT_option_flag ('d',
462 "display", 481 "display",
463 gettext_noop ("display all egos"), 482 gettext_noop ("display all egos"),
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index 22e7c0e25..530879b21 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -153,6 +153,11 @@ extern "C" {
153 */ 153 */
154#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555 154#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555
155 155
156/**
157 * Record type for EDKEY delegations.
158 */
159#define GNUNET_GNSRECORD_TYPE_EDKEY GNUNET_IDENTITY_TYPE_EDDSA
160
156 161
157/** 162/**
158 * Flags that can be set for a record. 163 * Flags that can be set for a record.
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h
index 3352d9bc0..17714fec4 100644
--- a/src/include/gnunet_identity_service.h
+++ b/src/include/gnunet_identity_service.h
@@ -69,7 +69,7 @@ enum GNUNET_IDENTITY_KeyType
69 * EDDSA identity. The value is the same as the EDKEY 69 * EDDSA identity. The value is the same as the EDKEY
70 * record type. 70 * record type.
71 */ 71 */
72 GNUNET_IDENTITY_TYPE_EDDSA = 65599 // FIXME 72 GNUNET_IDENTITY_TYPE_EDDSA = 65556
73}; 73};
74 74
75/** 75/**
diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c
index 13dee3529..1692472bb 100644
--- a/src/revocation/gnunet-revocation-tvg.c
+++ b/src/revocation/gnunet-revocation-tvg.c
@@ -67,7 +67,7 @@ run (void *cls,
67{ 67{
68 struct GNUNET_IDENTITY_PrivateKey id_priv; 68 struct GNUNET_IDENTITY_PrivateKey id_priv;
69 struct GNUNET_IDENTITY_PublicKey id_pub; 69 struct GNUNET_IDENTITY_PublicKey id_pub;
70 struct GNUNET_REVOCATION_PowP pow; 70 struct GNUNET_REVOCATION_PowP *pow;
71 struct GNUNET_REVOCATION_PowCalculationHandle *ph; 71 struct GNUNET_REVOCATION_PowCalculationHandle *ph;
72 struct GNUNET_TIME_Relative exp; 72 struct GNUNET_TIME_Relative exp;
73 73
@@ -81,10 +81,10 @@ run (void *cls,
81 fprintf (stdout, "Zone public key (zk):\n"); 81 fprintf (stdout, "Zone public key (zk):\n");
82 print_bytes (&id_pub, sizeof(id_pub), 0); 82 print_bytes (&id_pub, sizeof(id_pub), 0);
83 fprintf (stdout, "\n"); 83 fprintf (stdout, "\n");
84 memset (&pow, 0, sizeof (pow)); 84 pow = GNUNET_malloc (GNUNET_REVOCATION_MAX_PROOF_SIZE);
85 GNUNET_REVOCATION_pow_init (&id_priv, 85 GNUNET_REVOCATION_pow_init (&id_priv,
86 &pow); 86 pow);
87 ph = GNUNET_REVOCATION_pow_start (&pow, 87 ph = GNUNET_REVOCATION_pow_start (pow,
88 TEST_EPOCHS, 88 TEST_EPOCHS,
89 TEST_DIFFICULTY); 89 TEST_DIFFICULTY);
90 fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n", 90 fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n",
@@ -98,12 +98,12 @@ run (void *cls,
98 } 98 }
99 exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 99 exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
100 TEST_EPOCHS); 100 TEST_EPOCHS);
101 GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (&pow, 101 GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (pow,
102 TEST_DIFFICULTY, 102 TEST_DIFFICULTY,
103 exp)); 103 exp));
104 fprintf (stdout, "Proof:\n"); 104 fprintf (stdout, "Proof:\n");
105 print_bytes (&pow, 105 print_bytes (pow,
106 sizeof (pow), 106 GNUNET_REVOCATION_proof_get_size (pow),
107 8); 107 8);
108} 108}
109 109