donau

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

commit d3df720e43fd1cc1332ee6e83eb9041d04659819
parent 8a104e499fe55877382b7777c600f145cc3a0e41
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Sun, 19 Jul 2026 23:46:08 +0200

remove redundant pub_key_hash from proto

Diffstat:
Msrc/donau/donau-httpd.c | 13++++++++-----
Msrc/json/donau_json.c | 18++++++++++++------
Msrc/json/json_pack.c | 8++------
Msrc/testing/testing_api_cmd_issue_receipts.c | 9++++-----
4 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c @@ -185,6 +185,7 @@ typedef enum MHD_Result const struct TALER_CoinSpendPublicKeyP *coin_pub, const json_t *root); + /** * Function called whenever MHD is done with a request. If the * request was a POST, we may have stored a `struct Buffer *` in the @@ -297,11 +298,13 @@ proceed_with_handler (struct DH_RequestContext *rc, should basically only apply for test systems */ if ( (NULL != admin_bearer) && ( (NULL == ah) || - (0 != strncasecmp (ah, - "Bearer ", - strlen ("Bearer "))) || - (0 != strcmp (ah + strlen ("Bearer "), - admin_bearer)) ) ) + (0 != + strncasecmp (ah, + "Bearer ", + strlen ("Bearer "))) || + (0 != + TALER_strcmp_ct (ah + strlen ("Bearer "), + admin_bearer)) ) ) { GNUNET_break_op (0); return TALER_MHD_reply_with_error (rc->connection, diff --git a/src/json/donau_json.c b/src/json/donau_json.c @@ -94,11 +94,10 @@ parse_donation_unit_pub (void *cls, GNUNET_JSON_spec_rsa_public_key ( "rsa_public_key", &bsign_pub->details.rsa_public_key), - GNUNET_JSON_spec_fixed_auto ( - "pub_key_hash", - &bsign_pub->pub_key_hash), GNUNET_JSON_spec_end () }; + size_t len; + void *res; if (GNUNET_OK != GNUNET_JSON_parse (root, @@ -110,6 +109,13 @@ parse_donation_unit_pub (void *cls, GNUNET_free (bsign_pub); return GNUNET_SYSERR; } + len = GNUNET_CRYPTO_rsa_public_key_encode ( + bsign_pub->details.rsa_public_key, + &res); + GNUNET_CRYPTO_hash (res, + len, + &bsign_pub->pub_key_hash); + GNUNET_free (res); donation_unit_pub->bsign_pub_key = bsign_pub; return GNUNET_OK; } @@ -119,9 +125,6 @@ parse_donation_unit_pub (void *cls, GNUNET_JSON_spec_fixed ("cs_public_key", &bsign_pub->details.cs_public_key, sizeof (bsign_pub->details.cs_public_key)), - GNUNET_JSON_spec_fixed_auto ( - "pub_key_hash", - &bsign_pub->pub_key_hash), GNUNET_JSON_spec_end () }; @@ -135,6 +138,9 @@ parse_donation_unit_pub (void *cls, GNUNET_free (bsign_pub); return GNUNET_SYSERR; } + GNUNET_CRYPTO_hash (&bsign_pub->details.cs_public_key, + sizeof (bsign_pub->details.cs_public_key), + &bsign_pub->pub_key_hash); donation_unit_pub->bsign_pub_key = bsign_pub; return GNUNET_OK; } diff --git a/src/json/json_pack.c b/src/json/json_pack.c @@ -50,9 +50,7 @@ DONAU_JSON_pack_donation_unit_pub ( GNUNET_JSON_pack_string ("cipher", "RSA"), GNUNET_JSON_pack_rsa_public_key ("rsa_public_key", - bsp->details.rsa_public_key), - GNUNET_JSON_pack_data_auto ("pub_key_hash", - &bsp->pub_key_hash)); + bsp->details.rsa_public_key)); return ps; case GNUNET_CRYPTO_BSA_CS: ps.object @@ -61,9 +59,7 @@ DONAU_JSON_pack_donation_unit_pub ( "CS"), GNUNET_JSON_pack_data_varsize ("cs_public_key", &bsp->details.cs_public_key, - sizeof (bsp->details.cs_public_key)), - GNUNET_JSON_pack_data_auto ("pub_key_hash", - &bsp->pub_key_hash)); + sizeof (bsp->details.cs_public_key))); return ps; } GNUNET_assert (0); diff --git a/src/testing/testing_api_cmd_issue_receipts.c b/src/testing/testing_api_cmd_issue_receipts.c @@ -298,8 +298,8 @@ cs_stage_two_callback ( { struct DONAU_DonationUnitPublicKey *cs_pk = &csr_data->ss->keys->donation_unit_keys[csr_data->position].key; - struct DONAU_BatchIssueValues *alg_values = GNUNET_new (struct - DONAU_BatchIssueValues); + struct DONAU_BatchIssueValues *alg_values + = GNUNET_new (struct DONAU_BatchIssueValues); struct DONAU_BudiMasterSecretP ps; struct DONAU_UniqueDonorIdentifierHashP *udi_hash = &csr_data->ss->h_udis[csr_data->position]; @@ -308,7 +308,8 @@ cs_stage_two_callback ( struct DONAU_UniqueDonorIdentifierNonce *udi_nonce = &csr_data->ss->receipts[csr_data->position].nonce; - GNUNET_assert (GNUNET_CRYPTO_BSA_CS == cs_pk->bsign_pub_key->cipher); + GNUNET_assert (GNUNET_CRYPTO_BSA_CS == + cs_pk->bsign_pub_key->cipher); DONAU_donation_unit_ewv_copy (alg_values, &csrresp->details.ok. @@ -594,7 +595,6 @@ TALER_TESTING_cmd_issue_receipts (const char *label, struct StatusState *ss; ss = GNUNET_new (struct StatusState); - ss->year = year; ss->charity_reference = charity_reference; ss->expected_response_code = expected_response_code; @@ -631,6 +631,5 @@ TALER_TESTING_cmd_issue_receipts (const char *label, }; return cmd; - } }