[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29910 - gnunet/src/revocation
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29910 - gnunet/src/revocation |
Date: |
Mon, 7 Oct 2013 00:00:14 +0200 |
Author: grothoff
Date: 2013-10-07 00:00:14 +0200 (Mon, 07 Oct 2013)
New Revision: 29910
Added:
gnunet/src/revocation/test_revocation.conf
Modified:
gnunet/src/revocation/Makefile.am
gnunet/src/revocation/gnunet-revocation.c
gnunet/src/revocation/gnunet-service-revocation.c
gnunet/src/revocation/revocation_api.c
Log:
-finishing revocation command line tool
Modified: gnunet/src/revocation/Makefile.am
===================================================================
--- gnunet/src/revocation/Makefile.am 2013-10-06 21:29:55 UTC (rev 29909)
+++ gnunet/src/revocation/Makefile.am 2013-10-06 22:00:14 UTC (rev 29910)
@@ -1,7 +1,7 @@
AM_CPPFLAGS = -I$(top_srcdir)/src/include
if MINGW
- WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
+ WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
endif
if USE_COVERAGE
@@ -17,11 +17,11 @@
revocation.conf
bin_PROGRAMS = \
- gnunet-revocation
+ gnunet-revocation
gnunet_revocation_SOURCES = \
- gnunet-revocation.c
+ gnunet-revocation.c
gnunet_revocation_LDADD = \
libgnunetrevocation.la \
$(top_builddir)/src/identity/libgnunetidentity.la \
@@ -40,11 +40,11 @@
-version-info 0:0:0
libexec_PROGRAMS = \
- gnunet-service-revocation
+ gnunet-service-revocation
gnunet_service_revocation_SOURCES = \
- gnunet-service-revocation.c
+ gnunet-service-revocation.c
gnunet_service_revocation_LDADD = \
$(top_builddir)/src/revocation/libgnunetrevocation.la \
$(top_builddir)/src/core/libgnunetcore.la \
@@ -57,5 +57,5 @@
libgnunetrevocation.la
+EXTRA_DIST = test_revocation.conf
-#EXTRA_DIST =
Modified: gnunet/src/revocation/gnunet-revocation.c
===================================================================
--- gnunet/src/revocation/gnunet-revocation.c 2013-10-06 21:29:55 UTC (rev
29909)
+++ gnunet/src/revocation/gnunet-revocation.c 2013-10-06 22:00:14 UTC (rev
29910)
@@ -153,14 +153,24 @@
switch (is_valid)
{
case GNUNET_YES:
- FPRINTF (stdout,
- _("Key for ego `%s' is still valid, revocation failed (!)\n"),
- test_ego);
+ if (NULL != revoke_ego)
+ FPRINTF (stdout,
+ _("Key for ego `%s' is still valid, revocation failed (!)\n"),
+ revoke_ego);
+ else
+ FPRINTF (stdout,
+ "%s",
+ _("Revocation failed (!)\n"));
break;
case GNUNET_NO:
- FPRINTF (stdout,
- _("Key for ego `%s' has been successfully revoked\n"),
- test_ego);
+ if (NULL != revoke_ego)
+ FPRINTF (stdout,
+ _("Key for ego `%s' has been successfully revoked\n"),
+ revoke_ego);
+ else
+ FPRINTF (stdout,
+ "%s",
+ _("Revocation successful.\n"));
break;
case GNUNET_SYSERR:
FPRINTF (stdout,
@@ -224,15 +234,10 @@
{
struct RevocationData *rd = cls;
+ /* store temporary results */
if ( (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) ||
(0 == (rd->pow % 128) ) )
{
- if (0 == (rd->pow % 128 * 1024))
- {
- if (0 == (rd->pow % (1024 * 128 * 80)))
- fprintf (stderr, "\n");
- fprintf (stderr, ".");
- }
if ( (NULL != filename) &&
(sizeof (struct RevocationData) ==
GNUNET_DISK_fn_write (filename,
@@ -244,11 +249,21 @@
"write",
filename);
}
+ /* display progress estimate */
+ if ( (0 == ((1 << matching_bits) / 100 / 50)) ||
+ (0 == (rd->pow % ((1 << matching_bits) / 100 / 50))) )
+ FPRINTF (stderr, "%s", ".");
+ if ( (0 != rd->pow) &&
+ ( (0 == ((1 << matching_bits) / 100)) ||
+ (0 == (rd->pow % ((1 << matching_bits) / 100))) ) )
+ FPRINTF (stderr, " - @ %3u%% (estimate)\n",
+ (unsigned int) (rd->pow * 100) / (1 << matching_bits));
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
{
GNUNET_free (rd);
return;
}
+ /* actually do POW calculation */
rd->pow++;
if (GNUNET_OK ==
GNUNET_REVOCATION_check_pow (&rd->key,
@@ -256,10 +271,10 @@
(unsigned int) matching_bits))
{
if ( (NULL != filename) &&
- (sizeof (struct RevocationData) ==
+ (sizeof (struct RevocationData) !=
GNUNET_DISK_fn_write (filename,
- &rd,
- sizeof (rd),
+ rd,
+ sizeof (struct RevocationData),
GNUNET_DISK_PERM_USER_READ |
GNUNET_DISK_PERM_USER_WRITE)) )
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
@@ -269,6 +284,7 @@
perform_revocation (rd);
else
{
+ FPRINTF (stderr, "%s", "\n");
FPRINTF (stderr,
_("Revocation certificate for `%s' stored in `%s'\n"),
revoke_ego,
@@ -276,6 +292,7 @@
GNUNET_SCHEDULER_shutdown ();
}
GNUNET_free (rd);
+ return;
}
GNUNET_SCHEDULER_add_now (&calculate_pow,
rd);
@@ -312,8 +329,8 @@
GNUNET_DISK_file_test (filename)) &&
(sizeof (struct RevocationData) ==
GNUNET_DISK_fn_read (filename,
- &rd,
- sizeof (rd))) )
+ rd,
+ sizeof (struct RevocationData))) )
{
if (0 != memcmp (&rd->key,
&key,
@@ -340,8 +357,11 @@
{
FPRINTF (stderr,
"%s",
- _("Revocation certificate ready, initiating revocation\n"));
- perform_revocation (rd);
+ _("Revocation certificate ready\n"));
+ if (perform)
+ perform_revocation (rd);
+ else
+ GNUNET_SCHEDULER_shutdown ();
GNUNET_free (rd);
return;
}
@@ -432,10 +452,23 @@
filename);
return;
}
- perform_revocation (&rd);
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&do_shutdown,
NULL);
+ if (GNUNET_YES !=
+ GNUNET_REVOCATION_check_pow (&rd.key,
+ rd.pow,
+ (unsigned int) matching_bits))
+ {
+ struct RevocationData *cp = GNUNET_new (struct RevocationData);
+
+ *cp = rd;
+ GNUNET_SCHEDULER_add_now (&calculate_pow,
+ cp);
+ return;
+
+ }
+ perform_revocation (&rd);
return;
}
FPRINTF (stderr,
Modified: gnunet/src/revocation/gnunet-service-revocation.c
===================================================================
--- gnunet/src/revocation/gnunet-service-revocation.c 2013-10-06 21:29:55 UTC
(rev 29909)
+++ gnunet/src/revocation/gnunet-service-revocation.c 2013-10-06 22:00:14 UTC
(rev 29910)
@@ -148,9 +148,7 @@
(unsigned int) revocation_work_required))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Proof of work invalid: %llu!\n",
- (unsigned long long)
- GNUNET_ntohll (rm->proof_of_work));
+ "Proof of work invalid!\n");
GNUNET_break_op (0);
return GNUNET_NO;
}
Modified: gnunet/src/revocation/revocation_api.c
===================================================================
--- gnunet/src/revocation/revocation_api.c 2013-10-06 21:29:55 UTC (rev
29909)
+++ gnunet/src/revocation/revocation_api.c 2013-10-06 22:00:14 UTC (rev
29910)
@@ -294,8 +294,8 @@
GNUNET_REVOCATION_revoke_cancel (h);
return 0;
}
- rm.header.size = htons (sizeof (struct QueryMessage));
- rm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_QUERY);
+ rm.header.size = htons (sizeof (struct RevokeMessage));
+ rm.header.type = htons (GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE);
rm.reserved = htonl (0);
rm.proof_of_work = h->pow;
rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION);
Added: gnunet/src/revocation/test_revocation.conf
===================================================================
--- gnunet/src/revocation/test_revocation.conf (rev 0)
+++ gnunet/src/revocation/test_revocation.conf 2013-10-06 22:00:14 UTC (rev
29910)
@@ -0,0 +1,2 @@
+[revocation]
+WORKBITS = 5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29910 - gnunet/src/revocation,
gnunet <=