hash inputs to sign_fdh functions as required by new API

This commit is contained in:
Christian Grothoff 2016-04-01 20:18:18 +02:00
parent 9bc96506bb
commit 4154e41a41
2 changed files with 17 additions and 8 deletions

View File

@ -335,6 +335,7 @@ PERF_TALER_EXCHANGEDB_coin_init (
{
struct PERF_TALER_EXCHANGEDB_Coin *coin;
struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
struct GNUNET_HashCode hc;
coin = GNUNET_new (struct PERF_TALER_EXCHANGEDB_Coin);
GNUNET_assert (NULL != coin);
@ -350,11 +351,12 @@ PERF_TALER_EXCHANGEDB_coin_init (
&coin->public_info.coin_pub.eddsa_pub);
coin->public_info.denom_pub.rsa_public_key =
GNUNET_CRYPTO_rsa_public_key_dup (dki->denom_pub.rsa_public_key);
// This is broken at the moment because it needs to be a hash of a coin public key.
GNUNET_CRYPTO_hash (&coin->public_info.coin_pub,
sizeof (struct TALER_CoinSpendPublicKeyP),
&hc);
coin->public_info.denom_sig.rsa_signature =
GNUNET_CRYPTO_rsa_sign_fdh (dki->denom_priv.rsa_private_key,
&coin->public_info.coin_pub,
sizeof (struct TALER_CoinSpendPublicKeyP));
&hc);
GNUNET_assert (NULL != coin->public_info.denom_pub.rsa_public_key);
GNUNET_assert (NULL != coin->public_info.denom_sig.rsa_signature);

View File

@ -335,12 +335,15 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
melts = GNUNET_new_array (MELT_OLD_COINS, struct TALER_EXCHANGEDB_RefreshMelt);
for (cnt=0; cnt < MELT_OLD_COINS; cnt++)
{
struct GNUNET_HashCode hc;
RND_BLK (&melts[cnt].coin.coin_pub);
// This appears to be broken because it needs to be a hash of a coin public key
GNUNET_CRYPTO_hash (&melts[cnt].coin.coin_pub,
sizeof (melts[cnt].coin.coin_pub),
&hc);
melts[cnt].coin.denom_sig.rsa_signature =
GNUNET_CRYPTO_rsa_sign_fdh (dkp->priv.rsa_private_key,
&melts[cnt].coin.coin_pub,
sizeof (melts[cnt].coin.coin_pub));
&hc);
melts[cnt].coin.denom_pub = dkp->pub;
RND_BLK (&melts[cnt].coin_sig);
melts[cnt].session_hash = session_hash;
@ -569,6 +572,7 @@ run (void *cls,
struct TALER_EXCHANGEDB_Deposit deposit;
struct TALER_EXCHANGEDB_Deposit deposit2;
struct TALER_WireTransferIdentifierRawP wtid;
struct GNUNET_HashCode hc;
json_t *wire;
json_t *just;
const char * const json_wire_str =
@ -663,10 +667,12 @@ run (void *cls,
RND_BLK(&cbc.h_coin_envelope);
RND_BLK(&cbc.reserve_sig);
cbc.denom_pub = dkp->pub;
GNUNET_CRYPTO_hash (&cbc.h_coin_envelope,
sizeof (cbc.h_coin_envelope),
&hc);
cbc.sig.rsa_signature
= GNUNET_CRYPTO_rsa_sign_fdh (dkp->priv.rsa_private_key,
&cbc.h_coin_envelope,
sizeof (cbc.h_coin_envelope));
&hc);
cbc.reserve_pub = reserve_pub;
cbc.amount_with_fee = value;
GNUNET_assert (GNUNET_OK ==
@ -890,6 +896,7 @@ main (int argc,
"test-exchange-db-%s", plugin_name);
(void) GNUNET_asprintf (&config_filename,
"%s.conf", testname);
argv2[0] = argv[0];
argv2[2] = config_filename;
if (GNUNET_OK !=