GNUnet  0.11.x
Data Structures | Functions | Variables
gnunet-crypto-tvg.c File Reference
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_signatures.h"
#include "gnunet_testing_lib.h"
#include <jansson.h>
#include <gcrypt.h>
Include dependency graph for gnunet-crypto-tvg.c:

Go to the source code of this file.

Data Structures

struct  TestSignatureDataPS
 Sample signature struct. More...
 

Functions

static json_t * vec_for (json_t *vecs, const char *vecname)
 Create a fresh test vector for a given operation label. More...
 
static void d2j (json_t *vec, const char *label, const void *data, size_t size)
 Add a base32crockford encoded value to a test vector. More...
 
static void uint2j (json_t *vec, const char *label, unsigned int num)
 Add a number to a test vector. More...
 
static int expect_data_fixed (json_t *vec, const char *name, void *data, size_t expect_len)
 
static int expect_data_dynamic (json_t *vec, const char *name, void **data, size_t *ret_len)
 
static int checkvec (const char *operation, json_t *vec)
 Check a single vector. More...
 
static int check_vectors ()
 Check test vectors from stdin. More...
 
static int output_vectors ()
 Output test vectors. More...
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Main function that will be run. More...
 
int main (int argc, char *const *argv)
 The main function of the test vector generation tool. More...
 

Variables

static GNUNET_NETWORK_STRUCT_END int verify_flag = GNUNET_NO
 Should we verify or output test vectors? More...
 
static int global_ret = 0
 Global exit code. More...
 

Function Documentation

◆ vec_for()

static json_t* vec_for ( json_t *  vecs,
const char *  vecname 
)
static

Create a fresh test vector for a given operation label.

Parameters
vecsarray of vectors to append the new vector to
vecnamelabel for the operation of the vector
Returns
the fresh test vector

Definition at line 93 of file gnunet-crypto-tvg.c.

References t.

Referenced by output_vectors().

94 {
95  json_t *t = json_object ();
96 
97  json_object_set_new (t,
98  "operation",
99  json_string (vecname));
100  json_array_append_new (vecs, t);
101  return t;
102 }
static struct GNUNET_SCHEDULER_Task * t
Main task.
Here is the caller graph for this function:

◆ d2j()

static void d2j ( json_t *  vec,
const char *  label,
const void *  data,
size_t  size 
)
static

Add a base32crockford encoded value to a test vector.

Parameters
vectest vector to add to
labellabel for the value
datadata to add
sizesize of data

Definition at line 115 of file gnunet-crypto-tvg.c.

References buf, GNUNET_break, GNUNET_free, and GNUNET_STRINGS_data_to_string_alloc().

Referenced by output_vectors().

119 {
120  char *buf;
121  json_t *json;
122 
124  json = json_string (buf);
125  GNUNET_free (buf);
126  GNUNET_break (NULL != json);
127 
128  json_object_set_new (vec, label, json);
129 }
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static char buf[2048]
static unsigned int size
Size of the "table".
Definition: peer.c:67
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:937
uint32_t data
The data value.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uint2j()

static void uint2j ( json_t *  vec,
const char *  label,
unsigned int  num 
)
static

Add a number to a test vector.

Parameters
vectest vector to add to
labellabel for the value
datadata to add
sizesize of data

Definition at line 140 of file gnunet-crypto-tvg.c.

Referenced by output_vectors().

143 {
144  json_t *json = json_integer (num);
145 
146  json_object_set_new (vec, label, json);
147 }
Here is the caller graph for this function:

◆ expect_data_fixed()

static int expect_data_fixed ( json_t *  vec,
const char *  name,
void *  data,
size_t  expect_len 
)
static

Definition at line 151 of file gnunet-crypto-tvg.c.

References GNUNET_NO, GNUNET_OK, and GNUNET_STRINGS_string_to_data().

Referenced by checkvec().

155 {
156  const char *s = json_string_value (json_object_get (vec, name));
157 
158  if (NULL == s)
159  return GNUNET_NO;
160 
162  strlen (s),
163  data,
164  expect_len))
165  return GNUNET_NO;
166  return GNUNET_OK;
167 }
const char * name
uint32_t data
The data value.
int GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
Definition: strings.c:972
Here is the call graph for this function:
Here is the caller graph for this function:

◆ expect_data_dynamic()

static int expect_data_dynamic ( json_t *  vec,
const char *  name,
void **  data,
size_t *  ret_len 
)
static

Definition at line 170 of file gnunet-crypto-tvg.c.

References GNUNET_malloc, GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_string_to_data(), and len.

Referenced by checkvec().

174 {
175  const char *s = json_string_value (json_object_get (vec, name));
176  size_t len;
177 
178  if (NULL == s)
179  return GNUNET_NO;
180 
181  len = (strlen (s) * 5) / 8;
182  if (NULL != ret_len)
183  *ret_len = len;
184  *data = GNUNET_malloc (len);
185 
186  if (GNUNET_OK != GNUNET_STRINGS_string_to_data (s, strlen (s), *data, len))
187  return GNUNET_NO;
188  return GNUNET_OK;
189 }
const char * name
uint32_t data
The data value.
#define GNUNET_malloc(size)
Wrapper around malloc.
int GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
Definition: strings.c:972
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkvec()

static int checkvec ( const char *  operation,
json_t *  vec 
)
static

