simplify logic, remove dead call

This commit is contained in:
Christian Grothoff 2015-01-28 20:59:39 +01:00
parent 8c558ddf89
commit 5fcca8707f
6 changed files with 38 additions and 84 deletions

View File

@ -55,11 +55,6 @@ struct GNUNET_CONFIGURATION_Handle *cfg;
*/
struct GNUNET_CRYPTO_EddsaPublicKey master_pub;
/**
* Private key of the mint we use to sign messages.
*/
struct GNUNET_CRYPTO_EddsaPrivateKey mint_priv;
/**
* The HTTP Daemon.
*/
@ -236,7 +231,6 @@ mint_serve_process_config (const char *mint_directory)
unsigned long long port;
unsigned long long kappa;
char *master_pub_str;
char *mint_priv_str;
char *db_cfg;
cfg = TALER_config_load (mint_directory);
@ -266,26 +260,6 @@ mint_serve_process_config (const char *mint_directory)
return GNUNET_NO;
}
GNUNET_free (master_pub_str);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
"mint", "mint_priv",
&mint_priv_str))
{
fprintf (stderr,
"No master public key given in mint configuration.");
return GNUNET_NO;
}
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_private_key_from_string (mint_priv_str,
strlen (mint_priv_str),
&mint_priv))
{
fprintf (stderr,
"Invalid mint private key given in mint configuration.");
GNUNET_free (mint_priv_str);
return GNUNET_NO;
}
GNUNET_free (mint_priv_str);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,

View File

@ -72,30 +72,4 @@ TALER_MINT_handler_keys (struct RequestHandler *rh,
}
/**
* Sign the message in @a purpose with the mint's signing
* key.
*
* @param purpose the message to sign
* @param[OUT] sig signature over purpose using current signing key
*/
void
TALER_MINT_keys_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
struct GNUNET_CRYPTO_EddsaSignature *sig)
{
struct MintKeyState *key_state;
key_state = TALER_MINT_key_state_acquire ();
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (&key_state->current_sign_key_issue.signkey_priv,
purpose,
sig));
TALER_MINT_key_state_release (key_state);
}
/* end of taler-mint-httpd_keys.c */

View File

@ -32,34 +32,6 @@
#include "taler-mint-httpd_keystate.h"
/**
* Check if a coin is valid; that is, whether the denomination key exists,
* is not expired, and the signature is correct.
*
* @param key_state the key state to use for checking the coin's validity
* @param coin_public_info the coin public info to check for validity
* @return #GNUNET_YES if the coin is valid,
* #GNUNET_NO if it is invalid
* #GNUNET_SYSERROR if an internal error occured
*/
int
TALER_MINT_test_coin_valid (const struct MintKeyState *key_state,
const struct TALER_CoinPublicInfo *coin_public_info);
/**
* Sign the message in @a purpose with the mint's signing
* key.
*
* @param purpose the message to sign
* @param[OUT] sig signature over purpose using current signing key
*/
void
TALER_MINT_keys_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
struct GNUNET_CRYPTO_EddsaSignature *sig);
/**
* Handle a "/keys" request
*

View File

@ -456,4 +456,29 @@ read_again:
}
/**
* Sign the message in @a purpose with the mint's signing
* key.
*
* @param purpose the message to sign
* @param[OUT] sig signature over purpose using current signing key
*/
void
TALER_MINT_keys_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
struct GNUNET_CRYPTO_EddsaSignature *sig)
{
struct MintKeyState *key_state;
key_state = TALER_MINT_key_state_acquire ();
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (&key_state->current_sign_key_issue.signkey_priv,
purpose,
sig));
TALER_MINT_key_state_release (key_state);
}
/* end of taler-mint-httpd_keystate.c */

View File

@ -124,6 +124,17 @@ int
TALER_MINT_key_reload_loop (void);
/**
* Sign the message in @a purpose with the mint's signing
* key.
*
* @param purpose the message to sign
* @param[OUT] sig signature over purpose using current signing key
*/
void
TALER_MINT_keys_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
struct GNUNET_CRYPTO_EddsaSignature *sig);
#endif

View File

@ -272,10 +272,8 @@ TALER_MINT_reply_deposit_success (struct MHD_Connection *connection,
dc.amount = TALER_amount_hton (*amount);
dc.coin_pub = *coin_pub;
dc.merchant = *merchant;
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_sign (&mint_priv,
&dc.purpose,
&sig))
TALER_MINT_keys_sign (&dc.purpose,
&sig);
{
LOG_WARNING ("Failed to create EdDSA signature using my private key\n");
return TALER_MINT_reply_internal_error (connection,