32#include "../../lib/gnsrecord/gnsrecord_crypto.h"
36#define TEST_DIFFICULTY 5
39 "6fea32c05af58bfa979553d188605fd57d8bf9cc263b78d5f7478c07b998ed70";
42 "5af7020ee19160328832352bbc6a68a8d71a7cbe1b929969a7c66d415a0d8f65";
45parsehex (
char *src,
char *dst,
size_t dstlen,
int invert)
53 while (sscanf (
data,
" %02x%n", &read_byte, &off) == 1)
56 dst[dstlen - 1 - data_len++] = read_byte;
58 dst[data_len++] = read_byte;
73 for (i = 0; i < buf_len; i++)
77 if ((0 != fold) && (i % fold == 0))
87 printf (
"%02x", ((
unsigned char*) buf)[buf_len - 1 - i]);
89 printf (
"%02x", ((
unsigned char*) buf)[i]);
121 fprintf (stdout,
"\n");
122 fprintf (stdout,
"Zone identifier (ztype|zkey):\n");
126 fprintf (stdout,
"\n");
127 fprintf (stdout,
"Encoded zone identifier (zkl = zTLD):\n");
128 fprintf (stdout,
"%s\n", ztld);
129 fprintf (stdout,
"\n");
136 fprintf (stdout,
"Difficulty (%d base difficulty + %d epochs): %d\n\n",
147 fprintf (stdout,
"Signed message:\n");
159 fprintf (stdout,
"Proof:\n");
187 fprintf (stdout,
"Zone private key (d, big-endian):\n");
194 fprintf (stdout,
"Zone private key (d):\n");
222 "gnunet-revocation-tvg",
223 "Generate test vectors for revocation",
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
struct GNUNET_GNSRECORD_SignaturePurposePS * GNR_create_signature_message(const struct GNUNET_GNSRECORD_PowP *pow)
Create the revocation metadata to sign for a revocation message.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static char * line
Desired phone line (string to be converted to a hash).
static char * data
The data to insert into the dht.
static void print_bytes_(void *buf, size_t buf_len, int fold, int in_be)
int parsehex(char *src, char *dst, size_t dstlen, int invert)
static void print_bytes(void *buf, size_t buf_len, int fold)
static void run_with_key(struct GNUNET_CRYPTO_PrivateKey *id_priv)
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run.
int main(int argc, char *const *argv)
The main function of the test vector generation tool.
static unsigned int pow_passes
Pow passes.
API to perform and access key revocations.
size_t GNUNET_GNSRECORD_proof_get_size(const struct GNUNET_GNSRECORD_PowP *pow)
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_pow_round(struct GNUNET_GNSRECORD_PowCalculationHandle *pc)
Calculate a single round in the key revocation PoW.
void GNUNET_GNSRECORD_pow_init(const struct GNUNET_CRYPTO_PrivateKey *key, struct GNUNET_GNSRECORD_PowP *pow)
Initializes a fresh PoW computation.
struct GNUNET_GNSRECORD_PowCalculationHandle * GNUNET_GNSRECORD_pow_start(struct GNUNET_GNSRECORD_PowP *pow, int epochs, unsigned int difficulty)
Starts a proof-of-work calculation given the pow object as well as target epochs and difficulty.
#define GNUNET_MAX_POW_SIZE
Maximum length of a revocation.
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_check_pow(const struct GNUNET_GNSRECORD_PowP *pow, unsigned int matching_bits, struct GNUNET_TIME_Relative epoch_duration)
Check if the given proof-of-work is valid.
ssize_t GNUNET_CRYPTO_public_key_get_length(const struct GNUNET_CRYPTO_PublicKey *key)
Get the compacted length of a GNUNET_CRYPTO_PublicKey.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_key_get_public(const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key)
Retrieves the public key representation of a private key.
@ GNUNET_PUBLIC_KEY_TYPE_EDDSA
EDDSA identity.
@ GNUNET_PUBLIC_KEY_TYPE_ECDSA
The identity type.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
enum GNUNET_GenericReturnValue GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, 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,...
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.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
#define GNUNET_TIME_UNIT_YEARS
One year (365 days).
uint32_t size
How many bytes does this signature sign? (including this purpose header); in network byte order (!...
A private key for an identity as per LSD0001.
uint32_t type
Type of public key.
struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_key
AN EdDSA identtiy key.
struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key
An ECDSA identity key.
An identity key as per LSD0001.
Definition of a command line option.
The handle to a PoW calculation.
Struct for a proof of work as part of the revocation.
uint64_t pow[32]
The PoWs.
The signature object we use for the PoW.
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
The signature purpose.
Time for relative time used by GNUnet, in microseconds.