commit 2de49c1a5f66ba4a637bf59456ebd5fbb4ac02d3 parent 7004a9f8c13ae58b777217d17decb4adf5d39b03 Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch> Date: Sun, 26 Nov 2023 23:44:39 +0100 [donau] rename files [lib] adjust methods Diffstat:
21 files changed, 4 insertions(+), 79 deletions(-)
diff --git a/src/donau/donau-httpd_batch-withdraw.c b/src/donau/donau-httpd_batch-issue_receipts.c diff --git a/src/donau/donau-httpd_batch-withdraw.h b/src/donau/donau-httpd_batch-issue_receipts.h diff --git a/src/donau/donau-httpd_batch-deposit.c b/src/donau/donau-httpd_batch-submit_receipts.c diff --git a/src/donau/donau-httpd_batch-deposit.h b/src/donau/donau-httpd_batch-submit_receipts.h diff --git a/src/donau/donau-httpd_reserves_close.c b/src/donau/donau-httpd_charities_close.c diff --git a/src/donau/donau-httpd_reserves_close.h b/src/donau/donau-httpd_charities_close.h diff --git a/src/donau/donau-httpd_reserves_get.c b/src/donau/donau-httpd_charities_get.c diff --git a/src/donau/donau-httpd_reserves_get.h b/src/donau/donau-httpd_charities_get.h diff --git a/src/donau/donau-httpd_reserves_history.c b/src/donau/donau-httpd_charities_history.c diff --git a/src/donau/donau-httpd_reserves_history.h b/src/donau/donau-httpd_charities_history.h diff --git a/src/donau/donau-httpd_reserves_open.c b/src/donau/donau-httpd_charities_open.c diff --git a/src/donau/donau-httpd_reserves_open.h b/src/donau/donau-httpd_charities_open.h diff --git a/src/donau/donau-httpd_reserves_status.c b/src/donau/donau-httpd_charities_status.c diff --git a/src/donau/donau-httpd_reserves_status.h b/src/donau/donau-httpd_charities_status.h diff --git a/src/donau/donau-httpd_common_deposit.c b/src/donau/donau-httpd_common_submit_receipts.c diff --git a/src/donau/donau-httpd_common_deposit.h b/src/donau/donau-httpd_common_submit_receipts.h diff --git a/src/donau/donau-httpd_withdraw.c b/src/donau/donau-httpd_issue_receipts.c diff --git a/src/donau/donau-httpd_withdraw.h b/src/donau/donau-httpd_issue_receipts.h diff --git a/src/donau/donau-httpd_deposits_get.c b/src/donau/donau-httpd_submit_receipts_get.c diff --git a/src/donau/donau-httpd_deposits_get.h b/src/donau/donau-httpd_submit_receipts_get.h diff --git a/src/lib/donau_api_handle.c b/src/lib/donau_api_handle.c @@ -22,6 +22,7 @@ * @brief Implementation of the "handle" component of the donau's HTTP API * @author Sree Harsha Totakura <sreeharsha@totakura.in> * @author Christian Grothoff + * @author Lukas Matyja */ #include "platform.h" #include <microhttpd.h> @@ -33,6 +34,7 @@ #include "donau_api_curl_defaults.h" #include "backoff.h" #include "taler_curl_lib.h" +#include <gnunet/gnunet_crypto_lib.h> /** * Which version of the Taler protocol is implemented @@ -265,41 +267,6 @@ EXITIF_exit: /** - * Compare two donation unit keys. - * - * @param denom1 first donation unit key - * @param denom2 second donation unit key - * @return 0 if the two keys are equal (not necessarily - * the same object), 1 otherwise. - */ -static unsigned int -denoms_cmp (const struct TALER_DonationUnitInformation *du1, - const struct TALER_DonationUnitInformation *du2) -{ - struct TALER_DONAU_DenomPublicKey tmp1; - struct TALER_DONAU_DenomPublicKey tmp2; - - if (0 != - TALER_denom_pub_cmp (&du1->key, - &du2->key)) - return 1; - tmp1 = *du1; - tmp2 = *du2; - if (tmp1.year != tmp2.year) - return 1; - - memset (&tmp1.key, - 0, - sizeof (tmp1.key)); - memset (&tmp2.key, - 0, - sizeof (tmp2.key)); - return GNUNET_memcmp (&tmp1, - &tmp2); -} - - -/** * Decode the JSON in @a resp_obj from the /keys response * and store the data in the @a key_data. * @@ -689,7 +656,7 @@ decode_keys_json (const json_t *resp_obj, j<key_data->num_denom_keys; j++) { - if (0 == denoms_cmp (&dk, + if (0 == GNUNET_CRYPTO_bsign_pub_cmp (&dk, &key_data->denom_keys[j])) { found = true; @@ -1180,7 +1147,6 @@ TALER_DONAU_get_keys ( { struct TALER_DONAU_GetKeysHandle *gkh; CURL *eh; - char last_date[80] = { 0 }; TALER_LOG_DEBUG ("Connecting to the donau (%s)\n", url); @@ -1188,28 +1154,8 @@ TALER_DONAU_get_keys ( gkh->donau_url = GNUNET_strdup (url); gkh->cert_cb = cert_cb; gkh->cert_cb_cls = cert_cb_cls; - if (NULL != last_keys) - { - gkh->prev_keys = TALER_DONAU_keys_incref (last_keys); - TALER_LOG_DEBUG ("Last DK issue date (before GETting /keys): %s\n", - GNUNET_TIME_timestamp2s ( - last_keys->last_denom_issue_date)); - GNUNET_snprintf (last_date, - sizeof (last_date), - "%llu", - (unsigned long long) - last_keys->last_denom_issue_date.abs_time.abs_value_us - / 1000000LLU); - } gkh->url = TALER_url_join (url, - "keys", - (NULL != last_keys) - ? "last_issue_date" - : NULL, - (NULL != last_keys) - ? last_date - : NULL, - NULL); + "keys"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requesting keys with URL `%s'.\n", gkh->url); @@ -1306,27 +1252,6 @@ TALER_DONAU_get_denomination_key ( } -const struct TALER_DONAU_GlobalFee * -TALER_DONAU_get_global_fee ( - const struct TALER_DONAU_Keys *keys, - struct GNUNET_TIME_Timestamp ts) -{ - for (unsigned int i = 0; i<keys->num_global_fees; i++) - { - const struct TALER_DONAU_GlobalFee *gf = &keys->global_fees[i]; - - if (GNUNET_TIME_timestamp_cmp (ts, - >=, - gf->start_date) && - GNUNET_TIME_timestamp_cmp (ts, - <, - gf->end_date)) - return gf; - } - return NULL; -} - - struct TALER_DONAU_DenomPublicKey * TALER_DONAU_copy_denomination_key ( const struct TALER_DONAU_DenomPublicKey *key)