From ebd2e7d763689430d37386903ac190da4943ce2c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 15 Sep 2019 12:39:15 +0200 Subject: fix leaks and unnecessary fetch of RSA signature on refresh/reveal --- src/exchangedb/plugin_exchangedb_postgres.c | 9 ++++----- src/exchangedb/test_exchangedb.c | 9 ++------- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src/exchangedb') diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index acd6e9278..17894281b 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -887,7 +887,6 @@ postgres_prepare (PGconn *db_conn) " kc.denom_pub_hash" ",denom.fee_refresh_val" ",denom.fee_refresh_frac" - ",kc.denom_sig" ",old_coin_pub" ",old_coin_sig" ",amount_with_fee_val" @@ -3729,7 +3728,9 @@ postgres_select_refunds_by_coin (void *cls, * @param cls the `struct PostgresClosure` with the plugin-specific state * @param session database handle to use, NULL if not run in any transaction * @param rc commitment hash to use to locate the operation - * @param[out] refresh_melt where to store the result + * @param[out] refresh_melt where to store the result; note that + * refresh_melt->session.coin.denom_sig will be set to NULL + * and is not fetched by this routine (as it is not needed by the client) * @return transaction status */ static enum GNUNET_DB_QueryStatus @@ -3749,9 +3750,6 @@ postgres_get_melt (void *cls, denom_pub_hash), TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refresh", &refresh_melt->melt_fee), - GNUNET_PQ_result_spec_rsa_signature ("denom_sig", - &refresh_melt->session.coin.denom_sig. - rsa_signature), GNUNET_PQ_result_spec_uint32 ("noreveal_index", &refresh_melt->session.noreveal_index), GNUNET_PQ_result_spec_auto_from_type ("old_coin_pub", @@ -3764,6 +3762,7 @@ postgres_get_melt (void *cls, }; enum GNUNET_DB_QueryStatus qs; + refresh_melt->session.coin.denom_sig.rsa_signature = NULL; if (NULL == session) session = postgres_get_session (pg); qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn, diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index 7033f728e..6c48f3a19 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -562,19 +562,14 @@ test_melting (struct TALER_EXCHANGEDB_Session *session) GNUNET_memcmp (&refresh_session.rc, &ret_refresh_session.session.rc)); FAILIF (0 != GNUNET_memcmp (&refresh_session.coin_sig, &ret_refresh_session.session.coin_sig)); - FAILIF (0 != - GNUNET_CRYPTO_rsa_signature_cmp ( - refresh_session.coin.denom_sig.rsa_signature, - ret_refresh_session.session.coin. - denom_sig.rsa_signature)); + FAILIF (NULL != + ret_refresh_session.session.coin.denom_sig.rsa_signature); FAILIF (0 != memcmp (&refresh_session.coin.coin_pub, &ret_refresh_session.session.coin.coin_pub, sizeof (refresh_session.coin.coin_pub))); FAILIF (0 != GNUNET_memcmp (&refresh_session.coin.denom_pub_hash, &ret_refresh_session.session.coin.denom_pub_hash)); - GNUNET_CRYPTO_rsa_signature_free ( - ret_refresh_session.session.coin.denom_sig.rsa_signature); /* test 'select_refreshs_above_serial_id' */ auditor_row_cnt = 0; -- cgit v1.2.3