aboutsummaryrefslogtreecommitdiff
path: root/src/revocation/gnunet-revocation-tvg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/revocation/gnunet-revocation-tvg.c')
-rw-r--r--src/revocation/gnunet-revocation-tvg.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c
index 29df1bb4d..cb5e31fcd 100644
--- a/src/revocation/gnunet-revocation-tvg.c
+++ b/src/revocation/gnunet-revocation-tvg.c
@@ -65,25 +65,34 @@ run (void *cls,
65 const char *cfgfile, 65 const char *cfgfile,
66 const struct GNUNET_CONFIGURATION_Handle *cfg) 66 const struct GNUNET_CONFIGURATION_Handle *cfg)
67{ 67{
68 struct GNUNET_CRYPTO_EcdsaPrivateKey id_priv; 68 struct GNUNET_IDENTITY_PrivateKey id_priv;
69 struct GNUNET_CRYPTO_EcdsaPublicKey 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 char ztld[128];
74 GNUNET_CRYPTO_ecdsa_key_create (&id_priv); 74
75 GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv, 75 id_priv.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
76 &id_pub); 76 GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key);
77 fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); 77 GNUNET_IDENTITY_key_get_public (&id_priv,
78 print_bytes (&id_priv, sizeof(id_priv), 0); 78 &id_pub);
79 GNUNET_STRINGS_data_to_string (&id_pub,
80 GNUNET_IDENTITY_key_get_length (&id_pub),
81 ztld,
82 sizeof (ztld));
83 fprintf (stdout, "Zone private key (d, little-endian scalar, with ztype prepended):\n");
84 print_bytes (&id_priv, sizeof(id_priv), 8);
85 fprintf (stdout, "\n");
86 fprintf (stdout, "Zone identifier (zid):\n");
87 print_bytes (&id_pub, GNUNET_IDENTITY_key_get_length (&id_pub), 8);
79 fprintf (stdout, "\n"); 88 fprintf (stdout, "\n");
80 fprintf (stdout, "Zone public key (zk):\n"); 89 fprintf (stdout, "Encoded zone identifier (zkl = zTLD):\n");
81 print_bytes (&id_pub, sizeof(id_pub), 0); 90 fprintf (stdout, "%s\n", ztld);
82 fprintf (stdout, "\n"); 91 fprintf (stdout, "\n");
83 memset (&pow, 0, sizeof (pow)); 92 pow = GNUNET_malloc (GNUNET_REVOCATION_MAX_PROOF_SIZE);
84 GNUNET_REVOCATION_pow_init (&id_priv, 93 GNUNET_REVOCATION_pow_init (&id_priv,
85 &pow); 94 pow);
86 ph = GNUNET_REVOCATION_pow_start (&pow, 95 ph = GNUNET_REVOCATION_pow_start (pow,
87 TEST_EPOCHS, 96 TEST_EPOCHS,
88 TEST_DIFFICULTY); 97 TEST_DIFFICULTY);
89 fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n", 98 fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n",
@@ -97,12 +106,12 @@ run (void *cls,
97 } 106 }
98 exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 107 exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
99 TEST_EPOCHS); 108 TEST_EPOCHS);
100 GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (&pow, 109 GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (pow,
101 TEST_DIFFICULTY, 110 TEST_DIFFICULTY,
102 exp)); 111 exp));
103 fprintf (stdout, "Proof:\n"); 112 fprintf (stdout, "Proof:\n");
104 print_bytes (&pow, 113 print_bytes (pow,
105 sizeof (pow), 114 GNUNET_REVOCATION_proof_get_size (pow),
106 8); 115 8);
107} 116}
108 117