use existing log functions more
This commit is contained in:
parent
4eeaff1355
commit
2018a6b713
@ -419,11 +419,12 @@ get_anchor (const char *dir,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create a mint signing key (for signing mint messages, not for coins)
|
||||||
|
* and assert its correctness by signing it with the master key.
|
||||||
*
|
*
|
||||||
*
|
* @param start start time of the validity period for the key
|
||||||
* @param start
|
* @param duration how long should the key be valid
|
||||||
* @param duration
|
* @param pi[OUT] set to the signing key information
|
||||||
* @param pi[OUT]
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
create_signkey_issue_priv (struct GNUNET_TIME_Absolute start,
|
create_signkey_issue_priv (struct GNUNET_TIME_Absolute start,
|
||||||
@ -440,10 +441,8 @@ create_signkey_issue_priv (struct GNUNET_TIME_Absolute start,
|
|||||||
issue->start = GNUNET_TIME_absolute_hton (start);
|
issue->start = GNUNET_TIME_absolute_hton (start);
|
||||||
issue->expire = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (start,
|
issue->expire = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (start,
|
||||||
duration));
|
duration));
|
||||||
|
|
||||||
GNUNET_CRYPTO_eddsa_key_get_public (&pi->signkey_priv,
|
GNUNET_CRYPTO_eddsa_key_get_public (&pi->signkey_priv,
|
||||||
&issue->signkey_pub);
|
&issue->signkey_pub);
|
||||||
|
|
||||||
issue->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNKEY);
|
issue->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNKEY);
|
||||||
issue->purpose.size = htonl (sizeof (struct TALER_MINT_SignKeyIssue) -
|
issue->purpose.size = htonl (sizeof (struct TALER_MINT_SignKeyIssue) -
|
||||||
offsetof (struct TALER_MINT_SignKeyIssue,
|
offsetof (struct TALER_MINT_SignKeyIssue,
|
||||||
@ -474,8 +473,9 @@ mint_keys_update_signkeys ()
|
|||||||
"signkey_duration",
|
"signkey_duration",
|
||||||
&signkey_duration))
|
&signkey_duration))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Cannot read config value mint_keys.signkey_duration\n");
|
"mint_keys",
|
||||||
|
"signkey_duration");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
ROUND_TO_SECS (signkey_duration,
|
ROUND_TO_SECS (signkey_duration,
|
||||||
@ -549,15 +549,16 @@ get_cointype_params (const char *ct,
|
|||||||
const char *dir;
|
const char *dir;
|
||||||
unsigned long long rsa_keysize;
|
unsigned long long rsa_keysize;
|
||||||
|
|
||||||
|
/* FIXME: is 'ct' option or section name? */
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CONFIGURATION_get_value_time (kcfg,
|
GNUNET_CONFIGURATION_get_value_time (kcfg,
|
||||||
"mint_denom_duration_withdraw",
|
"mint_denom_duration_withdraw",
|
||||||
ct,
|
ct,
|
||||||
¶ms->duration_withdraw))
|
¶ms->duration_withdraw))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Withdraw duration not given for coin type '%s'\n",
|
ct,
|
||||||
ct);
|
"mint_denom_duration_withdraw");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
ROUND_TO_SECS (params->duration_withdraw,
|
ROUND_TO_SECS (params->duration_withdraw,
|
||||||
@ -568,9 +569,9 @@ get_cointype_params (const char *ct,
|
|||||||
ct,
|
ct,
|
||||||
¶ms->duration_spend))
|
¶ms->duration_spend))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Spend duration not given for coin type '%s'\n",
|
ct,
|
||||||
ct);
|
"mint_denom_duration_spend");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
ROUND_TO_SECS (params->duration_spend,
|
ROUND_TO_SECS (params->duration_spend,
|
||||||
@ -581,9 +582,9 @@ get_cointype_params (const char *ct,
|
|||||||
ct,
|
ct,
|
||||||
¶ms->duration_overlap))
|
¶ms->duration_overlap))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Overlap duration not given for coin type '%s'\n",
|
ct,
|
||||||
ct);
|
"mint_denom_duration_overlap");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
ROUND_TO_SECS (params->duration_overlap,
|
ROUND_TO_SECS (params->duration_overlap,
|
||||||
@ -594,9 +595,9 @@ get_cointype_params (const char *ct,
|
|||||||
ct,
|
ct,
|
||||||
&rsa_keysize))
|
&rsa_keysize))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"RSA keysize not given for coin type '%s'\n",
|
ct,
|
||||||
ct);
|
"mint_denom_rsa_keysize");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if ( (rsa_keysize > 4 * 2048) ||
|
if ( (rsa_keysize > 4 * 2048) ||
|
||||||
@ -614,9 +615,9 @@ get_cointype_params (const char *ct,
|
|||||||
ct,
|
ct,
|
||||||
¶ms->value))
|
¶ms->value))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Value not given for coin type '%s'\n",
|
ct,
|
||||||
ct);
|
"mint_denom_value");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
@ -625,9 +626,9 @@ get_cointype_params (const char *ct,
|
|||||||
ct,
|
ct,
|
||||||
¶ms->fee_withdraw))
|
¶ms->fee_withdraw))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Withdraw fee not given for coin type '%s'\n",
|
ct,
|
||||||
ct);
|
"mint_denom_fee_withdraw");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
@ -636,9 +637,9 @@ get_cointype_params (const char *ct,
|
|||||||
ct,
|
ct,
|
||||||
¶ms->fee_deposit))
|
¶ms->fee_deposit))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Deposit fee not given for coin type '%s'\n",
|
ct,
|
||||||
ct);
|
"mint_denom_fee_deposit");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
@ -647,9 +648,9 @@ get_cointype_params (const char *ct,
|
|||||||
ct,
|
ct,
|
||||||
¶ms->fee_refresh))
|
¶ms->fee_refresh))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Deposit fee not given for coin type '%s'\n",
|
ct,
|
||||||
ct);
|
"mint_denom_fee_refresh");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -763,7 +764,7 @@ mint_keys_update_cointype (const char *coin_alias)
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @return
|
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
mint_keys_update_denomkeys ()
|
mint_keys_update_denomkeys ()
|
||||||
@ -778,8 +779,9 @@ mint_keys_update_denomkeys ()
|
|||||||
"coin_types",
|
"coin_types",
|
||||||
&coin_types))
|
&coin_types))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"mint_keys.coin_types not in configuration\n");
|
"mint_keys",
|
||||||
|
"coin_types");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -800,7 +802,7 @@ mint_keys_update_denomkeys ()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
mint_keys_update ()
|
mint_keys_update ()
|
||||||
@ -814,14 +816,17 @@ mint_keys_update ()
|
|||||||
"lookahead_sign",
|
"lookahead_sign",
|
||||||
&lookahead_sign))
|
&lookahead_sign))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"mint_keys.lookahead_sign not found\n");
|
"mint_keys",
|
||||||
|
"lookahead_sign");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if (0 == lookahead_sign.rel_value_us)
|
if (0 == lookahead_sign.rel_value_us)
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"mint_keys.lookahead_sign must not be zero\n");
|
"mint_keys",
|
||||||
|
"lookahead_sign",
|
||||||
|
_("must not be zero"));
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
ROUND_TO_SECS (lookahead_sign,
|
ROUND_TO_SECS (lookahead_sign,
|
||||||
@ -932,8 +937,9 @@ main (int argc, char *const *argv)
|
|||||||
&master_pub_from_cfg,
|
&master_pub_from_cfg,
|
||||||
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))
|
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Master public key missing in configuration (mint.master_pub)\n");
|
"mint",
|
||||||
|
"master_pub");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (0 !=
|
if (0 !=
|
||||||
@ -941,8 +947,10 @@ main (int argc, char *const *argv)
|
|||||||
&master_pub_from_cfg,
|
&master_pub_from_cfg,
|
||||||
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))
|
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"Mismatch between key from mint configuration and master private key file from command line.\n");
|
"mint",
|
||||||
|
"master_pub",
|
||||||
|
_("does not match with private key"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user