/**
* Version of the key revocation API.
*/
-#define GNUNET_REVOCATION_VERSION 0x00000000
+#define GNUNET_REVOCATION_VERSION 0x00000001
/**
* The proof-of-work narrowing factor.
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
/**
* The signature object we use for the PoW
*/
-struct GNUNET_REVOCATION_SignaturePurpose
+struct GNUNET_REVOCATION_SignaturePurposePS
{
/**
* The signature purpose
*/
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);
* @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);
*/
void
GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
- struct GNUNET_REVOCATION_Pow *pow);
+ struct GNUNET_REVOCATION_PowP *pow);
/**
* @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);
/**
* 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.
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);
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);
/**
* 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;
};
/**
* The final PoW result data structure.
*/
- struct GNUNET_REVOCATION_Pow *pow;
+ struct GNUNET_REVOCATION_PowP *pow;
/**
* The current nonce to try
*/
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)
{
* @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;
*/
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
* @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)
{