donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 6308274e396f44fabecafd4cd0dff7af179b0c06
parent 973736d72bb05fd9e52bf04e9d5839628711b838
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Thu, 13 Jun 2024 16:03:58 +0200

cleanup

Diffstat:
Msrc/donau/donau-httpd_batch-issue.c | 1-
Msrc/donau/donau-httpd_keys.c | 2+-
Msrc/include/donau_service.h | 2--
Msrc/lib/donau_api_charity_get.c | 2+-
Msrc/lib/donau_api_donation_statement_get.c | 2+-
Msrc/lib/donau_api_handle.c | 60+-----------------------------------------------------------
Msrc/testing/Makefile.am | 4++--
Msrc/testing/test_donau_api.c | 2+-
Msrc/testing/testing_api_cmd_donation_statement_get.c | 25++++++++++++-------------
Msrc/testing/testing_api_cmd_submit_receipts.c | 2--
10 files changed, 19 insertions(+), 83 deletions(-)

diff --git a/src/donau/donau-httpd_batch-issue.c b/src/donau/donau-httpd_batch-issue.c @@ -62,7 +62,6 @@ parse_json_bkp (struct DONAU_BlindedUniqueDonorIdentifierKeyPair *bkp, GNUNET_break_op (0); return GNUNET_SYSERR; } - /* TODO: Check for duplicate blinded UDIs.*/ return GNUNET_OK; } diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c @@ -1253,7 +1253,7 @@ DH_keys_donau_sign_ ( purpose, &donau_pub, &donau_sig); - if (TALER_EC_NONE != ec) + if (TALER_EC_NONE != ec) return ec; pub->eddsa_pub = donau_pub.eddsa_pub; sig->eddsa_sig = donau_sig.eddsa_signature; diff --git a/src/include/donau_service.h b/src/include/donau_service.h @@ -318,7 +318,6 @@ struct DONAU_GetKeysHandle; * * @param ctx the context * @param url HTTP base URL for the donau - * @param[in,out] last_keys previous keys object, NULL for none * @param cert_cb function to call with the donau's certification information, * possibly called repeatedly if the information changes * @param cert_cb_cls closure for @a cert_cb @@ -328,7 +327,6 @@ struct DONAU_GetKeysHandle * DONAU_get_keys ( struct GNUNET_CURL_Context *ctx, const char *url, - // struct DONAU_Keys *last_keys, -> temporarily removed DONAU_GetKeysCallback cert_cb, void *cert_cb_cls); diff --git a/src/lib/donau_api_charity_get.c b/src/lib/donau_api_charity_get.c @@ -200,7 +200,7 @@ DONAU_charity_get ( struct GNUNET_CURL_Context *ctx, const char *url, const uint64_t id, - const struct DONAU_BearerToken *bearer, // TODO: check authorization + const struct DONAU_BearerToken *bearer, // for authorization DONAU_GetCharityResponseCallback cb, void *cb_cls) { diff --git a/src/lib/donau_api_donation_statement_get.c b/src/lib/donau_api_donation_statement_get.c @@ -204,7 +204,7 @@ prepare_url ( struct DONAU_DonationStatementGetHandle * DONAU_donation_statement_get ( struct GNUNET_CURL_Context *ctx, - const char *url, // FIXME change the name of every api function call base url to donau_url. + const char *url, const uint64_t year, const struct DONAU_HashDonorTaxId *h_donor_tax_id, DONAU_GetDonationStatmentResponseCallback cb, diff --git a/src/lib/donau_api_handle.c b/src/lib/donau_api_handle.c @@ -297,20 +297,6 @@ decode_keys_json (const json_t *resp_obj, eline); EXITIF (1); } -// { -// struct GNUNET_JSON_Specification sspec[] = { // why separate sspec and mspec? -// TALER_JSON_spec_currency_specification ( -// "currency_specification", -// currency, -// &key_data->currency_specification), -// GNUNET_JSON_spec_end () -// }; -// -// EXITIF (GNUNET_OK != -// GNUNET_JSON_parse (resp_obj, -// sspec, -// NULL, NULL)); -// } key_data->currency = GNUNET_strdup (currency); } @@ -461,48 +447,10 @@ keys_completed_cb (void *cls, } -/** - * Function called for each header in the HTTP /keys response. - * Finds the "Expire:" header and parses it, storing the result - * in the "expire" field of the keys request. - * - * @param buffer header data received - * @param size size of an item in @a buffer - * @param nitems number of items in @a buffer - * @param userdata the `struct DONAU_GetKeysHandle` - * @return `size * nitems` on success (everything else aborts) - */ -// static size_t -// header_cb (char *buffer, -// size_t size, -// size_t nitems, -// void *userdata) -// { -// size_t total = size * nitems; -// char *val; - -// if (total < strlen (MHD_HTTP_HEADER_EXPIRES ": ")) -// return total; -// if (0 != strncasecmp (MHD_HTTP_HEADER_EXPIRES ": ", -// buffer, -// strlen (MHD_HTTP_HEADER_EXPIRES ": "))) -// return total; -// val = GNUNET_strndup (&buffer[strlen (MHD_HTTP_HEADER_EXPIRES ": ")], -// total - strlen (MHD_HTTP_HEADER_EXPIRES ": ")); -// GNUNET_log (GNUNET_ERROR_TYPE_INFO, -// "Found %s header `%s'\n", -// MHD_HTTP_HEADER_EXPIRES, -// val); -// GNUNET_free (val); -// return total; -// } - - struct DONAU_GetKeysHandle * DONAU_get_keys ( struct GNUNET_CURL_Context *ctx, const char *url, - // struct DONAU_Keys *last_keys, -> temporarily removed DONAU_GetKeysCallback cert_cb, void *cert_cb_cls) { @@ -538,10 +486,6 @@ DONAU_get_keys ( curl_easy_setopt (eh, CURLOPT_TIMEOUT, 120 /* seconds */)); - // GNUNET_assert (CURLE_OK == - // curl_easy_setopt (eh, - // CURLOPT_HEADERFUNCTION, - // &header_cb)); gkh->job = GNUNET_CURL_job_add_with_ct_json (ctx, eh, &keys_completed_cb, @@ -763,8 +707,6 @@ add_grp (void *cls, return GNUNET_OK; } - -// FIXME json_t * DONAU_keys_to_json (const struct DONAU_Keys *kd) { @@ -797,7 +739,7 @@ DONAU_keys_to_json (const struct DONAU_Keys *kd) { struct GNUNET_CONTAINER_MultiHashMap *dbg; - dbg = GNUNET_CONTAINER_multihashmap_create (128, // why 128?? + dbg = GNUNET_CONTAINER_multihashmap_create (128, false); for (unsigned int i = 0; i<kd->num_donation_unit_keys; i++) { diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am @@ -36,8 +36,8 @@ AM_TESTS_ENVIRONMENT=export DONAU_PREFIX=$${DONAU_PREFIX:-@libdir@};export PATH= .NOTPARALLEL: check_PROGRAMS = \ - test_donau_api_cs \ - test_donau_api_rsa + test_donau_api_rsa \ + test_donau_api_cs TESTS = \ diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c @@ -87,7 +87,7 @@ run (void *cls, TALER_TESTING_cmd_charities_get ("get-charities", &bearer, MHD_HTTP_OK), - // FIXME + // FIXME: CSR signatures TALER_TESTING_cmd_issue_receipts ("issue-receipts", "post-charity", uses_cs, diff --git a/src/testing/testing_api_cmd_donation_statement_get.c b/src/testing/testing_api_cmd_donation_statement_get.c @@ -111,21 +111,20 @@ donation_statement_status_cb (void *cls, ss->donation_statement.donation_statement_sig = dsr->details.ok.donation_statement_sig; - // FIXME: check the authenticity of the eddsa key (existence in ss->keys) for (unsigned int i = 0; i < ss->keys->num_sign_keys; i++) { - if (GNUNET_OK == DONAU_donation_statement_verify ( - &ss->donation_statement.total_amount, - ss->donation_statement.year, - ss->donation_statement. - h_donor_tax_id, - &ss->keys->sign_keys[i].key, - &ss->donation_statement. - donation_statement_sig)) - { - TALER_TESTING_interpreter_next (ss->is); - return; - } + if (GNUNET_OK == DONAU_donation_statement_verify ( + &ss->donation_statement.total_amount, + ss->donation_statement.year, + ss->donation_statement. + h_donor_tax_id, + &dsr->details.ok.donau_pub, + &ss->donation_statement. + donation_statement_sig)) + { + TALER_TESTING_interpreter_next (ss->is); + return; + } } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Verify donation statement signature failed!"); diff --git a/src/testing/testing_api_cmd_submit_receipts.c b/src/testing/testing_api_cmd_submit_receipts.c @@ -94,8 +94,6 @@ submit_receipts_status_cb (void *cls, { struct StatusState *ss = cls; - // TODO: use the public donation unit keys from the DONAU to verify the signatures - ss->bsrh = NULL; if (ss->expected_response_code != rtsresp->hr.http_status) {