#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_signatures.h"
#include <jansson.h>
#include <gcrypt.h>
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... | |
|
static |
Create a fresh test vector for a given operation label.
vecs | array of vectors to append the new vector to |
vecname | label for the operation of the vector |
Definition at line 93 of file gnunet-crypto-tvg.c.
References t.
Referenced by output_vectors().
|
static |
Add a base32crockford encoded value to a test vector.
vec | test vector to add to |
label | label for the value |
data | data to add |
size | size of data |
Definition at line 115 of file gnunet-crypto-tvg.c.
References data, GNUNET_break, GNUNET_free, GNUNET_STRINGS_data_to_string_alloc(), and size.
Referenced by output_vectors().
|
static |
Add a number to a test vector.
vec | test vector to add to |
label | label for the value |
data | data to add |
size | size of data |
Definition at line 141 of file gnunet-crypto-tvg.c.
Referenced by output_vectors().
|
static |
Definition at line 152 of file gnunet-crypto-tvg.c.
References data, GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_string_to_data(), and name.
Referenced by checkvec().
|
static |
Definition at line 172 of file gnunet-crypto-tvg.c.
References data, GNUNET_free, GNUNET_malloc, GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_string_to_data(), and name.
Referenced by checkvec().
|
static |
Check a single vector.
operation | operator of the vector |
vec | the vector, a JSON object. |
Definition at line 208 of file gnunet-crypto-tvg.c.
References alpha, GNUNET_CRYPTO_CsBlindSignature::b, beta, GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg, GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg_size, GNUNET_CRYPTO_CsBlindingNonce::bnonce, GNUNET_CRYPTO_CsBlindedMessage::c, ctx, data, expect_data_dynamic(), expect_data_fixed(), GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_cs_blinding_secrets_derive(), GNUNET_CRYPTO_cs_calc_blinded_c(), GNUNET_CRYPTO_cs_r_derive(), GNUNET_CRYPTO_cs_r_get_public(), GNUNET_CRYPTO_cs_sign_derive(), GNUNET_CRYPTO_cs_unblind(), GNUNET_CRYPTO_cs_verify(), 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_blinded_message_free(), GNUNET_CRYPTO_rsa_private_key_decode(), GNUNET_CRYPTO_rsa_private_key_free(), GNUNET_CRYPTO_rsa_public_key_decode(), 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_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_log, GNUNET_malloc, GNUNET_memcmp, GNUNET_NO, GNUNET_OK, GNUNET_SIGNATURE_PURPOSE_TEST, GNUNET_SYSERR, GNUNET_YES, pkey, pub, GNUNET_CRYPTO_CsSignature::r_point, GNUNET_CRYPTO_CSPublicRPairP::r_pub, GNUNET_CRYPTO_CsSignature::s_scalar, GNUNET_CRYPTO_CsBlindSignature::s_scalar, salt, and GNUNET_CRYPTO_CsSessionNonce::snonce.
Referenced by check_vectors().
|
static |
Check test vectors from stdin.
Definition at line 997 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().
|
static |
Output test vectors.
Definition at line 1062 of file gnunet-crypto-tvg.c.
References alpha, GNUNET_CRYPTO_CsBlindSignature::b, beta, GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg, GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg_size, GNUNET_CRYPTO_CsBlindingNonce::bnonce, GNUNET_CRYPTO_CsBlindedMessage::c, ctx, d2j(), data, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_cs_blinding_secrets_derive(), GNUNET_CRYPTO_cs_calc_blinded_c(), GNUNET_CRYPTO_cs_private_key_generate(), GNUNET_CRYPTO_cs_private_key_get_public(), GNUNET_CRYPTO_cs_r_derive(), GNUNET_CRYPTO_cs_r_get_public(), GNUNET_CRYPTO_cs_sign_derive(), GNUNET_CRYPTO_cs_unblind(), GNUNET_CRYPTO_cs_verify(), 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_edx25519_key_create(), GNUNET_CRYPTO_edx25519_key_get_public(), GNUNET_CRYPTO_edx25519_private_key_derive(), GNUNET_CRYPTO_edx25519_public_key_derive(), GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_hkdf_gnunet(), GNUNET_CRYPTO_kdf(), GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_block(), GNUNET_CRYPTO_rsa_blind(), GNUNET_CRYPTO_rsa_blinded_message_free(), 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_SYSERR, GNUNET_YES, pkey, pub, GNUNET_CRYPTO_CsSignature::r_point, GNUNET_CRYPTO_CSPublicRPairP::r_pub, GNUNET_CRYPTO_CsSignature::s_scalar, GNUNET_CRYPTO_CsBlindSignature::s_scalar, salt, seed, GNUNET_CRYPTO_CsSessionNonce::snonce, uint2j(), and vec_for().
Referenced by run().
|
static |
Main function that will be run.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 1560 of file gnunet-crypto-tvg.c.
References check_vectors(), global_ret, GNUNET_YES, output_vectors(), and verify_flag.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function of the test vector generation tool.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 1580 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_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), options, run(), and verify_flag.
|
static |
Should we verify or output test vectors?
Definition at line 76 of file gnunet-crypto-tvg.c.
|
static |
Global exit code.
Definition at line 82 of file gnunet-crypto-tvg.c.