35 #define TEST_DIFFICULTY 5 44 for (i = 0; i < buf_len; i++)
46 if ((0 != i) && (0 != fold) && (i % fold == 0))
48 printf (
"%02x", ((
unsigned char*) buf)[i]);
83 fprintf (stdout,
"Zone private key (d, little-endian scalar, with ztype prepended):\n");
85 fprintf (stdout,
"\n");
86 fprintf (stdout,
"Zone identifier (zid):\n");
88 fprintf (stdout,
"\n");
89 fprintf (stdout,
"Encoded zone identifier (zkl = zTLD):\n");
90 fprintf (stdout,
"%s\n", ztld);
91 fprintf (stdout,
"\n");
98 fprintf (stdout,
"Difficulty (%d base difficulty + %d epochs): %d\n\n",
112 fprintf (stdout,
"Proof:\n");
140 "gnunet-revocation-tvg",
141 "Generate test vectors for revocation",
static void print_bytes(void *buf, size_t buf_len, int fold)
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
enum GNUNET_GenericReturnValue GNUNET_REVOCATION_pow_round(struct GNUNET_REVOCATION_PowCalculationHandle *pc)
Calculate a single round in the key revocation PoW.
Struct for a proof of work as part of the revocation.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct GNUNET_ATS_PerformanceHandle * ph
ATS performance handle used.
ssize_t GNUNET_IDENTITY_key_get_length(const struct GNUNET_IDENTITY_PublicKey *key)
Get the compacted length of a GNUNET_IDENTITY_PublicKey.
#define GNUNET_REVOCATION_MAX_PROOF_SIZE
Maximum length of a revocation.
A private key for an identity as per LSD0001.
Definition of a command line option.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key
An ECDSA identity key.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_key_get_public(const struct GNUNET_IDENTITY_PrivateKey *privkey, struct GNUNET_IDENTITY_PublicKey *key)
Retrieves the public key representation of a private key.
uint64_t pow[32]
The PoWs.
static unsigned int pow_passes
Pow passes.
uint32_t type
Type of public key.
struct GNUNET_REVOCATION_PowCalculationHandle * GNUNET_REVOCATION_pow_start(struct GNUNET_REVOCATION_PowP *pow, int epochs, unsigned int difficulty)
Starts a proof-of-work calculation given the pow object as well as target epochs and difficulty...
size_t GNUNET_REVOCATION_proof_get_size(const struct GNUNET_REVOCATION_PowP *pow)
An identity key as per LSD0001.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run.
void GNUNET_CRYPTO_ecdsa_key_create(struct GNUNET_CRYPTO_EcdsaPrivateKey *pk)
Create a new private key.
#define GNUNET_TIME_UNIT_YEARS
One year (365 days).
The handle to a PoW calculation.
int main(int argc, char *const *argv)
The main function of the test vector generation tool.
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
void GNUNET_REVOCATION_pow_init(const struct GNUNET_IDENTITY_PrivateKey *key, struct GNUNET_REVOCATION_PowP *pow)
Initializes a fresh PoW computation.
#define GNUNET_malloc(size)
Wrapper around malloc.
char * GNUNET_STRINGS_data_to_string(const void *data, size_t size, char *out, size_t out_size)
Convert binary data to ASCII encoding using CrockfordBase32.
Time for relative time used by GNUnet, in microseconds.
enum GNUNET_GenericReturnValue GNUNET_REVOCATION_check_pow(const struct GNUNET_REVOCATION_PowP *pow, unsigned int matching_bits, struct GNUNET_TIME_Relative epoch_duration)
Check if the given proof-of-work is valid.