gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: - fix tvgs; expose alternative identity


From: gnunet
Subject: [gnunet] branch master updated: - fix tvgs; expose alternative identity type
Date: Fri, 16 Oct 2020 09:55:04 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 4bf09d00f - fix tvgs; expose alternative identity type
4bf09d00f is described below

commit 4bf09d00f1aeb0586f14587dfa455a0a5b902eda
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Fri Oct 16 09:48:03 2020 +0200

    - fix tvgs; expose alternative identity type
---
 src/gnsrecord/gnunet-gnsrecord-tvg.c   |  4 ++--
 src/identity/gnunet-identity.c         | 27 +++++++++++++++++++++++----
 src/include/gnunet_gnsrecord_lib.h     |  5 +++++
 src/include/gnunet_identity_service.h  |  2 +-
 src/revocation/gnunet-revocation-tvg.c | 14 +++++++-------
 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,
   GNUNET_IDENTITY_key_get_public (&id_priv,
                                   &id_pub);
   fprintf (stdout, "Zone private key (d, little-endian scalar):\n");
-  print_bytes (&id_priv, sizeof(id_priv), 0);
+  print_bytes (&id_priv, GNUNET_IDENTITY_key_get_length (&id_pub), 0); //FIXME 
length for privkey?
   fprintf (stdout, "\n");
   fprintf (stdout, "Zone public key (zk):\n");
-  print_bytes (&id_pub, sizeof(id_pub), 0);
+  print_bytes (&id_pub, GNUNET_IDENTITY_key_get_length (&id_pub), 0);
   fprintf (stdout, "\n");
 
   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
@@ -65,6 +65,11 @@ static unsigned int verbose;
  */
 static int quiet;
 
+/**
+ * Was "eddsa" specified?
+ */
+static int type_eddsa;
+
 /**
  * -C option
  */
@@ -357,9 +362,16 @@ print_ego (void *cls,
     else
     {
       if (private_keys)
-        fprintf (stdout, "%s - %s - %s\n", identifier, s, privs);
+        fprintf (stdout, "%s - %s - %s - %s\n",
+                 identifier, s, privs,
+                 (ntohl (pk.type) == GNUNET_IDENTITY_TYPE_ECDSA) ?
+                 "ECDSA" : "EdDSA");
       else
-        fprintf (stdout, "%s - %s\n", identifier, s);
+        fprintf (stdout, "%s - %s - %s\n",
+                 identifier, s,
+                 (ntohl (pk.type) == GNUNET_IDENTITY_TYPE_ECDSA) ?
+                 "ECDSA" : "EdDSA");
+
     }
   }
   GNUNET_free (privs);
@@ -412,7 +424,7 @@ run (void *cls,
         GNUNET_IDENTITY_create (sh,
                                 create_ego,
                                 &pk,
-                                0, //Ignored
+                                0, // Ignored
                                 &create_finished,
                                 &create_op);
     }
@@ -421,7 +433,9 @@ run (void *cls,
         GNUNET_IDENTITY_create (sh,
                                 create_ego,
                                 NULL,
-                                GNUNET_IDENTITY_TYPE_ECDSA, //FIXME from 
parameter
+                                (type_eddsa) ?
+                                GNUNET_IDENTITY_TYPE_EDDSA :
+                                GNUNET_IDENTITY_TYPE_ECDSA,
                                 &create_finished,
                                 &create_op);
   }
@@ -458,6 +472,11 @@ main (int argc, char *const *argv)
                                  gettext_noop (
                                    "set the private key for the identity to 
PRIVATE_KEY (use together with -C)"),
                                  &privkey_ego),
+    GNUNET_GETOPT_option_flag ('X',
+                               "eddsa",
+                               gettext_noop (
+                                 "generate an EdDSA identity. (use together 
with -C) EXPERIMENTAL"),
+                               &type_eddsa),
     GNUNET_GETOPT_option_flag ('d',
                                "display",
                                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" {
  */
 #define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555
 
+/**
+ * Record type for EDKEY delegations.
+ */
+#define GNUNET_GNSRECORD_TYPE_EDKEY GNUNET_IDENTITY_TYPE_EDDSA
+
 
 /**
  * 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
    * EDDSA identity. The value is the same as the EDKEY
    * record type.
    */
-  GNUNET_IDENTITY_TYPE_EDDSA = 65599 // FIXME
+  GNUNET_IDENTITY_TYPE_EDDSA = 65556
 };
 
 /**
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,
 {
   struct GNUNET_IDENTITY_PrivateKey id_priv;
   struct GNUNET_IDENTITY_PublicKey id_pub;
-  struct GNUNET_REVOCATION_PowP pow;
+  struct GNUNET_REVOCATION_PowP *pow;
   struct GNUNET_REVOCATION_PowCalculationHandle *ph;
   struct GNUNET_TIME_Relative exp;
 
@@ -81,10 +81,10 @@ run (void *cls,
   fprintf (stdout, "Zone public key (zk):\n");
   print_bytes (&id_pub, sizeof(id_pub), 0);
   fprintf (stdout, "\n");
-  memset (&pow, 0, sizeof (pow));
+  pow = GNUNET_malloc (GNUNET_REVOCATION_MAX_PROOF_SIZE);
   GNUNET_REVOCATION_pow_init (&id_priv,
-                              &pow);
-  ph = GNUNET_REVOCATION_pow_start (&pow,
+                              pow);
+  ph = GNUNET_REVOCATION_pow_start (pow,
                                     TEST_EPOCHS,
                                     TEST_DIFFICULTY);
   fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n",
@@ -98,12 +98,12 @@ run (void *cls,
   }
   exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
                                        TEST_EPOCHS);
-  GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (&pow,
+  GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (pow,
                                                            TEST_DIFFICULTY,
                                                            exp));
   fprintf (stdout, "Proof:\n");
-  print_bytes (&pow,
-               sizeof (pow),
+  print_bytes (pow,
+               GNUNET_REVOCATION_proof_get_size (pow),
                8);
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]