From 4154e41a411df9d30ab0213a7409642c924e78b0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 1 Apr 2016 20:18:18 +0200 Subject: hash inputs to sign_fdh functions as required by new API --- src/exchangedb/perf_taler_exchangedb_init.c | 8 +++++--- src/exchangedb/test_exchangedb.c | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src/exchangedb') diff --git a/src/exchangedb/perf_taler_exchangedb_init.c b/src/exchangedb/perf_taler_exchangedb_init.c index 8036d8597..c669518ad 100644 --- a/src/exchangedb/perf_taler_exchangedb_init.c +++ b/src/exchangedb/perf_taler_exchangedb_init.c @@ -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); diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index 090c08fbd..56c300678 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -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 != -- cgit v1.2.3