Check a single vector.

Parameters
operationoperator of the vector
vecthe vector, a JSON object.
Returns
GNUNET_OK if the vector is okay

Definition at line 201 of file gnunet-crypto-tvg.c.

References ctx, data, expect_data_dynamic(), expect_data_fixed(), GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_ecc_ecdh(), GNUNET_CRYPTO_ecdh_eddsa(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_CRYPTO_eddsa_sign, GNUNET_CRYPTO_eddsa_verify, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_kdf(), GNUNET_CRYPTO_rsa_blind(), GNUNET_CRYPTO_rsa_private_key_decode(), GNUNET_CRYPTO_rsa_public_key_decode(), GNUNET_CRYPTO_rsa_public_key_encode(), GNUNET_CRYPTO_rsa_sign_blinded(), GNUNET_CRYPTO_rsa_signature_encode(), GNUNET_CRYPTO_rsa_unblind(), GNUNET_CRYPTO_rsa_verify(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_malloc, GNUNET_memcmp, GNUNET_NO, GNUNET_OK, GNUNET_SIGNATURE_PURPOSE_TEST, GNUNET_SYSERR, GNUNET_YES, pkey, and salt.

Referenced by check_vectors().

203 {
205  "checking %s\n", operation);
206 
207  if (0 == strcmp (operation, "hash"))
208  {
209  void *data;
210  size_t data_len;
211  struct GNUNET_HashCode hash_out;
212  struct GNUNET_HashCode hc;
213 
214  if (GNUNET_OK != expect_data_dynamic (vec,
215  "input",
216  &data,
217  &data_len))
218  {
219  GNUNET_break (0);
220  return GNUNET_SYSERR;
221  }
222  if (GNUNET_OK != expect_data_fixed (vec,
223  "output",
224  &hash_out,
225  sizeof (hash_out)))
226  {
227  GNUNET_break (0);
228  return GNUNET_NO;
229  }
230 
231  GNUNET_CRYPTO_hash (data, data_len, &hc);
232 
233  if (0 != GNUNET_memcmp (&hc, &hash_out))
234  {
235  GNUNET_break (0);
236  return GNUNET_NO;
237  }
238  }
239  else if (0 == strcmp (operation, "ecc_ecdh"))
240  {
241  struct GNUNET_CRYPTO_EcdhePrivateKey priv1;
242  struct GNUNET_CRYPTO_EcdhePublicKey pub1;
243  struct GNUNET_CRYPTO_EcdhePrivateKey priv2;
244  struct GNUNET_HashCode skm;
245  struct GNUNET_HashCode skm_comp;
246 
247  if (GNUNET_OK != expect_data_fixed (vec,
248  "priv1",
249  &priv1,
250  sizeof (priv1)))
251  {
252  GNUNET_break (0);
253  return GNUNET_NO;
254  }
255  if (GNUNET_OK != expect_data_fixed (vec,
256  "priv2",
257  &priv2,
258  sizeof (priv2)))
259  {
260  GNUNET_break (0);
261  return GNUNET_NO;
262  }
263  if (GNUNET_OK != expect_data_fixed (vec,
264  "pub1",
265  &pub1,
266  sizeof (pub1)))
267  {
268  GNUNET_break (0);
269  return GNUNET_NO;
270  }
271  if (GNUNET_OK != expect_data_fixed (vec,
272  "skm",
273  &skm,
274  sizeof (skm)))
275  {
276  GNUNET_break (0);
277  return GNUNET_NO;
278  }
280  GNUNET_CRYPTO_ecc_ecdh (&priv2,
281  &pub1,
282  &skm_comp));
283  if (0 != GNUNET_memcmp (&skm, &skm_comp))
284  {
285  GNUNET_break (0);
286  return GNUNET_NO;
287  }
288  }
289  else if (0 == strcmp (operation, "eddsa_key_derivation"))
290  {
291  struct GNUNET_CRYPTO_EddsaPrivateKey priv;
293  struct GNUNET_CRYPTO_EddsaPublicKey pub_comp;
294 
295  if (GNUNET_OK != expect_data_fixed (vec,
296  "priv",
297  &priv,
298  sizeof (priv)))
299  {
300  GNUNET_break (0);
301  return GNUNET_NO;
302  }
303 
304  if (GNUNET_OK != expect_data_fixed (vec,
305  "pub",
306  &pub,
307  sizeof (pub)))
308  {
309  GNUNET_break (0);
310  return GNUNET_NO;
311  }
312 
314  &pub_comp);
315  if (0 != GNUNET_memcmp (&pub, &pub_comp))
316  {
317  GNUNET_break (0);
318  return GNUNET_NO;
319  }
320 
321  }
322  else if (0 == strcmp (operation, "eddsa_signing"))
323  {
324  struct GNUNET_CRYPTO_EddsaPrivateKey priv;
326  struct TestSignatureDataPS data = { 0 };
327  struct GNUNET_CRYPTO_EddsaSignature sig;
328  struct GNUNET_CRYPTO_EddsaSignature sig_comp;
329 
330  if (GNUNET_OK != expect_data_fixed (vec,
331  "priv",
332  &priv,
333  sizeof (priv)))
334  {
335  GNUNET_break (0);
336  return GNUNET_NO;
337  }
338 
339  if (GNUNET_OK != expect_data_fixed (vec,
340  "pub",
341  &pub,
342  sizeof (pub)))
343  {
344  GNUNET_break (0);
345  return GNUNET_NO;
346  }
347 
348  if (GNUNET_OK != expect_data_fixed (vec,
349  "data",
350  &data,
351  sizeof (data)))
352  {
353  GNUNET_break (0);
354  return GNUNET_NO;
355  }
356 
357  if (GNUNET_OK != expect_data_fixed (vec,
358  "sig",
359  &sig,
360  sizeof (sig)))
361  {
362  GNUNET_break (0);
363  return GNUNET_NO;
364  }
365 
367  &data,
368  &sig_comp);
371  &data,
372  &sig,
373  &pub));
374  if (0 != GNUNET_memcmp (&sig, &sig_comp))
375  {
376  GNUNET_break (0);
377  return GNUNET_NO;
378  }
379  }
380  else if (0 == strcmp (operation, "kdf"))
381  {
382  size_t out_len;
383  void *out;
384  size_t out_len_comp;
385  void *out_comp;
386  void *ikm;
387  size_t ikm_len;
388  void *salt;
389  size_t salt_len;
390  void *ctx;
391  size_t ctx_len;
392 
393  if (GNUNET_OK != expect_data_dynamic (vec,
394  "out",
395  &out,
396  &out_len))
397  {
398  GNUNET_break (0);
399  return GNUNET_SYSERR;
400  }
401 
402  out_len_comp = out_len;
403  out_comp = GNUNET_malloc (out_len_comp);
404 
405  if (GNUNET_OK != expect_data_dynamic (vec,
406  "ikm",
407  &ikm,
408  &ikm_len))
409  {
410  GNUNET_break (0);
411  return GNUNET_SYSERR;
412  }
413 
414  if (GNUNET_OK != expect_data_dynamic (vec,
415  "salt",
416  &salt,
417  &salt_len))
418  {
419  GNUNET_break (0);
420  return GNUNET_SYSERR;
421  }
422 
423  if (GNUNET_OK != expect_data_dynamic (vec,
424  "ctx",
425  &ctx,
426  &ctx_len))
427  {
428  GNUNET_break (0);
429  return GNUNET_SYSERR;
430  }
431 
433  GNUNET_CRYPTO_kdf (out_comp,
434  out_len_comp,
435  salt,
436  salt_len,
437  ikm,
438  ikm_len,
439  ctx,
440  ctx_len,
441  NULL));
442 
443  if (0 != memcmp (out, out_comp, out_len))
444  {
445  GNUNET_break (0);
446  return GNUNET_NO;
447  }
448 
449  }
450  else if (0 == strcmp (operation, "eddsa_ecdh"))
451  {
452  struct GNUNET_CRYPTO_EcdhePrivateKey priv_ecdhe;
453  struct GNUNET_CRYPTO_EcdhePublicKey pub_ecdhe;
454  struct GNUNET_CRYPTO_EddsaPrivateKey priv_eddsa;
455  struct GNUNET_CRYPTO_EddsaPublicKey pub_eddsa;
456  struct GNUNET_HashCode key_material;
457  struct GNUNET_HashCode key_material_comp;
458 
459  if (GNUNET_OK != expect_data_fixed (vec,
460  "priv_ecdhe",
461  &priv_ecdhe,
462  sizeof (priv_ecdhe)))
463  {
464  GNUNET_break (0);
465  return GNUNET_NO;
466  }
467 
468  if (GNUNET_OK != expect_data_fixed (vec,
469  "pub_ecdhe",
470  &pub_ecdhe,
471  sizeof (pub_ecdhe)))
472  {
473  GNUNET_break (0);
474  return GNUNET_NO;
475  }
476 
477  if (GNUNET_OK != expect_data_fixed (vec,
478  "priv_eddsa",
479  &priv_eddsa,
480  sizeof (priv_eddsa)))
481  {
482  GNUNET_break (0);
483  return GNUNET_NO;
484  }
485 
486  if (GNUNET_OK != expect_data_fixed (vec,
487  "pub_eddsa",
488  &pub_eddsa,
489  sizeof (pub_eddsa)))
490  {
491  GNUNET_break (0);
492  return GNUNET_NO;
493  }
494 
495  if (GNUNET_OK != expect_data_fixed (vec,
496  "key_material",
497  &key_material,
498  sizeof (key_material)))
499  {
500  GNUNET_break (0);
501  return GNUNET_NO;
502  }
503 
504  GNUNET_CRYPTO_ecdh_eddsa (&priv_ecdhe, &pub_eddsa, &key_material_comp);
505 
506  if (0 != GNUNET_memcmp (&key_material, &key_material_comp))
507  {
508  GNUNET_break (0);
509  return GNUNET_NO;
510  }
511  }
512  else if (0 == strcmp (operation, "rsa_blind_signing"))
513  {
514  struct GNUNET_CRYPTO_RsaPrivateKey *skey;
516  struct GNUNET_HashCode message_hash;
518  struct GNUNET_CRYPTO_RsaSignature *blinded_sig;
519  struct GNUNET_CRYPTO_RsaSignature *sig;
520  void *blinded_data;
521  size_t blinded_len;
522  void *blinded_data_comp;
523  size_t blinded_len_comp;
524  void *public_enc_data;
525  size_t public_enc_len;
526  void *secret_enc_data;
527  size_t secret_enc_len;
528  void *sig_enc_data;
529  size_t sig_enc_length;
530  void *sig_enc_data_comp;
531  size_t sig_enc_length_comp;
532 
533  if (GNUNET_OK != expect_data_fixed (vec,
534  "message_hash",
535  &message_hash,
536  sizeof (message_hash)))
537  {
538  GNUNET_break (0);
539  return GNUNET_SYSERR;
540  }
541 
542  if (GNUNET_OK != expect_data_fixed (vec,
543  "blinding_key_secret",
544  &bks,
545  sizeof (bks)))
546  {
547  GNUNET_break (0);
548  return GNUNET_SYSERR;
549  }
550 
551  if (GNUNET_OK != expect_data_dynamic (vec,
552  "blinded_message",
553  &blinded_data,
554  &blinded_len))
555  {
556  GNUNET_break (0);
557  return GNUNET_SYSERR;
558  }
559 
560  if (GNUNET_OK != expect_data_dynamic (vec,
561  "rsa_public_key",
562  &public_enc_data,
563  &public_enc_len))
564  {
565  GNUNET_break (0);
566  return GNUNET_SYSERR;
567  }
568 
569  if (GNUNET_OK != expect_data_dynamic (vec,
570  "rsa_private_key",
571  &secret_enc_data,
572  &secret_enc_len))
573  {
574  GNUNET_break (0);
575  return GNUNET_SYSERR;
576  }
577 
578  if (GNUNET_OK != expect_data_dynamic (vec,
579  "sig",
580  &sig_enc_data,
581  &sig_enc_length))
582  {
583  GNUNET_break (0);
584  return GNUNET_SYSERR;
585  }
586 
587  pkey = GNUNET_CRYPTO_rsa_public_key_decode (public_enc_data,
588  public_enc_len);
589  GNUNET_assert (NULL != pkey);
590  skey = GNUNET_CRYPTO_rsa_private_key_decode (secret_enc_data,
591  secret_enc_len);
592  GNUNET_assert (NULL != skey);
593 
595  GNUNET_CRYPTO_rsa_blind (&message_hash,
596  &bks,
597  pkey,
598  &blinded_data_comp,
599  &blinded_len_comp));
600  if ( (blinded_len != blinded_len_comp) || (0 != memcmp (blinded_data,
601  blinded_data_comp,
602  blinded_len)) )
603  {
604  GNUNET_break (0);
605  return GNUNET_NO;
606  }
607  blinded_sig = GNUNET_CRYPTO_rsa_sign_blinded (skey, blinded_data,
608  blinded_len);
609  sig = GNUNET_CRYPTO_rsa_unblind (blinded_sig, &bks, pkey);
610  GNUNET_assert (GNUNET_YES == GNUNET_CRYPTO_rsa_verify (&message_hash, sig,
611  pkey));
612  public_enc_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey,
613  &public_enc_data);
614  sig_enc_length_comp = GNUNET_CRYPTO_rsa_signature_encode (sig, &sig_enc_data_comp);
615 
616  if ( (sig_enc_length != sig_enc_length_comp) ||
617  (0 != memcmp (sig_enc_data, sig_enc_data_comp, sig_enc_length) ))
618  {
619  GNUNET_break (0);
620  return GNUNET_NO;
621  }
622  }
623  else
624  {
626  "unsupported operation '%s'\n", operation);
627  }
628 
629  return GNUNET_OK;
630 }
struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_decode(const void *buf, size_t buf_size)
Decode the private key from the data-format back to the "normal", internal format.
Definition: crypto_rsa.c:203
static int expect_data_dynamic(json_t *vec, const char *name, void **data, size_t *ret_len)
int GNUNET_CRYPTO_rsa_blind(const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, struct GNUNET_CRYPTO_RsaPublicKey *pkey, void **buf, size_t *buf_size)
Blinds the given message with the given blinding key.
Definition: crypto_rsa.c:744
static char * pkey
Public key of the zone to look in, in ASCII.
#define GNUNET_CRYPTO_eddsa_sign(priv, ps, sig)
EdDSA sign a given block.
an RSA signature
Definition: crypto_rsa.c:63
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_rsa_verify(const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_RsaSignature *sig, const struct GNUNET_CRYPTO_RsaPublicKey *public_key)
Verify whether the given hash corresponds to the given signature and the signature is valid with resp...
Definition: crypto_rsa.c:1128
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
size_t GNUNET_CRYPTO_rsa_signature_encode(const struct GNUNET_CRYPTO_RsaSignature *sig, void **buffer)
Encode the given signature in a format suitable for storing it into a file.
Definition: crypto_rsa.c:952
#define GNUNET_CRYPTO_eddsa_verify(purp, ps, sig, pub)
Verify EdDSA signature.
static int expect_data_fixed(json_t *vec, const char *name, void *data, size_t expect_len)
The public information of an RSA key pair.
Definition: crypto_rsa.c:51
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdh_eddsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EddsaPublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a EdDSA public key and a private ECDH key.
Definition: crypto_ecc.c:867
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_public_key_decode(const char *buf, size_t len)
Decode the public key from the data-format back to the "normal", internal format. ...
Definition: crypto_rsa.c:383
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_kdf(void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...)
Derive key.
Definition: crypto_kdf.c:90
#define GNUNET_SIGNATURE_PURPOSE_TEST
Test signature, not valid for anything other than writing a test.
A 512-bit hashcode.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_ecdh(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a public and a private ECC key.
Definition: crypto_ecc.c:685
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_unblind(const struct GNUNET_CRYPTO_RsaSignature *sig, const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, struct GNUNET_CRYPTO_RsaPublicKey *pkey)
Unblind a blind-signed signature.
Definition: crypto_rsa.c:1047
Private ECC key encoded for transmission.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
an ECC signature using EdDSA.
void GNUNET_CRYPTO_eddsa_key_get_public(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:181
static struct GNUNET_CRYPTO_PowSalt salt
Salt for PoW calcualations.
Private ECC key encoded for transmission.
static struct GNUNET_CRYPTO_EddsaPublicKey pub
Definition: gnunet-scrypt.c:46
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_sign_blinded(const struct GNUNET_CRYPTO_RsaPrivateKey *key, const void *msg, size_t msg_len)
Sign a blinded value, which must be a full domain hash of a message.
Definition: crypto_rsa.c:900
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
#define GNUNET_log(kind,...)
The private information of an RSA key pair.
Definition: crypto_rsa.c:39
Constant-size pre-secret for blinding key generation.
size_t GNUNET_CRYPTO_rsa_public_key_encode(const struct GNUNET_CRYPTO_RsaPublicKey *key, void **buffer)
Encode the public key in a format suitable for storing it into a file.
Definition: crypto_rsa.c:300
Sample signature struct.
uint32_t data
The data value.
#define GNUNET_malloc(size)
Wrapper around malloc.
Public ECC key (always for curve Ed25519) encoded in a format suitable for network transmission and E...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_vectors()

static int check_vectors ( )
static

Check test vectors from stdin.

Returns
global exit code

Definition at line 638 of file gnunet-crypto-tvg.c.

References checkvec(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, op, ret, and value.

Referenced by run().

639 {
640  json_error_t err;
641  json_t *vecfile = json_loadf (stdin, 0, &err);
642  const char *encoding;
643  json_t *vectors;
644 
645  if (NULL == vecfile)
646  {
647  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "unable to parse JSON\n");
648  return 1;
649  }
650  encoding = json_string_value (json_object_get (vecfile,
651  "encoding"));
652  if ( (NULL == encoding) || (0 != strcmp (encoding, "base32crockford")) )
653  {
654  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "unsupported or missing encoding\n");
655  json_decref (vecfile);
656  return 1;
657  }
658  vectors = json_object_get (vecfile, "vectors");
659  if (!json_is_array (vectors))
660  {
661  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "bad vectors\n");
662  json_decref (vecfile);
663  return 1;
664  }
665  {
666  /* array is a JSON array */
667  size_t index;
668  json_t *value;
669  int ret;
670 
671  json_array_foreach (vectors, index, value) {
672  const char *op = json_string_value (json_object_get (value,
673  "operation"));
674 
675  if (NULL == op)
676  {
678  "missing operation\n");
679  ret = GNUNET_SYSERR;
680  break;
681  }
682  ret = checkvec (op, value);
683  if (GNUNET_OK != ret)
684  {
686  "bad vector %u\n",
687  (unsigned int) index);
688  break;
689  }
690  }
691  return (ret == GNUNET_OK) ? 0 : 1;
692  }
693 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static char * value
Value of the record to add/remove.
#define GNUNET_log(kind,...)
static int checkvec(const char *operation, json_t *vec)
Check a single vector.
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
Here is the call graph for this function:
Here is the caller graph for this function:

