diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mint/taler-mint-httpd.c | 26 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_keys.c | 26 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_keys.h | 28 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_keystate.c | 25 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_keystate.h | 11 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_responses.c | 6 |
6 files changed, 38 insertions, 84 deletions
diff --git a/src/mint/taler-mint-httpd.c b/src/mint/taler-mint-httpd.c index d22f8af60..c4c63c077 100644 --- a/src/mint/taler-mint-httpd.c +++ b/src/mint/taler-mint-httpd.c @@ -56,11 +56,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. */ static struct MHD_Daemon *mydaemon; @@ -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, diff --git a/src/mint/taler-mint-httpd_keys.c b/src/mint/taler-mint-httpd_keys.c index 71d7f077e..a03f5d23c 100644 --- a/src/mint/taler-mint-httpd_keys.c +++ b/src/mint/taler-mint-httpd_keys.c @@ -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 */ diff --git a/src/mint/taler-mint-httpd_keys.h b/src/mint/taler-mint-httpd_keys.h index 7dc5bc0eb..8137561fc 100644 --- a/src/mint/taler-mint-httpd_keys.h +++ b/src/mint/taler-mint-httpd_keys.h @@ -33,34 +33,6 @@ /** - * 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 * * @param rh context of the handler diff --git a/src/mint/taler-mint-httpd_keystate.c b/src/mint/taler-mint-httpd_keystate.c index 41617589a..c35ed15ad 100644 --- a/src/mint/taler-mint-httpd_keystate.c +++ b/src/mint/taler-mint-httpd_keystate.c @@ -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 */ diff --git a/src/mint/taler-mint-httpd_keystate.h b/src/mint/taler-mint-httpd_keystate.h index 6f83b0861..b71fedd27 100644 --- a/src/mint/taler-mint-httpd_keystate.h +++ b/src/mint/taler-mint-httpd_keystate.h @@ -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 diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c index d605a85ab..d8a65f176 100644 --- a/src/mint/taler-mint-httpd_responses.c +++ b/src/mint/taler-mint-httpd_responses.c @@ -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, |