summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-30 12:49:16 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-30 12:49:16 +0200
commitd3ec11c5a2dc7521efbd308e273dccc26c0e4bb4 (patch)
treeea901f3dba1e37d1a63d703f183e2b4e1639571b
parent170b9c1fd81b29721a0e4eb43b06b229a4f425ad (diff)
parent1eade92340968378afc390379b86590f335cb814 (diff)
Merge branch 'master' of git+ssh://gnunet.org/gnunet
-rw-r--r--src/include/gnunet_revocation_service.h17
-rw-r--r--src/revocation/gnunet-revocation.c10
-rw-r--r--src/revocation/revocation.h2
-rw-r--r--src/revocation/revocation_api.c14
4 files changed, 23 insertions, 20 deletions
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h
index 9a8918b43..105bb1149 100644
--- a/src/include/gnunet_revocation_service.h
+++ b/src/include/gnunet_revocation_service.h
@@ -48,7 +48,7 @@ extern "C"
/**
* Version of the key revocation API.
*/
-#define GNUNET_REVOCATION_VERSION 0x00000000
+#define GNUNET_REVOCATION_VERSION 0x00000001
/**
* The proof-of-work narrowing factor.
@@ -59,7 +59,10 @@ extern "C"
GNUNET_NETWORK_STRUCT_BEGIN
-struct GNUNET_REVOCATION_Pow
+/**
+ * Struct for a proof of work as part of the revocation.
+ */
+struct GNUNET_REVOCATION_PowP
{
/**
* The timestamp of the revocation
@@ -91,7 +94,7 @@ struct GNUNET_REVOCATION_Pow
/**
* The signature object we use for the PoW
*/
-struct GNUNET_REVOCATION_SignaturePurpose
+struct GNUNET_REVOCATION_SignaturePurposePS
{
/**
* The signature purpose
@@ -180,7 +183,7 @@ struct GNUNET_REVOCATION_Handle;
*/
struct GNUNET_REVOCATION_Handle *
GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_REVOCATION_Pow *pow,
+ const struct GNUNET_REVOCATION_PowP *pow,
GNUNET_REVOCATION_Callback func, void *func_cls);
@@ -202,7 +205,7 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h);
* @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
*/
enum GNUNET_GenericReturnValue
-GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
+GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
unsigned int matching_bits,
struct GNUNET_TIME_Relative epoch_duration);
@@ -215,7 +218,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
*/
void
GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
- struct GNUNET_REVOCATION_Pow *pow);
+ struct GNUNET_REVOCATION_PowP *pow);
/**
@@ -228,7 +231,7 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
* @return a handle for use in PoW rounds
*/
struct GNUNET_REVOCATION_PowCalculationHandle*
-GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow,
+GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow,
int epochs,
unsigned int difficulty);
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c
index 8b7cf33c6..1edd98f0e 100644
--- a/src/revocation/gnunet-revocation.c
+++ b/src/revocation/gnunet-revocation.c
@@ -101,7 +101,7 @@ static struct GNUNET_SCHEDULER_Task *pow_task;
/**
* Proof-of-work object
*/
-static struct GNUNET_REVOCATION_Pow proof_of_work;
+static struct GNUNET_REVOCATION_PowP proof_of_work;
/**
* Function run if the user aborts with CTRL-C.
@@ -229,10 +229,10 @@ static void
sync_pow ()
{
if ((NULL != filename) &&
- (sizeof(struct GNUNET_REVOCATION_Pow) !=
+ (sizeof(struct GNUNET_REVOCATION_PowP) !=
GNUNET_DISK_fn_write (filename,
&proof_of_work,
- sizeof(struct GNUNET_REVOCATION_Pow),
+ sizeof(struct GNUNET_REVOCATION_PowP),
GNUNET_DISK_PERM_USER_READ
| GNUNET_DISK_PERM_USER_WRITE)))
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename);
@@ -278,10 +278,10 @@ calculate_pow (void *cls)
if (GNUNET_OK == GNUNET_REVOCATION_pow_round (ph))
{
if ((NULL != filename) &&
- (sizeof(struct GNUNET_REVOCATION_Pow) !=
+ (sizeof(struct GNUNET_REVOCATION_PowP) !=
GNUNET_DISK_fn_write (filename,
&proof_of_work,
- sizeof(struct GNUNET_REVOCATION_Pow),
+ sizeof(struct GNUNET_REVOCATION_PowP),
GNUNET_DISK_PERM_USER_READ
| GNUNET_DISK_PERM_USER_WRITE)))
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", filename);
diff --git a/src/revocation/revocation.h b/src/revocation/revocation.h
index 868c2b853..635c56cfc 100644
--- a/src/revocation/revocation.h
+++ b/src/revocation/revocation.h
@@ -92,7 +92,7 @@ struct RevokeMessage
/**
* Number that causes a hash collision with the @e public_key.
*/
- struct GNUNET_REVOCATION_Pow proof_of_work;
+ struct GNUNET_REVOCATION_PowP proof_of_work;
};
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 18a312ab8..12cb63c57 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -83,7 +83,7 @@ struct GNUNET_REVOCATION_PowCalculationHandle
/**
* The final PoW result data structure.
*/
- struct GNUNET_REVOCATION_Pow *pow;
+ struct GNUNET_REVOCATION_PowP *pow;
/**
* The current nonce to try
@@ -297,7 +297,7 @@ handle_revocation_response (void *cls,
*/
struct GNUNET_REVOCATION_Handle *
GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_REVOCATION_Pow *pow,
+ const struct GNUNET_REVOCATION_PowP *pow,
GNUNET_REVOCATION_Callback func,
void *func_cls)
{
@@ -428,14 +428,14 @@ calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph)
* @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not
*/
enum GNUNET_GenericReturnValue
-GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
+GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
unsigned int difficulty,
struct GNUNET_TIME_Relative epoch_duration)
{
char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
+ sizeof (struct GNUNET_TIME_AbsoluteNBO)
+ sizeof (uint64_t)] GNUNET_ALIGN;
- struct GNUNET_REVOCATION_SignaturePurpose spurp;
+ struct GNUNET_REVOCATION_SignaturePurposePS spurp;
struct GNUNET_HashCode result;
struct GNUNET_TIME_Absolute ts;
struct GNUNET_TIME_Absolute exp;
@@ -538,10 +538,10 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_Pow *pow,
*/
void
GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
- struct GNUNET_REVOCATION_Pow *pow)
+ struct GNUNET_REVOCATION_PowP *pow)
{
struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get ();
- struct GNUNET_REVOCATION_SignaturePurpose rp;
+ struct GNUNET_REVOCATION_SignaturePurposePS rp;
/**
* Predate the validity period to prevent rejections due to
@@ -575,7 +575,7 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
* @return a handle for use in PoW rounds
*/
struct GNUNET_REVOCATION_PowCalculationHandle*
-GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_Pow *pow,
+GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow,
int epochs,
unsigned int difficulty)
{