◆ output_vectors()

static int output_vectors ( )
static

Output test vectors.

Returns
global exit code

Definition at line 701 of file gnunet-crypto-tvg.c.

References ctx, d2j(), GNUNET_assert, GNUNET_CRYPTO_ecc_ecdh(), GNUNET_CRYPTO_ecdh_eddsa(), GNUNET_CRYPTO_ecdhe_key_create(), GNUNET_CRYPTO_ecdhe_key_get_public(), GNUNET_CRYPTO_eddsa_key_create(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_CRYPTO_eddsa_sign, GNUNET_CRYPTO_eddsa_verify, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_kdf(), GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_block(), GNUNET_CRYPTO_rsa_blind(), GNUNET_CRYPTO_rsa_private_key_create(), GNUNET_CRYPTO_rsa_private_key_encode(), GNUNET_CRYPTO_rsa_private_key_free(), GNUNET_CRYPTO_rsa_private_key_get_public(), GNUNET_CRYPTO_rsa_public_key_encode(), GNUNET_CRYPTO_rsa_public_key_free(), GNUNET_CRYPTO_rsa_sign_blinded(), GNUNET_CRYPTO_rsa_signature_encode(), GNUNET_CRYPTO_rsa_signature_free(), GNUNET_CRYPTO_rsa_unblind(), GNUNET_CRYPTO_rsa_verify(), GNUNET_free, GNUNET_OK, GNUNET_SIGNATURE_PURPOSE_TEST, GNUNET_YES, pkey, GNUNET_CRYPTO_EccSignaturePurpose::purpose, TestSignatureDataPS::purpose, salt, GNUNET_CRYPTO_EccSignaturePurpose::size, uint2j(), and vec_for().

Referenced by run().

702 {
703  json_t *vecfile = json_object ();
704  json_t *vecs = json_array ();
705 
706  json_object_set_new (vecfile,
707  "encoding",
708  json_string ("base32crockford"));
709  json_object_set_new (vecfile,
710  "producer",
711  json_string ("GNUnet " PACKAGE_VERSION " " VCS_VERSION));
712  json_object_set_new (vecfile,
713  "vectors",
714  vecs);
715 
716  {
717  json_t *vec = vec_for (vecs, "hash");
718  struct GNUNET_HashCode hc;
719  char *str = "Hello, GNUnet";
720 
721  GNUNET_CRYPTO_hash (str, strlen (str), &hc);
722 
723  d2j (vec, "input", str, strlen (str));
724  d2j (vec, "output", &hc, sizeof (struct GNUNET_HashCode));
725  }
726  {
727  json_t *vec = vec_for (vecs, "ecc_ecdh");
728  struct GNUNET_CRYPTO_EcdhePrivateKey priv1;
729  struct GNUNET_CRYPTO_EcdhePublicKey pub1;
730  struct GNUNET_CRYPTO_EcdhePrivateKey priv2;
731  struct GNUNET_HashCode skm;
732 
736  &pub1);
738  GNUNET_CRYPTO_ecc_ecdh (&priv2,
739  &pub1,
740  &skm));
741 
742  d2j (vec,
743  "priv1",
744  &priv1,
745  sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
746  d2j (vec,
747  "pub1",
748  &pub1,
749  sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
750  d2j (vec,
751  "priv2",
752  &priv2,
753  sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
754  d2j (vec,
755  "skm",
756  &skm,
757  sizeof (struct GNUNET_HashCode));
758  }
759 
760  {
761  json_t *vec = vec_for (vecs, "eddsa_key_derivation");
762  struct GNUNET_CRYPTO_EddsaPrivateKey priv;
764 
767  &pub);
768 
769  d2j (vec,
770  "priv",
771  &priv,
772  sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey));
773  d2j (vec,
774  "pub",
775  &pub,
776  sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
777  }
778  {
779  json_t *vec = vec_for (vecs, "eddsa_signing");
780  struct GNUNET_CRYPTO_EddsaPrivateKey priv;
782  struct GNUNET_CRYPTO_EddsaSignature sig;
783  struct TestSignatureDataPS data = { 0 };
784 
787  &pub);
788  data.purpose.size = htonl (sizeof (data));
791  &data,
792  &sig);
795  &data,
796  &sig,
797  &pub));
798 
799  d2j (vec,
800  "priv",
801  &priv,
802  sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey));
803  d2j (vec,
804  "pub",
805  &pub,
806  sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
807  d2j (vec,
808  "data",
809  &data,
810  sizeof (struct TestSignatureDataPS));
811  d2j (vec,
812  "sig",
813  &sig,
814  sizeof (struct GNUNET_CRYPTO_EddsaSignature));
815  }
816 
817  {
818  json_t *vec = vec_for (vecs, "kdf");
819  size_t out_len = 64;
820  char out[out_len];
821  char *ikm = "I'm the secret input key material";
822  char *salt = "I'm very salty";
823  char *ctx = "I'm a context chunk, also known as 'info' in the RFC";
824 
826  GNUNET_CRYPTO_kdf (&out,
827  out_len,
828  salt,
829  strlen (salt),
830  ikm,
831  strlen (ikm),
832  ctx,
833  strlen (ctx),
834  NULL));
835 
836  d2j (vec,
837  "salt",
838  salt,
839  strlen (salt));
840  d2j (vec,
841  "ikm",
842  ikm,
843  strlen (ikm));
844  d2j (vec,
845  "ctx",
846  ctx,
847  strlen (ctx));
848  uint2j (vec,
849  "out_len",
850  (unsigned int) out_len);
851  d2j (vec,
852  "out",
853  out,
854  out_len);
855  }
856  {
857  json_t *vec = vec_for (vecs, "eddsa_ecdh");
858  struct GNUNET_CRYPTO_EcdhePrivateKey priv_ecdhe;
859  struct GNUNET_CRYPTO_EcdhePublicKey pub_ecdhe;
860  struct GNUNET_CRYPTO_EddsaPrivateKey priv_eddsa;
861  struct GNUNET_CRYPTO_EddsaPublicKey pub_eddsa;
862  struct GNUNET_HashCode key_material;
863 
864  GNUNET_CRYPTO_ecdhe_key_create (&priv_ecdhe);
865  GNUNET_CRYPTO_ecdhe_key_get_public (&priv_ecdhe, &pub_ecdhe);
866  GNUNET_CRYPTO_eddsa_key_create (&priv_eddsa);
867  GNUNET_CRYPTO_eddsa_key_get_public (&priv_eddsa, &pub_eddsa);
868  GNUNET_CRYPTO_ecdh_eddsa (&priv_ecdhe, &pub_eddsa, &key_material);
869 
870  d2j (vec, "priv_ecdhe",
871  &priv_ecdhe,
872  sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
873  d2j (vec, "pub_ecdhe",
874  &pub_ecdhe,
875  sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
876  d2j (vec, "priv_eddsa",
877  &priv_eddsa,
878  sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey));
879  d2j (vec, "pub_eddsa",
880  &pub_eddsa,
881  sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
882  d2j (vec, "key_material",
883  &key_material,
884  sizeof (struct GNUNET_HashCode));
885  }
886 
887  {
888  json_t *vec = vec_for (vecs, "rsa_blind_signing");
889 
890  struct GNUNET_CRYPTO_RsaPrivateKey *skey;
892  struct GNUNET_HashCode message_hash;
894  struct GNUNET_CRYPTO_RsaSignature *blinded_sig;
895  struct GNUNET_CRYPTO_RsaSignature *sig;
896  void *blinded_data;
897  size_t blinded_len;
898  void *public_enc_data;
899  size_t public_enc_len;
900  void *secret_enc_data;
901  size_t secret_enc_len;
902  void *blinded_sig_enc_data;
903  size_t blinded_sig_enc_length;
904  void *sig_enc_data;
905  size_t sig_enc_length;
906 
910  &message_hash,
911  sizeof (struct GNUNET_HashCode));
913  &bks,
914  sizeof (struct
917  GNUNET_CRYPTO_rsa_blind (&message_hash,
918  &bks,
919  pkey,
920  &blinded_data,
921  &blinded_len));
922  blinded_sig = GNUNET_CRYPTO_rsa_sign_blinded (skey, blinded_data,
923  blinded_len);
924  sig = GNUNET_CRYPTO_rsa_unblind (blinded_sig, &bks, pkey);
925  GNUNET_assert (GNUNET_YES == GNUNET_CRYPTO_rsa_verify (&message_hash, sig,
926  pkey));
927  public_enc_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey,
928  &public_enc_data);
929  secret_enc_len = GNUNET_CRYPTO_rsa_private_key_encode (skey,
930  &secret_enc_data);
931  blinded_sig_enc_length = GNUNET_CRYPTO_rsa_signature_encode (blinded_sig,
932  &
933  blinded_sig_enc_data);
934  sig_enc_length = GNUNET_CRYPTO_rsa_signature_encode (sig, &sig_enc_data);
935  d2j (vec,
936  "message_hash",
937  &message_hash,
938  sizeof (struct GNUNET_HashCode));
939  d2j (vec,
940  "rsa_public_key",
941  public_enc_data,
942  public_enc_len);
943  d2j (vec,
944  "rsa_private_key",
945  secret_enc_data,
946  secret_enc_len);
947  d2j (vec,
948  "blinding_key_secret",
949  &bks,
950  sizeof (struct GNUNET_CRYPTO_RsaBlindingKeySecret));
951  d2j (vec,
952  "blinded_message",
953  blinded_data,
954  blinded_len);
955  d2j (vec,
956  "blinded_sig",
957  blinded_sig_enc_data,
958  blinded_sig_enc_length);
959  d2j (vec,
960  "sig",
961  sig_enc_data,
962  sig_enc_length);
966  GNUNET_CRYPTO_rsa_signature_free (blinded_sig);
967  GNUNET_free (public_enc_data);
968  GNUNET_free (blinded_data);
969  GNUNET_free (sig_enc_data);
970  GNUNET_free (blinded_sig_enc_data);
971  }
972 
973  json_dumpf (vecfile, stdout, JSON_INDENT (2));
974  json_decref (vecfile);
975  printf ("\n");
976 
977  return 0;
978 }
int GNUNET_CRYPTO_rsa_blind(const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, struct GNUNET_CRYPTO_RsaPublicKey *pkey, void **buf, size_t *buf_size)
Blinds the given message with the given blinding key.
Definition: crypto_rsa.c:744
static char * pkey
Public key of the zone to look in, in ASCII.
#define GNUNET_CRYPTO_eddsa_sign(priv, ps, sig)
EdDSA sign a given block.
an RSA signature
Definition: crypto_rsa.c:63
void GNUNET_CRYPTO_rsa_signature_free(struct GNUNET_CRYPTO_RsaSignature *sig)
Free memory occupied by signature.
Definition: crypto_rsa.c:944
uint32_t purpose
What does this signature vouch for? This must contain a GNUNET_SIGNATURE_PURPOSE_XXX constant (from g...
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_rsa_verify(const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_RsaSignature *sig, const struct GNUNET_CRYPTO_RsaPublicKey *public_key)
Verify whether the given hash corresponds to the given signature and the signature is valid with resp...
Definition: crypto_rsa.c:1128
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
size_t GNUNET_CRYPTO_rsa_signature_encode(const struct GNUNET_CRYPTO_RsaSignature *sig, void **buffer)
Encode the given signature in a format suitable for storing it into a file.
Definition: crypto_rsa.c:952
struct GNUNET_CRYPTO_RsaPrivateKey * GNUNET_CRYPTO_rsa_private_key_create(unsigned int len)
Create a new private key.
Definition: crypto_rsa.c:143
#define GNUNET_CRYPTO_eddsa_verify(purp, ps, sig, pub)
Verify EdDSA signature.
The public information of an RSA key pair.
Definition: crypto_rsa.c:51
static void d2j(json_t *vec, const char *label, const void *data, size_t size)
Add a base32crockford encoded value to a test vector.
size_t GNUNET_CRYPTO_rsa_private_key_encode(const struct GNUNET_CRYPTO_RsaPrivateKey *key, void **buffer)
Encode the private key in a format suitable for storing it into a file.
Definition: crypto_rsa.c:180
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
void GNUNET_CRYPTO_ecdhe_key_create(struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:419
static void uint2j(json_t *vec, const char *label, unsigned int num)
Add a number to a test vector.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdh_eddsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EddsaPublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a EdDSA public key and a private ECDH key.
Definition: crypto_ecc.c:867
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_kdf(void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...)
Derive key.
Definition: crypto_kdf.c:90
#define GNUNET_SIGNATURE_PURPOSE_TEST
Test signature, not valid for anything other than writing a test.
static json_t * vec_for(json_t *vecs, const char *vecname)
Create a fresh test vector for a given operation label.
uint32_t size
How many bytes does this signature sign? (including this purpose header); in network byte order (!)...
A 512-bit hashcode.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecc_ecdh(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a public and a private ECC key.
Definition: crypto_ecc.c:685
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_unblind(const struct GNUNET_CRYPTO_RsaSignature *sig, const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, struct GNUNET_CRYPTO_RsaPublicKey *pkey)
Unblind a blind-signed signature.
Definition: crypto_rsa.c:1047
Private ECC key encoded for transmission.
void GNUNET_CRYPTO_ecdhe_key_get_public(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, struct GNUNET_CRYPTO_EcdhePublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:197
void GNUNET_CRYPTO_eddsa_key_create(struct GNUNET_CRYPTO_EddsaPrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:445
an ECC signature using EdDSA.
void GNUNET_CRYPTO_eddsa_key_get_public(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:181
static struct GNUNET_CRYPTO_PowSalt salt
Salt for PoW calcualations.
Private ECC key encoded for transmission.
static struct GNUNET_CRYPTO_EddsaPublicKey pub
Definition: gnunet-scrypt.c:46
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_sign_blinded(const struct GNUNET_CRYPTO_RsaPrivateKey *key, const void *msg, size_t msg_len)
Sign a blinded value, which must be a full domain hash of a message.
Definition: crypto_rsa.c:900
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
The private information of an RSA key pair.
Definition: crypto_rsa.c:39
void GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length)
Fill block with a random values.
struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_private_key_get_public(const struct GNUNET_CRYPTO_RsaPrivateKey *priv)
Extract the public key of the given private key.
Definition: crypto_rsa.c:232
Constant-size pre-secret for blinding key generation.
void GNUNET_CRYPTO_rsa_public_key_free(struct GNUNET_CRYPTO_RsaPublicKey *key)
Free memory occupied by the public key.
Definition: crypto_rsa.c:267
size_t GNUNET_CRYPTO_rsa_public_key_encode(const struct GNUNET_CRYPTO_RsaPublicKey *key, void **buffer)
Encode the public key in a format suitable for storing it into a file.
Definition: crypto_rsa.c:300
Sample signature struct.
uint32_t data
The data value.
void GNUNET_CRYPTO_rsa_private_key_free(struct GNUNET_CRYPTO_RsaPrivateKey *key)
Free memory occupied by the private key.
Definition: crypto_rsa.c:172
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
#define GNUNET_free(ptr)
Wrapper around free.
Public ECC key (always for curve Ed25519) encoded in a format suitable for network transmission and E...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle cfg 
)
static

Main function that will be run.

Parameters
clsclosure
argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)
cfgconfiguration

Definition at line 989 of file gnunet-crypto-tvg.c.

References check_vectors(), global_ret, GNUNET_YES, output_vectors(), and verify_flag.

Referenced by main().

993 {
994  if (GNUNET_YES == verify_flag)
996  else
998 }
static GNUNET_NETWORK_STRUCT_END int verify_flag
Should we verify or output test vectors?
static int global_ret
Global exit code.
static int output_vectors()
Output test vectors.
static int check_vectors()
Check test vectors from stdin.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const *  argv 
)

The main function of the test vector generation tool.

Parameters
argcnumber of arguments from the command line
argvcommand line arguments
Returns
0 ok, 1 on error

Definition at line 1009 of file gnunet-crypto-tvg.c.

References gettext_noop, global_ret, GNUNET_assert, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_log_setup(), GNUNET_OK, GNUNET_PROGRAM_run(), run(), and verify_flag.

1011 {
1012  const struct GNUNET_GETOPT_CommandLineOption options[] = {
1014  "verify",
1015  gettext_noop (
1016  "verify a test vector from stdin"),
1017  &verify_flag),
1019  };
1020 
1022  GNUNET_log_setup ("gnunet-crypto-tvg",
1023  "INFO",
1024  NULL));
1025  if (GNUNET_OK !=
1026  GNUNET_PROGRAM_run (argc, argv,
1027  "gnunet-crypto-tvg",
1028  "Generate test vectors for cryptographic operations",
1029  options,
1030  &run, NULL))
1031  return 1;
1032  return global_ret;
1033 }
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).
Definition: program.c:363
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static GNUNET_NETWORK_STRUCT_END int verify_flag
Should we verify or output test vectors?
Definition of a command line option.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
static int global_ret
Global exit code.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:

Variable Documentation

◆ verify_flag

GNUNET_NETWORK_STRUCT_END int verify_flag = GNUNET_NO
static

Should we verify or output test vectors?

Definition at line 76 of file gnunet-crypto-tvg.c.

Referenced by main(), and run().

◆ global_ret

int global_ret = 0
static

Global exit code.

Definition at line 82 of file gnunet-crypto-tvg.c.

Referenced by main(), and run().