donau

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

commit 138bdfc8b80d4e557aa7ca80e3a835c2f26d9510
parent 112e74e9a43edbf3a5d716eb8005c832e0eea961
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 26 Sep 2025 14:38:22 +0200

fix compiler warnings, do not sign over pointers

Diffstat:
Msrc/donau/donau-httpd_batch-issue.c | 2+-
Msrc/donaudb/test_donaudb.c | 1+
Msrc/util/charity_signatures.c | 52++++++++++++++++++++++++++++++++++++++++++----------
3 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/src/donau/donau-httpd_batch-issue.c b/src/donau/donau-httpd_batch-issue.c @@ -228,7 +228,7 @@ DH_handler_issue_receipts_post (struct DH_RequestContext *rc, rc->connection, MHD_HTTP_FORBIDDEN, TALER_EC_DONAU_CHARITY_SIGNATURE_INVALID, - NULL); + "charity_sig"); } { diff --git a/src/donaudb/test_donaudb.c b/src/donaudb/test_donaudb.c @@ -77,6 +77,7 @@ static enum GNUNET_GenericReturnValue charities_cb ( void *cls, uint64_t charity_id, + const struct DONAU_CharityPublicKeyP *charity_pub, const char *charity_name, struct TALER_Amount max_per_year, struct TALER_Amount receipts_to_date) diff --git a/src/util/charity_signatures.c b/src/util/charity_signatures.c @@ -67,18 +67,34 @@ DONAU_charity_bkp_sign ( .purpose.size = htonl (sizeof (tps)), .num_bkp = htonl (num_bkp) }; - struct GNUNET_HashContext *hc; + hc = GNUNET_CRYPTO_hash_context_start (); for (unsigned int i = 0; i < num_bkp; i++) { + const struct GNUNET_CRYPTO_BlindedMessage *bm + = bkp[i].blinded_udi.blinded_message; + GNUNET_CRYPTO_hash_context_read (hc, &bkp[i].h_donation_unit_pub, sizeof (bkp[i].h_donation_unit_pub)); - GNUNET_CRYPTO_hash_context_read (hc, - bkp[i].blinded_udi.blinded_message, - sizeof (bkp[i].blinded_udi.blinded_message) - ); + switch (bm->cipher) + { + case GNUNET_CRYPTO_BSA_INVALID: + GNUNET_assert (0); + case GNUNET_CRYPTO_BSA_CS: + GNUNET_CRYPTO_hash_context_read ( + hc, + &bm->details.cs_blinded_message, + sizeof (bm->details.cs_blinded_message)); + break; + case GNUNET_CRYPTO_BSA_RSA: + GNUNET_CRYPTO_hash_context_read ( + hc, + bm->details.rsa_blinded_message.blinded_msg, + bm->details.rsa_blinded_message.blinded_msg_size); + break; + } } GNUNET_CRYPTO_hash_context_finish (hc, &tps.bkps_hash); @@ -101,18 +117,34 @@ DONAU_charity_bkp_verify ( .purpose.size = htonl (sizeof (tps)), .num_bkp = htonl (num_bkp) }; - struct GNUNET_HashContext *hc; + hc = GNUNET_CRYPTO_hash_context_start (); for (unsigned int i = 0; i < num_bkp; i++) { + const struct GNUNET_CRYPTO_BlindedMessage *bm + = bkp[i].blinded_udi.blinded_message; + GNUNET_CRYPTO_hash_context_read (hc, &bkp[i].h_donation_unit_pub, sizeof (bkp[i].h_donation_unit_pub)); - GNUNET_CRYPTO_hash_context_read (hc, - bkp[i].blinded_udi.blinded_message, - sizeof (bkp[i].blinded_udi.blinded_message) - ); + switch (bm->cipher) + { + case GNUNET_CRYPTO_BSA_INVALID: + GNUNET_assert (0); + case GNUNET_CRYPTO_BSA_CS: + GNUNET_CRYPTO_hash_context_read ( + hc, + &bm->details.cs_blinded_message, + sizeof (bm->details.cs_blinded_message)); + break; + case GNUNET_CRYPTO_BSA_RSA: + GNUNET_CRYPTO_hash_context_read ( + hc, + bm->details.rsa_blinded_message.blinded_msg, + bm->details.rsa_blinded_message.blinded_msg_size); + break; + } } GNUNET_CRYPTO_hash_context_finish (hc, &tps.bkps_hash);