donau

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

commit d8740641be3f295e48b95ebe8ae0627600af64e9
parent d5d834a7d750362583e99ed3866e71545d2c6056
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date:   Tue, 21 May 2024 17:20:03 +0200

updated donau ec

Diffstat:
Msrc/donau/donau-httpd.c | 4++--
Msrc/donau/donau-httpd_batch-submit.c | 7+++----
Msrc/donau/donau-httpd_csr.c | 4++--
Msrc/donau/donau-httpd_keys.c | 16+++++++---------
Msrc/include/donau_crypto_lib.h | 114-------------------------------------------------------------------------------
5 files changed, 14 insertions(+), 131 deletions(-)

diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c @@ -55,7 +55,7 @@ * Above what request latency do we start to log? */ #define WARN_LATENCY GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_MILLISECONDS, 500) + GNUNET_TIME_UNIT_MILLISECONDS, 500) /** * Are clients allowed to request /keys for times other than the @@ -341,7 +341,7 @@ proceed_with_handler (struct DH_RequestContext *rc, json_decref (root); return TALER_MHD_reply_with_error (rc->connection, MHD_HTTP_NOT_FOUND, - TALER_EC_EXCHANGE_GENERIC_WRONG_NUMBER_OF_SEGMENTS, + TALER_EC_DONAU_GENERIC_WRONG_NUMBER_OF_SEGMENTS, emsg); } GNUNET_assert (NULL == args[i - 1]); diff --git a/src/donau/donau-httpd_batch-submit.c b/src/donau/donau-httpd_batch-submit.c @@ -155,7 +155,7 @@ DH_handler_submit_receipts_post (struct DH_RequestContext *rc, GNUNET_break_op (0); return TALER_MHD_reply_with_error (rc->connection, MHD_HTTP_NOT_FOUND, - TALER_EC_DONAU_GENERIC_KEYS_MISSING, + TALER_EC_DONAU_GENERIC_DONATION_UNIT_UNKNOWN, NULL); } @@ -172,10 +172,9 @@ DH_handler_submit_receipts_post (struct DH_RequestContext *rc, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Donation receipt signature invalid!\n"); - // FIXME change error message return TALER_MHD_reply_with_error (rc->connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_DONAU_GENERIC_KEYS_MISSING, + MHD_HTTP_FORBIDDEN, + TALER_EC_DONAU_DONATION_RECEIPT_SIGNATURE_INVALID, NULL); } diff --git a/src/donau/donau-httpd_csr.c b/src/donau/donau-httpd_csr.c @@ -78,7 +78,7 @@ DH_handler_csr_issue (struct DH_RequestContext *rc, return TALER_MHD_reply_with_error ( rc->connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, // FIXME + TALER_EC_DONAU_GENERIC_KEYS_MISSING, NULL); } if (GNUNET_CRYPTO_BSA_CS != @@ -89,7 +89,7 @@ DH_handler_csr_issue (struct DH_RequestContext *rc, return TALER_MHD_reply_with_error ( rc->connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, // FIXME + TALER_EC_DONAU_GENERIC_KEYS_MISSING, NULL); } } diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c @@ -1197,14 +1197,14 @@ DH_handler_keys (struct DH_RequestContext *rc, /* Either IPC failed, or neither helper had any donation_unit configured. */ return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_GATEWAY, - TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE, + TALER_EC_DONAU_DONATION_UNIT_HELPER_UNAVAILABLE, NULL); } if (GNUNET_is_zero (&esign_sm_pub)) { return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_GATEWAY, - TALER_EC_EXCHANGE_SIGNKEY_HELPER_UNAVAILABLE, + TALER_EC_DONAU_SIGNKEY_HELPER_UNAVAILABLE, NULL); } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -1242,7 +1242,7 @@ DH_keys_donau_sign_ ( or had some bad error. */ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot sign request, no valid signing keys available.\n"); - return TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING; + return TALER_EC_DONAU_GENERIC_KEYS_MISSING; } /* need to "cast" because TALER_CRYPTO works with TALER_Exchange.. */ @@ -1279,7 +1279,7 @@ DH_keys_donau_sign_ ( memset (sig, 0, sizeof (*sig)); - return TALER_EC_EXCHANGE_SIGNKEY_HELPER_BUG; + return TALER_EC_DONAU_SIGNKEY_HELPER_BUG; } } return ec; @@ -1304,8 +1304,7 @@ DH_keys_donation_unit_batch_sign ( ksh = DH_keys_get_state (); if (NULL == ksh) - // FIXME change error code - return TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING; + return TALER_EC_DONAU_GENERIC_KEYS_MISSING; for (unsigned int i = 0; i<num_bkps; i++) { const struct DONAU_DonationUnitHashP *h_du_pub = @@ -1315,8 +1314,7 @@ DH_keys_donation_unit_batch_sign ( du = GNUNET_CONTAINER_multihashmap_get (du_keys, &h_du_pub->hash); if (NULL == du) - // FIXME change error code - return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN; + return TALER_EC_DONAU_GENERIC_DONATION_UNIT_UNKNOWN; if (budi->blinded_message->cipher != du->donation_unit_pub.bsign_pub_key->cipher) return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE; @@ -1450,7 +1448,7 @@ DH_keys_donation_unit_cs_r_pub ( dk = DH_keys_donation_unit_by_hash (h_donation_unit_pub); if (NULL == dk) { - return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN; + return TALER_EC_DONAU_GENERIC_DONATION_UNIT_UNKNOWN; } if (GNUNET_CRYPTO_BSA_CS != dk->donation_unit_pub.bsign_pub_key->cipher) diff --git a/src/include/donau_crypto_lib.h b/src/include/donau_crypto_lib.h @@ -512,120 +512,6 @@ TALER_donation_unit_pub_verify (const struct const struct DONAU_BudiHashP *budi_hash); -// FIXME: Copied from taler_crypto_lib.h, is anything of this necessary? -///** -// * Compute the hash of the given @a donation_unit_pub. -// * -// * @param donation_unit_pub public key to hash -// * @param[out] h_donation_unit_pub resulting hash value -// */ -// void -// TALER_donation_unit_pub_hash (const struct DONAU_DonationUnitPublicKey *donation_unit_pub, -// struct DONAU_DonationUnitHashP *h_donation_unit_pub); -// -// -///** -// * Make a (deep) copy of the given @a donation_unit_src to -// * @a donation_unit_dst. -// * -// * @param[out] donation_unit_dst target to copy to -// * @param donation_unit_src public key to copy -// */ -// void -// TALER_donation_unit_pub_deep_copy (struct DONAU_DonationUnitPublicKey *donation_unit_dst, -// const struct DONAU_DonationUnitPublicKey *donation_unit_src); -// -// -///** -// * Make a (deep) copy of the given @a donation_unit_src to -// * @a donation_unit_dst. -// * -// * @param[out] donation_unit_dst target to copy to -// * @param donation_unit_src public key to copy -// */ -// void -// TALER_donation_unit_sig_deep_copy (struct DONAU_DonationUnitSignature *donation_unit_dst, -// const struct DONAU_DonationUnitSignature *donation_unit_src); -// -// -///** -// * Make a (deep) copy of the given @a donation_unit_src to -// * @a donation_unit_dst. -// * -// * @param[out] donation_unit_dst target to copy to -// * @param donation_unit_src public key to copy -// */ -// void -// TALER_blinded_donation_unit_sig_deep_copy ( -// struct DONAU_BlindedDonationUnitSignature *donation_unit_dst, -// const struct DONAU_BlindedDonationUnitSignature *donation_unit_src); -// -// -///** -// * Compare two donation unit public keys. -// * -// * @param donation_unit1 first key -// * @param donation_unit2 second key -// * @return 0 if the keys are equal, otherwise -1 or 1 -// */ -// int -// TALER_donation_unit_pub_cmp (const struct DONAU_DonationUnitPublicKey *donation_unit1, -// const struct DONAU_DonationUnitPublicKey *donation_unit2); -// -// -///** -// * Compare two donation unit signatures. -// * -// * @param sig1 first signature -// * @param sig2 second signature -// * @return 0 if the keys are equal, otherwise -1 or 1 -// */ -// int -// TALER_donation_unit_sig_cmp (const struct DONAU_DonationUnitSignature *sig1, -// const struct DONAU_DonationUnitSignature *sig2); -// -// -///** -// * Compare two blinded donation unit signatures. -// * -// * @param sig1 first signature -// * @param sig2 second signature -// * @return 0 if the keys are equal, otherwise -1 or 1 -// */ -// int -// TALER_blinded_donation_unit_sig_cmp ( -// const struct DONAU_BlindedDonationUnitSignature *sig1, -// const struct DONAU_BlindedDonationUnitSignature *sig2); -// -// -///** -// * Compare two blinded planchets. -// * -// * @param bp1 first blinded planchet -// * @param bp2 second blinded planchet -// * @return 0 if the keys are equal, otherwise -1 or 1 -// */ -// int -// TALER_blinded_planchet_cmp ( -// const struct DONAU_BlindedPlanchet *bp1, -// const struct DONAU_BlindedPlanchet *bp2); -// -// -///** -// * Verify signature made with a donation unit public key -// * over a donation receipt. -// * -// * @param donation_unit_pub public donation unit key -// * @param donation_unit_sig signature made with the private key -// * @param c_hash hash over the coin -// * @return #GNUNET_OK if the signature is valid -// */ -// enum GNUNET_GenericReturnValue -// TALER_donation_unit_pub_verify (const struct DONAU_DonationUnitPublicKey *donation_unit_pub, -// const struct DONAU_DonationUnitSignature *donation_unit_sig, -// const struct DONAU_ *c_hash); -// - /* ********************* client blind/unblind ************************** */ /**