commit 409434523d7740d2707395096f62717fbffa9b09
parent 6d59e14e8f0c4fa717fc60528c5094dbb9e5a724
Author: bohdan-potuzhnyi <bohdan.potuzhnyi@gmail.com>
Date: Fri, 8 Aug 2025 02:40:30 +0200
very bad func + salt hash from donau
Diffstat:
2 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -584,6 +584,11 @@ struct PayContext
* Donau keys, that we are using to get the information about the bkps.
*/
struct DONAU_Keys *donau_keys;
+
+ /**
+ * Amount from BKPS
+ */
+ struct TALER_Amount donation_amount;
#endif
} parse_wallet_data;
@@ -3424,13 +3429,13 @@ handle_output_donation_receipt (
"donau support disabled"));
return GNUNET_NO;
#else
- const struct TALER_Amount *wallet_amount =
- DONAU_get_donation_amount_from_bkps (
- pc->parse_wallet_data.donau_keys,
- pc->parse_wallet_data.bkps,
- pc->parse_wallet_data.num_bkps,
- pc->parse_wallet_data.donau.donation_year);
- if (NULL == wallet_amount)
+ if (GNUNET_OK !=
+ DONAU_get_donation_amount_from_bkps (
+ pc->parse_wallet_data.donau_keys,
+ pc->parse_wallet_data.bkps,
+ pc->parse_wallet_data.num_bkps,
+ pc->parse_wallet_data.donau.donation_year,
+ &pc->parse_wallet_data.donation_amount) )
{
GNUNET_break_op (0);
pay_end (pc,
@@ -3442,7 +3447,7 @@ handle_output_donation_receipt (
}
if (GNUNET_OK !=
- TALER_amount_cmp_currency (wallet_amount,
+ TALER_amount_cmp_currency (&pc->parse_wallet_data.donation_amount,
&output->details.donation_receipt.amount))
{
GNUNET_break_op (0);
@@ -3455,12 +3460,12 @@ handle_output_donation_receipt (
return GNUNET_NO;
}
- if (0 != TALER_amount_cmp (wallet_amount,
+ if (0 != TALER_amount_cmp (&pc->parse_wallet_data.donation_amount,
&output->details.donation_receipt.amount))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wallet amount: %s\n",
- TALER_amount2s (wallet_amount));
+ TALER_amount2s (&pc->parse_wallet_data.donation_amount));
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Donation receipt amount: %s\n",
TALER_amount2s (&output->details.donation_receipt.amount));
@@ -3478,7 +3483,7 @@ handle_output_donation_receipt (
if (0 >
TALER_amount_add (&receipts_to_date,
&pc->parse_wallet_data.charity_receipts_to_date,
- wallet_amount))
+ &pc->parse_wallet_data.donation_amount))
{
GNUNET_break (0);
pay_end (pc,
diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c
@@ -170,7 +170,7 @@ prepare_donau_data (struct TALER_TESTING_Interpreter *is,
/* Get charity id and the charity private key from trait */
{
const struct TALER_TESTING_Command *charity_post_cmd;
- uint64_t *charity_id;
+ const uint64_t *charity_id;
charity_post_cmd = TALER_TESTING_interpreter_lookup_command (
is,
@@ -1600,23 +1600,16 @@ TALER_TESTING_cmd_merchant_pay_order_donau (
if (GNUNET_OK !=
TALER_string_to_amount (amount_donation,
&ps->donau_data.donation_amount))
+ {
+ GNUNET_assert (0);
+ }
/* Compute h_donor_tax_id directly into ps->donau_data: */
- // FIXME: donau should export a helper function for this!
+ if (! DONAU_compute_salted_tax_id_hash (donor_tax_id,
+ salt,
+ ps->donau_data.h_donor_tax_id.hash))
{
- crypto_hash_sha512_state state;
- size_t tax_length = strlen (donor_tax_id);
- size_t salt_length = strlen (salt);
-
- crypto_hash_sha512_init (&state);
- crypto_hash_sha512_update (&state,
- (const unsigned char*) donor_tax_id,
- tax_length);
- crypto_hash_sha512_update (&state,
- (const unsigned char*) salt,
- salt_length);
- crypto_hash_sha512_final (&state,
- ps->donau_data.h_donor_tax_id.hash);
+ GNUNET_assert (0);
}
{