summaryrefslogtreecommitdiff
path: root/src/exchange-tools
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-08-25 16:18:24 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-08-25 16:18:24 +0200
commiteb559970846f0fa27f1f25c482cd07210a56f4b1 (patch)
tree8526637825e520e1420b17515934ced794a33c01 /src/exchange-tools
parent3742239c13001433eeade439a0e0490f07351c43 (diff)
downloadexchange-eb559970846f0fa27f1f25c482cd07210a56f4b1.tar.gz
exchange-eb559970846f0fa27f1f25c482cd07210a56f4b1.tar.bz2
exchange-eb559970846f0fa27f1f25c482cd07210a56f4b1.zip
re-format code
Diffstat (limited to 'src/exchange-tools')
-rw-r--r--src/exchange-tools/taler-exchange-dbinit.c28
-rw-r--r--src/exchange-tools/taler-exchange-keycheck.c44
-rw-r--r--src/exchange-tools/taler-exchange-keyup.c63
-rw-r--r--src/exchange-tools/taler-exchange-wire.c14
-rw-r--r--src/exchange-tools/taler-wire.c78
5 files changed, 125 insertions, 102 deletions
diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c
index 77aef1ee5..afc1b837e 100644
--- a/src/exchange-tools/taler-exchange-dbinit.c
+++ b/src/exchange-tools/taler-exchange-dbinit.c
@@ -74,11 +74,11 @@ run (void *cls,
return;
}
if (gc_db)
- {
- if (GNUNET_SYSERR == plugin->gc (plugin->cls))
- fprintf (stderr,
- "Garbage collection failed!\n");
- }
+ {
+ if (GNUNET_SYSERR == plugin->gc (plugin->cls))
+ fprintf (stderr,
+ "Garbage collection failed!\n");
+ }
TALER_EXCHANGEDB_plugin_unload (plugin);
}
@@ -97,13 +97,13 @@ main (int argc,
{
const struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_flag ('r',
- "reset",
- "reset database (DANGEROUS: all existing data is lost!)",
- &reset_db),
+ "reset",
+ "reset database (DANGEROUS: all existing data is lost!)",
+ &reset_db),
GNUNET_GETOPT_option_flag ('g',
- "gc",
- "garbage collect database",
- &gc_db),
+ "gc",
+ "garbage collect database",
+ &gc_db),
GNUNET_GETOPT_OPTION_END
};
@@ -118,9 +118,9 @@ main (int argc,
if (GNUNET_OK !=
GNUNET_PROGRAM_run (argc, argv,
"taler-exchange-dbinit",
- "Initialize Taler exchange database",
- options,
- &run, NULL))
+ "Initialize Taler exchange database",
+ options,
+ &run, NULL))
return 1;
return global_ret;
}
diff --git a/src/exchange-tools/taler-exchange-keycheck.c b/src/exchange-tools/taler-exchange-keycheck.c
index c657454af..ac452a058 100644
--- a/src/exchange-tools/taler-exchange-keycheck.c
+++ b/src/exchange-tools/taler-exchange-keycheck.c
@@ -61,7 +61,7 @@ signkeys_iter (void *cls,
"Iterating over key `%s' for start time %s\n",
filename,
GNUNET_STRINGS_absolute_time_to_string
- (GNUNET_TIME_absolute_ntoh (ski->issue.start)));
+ (GNUNET_TIME_absolute_ntoh (ski->issue.start)));
if (ntohl (ski->issue.purpose.size) !=
(sizeof (struct TALER_ExchangeSigningKeyValidityPS)))
@@ -71,9 +71,12 @@ signkeys_iter (void *cls,
filename);
return GNUNET_SYSERR;
}
- if ( (0 != GNUNET_TIME_absolute_ntoh (ski->issue.start).abs_value_us % 1000000) ||
- (0 != GNUNET_TIME_absolute_ntoh (ski->issue.expire).abs_value_us % 1000000) ||
- (0 != GNUNET_TIME_absolute_ntoh (ski->issue.end).abs_value_us % 1000000) )
+ if ( (0 != GNUNET_TIME_absolute_ntoh (ski->issue.start).abs_value_us
+ % 1000000) ||
+ (0 != GNUNET_TIME_absolute_ntoh (ski->issue.expire).abs_value_us
+ % 1000000) ||
+ (0 != GNUNET_TIME_absolute_ntoh (ski->issue.end).abs_value_us
+ % 1000000) )
{
fprintf (stderr,
"Timestamps are not multiples of a round second\n");
@@ -127,7 +130,8 @@ exchange_signkeys_check ()
static int
denomkeys_iter (void *cls,
const char *alias,
- const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
+ const struct
+ TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
{
struct GNUNET_HashCode hc;
@@ -140,10 +144,14 @@ denomkeys_iter (void *cls,
return GNUNET_SYSERR;
}
- if ( (0 != GNUNET_TIME_absolute_ntoh (dki->issue.properties.start).abs_value_us % 1000000) ||
- (0 != GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_withdraw).abs_value_us % 1000000) ||
- (0 != GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_legal).abs_value_us % 1000000) ||
- (0 != GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_deposit).abs_value_us % 1000000) )
+ if ( (0 != GNUNET_TIME_absolute_ntoh (
+ dki->issue.properties.start).abs_value_us % 1000000) ||
+ (0 != GNUNET_TIME_absolute_ntoh (
+ dki->issue.properties.expire_withdraw).abs_value_us % 1000000) ||
+ (0 != GNUNET_TIME_absolute_ntoh (
+ dki->issue.properties.expire_legal).abs_value_us % 1000000) ||
+ (0 != GNUNET_TIME_absolute_ntoh (
+ dki->issue.properties.expire_deposit).abs_value_us % 1000000) )
{
fprintf (stderr,
"Timestamps are not multiples of a round second\n");
@@ -151,10 +159,11 @@ denomkeys_iter (void *cls,
}
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY,
- &dki->issue.properties.purpose,
- &dki->issue.signature.eddsa_signature,
- &dki->issue.properties.master.eddsa_pub))
+ GNUNET_CRYPTO_eddsa_verify (
+ TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY,
+ &dki->issue.properties.purpose,
+ &dki->issue.signature.eddsa_signature,
+ &dki->issue.properties.master.eddsa_pub))
{
fprintf (stderr,
"Denomination key for `%s' has invalid signature\n",
@@ -194,7 +203,8 @@ exchange_denomkeys_check ()
"exchange",
"master_public_key",
&master_public_key_from_cfg,
- sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))
+ sizeof (struct
+ GNUNET_CRYPTO_EddsaPublicKey)))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange",
@@ -268,9 +278,9 @@ main (int argc, char *const *argv)
if (GNUNET_OK !=
GNUNET_PROGRAM_run (argc, argv,
"taler-exchange-keycheck",
- "Check keys of the exchange for validity",
- options,
- &run, NULL))
+ "Check keys of the exchange for validity",
+ options,
+ &run, NULL))
return 1;
return global_ret;
diff --git a/src/exchange-tools/taler-exchange-keyup.c b/src/exchange-tools/taler-exchange-keyup.c
index 4c8682e54..8486f02cf 100644
--- a/src/exchange-tools/taler-exchange-keyup.c
+++ b/src/exchange-tools/taler-exchange-keyup.c
@@ -297,7 +297,8 @@ get_cointype_dir (const struct CoinTypeParams *p)
hash_coin_type (p, &hash);
hash_str = GNUNET_STRINGS_data_to_string_alloc (&hash,
- sizeof (struct GNUNET_HashCode));
+ sizeof (struct
+ GNUNET_HashCode));
GNUNET_assert (NULL != hash_str);
GNUNET_assert (HASH_CUTOFF <= strlen (hash_str) + 1);
hash_str[HASH_CUTOFF] = 0;
@@ -311,7 +312,8 @@ get_cointype_dir (const struct CoinTypeParams *p)
GNUNET_snprintf (dir,
sizeof (dir),
- "%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_DENOMINATION_KEYS DIR_SEPARATOR_STR "%s-%s",
+ "%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_DENOMINATION_KEYS
+ DIR_SEPARATOR_STR "%s-%s",
exchange_directory,
val_str,
hash_str);
@@ -462,7 +464,8 @@ static void
create_signkey_issue_priv (struct GNUNET_TIME_Absolute start,
struct GNUNET_TIME_Relative duration,
struct GNUNET_TIME_Absolute end,
- struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP *pi)
+ struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP
+ *pi)
{
struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
struct TALER_ExchangeSigningKeyValidityPS *issue = &pi->issue;
@@ -478,7 +481,8 @@ create_signkey_issue_priv (struct GNUNET_TIME_Absolute start,
GNUNET_CRYPTO_eddsa_key_get_public (&pi->signkey_priv.eddsa_priv,
&issue->signkey_pub.eddsa_pub);
issue->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
- issue->purpose.size = htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS));
+ issue->purpose.size = htonl (sizeof (struct
+ TALER_ExchangeSigningKeyValidityPS));
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv,
&issue->purpose,
@@ -753,20 +757,23 @@ get_cointype_params (const char *ct,
*/
static void
create_denomkey_issue (const struct CoinTypeParams *params,
- struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
+ struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *
+ dki)
{
dki->denom_priv.rsa_private_key
= GNUNET_CRYPTO_rsa_private_key_create (params->rsa_keysize);
GNUNET_assert (NULL != dki->denom_priv.rsa_private_key);
dki->denom_pub.rsa_public_key
- = GNUNET_CRYPTO_rsa_private_key_get_public (dki->denom_priv.rsa_private_key);
+ = GNUNET_CRYPTO_rsa_private_key_get_public (
+ dki->denom_priv.rsa_private_key);
GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub.rsa_public_key,
&dki->issue.properties.denom_hash);
dki->issue.properties.master = master_public_key;
dki->issue.properties.start = GNUNET_TIME_absolute_hton (params->anchor);
dki->issue.properties.expire_withdraw =
- GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor,
- params->duration_withdraw));
+ GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor,
+ params->
+ duration_withdraw));
dki->issue.properties.expire_deposit =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor,
params->duration_spend));
@@ -803,7 +810,7 @@ create_denomkey_issue (const struct CoinTypeParams *params,
*/
static void
exchange_keys_update_cointype (void *cls,
- const char *coin_alias)
+ const char *coin_alias)
{
int *ret = cls;
struct CoinTypeParams p;
@@ -837,7 +844,7 @@ exchange_keys_update_cointype (void *cls,
GNUNET_STRINGS_relative_time_to_string
(GNUNET_TIME_absolute_get_difference (p.anchor,
lookahead_sign_stamp),
- GNUNET_NO));
+ GNUNET_NO));
dkf = get_cointype_file (&p,
p.anchor);
GNUNET_break (GNUNET_YES !=
@@ -853,14 +860,16 @@ exchange_keys_update_cointype (void *cls,
&denomkey_issue);
if (GNUNET_OK !=
TALER_EXCHANGEDB_denomination_key_write (dkf,
- &denomkey_issue))
+ &denomkey_issue))
{
fprintf (stderr,
"Failed to write denomination key information to file `%s'.\n",
dkf);
*ret = GNUNET_SYSERR;
- GNUNET_CRYPTO_rsa_private_key_free (denomkey_issue.denom_priv.rsa_private_key);
- GNUNET_CRYPTO_rsa_public_key_free (denomkey_issue.denom_pub.rsa_public_key);
+ GNUNET_CRYPTO_rsa_private_key_free (
+ denomkey_issue.denom_priv.rsa_private_key);
+ GNUNET_CRYPTO_rsa_public_key_free (
+ denomkey_issue.denom_pub.rsa_public_key);
return;
}
if ( (NULL != auditor_output_file) &&
@@ -875,11 +884,14 @@ exchange_keys_update_cointype (void *cls,
auditorrequestfile,
STRERROR (errno));
*ret = GNUNET_SYSERR;
- GNUNET_CRYPTO_rsa_private_key_free (denomkey_issue.denom_priv.rsa_private_key);
- GNUNET_CRYPTO_rsa_public_key_free (denomkey_issue.denom_pub.rsa_public_key);
+ GNUNET_CRYPTO_rsa_private_key_free (
+ denomkey_issue.denom_priv.rsa_private_key);
+ GNUNET_CRYPTO_rsa_public_key_free (
+ denomkey_issue.denom_pub.rsa_public_key);
return;
}
- GNUNET_CRYPTO_rsa_private_key_free (denomkey_issue.denom_priv.rsa_private_key);
+ GNUNET_CRYPTO_rsa_private_key_free (
+ denomkey_issue.denom_priv.rsa_private_key);
GNUNET_CRYPTO_rsa_public_key_free (denomkey_issue.denom_pub.rsa_public_key);
p.anchor = GNUNET_TIME_absolute_add (p.anchor,
p.duration_withdraw);
@@ -1146,7 +1158,7 @@ static int
revoke_denomination (const struct GNUNET_HashCode *hc)
{
char *basedir;
-
+
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (kcfg,
"exchange",
@@ -1193,7 +1205,7 @@ run (void *cls,
if (now.abs_value_us != now_tmp.abs_value_us)
{
- /* The user gave "--now", use it */
+ /* The user gave "--now", use it */
now = now_tmp;
}
/* The user _might_ have given "--now" but it matched
@@ -1331,7 +1343,8 @@ run (void *cls,
"exchange",
"master_public_key",
&master_public_key_from_cfg,
- sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))
+ sizeof (struct
+ GNUNET_CRYPTO_EddsaPublicKey)))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange",
@@ -1346,7 +1359,7 @@ run (void *cls,
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"exchange",
"master_public_key",
- _("does not match with private key"));
+ _ ("does not match with private key"));
global_ret = 1;
return;
}
@@ -1369,7 +1382,7 @@ run (void *cls,
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"exchange",
"lookahead_sign",
- _("must not be zero"));
+ _ ("must not be zero"));
global_ret = 1;
return;
}
@@ -1457,10 +1470,10 @@ main (int argc,
now = now_tmp = GNUNET_TIME_absolute_get ();
if (GNUNET_OK !=
GNUNET_PROGRAM_run (argc, argv,
- "taler-exchange-keyup",
- "Setup signing and denomination keys for a Taler exchange",
- options,
- &run, NULL))
+ "taler-exchange-keyup",
+ "Setup signing and denomination keys for a Taler exchange",
+ options,
+ &run, NULL))
return 1;
if (NULL != auditor_output_file)
{
diff --git a/src/exchange-tools/taler-exchange-wire.c b/src/exchange-tools/taler-exchange-wire.c
index 366b69ecd..1a057e4e1 100644
--- a/src/exchange-tools/taler-exchange-wire.c
+++ b/src/exchange-tools/taler-exchange-wire.c
@@ -60,7 +60,7 @@ sign_account_data (void *cls,
char *json_out;
FILE *out;
int ret;
-
+
if (GNUNET_NO == ai->credit_enabled)
return;
if (NULL == ai->wire_response_filename)
@@ -71,12 +71,12 @@ sign_account_data (void *cls,
global_ret = 1;
return;
}
-
+
wire = TALER_JSON_exchange_wire_signature_make (ai->payto_url,
&master_priv);
GNUNET_assert (NULL != wire);
json_out = json_dumps (wire,
- JSON_INDENT(2));
+ JSON_INDENT (2));
json_decref (wire);
GNUNET_assert (NULL != json_out);
if (GNUNET_OK !=
@@ -242,10 +242,10 @@ main (int argc,
NULL));
if (GNUNET_OK !=
GNUNET_PROGRAM_run (argc, argv,
- "taler-exchange-wire",
- "Setup /wire response",
- options,
- &run, NULL))
+ "taler-exchange-wire",
+ "Setup /wire response",
+ options,
+ &run, NULL))
return 1;
return global_ret;
}
diff --git a/src/exchange-tools/taler-wire.c b/src/exchange-tools/taler-wire.c
index f27caf749..213c1eff3 100644
--- a/src/exchange-tools/taler-wire.c
+++ b/src/exchange-tools/taler-wire.c
@@ -151,7 +151,7 @@ confirmation_cb (void *cls,
GNUNET_assert (NULL != emsg);
fprintf (stderr,
"%s",
- emsg);
+ emsg);
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -179,22 +179,22 @@ prepare_cb (void *cls,
struct TALER_WIRE_ExecuteHandle *eh;
if (NULL == (eh = plugin_handle->execute_wire_transfer
- (plugin_handle->cls,
- buf,
- buf_size,
- confirmation_cb,
- NULL)))
+ (plugin_handle->cls,
+ buf,
+ buf_size,
+ confirmation_cb,
+ NULL)))
{
fprintf (stderr,
"Could not execute the wire transfer\n");
plugin_handle->prepare_wire_transfer_cancel
(plugin_handle->cls,
- ph);
+ ph);
plugin_handle->execute_wire_transfer_cancel
(plugin_handle->cls,
- eh);
+ eh);
GNUNET_SCHEDULER_shutdown ();
}
@@ -235,14 +235,14 @@ execute_wire_transfer ()
return;
}
if (NULL == (ph = plugin_handle->prepare_wire_transfer
- (plugin_handle->cls,
- account_section,
- destination_account_url,
- &a,
- "http://exchange.example.com/",
- &wtid, /* Any value will do. */
- prepare_cb,
- NULL)))
+ (plugin_handle->cls,
+ account_section,
+ destination_account_url,
+ &a,
+ "http://exchange.example.com/",
+ &wtid, /* Any value will do. */
+ prepare_cb,
+ NULL)))
{
fprintf (stderr,
"Could not prepare the wire transfer\n");
@@ -269,20 +269,20 @@ execute_history ()
GNUNET_assert
(GNUNET_OK == GNUNET_STRINGS_string_to_data
(since_when,
- strlen (since_when),
- since_when_bin,
- bin_len));
+ strlen (since_when),
+ since_when_bin,
+ bin_len));
}
if (NULL == plugin_handle->get_history
- (plugin_handle->cls,
- account_section,
- TALER_BANK_DIRECTION_BOTH,
- since_when_bin,
- bin_len,
- -10,
- history_cb,
- NULL))
+ (plugin_handle->cls,
+ account_section,
+ TALER_BANK_DIRECTION_BOTH,
+ since_when_bin,
+ bin_len,
+ -10,
+ history_cb,
+ NULL))
{
fprintf (stderr,
"Could not request the transaction history.\n");
@@ -327,10 +327,10 @@ run (void *cls,
}
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string
- (cfg,
- account_section,
- "plugin",
- &plugin_name))
+ (cfg,
+ account_section,
+ "plugin",
+ &plugin_name))
{
fprintf (stderr,
"Could not find the 'plugin' value under %s\n",
@@ -353,7 +353,7 @@ run (void *cls,
execute_wire_transfer ();
else
fprintf (stderr,
- "Please give either --history/-H or --transfer/t\n");
+ "Please give either --history/-H or --transfer/t\n");
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
@@ -422,13 +422,13 @@ main (int argc,
"WARNING",
NULL)); /* filename */
ret = GNUNET_PROGRAM_run
- (argc,
- argv,
- "taler-wire",
- "CLI bank client.",
- options,
- &run,
- NULL);
+ (argc,
+ argv,
+ "taler-wire",
+ "CLI bank client.",
+ options,
+ &run,
+ NULL);
if (GNUNET_OK != ret)
return ret;
return global_ret;